Home / MCP / Knowledge Graph Memory Server
Provides a persistent local memory store using a knowledge graph with entities, observations, and relations for Claude.
Configuration
View docs{
"mcpServers": {
"memory_docker": {
"command": "docker",
"args": [
"run",
"-i",
"-v",
"claude-memory:/app/dist",
"--rm",
"mcp/memory"
],
"env": {
"MEMORY_FILE_PATH": "/path/to/custom/memory.jsonl"
}
}
}
}The Knowledge Graph Memory Server provides a persistent memory layer for Claude by storing user information as a local knowledge graph of entities, observations, and their relationships. It helps the model remember details across chats and personalize interactions over time.
You interact with the Memory Server through an MCP client, which connects to the server to read and update knowledge graph data. Use the server to create entities for recurring people, organizations, or events; define relationships between those entities; and attach atomic observations to entities. As you converse, add new observations (for example, a preferred meeting time or a location) and let the server keep them organized. When your session ends, you can retrieve the memory to guide future conversations or personalize responses.
Prerequisites: Ensure you have a runtime capable of running the MCP server, such as Node.js or Docker, depending on how you choose to run the server.
{
"mcpServers": {
"memory": {
"command": "docker",
"args": ["run", "-i", "-v", "claude-memory:/app/dist", "--rm", "mcp/memory"]
}
}
}Alternatively, run the server with NPX to pull and start the memory server directly.
{
"mcpServers": {
"memory": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-memory"
]
}
}
}If you need a custom path for memory storage, you can specify an environment variable to point to your own file.
{
"mcpServers": {
"memory": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-memory"
],
"env": {
"MEMORY_FILE_PATH": "/path/to/custom/memory.jsonl"
}
}
}
}If you prefer to build and run a Docker image locally, you can build the memory server image before running it.
# Build the memory image from source
docker build -t mcp/memory -f src/memory/Dockerfile .You can customize how memory data is stored by pointing to a memory file path. The example below shows how to set MEMORY_FILE_PATH to a custom location.
{
"mcpServers": {
"memory": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-memory"
],
"env": {
"MEMORY_FILE_PATH": "/path/to/custom/memory.jsonl"
}
}
}
}Keep memory storage secure and back up the memory file regularly. If you run multiple instances, ensure they share a consistent data location or use separate memory stores to avoid data conflicts.
- Create entities for recurring organizations, people, and key events. - Attach atomic observations to each entity to avoid mixing facts. - Use relations to describe how entities interact, such as who works at which organization.
- Entity: a primary node in the memory graph with a unique name and type. - Observations: atomic pieces of information about an entity. - Relations: directed connections between entities that describe how they relate.
Create multiple new entities in the knowledge graph. Input is an array of entities with name, entityType, and observations.
Create multiple new relations between entities. Input is an array of relations with from, to, and relationType.
Add new observations to existing entities. Returns added observations per entity and fails if the entity does not exist.
Remove entities and their relations. Performs cascading deletion of related data.
Remove specific observations from entities. Silent if the observation does not exist.
Remove specific relations from the graph. Silent if the relation does not exist.
Read the entire knowledge graph, returning all entities and relations.
Search for nodes based on a query across names, types, and observations.
Retrieve specific nodes by name along with direct relations between them.