Memory MCP Server
Knowledge graph based persistent memory system that lets LLMs retain entities, relations, and observations across conversations.
The Memory MCP server is a reference implementation from the Model Context Protocol project that gives LLMs persistent, structured memory across sessions. It stores information as a local knowledge graph composed of entities (nodes with a name and type), relations (directed connections between entities, written in active voice), and observations (atomic facts attached to specific entities). The graph is persisted to a JSONL file on disk so that context survives between conversations.
The server exposes nine tools for reading and writing the graph, including creating and deleting entities and relations, appending or removing observations, retrieving the full graph, and searching or opening specific nodes. Together these primitives let an agent build up a long-running, personalized model of a user, their preferences, identities, relationships, and goals.
It is one of the original reference servers maintained in the modelcontextprotocol/servers repository and is distributed via the official @modelcontextprotocol/server-memory npm package and a Docker image (mcp/memory). It requires no API keys or external services, making it one of the simplest MCP servers to drop into Claude Desktop, Cursor, or VS Code.
Tools
| Tool | Description |
|---|---|
create_entities |
Add new entities to the knowledge graph with a name, entity type, and list of observations. |
create_relations |
Establish directed connections between existing entities, stored in active voice. |
add_observations |
Append new atomic facts (observations) to existing entities. |
delete_entities |
Remove entities and cascade delete their associated relations. |
delete_observations |
Remove specific observations (facts) from entities. |
delete_relations |
Remove specific relations between entities. |
read_graph |
Retrieve the entire knowledge graph (all entities and relations). |
search_nodes |
Search entities by matching against names, entity types, or observation contents. |
open_nodes |
Fetch one or more specific entities along with the relations among them. |
Installation
The Memory server is distributed as an npm package and a Docker image. No API keys are required.
Claude Desktop (NPX, macOS/Linux)
Add to claude_desktop_config.json:
{
"mcpServers": {
"memory": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-memory"]
}
}
}
Claude Desktop (Docker)
{
"mcpServers": {
"memory": {
"command": "docker",
"args": ["run", "-i", "-v", "claude-memory:/app/dist", "--rm", "mcp/memory"]
}
}
}
VS Code
Add to your User Settings (JSON) or .vscode/mcp.json:
{
"servers": {
"memory": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-memory"]
}
}
}
Environment Variables
MEMORY_FILE_PATH: Optional custom path to the JSONL file used for persistent storage. Defaults tomemory.jsonlnext to the server executable. Use an absolute path to keep memory in a stable location:
{
"mcpServers": {
"memory": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-memory"],
"env": {
"MEMORY_FILE_PATH": "/Users/you/.claude/memory.jsonl"
}
}
}
}
System Prompt
The README recommends adding a system prompt that instructs the model to recall and update memory at the start and end of each conversation. See the project README for the suggested prompt template.
- Maintain a long-running profile of a user (name, role, preferences, goals) that persists across separate chat sessions.
- Track relationships between people, projects, and companies as a graph the model can traverse at query time.
- Build a structured project memory: store decisions, constraints, and open questions as observations on entities representing features or services.
- Capture facts learned during research sessions and recall them later via
search_nodesinstead of re-reading source documents. - Power simple personal CRM or note-taking workflows where the agent updates entities like "Acme Corp" or "Q3 Planning" with new observations over time.
- "Remember that I prefer TypeScript over JavaScript and that I work as a staff engineer at Acme."
- "Create an entity for the project Phoenix and link it to Alice as the project lead."
- "Search your memory for anything you know about Acme Corp."
- "Read the full knowledge graph and summarize what you know about me."
- "Delete the observation that I live in Brooklyn, I moved to Oakland."
- Official reference implementation maintained in the
modelcontextprotocol/serversrepo, so it tracks the spec closely. - Zero configuration and no API keys required, runs locally via npx or Docker.
- Structured graph model (entities, relations, observations) is more queryable than free-form note storage.
- Persistence is a single JSONL file, easy to inspect, back up, version, or sync.
- Storage is a flat local JSONL file with no built-in scaling, indexing, or multi-user support.
- No semantic or vector search,
search_nodesis substring matching over names, types, and observations. - Quality of memory depends heavily on the system prompt directing the model to call the tools at the right times.
- Mem0 MCP server: vector-backed long-term memory with semantic recall.
- Basic Memory by Basic Machines: markdown-file based persistent memory for LLMs.
- Zep MCP integration: hosted memory service with temporal knowledge graphs and semantic search.