Direct answer
A memory MCP is a server that lets an AI agent such as Claude Code, Cursor or Codex save facts and recall them later. The official one, the Knowledge Graph Memory Server, keeps a local graph in one file and costs nothing. Hosted servers such as Mem0 share one memory across several tools.
Published 26 November 2026 by the Better Design team. Checked that day on GitHub, npm, PyPI and the makers' docs.
Summary
- Official server: @modelcontextprotocol/server-memory, version 2.2.1 on npm (18 November 2026), MIT licensed. It stores entities, relations and observations in a local memory.jsonl file and needs Node.js 24 or later.
- Set MEMORY_FILE_PATH to a file you own. The default file sits inside the npx cache, and clearing that cache can delete your memory.
- Basic Memory: notes as plain Markdown files in ~/basic-memory, free to run locally under AGPL-3.0. Its cloud version costs $15 a month during beta.
- Mem0: a hosted server at https://mcp.mem0.ai/mcp with browser sign-in. The Free plan gives 10,000 adds and 1,000 searches a month for the first 30 days.
- Graphiti: a temporal knowledge graph that runs in Docker with FalkorDB and calls an LLM, OpenAI by default, to extract facts.
- Before you add any of them: Claude Code already keeps CLAUDE.md and auto memory. A memory MCP earns its place when several tools, machines or people need the same memory.
What is a memory MCP server?
A memory MCP server is a program that speaks the Model Context Protocol and offers tools to store and retrieve facts. Your coding agent calls those tools the way it calls any other MCP tool. The memory lives outside the chat, so it survives when the session ends.
The official server stores memory as a knowledge graph. An entity is a named thing, such as a project or a person. A relation links two entities in the active voice, such as "api_service uses postgres". An observation is one fact attached to an entity, such as "staging runs on port 5433".
Do you need a memory MCP, or is CLAUDE.md enough?
For one person in one repository, the built-in memory is usually enough. Claude Code reads CLAUDE.md in every session and keeps auto memory, notes it writes itself, in ~/.claude/projects/<project>/memory/. At session start it loads the first 200 lines or 25KB of the MEMORY.md index, whichever comes first.
- Stay with CLAUDE.md and auto memory when you work alone, in one tool, on one machine.
- Use Cursor Rules for Cursor. Cursor's docs say models do not retain memory between completions, and Rules give persistent context at the prompt level.
- Add a memory MCP when Claude Code, Cursor and Codex should read the same facts. It also helps when you switch computers or a team shares one memory.
- Add one when you want search by meaning across months of notes, which file-based memory does not do.
Developers on r/ClaudeAI say the same thing: write the CLAUDE.md first, and tell the agent what not to save, or memory fills with stale notes.
Which memory MCP server should you use?
Pick by where the memory should live and who reads it. These four cover most setups.
- Knowledge Graph Memory Server (official): local, free, one JSONL file you can open. Search is plain text matching on names, types and observations, not search by meaning. Pick it to start.
- Basic Memory: local Markdown files you can also edit in Obsidian or any editor. Free locally; Basic Memory Cloud is $15 a month during beta, regular price $19, with a 7-day trial. Pick it when you want notes a person can read.
- Mem0: hosted, with semantic search and eight tools such as add_memory and search_memories. Memories live in your Mem0 account, not on your computer. Pick it for one memory across many tools with no server to run.
- Graphiti: a graph that tracks how facts change over time. It needs Docker and an LLM API key, and the README warns the MCP server has no authentication. Pick it when you can run infrastructure and need history.
- Not sure? Start with the official server. Your graph is a plain file, so moving it later is a script, not a migration.
How do you set up the official memory MCP in Claude Code?
Run one command, then check the server with /mcp. You need Node.js 24 or later for npx.
- Run: claude mcp add memory --scope user -e MEMORY_FILE_PATH=~/.mcp-memory/memory.jsonl -- npx -y @modelcontextprotocol/server-memory
- Create the folder first with mkdir -p ~/.mcp-memory. The server needs write access to that folder for its lock file.
- Start Claude Code and type /mcp. The memory server should show as connected.
- Test it: say "Remember that staging runs on port 5433." Open a new session and ask which port staging uses.
- Add one line to CLAUDE.md, such as "Search memory before answering about past decisions." This is what makes the agent use it.
--scope user makes the server available in every project. Use --scope project to write it to .mcp.json and share the setup with your team, but not the memory file, which stays on each computer.
How do you add a memory MCP to Cursor, Codex, VS Code and Claude Desktop?
Each client takes the same command and the same environment variable in its own config file.
- Cursor
- In ~/.cursor/mcp.json, add a server named memory under mcpServers with command npx, args -y and @modelcontextprotocol/server-memory, and env MEMORY_FILE_PATH. Restart Cursor and check Settings, then MCP.
- Codex
- Run codex mcp add memory --env MEMORY_FILE_PATH=/home/you/.mcp-memory/memory.jsonl -- npx -y @modelcontextprotocol/server-memory, or add the same entry under [mcp_servers.memory] in ~/.codex/config.toml.
- VS Code
- Use the Install with NPX button in the README, or add the server to your mcp.json. VS Code nests it under servers, not mcpServers.
- Claude Desktop
- Add the same mcpServers entry to claude_desktop_config.json and restart the app.
- claude.ai on the web
- A custom connector needs a remote URL. A server that runs on your computer over stdio cannot connect; use a hosted server such as Mem0.
Read Better Design's guide to adding MCP servers in Cursor and other clients.
What tools does the official memory server give the agent?
Nine tools, counted from the README on 26 November 2026. Three create, three delete, and three read.
- create_entities, create_relations and add_observations write to the graph. create_entities skips a name that already exists; use add_observations to extend it.
- delete_entities, delete_observations and delete_relations remove data. Deleting an entity also deletes every relation that touches it.
- read_graph returns the full graph, search_nodes searches names, types and observations, and open_nodes reads entities by name.
- On a large graph, pass observationLimit: 0 to read_graph for names and counts only, then open the entities you need.
- The graph is also a resource at memory://knowledge-graph, and clients that subscribe see changes live.
Why does the agent not use its memory?
The model decides when to call memory tools, and nothing forces it to. Mem0's docs put it the same way: the agent decides for itself when to save or look something up.
- Tell it when. Add a rule to CLAUDE.md, AGENTS.md or Cursor Rules: search memory at the start of a task, save decisions at the end.
- In Claude Code, tool search is on by default, so MCP tools are deferred and loaded on demand. Set "alwaysLoad": true on the server's entry to load its tools at session start.
- In a Claude Project, paste a memory prompt into the project instructions. The official README includes one that starts every chat by reading the graph.
- Check that the server connected. A memory server that failed to start looks the same as one the agent ignores; /mcp in Claude Code shows which it is.
Where is the memory stored, and can you lose it?
The official server writes to MEMORY_FILE_PATH, or by default to memory.jsonl in its own directory. Under npx that directory is inside a node_modules tree. The README warns that reinstalling the server or clearing the npx cache can delete the file and your graph.
- Set an absolute path you own, and back the file up like any other notes.
- Two clients can share one file. Each write takes a lock file next to it, so writes take turns and none is lost.
- To share one live server, run it over HTTP: npx -y @modelcontextprotocol/server-memory --transport streamable-http. It listens on 127.0.0.1:3001 at /mcp.
- Do not set HOST=0.0.0.0 unless you mean to. The reference server has no sign-in.
- Docker installs keep the graph in a volume. Upgrading needs the copy step in the README, or the old code keeps running.
How do you set up Basic Memory and Mem0?
- Basic Memory in Claude Code
- Claude mcp add basic-memory -- uvx --prerelease=allow basic-memory mcp. It needs uv. The README says the --prerelease=allow flag is required, or uv quietly installs an older release.
- Basic Memory in Codex
- Add [mcp_servers.basic-memory] to ~/.codex/config.toml with command uvx and the same arguments.
- Mem0 in several clients at once
- npx mcp-add --name mem0-mcp --type http --url "https://mcp.mem0.ai/mcp" --clients "claude code,cursor". Restart each client.
- Mem0 sign-in
- The first tool call opens a browser to approve access. For CI, send your API key as a bearer token instead. Without either, the server answers 401.
- Mem0 limits
- After 30 days, the Free plan needs your own LLM key and then allows 50,000 adds and 10,000 searches a month.
Is a memory MCP safe for work code?
- Keep secrets out of memory. The official server's file is plain text, and the agent reads what it saved back into its prompts.
- A hosted server receives what the agent saves. Check where the provider stores it before you save client or company data.
- Keep one memory per project or client, so facts from one job do not leak into another.
- Prune it. A wrong memory is worse than none, because the agent trusts it.
How we picked
On 26 November 2026 we read the official server's README and npm entry, and the Basic Memory and Graphiti READMEs. We also read Mem0's MCP docs and pricing page, and the Claude Code memory and MCP docs. We read two r/ClaudeAI threads on memory tools. We counted the official server's tools from its README. We did not run a long-term test of recall quality.
Want your agent to remember your design system too?
A memory server holds facts your agent learns. It does not hold your colors, type and components in a form the agent builds with. Better Design is an MCP server we make that gives Claude Code, Cursor or Codex your design system before they build a page. A free account gets 300 tool calls in 30 days.
Frequently asked questions
Yes. The official server is MIT licensed and runs on your computer. Basic Memory is free to run locally. Mem0 has a Free plan with monthly limits.
Yes. Claude Code has CLAUDE.md and auto memory, and the Claude apps have their own chat memory. None of them is shared with Cursor or Codex, which is the gap a memory MCP fills.
Anthropic's Claude apps have built-in memory, and any memory MCP server works with Claude. The official Knowledge Graph Memory Server was written for Claude, and its README shows the Claude Desktop setup first.
Wherever MEMORY_FILE_PATH points. Without it, the file sits in the server's install directory, inside the npx cache.
