MemoryMesh
以下摘录自该仓库的 README(片段) · 在 GitHub 读完整 README →
MemoryMesh is a knowledge graph server designed for AI models, with a focus on text-based RPGs and interactive storytelling. It helps AI maintain consistent, structured memory across conversations, enabling richer and more dynamic interactions.
*The project is based on the Knowledge Graph Memory Server from the MCP servers repository and retains its core functionality.*
IMPORTANT
**v0.3.0 Update:** The MCP SDK has been updated from v1.0.4 to v1.25.2 to comply with the current Model Context Protocol specification (2025-11-25). This is a major update that brings compatibility with the latest MCP clients including Claude Desktop, ChatGPT, Cursor, Gemini, and VS Code. After updating, run npm install to fetch the new dependencies.
Since v0.2.7 the default location of schemas was changed to dist/data/schemas.
This location is not expected to change in the future, but if you are updating from a previous version, make sure to move your schema files to the new location.
Quick Links
* Installation
* Example
* SchemaManager Guide Discussion
* MemoryViewer Guide Discussion
Overview
MemoryMesh is a local knowledge graph server that empowers you to build and manage structured information for AI models. While particularly well-suited for text-based RPGs, its adaptable design makes it useful for various applications, including social network simulations, organizational planning, or any scenario involving structured data.
Key Features
* **Dynamic Schema-Based Tools:** Define your data structure with schemas, and MemoryMesh automatically generates tools for adding, updating, and deleting data.
* **Intuitive Schema Design:** Create schemas that guide the AI in generating and connecting nodes, using required fields, enumerated types, and relationship definitions.
* **Metadata for AI Guidance:** Use metadata to provide context and structure, helping the AI understand the meaning and relationships within your data.
* **Relationship Handling:** Define relationships within your schemas to encourage the AI to create connections (edges) between related data points (nodes).
* **Informative Feedback:** Provides error feedback to the AI, enabling it to learn from mistakes and improve its interactions with the knowledge graph.
* **Event Support:** An event system tracks operations, providing insights into how the knowledge graph is being modified.
Nodes
Nodes represent entities or concepts within the knowledge graph. Each node has:
* name: A unique identifier.
* nodeType: The type of the node (e.g., npc, artifact, location), defined by your schemas.
* metadata: An array of strings providing descriptive details about the node.
* weight: (Optional) A numerical value between 0 and 1 representing the strength of the relationship, defaulting to 1.
**Example Node:**
Edges
Edges represent relationships between nodes. Each edge has:
* from: The name of the source node.
* to: The name of the target node.
* edgeType: The type of relationship (e.g., owns, located_in).
Schemas
Schemas are the heart of MemoryMesh. They define the structure of your data and drive the automatic generation of tools.
Schema File Location
Place your schema files (.schema.json) in the dist/data/schemas directory of your built MemoryMesh project. MemoryMesh will automatically detect and process these files on startup.
Schema Structure
File name: [name].schema.json. For example, for a schema defining an 'npc', the filename would be add_npc.schema.json.
* name - Identifier for the schema and node type within the memory. **IMPORTANT**: The schema’s name *must* start with add_ to be recognized.
* description - Used as the description for the add_ tool, providing context for the AI. *(The delete and update tools have a generic description)*
* properties - Each property includes its type, description, and additional constraints.
* property
* type - Supported values are string or array.
* description - Helps guide the AI on the entity’s purpose.