mcp-knowledge-graph
by: shaneholloman
MCP server enabling persistent memory for Claude through a local knowledge graph - fork focused on local development
📌Overview
Purpose: To provide a persistent memory solution utilizing a local knowledge graph that allows Claude to retain information about users across chat sessions.
Overview: The Knowledge Graph Memory Server is an advanced implementation derived from the original Memory Server, aimed at enhancing user interactions by remembering personalized details and preferences through a structured knowledge graph. The server supports customizable memory paths and operates efficiently without relying on ephemeral memory methods.
Key Features:
-
Customizable Memory Path: Users can define a specific path for storing memory data, providing flexibility and control over memory management.
-
Entities and Relations Management: The server allows for the creation, modification, and removal of entities and their relationships, supporting complex interaction modeling and personalized responses based on user history.
-
Observations Tracking: The ability to manage distinct observations per entity enables the server to retain granular information about users' preferences and characteristics, enhancing conversational context and relevance.
Knowledge Graph Memory Server
An improved implementation of persistent memory using a local knowledge graph with a customizable --memory-path
that enables Claude to remember information about the user across chats.
Server Name
mcp-knowledge-graph
Core Concepts
Entities
Entities are the primary nodes in the knowledge graph, each having:
- A unique name (identifier)
- An entity type (e.g., "person", "organization", "event")
- A list of observations
Example:
{
"name": "John_Smith",
"entityType": "person",
"observations": ["Speaks fluent Spanish"]
}
Relations
Relations define directed connections between entities, stored in active voice to describe interactions.
Example:
{
"from": "John_Smith",
"to": "Anthropic",
"relationType": "works_at"
}
Observations
Observations are discrete pieces of information about an entity:
- Stored as strings
- Attached to specific entities
- Can be added or removed independently
- Should be atomic (one fact per observation)
Example:
{
"entityName": "John_Smith",
"observations": [
"Speaks fluent Spanish",
"Graduated in 2019",
"Prefers morning meetings"
]
}
API
Tools
- create_entities: Create multiple new entities in the knowledge graph.
- create_relations: Create multiple new relations between entities.
- add_observations: Add new observations to existing entities.
- delete_entities: Remove entities and their relations.
- delete_observations: Remove specific observations from entities.
- delete_relations: Remove specific relations from the graph.
- read_graph: Read the entire knowledge graph.
- search_nodes: Search for nodes based on a query.
- open_nodes: Retrieve specific nodes by name.
Usage with Claude Desktop
Setup
Add the following to your claude_desktop_config.json
:
{
"mcpServers": {
"memory": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-memory"
]
}
}
}
Custom Memory Path
Specify a custom path for the memory file:
{
"mcpServers": {
"memory": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-memory", "--memory-path", "/path/to/your/memory.jsonl"]
}
}
}
If no path is specified, it defaults to memory.jsonl
.
System Prompt
An example prompt for chat personalization is provided for effective memory utilization.
Example Steps:
- User Identification: Interact with identified user.
- Memory Retrieval: Initiate chat with "Remembering..." and retrieve relevant information.
- Memory Update: Update memory with new information categories such as identity, behaviors, preferences, goals, and relationships.
License
This MCP server is licensed under the MIT License, allowing free use, modification, and distribution subject to the terms of the license.