What it is
Knowledge Graph Memory Server is a basic implementation of persistent memory using a local knowledge graph, letting Claude remember information about the user across chats. It stores entities (name, type, observations), directed relations in active voice, and atomic observations. It exposes nine tools plus a knowledge-graph MCP resource, and is published on npm as @modelcontextprotocol/server-memory.
Who it's for
- Claude Desktop users who want Claude to remember user information across chats
- VS Code users configuring MCP servers
- Developers building chat personalization with a custom system prompt
Requirements
Requirements
- An MCP client such as Claude Desktop or VS Code
- npx (for the NPX method) or Docker (for the Docker method)
- Optional: MEMORY_FILE_PATH environment variable to set a custom JSONL storage path (default: memory.jsonl in the server directory)
Setup
Claude Desktop via NPX
Add this to your claude_desktop_config.json.
json{ "mcpServers": { "memory": { "command": "npx", "args": [ "-y", "@modelcontextprotocol/server-memory" ] } } }Claude Desktop via Docker
Alternatively, add this to your claude_desktop_config.json to run the server in Docker with a named volume.
json{ "mcpServers": { "memory": { "command": "docker", "args": ["run", "-i", "-v", "claude-memory:/app/dist", "--rm", "mcp/memory"] } } }Custom storage file path
Set MEMORY_FILE_PATH in the env block to change where the JSONL memory file is stored.
json{ "mcpServers": { "memory": { "command": "npx", "args": [ "-y", "@modelcontextprotocol/server-memory" ], "env": { "MEMORY_FILE_PATH": "/path/to/custom/memory.jsonl" } } } }VS Code via NPX
Add to your user mcp.json (Command Palette: MCP: Open User Configuration) or to .vscode/mcp.json in your workspace.
json{ "servers": { "memory": { "command": "npx", "args": [ "-y", "@modelcontextprotocol/server-memory" ] } } }Build the Docker image
Build the image locally from the repository.
shdocker build -t mcp/memory -f src/memory/Dockerfile .
Examples
Entity structure
json{
"name": "John_Smith",
"entityType": "person",
"observations": ["Speaks fluent Spanish"]
}What it does: An entity has a unique name, a type and a list of observations; this is the shape used by create_entities.
Relation structure
json{
"from": "John_Smith",
"to": "Anthropic",
"relationType": "works_at"
}What it does: Relations are directed and stored in active voice. create_relations fails if either entity doesn't exist.
Adding observations
json{
"entityName": "John_Smith",
"observations": [
"Speaks fluent Spanish",
"Graduated in 2019",
"Prefers morning meetings"
]
}What it does: Observations are atomic facts (one per string) attached to an entity and can be added or removed independently.
Personalization system prompt
PromptFollow these steps for each interaction:
1. User Identification:
- You should assume that you are interacting with default_user
- If you have not identified default_user, proactively try to do so.
2. Memory Retrieval:
- Always begin your chat by saying only "Remembering..." and retrieve all relevant information from your knowledge graph
- Always refer to your knowledge graph as your "memory"Expected output: The first part of the documented example prompt, usable in the Custom Instructions field of a Claude.ai Project. The full prompt also covers memory categories and updates.
Pros & cons
Pros
- Pro:Persistent local knowledge graph lets Claude remember user information across chats
- Pro:Nine tools cover creating, reading, searching and deleting entities, relations and observations
- Pro:Offers a knowledge-graph MCP resource and emits update notifications to subscribed clients
- Pro:Supports NPX and Docker installs, with a configurable storage file path
Cons
- Con:Described as a basic implementation of persistent memory
- Con:Memory behavior depends on a user-written system prompt, which determines frequency and types of memories
- Con:Docker users with a prior mcp/memory volume must delete the old index.js file before starting a new container
Images
