MemoryMesh
by: CheMiguel23
A knowledge graph server that uses the Model Context Protocol (MCP) to provide structured memory persistence for AI models. v0.2.8
📌Overview
Purpose: MemoryMesh aims to create and manage structured knowledge graphs for AI models, particularly enhancing interactions in text-based RPGs.
Overview: MemoryMesh serves as a local knowledge graph server that enables users to effectively organize and manage information tailored for AI applications. Its flexible design facilitates a wide range of uses, from gaming to social simulations.
Key Features:
-
Dynamic Schema-Based Tools: Automatically generates tools for data management based on user-defined schemas, streamlining the data manipulation process.
-
Intuitive Schema Design: Allows users to create schemas that inform the AI on structuring and connecting data, facilitating accurate data creation and relationship definition.
-
Metadata for AI Guidance: Uses metadata to enhance the AI's understanding of data relationships, improving context and insights into interactions.
-
Relationship Handling: Supports the definition of relationships between nodes, promoting dynamic connections and interactions within the knowledge graph.
-
Informative Feedback: Provides error messages to the AI, aiding in recognizing and correcting mistakes, which enhances the learning process.
-
Event Support: Tracks operations within the graph, offering insights into how modifications occur and affecting data flow management.
MemoryMesh
MemoryMesh is a knowledge graph server designed for AI models, particularly focused on text-based RPGs and interactive storytelling. It enables AIs to maintain consistent and structured memory across conversations, facilitating richer interactions.
Important Changes
Since v0.2.7
, the default location of schemas has changed to dist/data/schemas
. If updating from a previous version, ensure to move your schema files to this new location.
Quick Links
Overview
MemoryMesh is a versatile local knowledge graph server designed to build and manage structured information for AI models. While it excels in text-based RPGs, it is also useful for various applications such as organizational planning and social network simulations.
Key Features
- Dynamic Schema-Based Tools: Automatically generates tools for adding, updating, and deleting data based on defined schemas.
- Intuitive Schema Design: Schemas guide AI in generating and connecting nodes with required fields and relationships.
- Metadata Usage: Provides context that helps the AI understand relationships within data.
- Relationship Handling: Encourages the AI to create connections between related data points.
- Informative Feedback: Supplies error feedback to improve AI interactions.
- Event Support: Tracks operations for insight into knowledge graph modifications.
Nodes
Nodes represent entities or concepts, characterized by:
name
: Unique identifier.nodeType
: Type of the node (e.g.,npc
,artifact
,location
).metadata
: Descriptive details.weight
: Optional numerical value between 0 and 1.
Example Node
{
"name": "Aragorn",
"nodeType": "player_character",
"metadata": [
"Race: Human",
"Class: Ranger",
"Skills: Tracking, Swordsmanship",
"Affiliation: Fellowship of the Ring"
]
}
Edges
Edges represent relationships between nodes, defined by:
from
: Source node's name.to
: Target node's name.edgeType
: Type of relationship.
{
"from": "Aragorn",
"to": "Andúril",
"edgeType": "owns"
}
Schemas
Schemas define the structure of your data and drive tool generation.
Schema Structure
- File name:
[name].schema.json
. - Properties:
name
: Identifier for the schema; must start withadd_
.description
: Context for the AI.properties
: Defines property types, requirements, and relationships.additionalProperties
: Allows extra attributes.
Example Schema
{
"name": "add_npc",
"description": "Schema for adding an NPC to the memory",
"properties": {
"name": {
"type": "string",
"description": "A unique identifier for the NPC",
"required": true
},
"race": {
"type": "string",
"description": "The species or race of the NPC",
"required": true,
"enum": [
"Human",
"Elf",
"Dwarf",
"Orc",
"Goblin"
]
},
"currentLocation": {
"type": "string",
"description": "The current location of the NPC",
"required": true,
"relationship": {
"edgeType": "located_in",
"description": "The current location of the NPC"
}
}
},
"additionalProperties": true
}
MemoryMesh automatically creates tools based on the schema, such as add_npc
, update_npc
, and delete_npc
.
Dynamic Tools
MemoryMesh auto-generates tools directly from your schema definitions, allowing convenient interaction with the knowledge graph:
add_<entity>
: Create new entity instances.update_<entity>
: Modify existing entities.delete_<entity>
: Remove entities.
Memory File
Data is stored in a JSON file located at dist/data/memory.json
.
Installation
Installing via Smithery
To install MemoryMesh for Claude Desktop using Smithery, run:
npx -y @smithery/cli install memorymesh --client claude
Prerequisites
- Node.js: Version 18 or higher.
- npm: Installed with Node.js.
- Claude for Desktop: Latest version needed.
Installation Steps
-
Clone the Repository:
git clone https://github.com/CheMiguel23/memorymesh.git cd memorymesh
-
Install Dependencies:
npm install
-
Build the Project:
npm run build
-
Depending on your setup, configure Claude Desktop by editing the appropriate configuration file for your system.
-
Restart Claude Desktop for changes to take effect.
Verify Installation
- Start Claude Desktop and open a new chat.
- Look for the MCP plugin icon.
- Ensure "memorymesh" is listed among connected servers and tools are exposed.
Advanced Configuration
MemoryMesh allows customization through variables in /config/config.ts
, enabling overrides of default settings like MEMORY_FILE
and SCHEMAS_DIR
.
Limitations
- Node Deletion: The AI may hesitate to delete nodes; encourage it through prompts.
Contribution
Contributions, feedback, and ideas are welcome to further explore integrating structured data with AI.