
Memory (Knowledge Graph)
OfficialOfficial MCP server providing persistent, file-backed knowledge-graph memory across sessions.
Add to your client
Copy the config for your MCP client and paste it into its config file.
npx -y @modelcontextprotocol/server-memoryPaste into ~/Library/Application Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"memory-knowledge-graph": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-memory"
],
"env": {
"MEMORY_FILE_PATH": "/absolute/path/to/memory.jsonl"
}
}
}
}Before you start
- Node.js 18+ (to run via `npx @modelcontextprotocol/server-memory`), OR Docker if using the container image
- No credentials or auth required
- A writable location for the JSONL memory file (defaults to `memory.jsonl`; set `MEMORY_FILE_PATH` to relocate it, and a Docker volume if you want persistence in a container)
About Memory (Knowledge Graph)
The Memory server is an official MCP reference server that gives a model persistent, long-term memory backed by a local knowledge graph. It lets Claude remember facts about a user or project across separate conversations instead of starting cold each time.
The graph has three primitives. Entities are nodes with a unique name, a type (e.g. person, project), and a list of observations. Relations are directed, active-voice edges between entities (e.g. Alice works_at Acme). Observations are discrete, atomic strings attached to an entity, which can be added and removed independently.
Data is persisted to a single JSONL file, so memory survives restarts and can be inspected or version-controlled. The storage location defaults to memory.jsonl next to the server and is overridable with the MEMORY_FILE_PATH environment variable. It runs over stdio with no authentication, via NPX or a Docker image (typically with a named volume so the JSONL persists).
Tools & capabilities (9)
create_entitiesAdd one or more new entities, each with a type and initial observations.
create_relationsCreate directed, active-voice relations between existing entities.
add_observationsAppend new observation strings to existing entities.
delete_entitiesRemove entities and any relations that reference them.
delete_observationsRemove specific observations from an entity.
delete_relationsRemove specific relations between entities.
read_graphReturn the entire knowledge graph (all entities and relations).
search_nodesSearch entities by name, type, or observation content.
open_nodesRetrieve specific named entities along with their relations.
When to use it
- Use it when you want the assistant to remember user preferences, names, and facts across separate chat sessions.
- Use it when building a personal assistant that should accumulate context about ongoing projects over time.
- Use it when you want memory you can inspect and edit — the JSONL file is human-readable and diffable.
- Use it when you need structured recall (entities and relationships) rather than a flat blob of notes.
- Use it when you want to seed an agent with a prebuilt knowledge graph and let it query specific nodes.
Quick setup
- 1Add the server to your MCP client config, e.g. command `npx` with args `-y @modelcontextprotocol/server-memory`.
- 2Optionally set `MEMORY_FILE_PATH` in the server's env to control where `memory.jsonl` is written.
- 3If using Docker (`mcp/memory`), attach a named volume so the JSONL file persists across runs.
- 4Add prompt guidance telling the model when to read from and write to memory (the README includes a recommended system-prompt snippet).
- 5Restart the client, then verify by asking the model to store a fact and recall it in a new conversation.
Security notes
Memory contents are stored unencrypted in a local JSON-lines file; treat that file as sensitive if the model stores personal data. Anyone with disk access can read or tamper with the stored graph.
Memory (Knowledge Graph) FAQ
Where is my memory data stored?
In a single JSONL file — `memory.jsonl` by default, next to the server. Override the location with the `MEMORY_FILE_PATH` environment variable.
Does the model automatically remember things?
Not on its own. You should add prompt instructions telling it when to call the memory tools; the README provides a sample system prompt for this.
How do I keep memory when running in Docker?
Mount a named volume (e.g. `-v claude-memory:/app/dist`) so the JSONL file isn't lost when the container is removed.
Is this the same as Claude's built-in memory feature?
No. This is a self-hosted, file-backed MCP server you run and control yourself; the data lives in your own JSONL file.
Can I edit or reset the memory manually?
Yes. Because storage is plain JSONL, you can open, edit, version-control, or delete the file to inspect or reset memory.
Alternatives to Memory (Knowledge Graph)
Structured step-by-step reasoning tool for breaking problems into revisable thought sequences.
Fully managed remote server for AWS docs, blogs, What's-New and Well-Architected guidance — no key.
Official Qdrant server using a vector collection as semantic memory: store and find embeddings.
Compare Memory (Knowledge Graph) with: