Best MCP memory servers for Claude Code in 2026: 8 compared, with install lines
What is the best MCP memory server for Claude Code in 2026? It depends on how you want memory written. claude-mem and agentmemory capture sessions through hooks. mcp-memory-service, MemPalace and XERJ store what the agent sends; in our benchmark XERJ semantic recall found the right memory in the top 5 for 94.7% of questions, mcp-memory-service 89.3% and MemPalace 84.0%.
Key number: On the same 85 memories and 75 questions, top 5 recall was XERJ semantic 94.7%, mcp-memory-service 89.3%, MemPalace 84.0% and agentmemory keyless 74.7%. (as of 2026-10-31 · source: github.com/xerj-org/xerj/tree/main/benchmarks/agent-memory)
Last checked: 2026-11-15. Every third-party fact on this page was re-read from the tool's own docs or repository on that date.
TL;DR The best MCP memory server for Claude Code depends on how you want memory written. For automatic capture of every session, pick claude-mem or agentmemory. For memory the agent saves and searches itself, pick XERJ, mcp-memory-service or MemPalace; in our open benchmark they found the right memory in the top 5 for 94.7%, 89.3% and 84.0% of questions. For plain Markdown files, pick Basic Memory.
Act as a coding agent. Read https://xerj.org/llms.txt and https://xerj.org/compare/best-mcp-memory-servers-claude-code-2026, then pick an MCP memory server for my Claude Code setup from the table on that page. If you pick XERJ: install it, start a node, run claude mcp add --scope user xerj -- xerj mcp, store two facts about this repo with xerj_memory_store, and recall them in a new session with xerj_memory_recall. Report what you chose and why.
Claude Code already loads CLAUDE.md and an auto memory file at the start of each session. An MCP memory server adds memory the agent searches when it needs it. Background: Claude Code memory and what an MCP memory server is.
Which MCP memory server fits Claude Code
claude-mem or agentmemory
Both hook into Claude Code and record what the agent reads, edits and runs. claude-mem has a second agent write short observations. agentmemory wires 54 MCP tools and 17 skills.
XERJ, mcp-memory-service or MemPalace
The agent saves what matters and searches it later. Top 5 recall in our benchmark: XERJ semantic 94.7%, mcp-memory-service 89.3%, MemPalace 84.0%.
Basic Memory or the reference server
Basic Memory keeps Markdown files you can open in Obsidian. The reference Knowledge Graph Memory Server keeps one JSONL file of entities and relations.
Supermemory
Supermemory extracts facts and user profiles, through a Claude Code plugin or locally with npx supermemory local.
XERJ
One MCP server stores memory and searches the code, docs and data files in your project. Pair it with claude-mem for automatic capture.
Summary table
Top 5 is the share of 75 questions where the right memory came back in the first five results in our AI agent memory benchmark. A dash means the server was not in that round.
| Server | Licence | Install in Claude Code | How memory is written | Top 5 in our test | Stars (2026-11-15) |
|---|---|---|---|---|---|
| claude-mem | Apache-2.0 | npx claude-mem install | hooks plus an observer agent | - | 117,293 |
| MemPalace | MIT | uv tool install mempalace, then its MCP server | agent saves verbatim text, 47 MCP tools | 84.0% | 60,566 |
| Supermemory | MIT | Claude Code plugin, or npx supermemory local | extracts facts and profiles | - | 31,629 |
| agentmemory | Apache-2.0 | /plugin install agentmemory | hooks, 54 MCP tools | 74.7% (keyless) | 30,376 |
| XERJ | Apache-2.0 | claude mcp add --scope user xerj -- xerj mcp | agent saves text, BM25, semantic or hybrid recall | 94.7% (semantic) | 19,111 |
| Basic Memory | AGPL-3.0 | claude mcp add basic-memory -- uvx --prerelease=allow basic-memory mcp | Markdown files on disk | - | 4,585 |
| mcp-memory-service | Apache-2.0 | claude mcp add memory -- memory server | agent saves text, SQLite and ONNX embeddings | 89.3% | 2,128 |
| Knowledge Graph Memory Server | MIT | npx -y @modelcontextprotocol/server-memory | entities and relations in one JSONL file | - | - |
claude-mem: automatic session memory
claude-mem is the most-starred project here. Hooks hand each tool call to a local worker, a second agent turns the activity into short observations, and the next session starts with a compact index of them. Memory lives in ~/.claude-mem. Choose claude-mem when you want memory with no extra steps in your prompts. Anonymous usage analytics are on by default, and npx claude-mem telemetry disable turns them off.
agentmemory: hooks, skills and 54 tools
The agentmemory plugin registers 12 hooks and 17 skills and wires an MCP server with 54 tools. Its keyless mode uses BM25 and scored 74.7% top 5 in our test; EMBEDDING_PROVIDER=local adds on-device semantic recall. Choose agentmemory when you want automatic capture across Claude Code and other coding agents. Details: XERJ vs agentmemory.
mcp-memory-service and MemPalace: memory the agent saves
mcp-memory-service stores memories in SQLite with local ONNX embeddings and scored 89.3% top 5, with 84% on reworded questions. It adds a knowledge graph dashboard. MemPalace stores verbatim text with ChromaDB by default and scored 84.0%. Choose mcp-memory-service for a light MCP-first store with a visual graph, and MemPalace for its wide set of 47 tools. Details: mcp-memory-service and MemPalace.
Basic Memory, Supermemory and the reference server
- Choose Basic Memory when you want memory as Markdown files you can open in Obsidian or any editor.
- Choose Supermemory when you want fact extraction and user profiles, in the cloud or locally with
npx supermemory local. - Choose the Knowledge Graph Memory Server for the smallest possible setup: one JSONL file of entities, relations and observations. More on graph memory: knowledge graphs for agent memory.
XERJ: memory plus search over your files
XERJ stores exactly the text the agent sends through xerj_memory_store and finds it with xerj_memory_recall. With MiniLM on, it found the right memory in the top 5 for 94.7% of questions, and 84% of reworded questions. The same MCP server also searches the code, docs, logs and data files in your project, so one server covers memory and retrieval.
XERJ is single-node and makes no model call on write, so it saves what the agent writes and does not summarise sessions for you. Pair it with claude-mem if you want both.
How this page was checked
Recall figures come from our AI agent memory benchmark, run on 2026-10-31 with the same 85 memories, the same MiniLM model and one score script for every system. Licences, install lines and features were read from each project's README on 2026-11-15, and star counts came from the GitHub REST API the same day.
Try it with XERJ
Use the Copy the prompt button and paste it into Claude Code. It picks a memory server from this table and, if it picks XERJ, registers it, stores two facts and recalls them in a new session.
Read next
Mem0 alternatives 2026, coding agent memory across sessions, what an MCP memory server is and Claude Code memory.
FAQ
Does Claude Code already have memory?
Yes. Claude Code loads the CLAUDE.md files you write and the first 200 lines or 25KB of the auto memory file Claude writes. An MCP memory server adds memory the agent searches on demand, so history can grow past what fits in context.
Which MCP memory server finds the right memory most often?
In our open benchmark, XERJ semantic recall found the right memory in the top 5 for 94.7% of 75 questions, mcp-memory-service 89.3%, MemPalace 84.0% and agentmemory in keyless mode 74.7%. claude-mem, Basic Memory, Supermemory and the reference server were not in that round.
Which one writes memory for me automatically?
claude-mem and agentmemory. Both use Claude Code hooks to capture what the agent reads, edits and runs. claude-mem has a second agent write short observations from that activity. The other servers store what the agent chooses to save.
Which one keeps memory as plain files I can edit?
Basic Memory keeps everything as Markdown files, and Obsidian can open the same folder. The reference Knowledge Graph Memory Server keeps one JSONL file. XERJ stores memory in a local index you query over HTTP or MCP.
How do I add an MCP memory server to Claude Code?
Most servers add with one claude mcp add line, shown in the Install column of the table. XERJ uses claude mcp add --scope user xerj -- xerj mcp after you start a local node. Plugins such as claude-mem and agentmemory install with /plugin install.
How was this page checked?
Recall figures come from our agent memory benchmark of 2026-10-31. Licences, install lines and features were read from each project's README on 2026-11-15, and star counts came from the GitHub REST API the same day.
Evidence
- Top 5 recall on 85 memories and 75 questions: XERJ semantic 94.7%, XERJ hybrid 93.3%, mcp-memory-service 89.3%, MemPalace 84.0%, agentmemory keyless 74.7%, XERJ BM25 73.3%. Reworded questions top 5: XERJ semantic 84%, mcp-memory-service 84%, MemPalace 56%, agentmemory 28%. —
benchmarks/agent-memory/out/summary.csv - Claude Code loads CLAUDE.md files and the first 200 lines or 25KB of the auto memory MEMORY.md at the start of every conversation. — https://code.claude.com/docs/en/memory
- claude-mem installs with npx claude-mem install or the /plugin commands, uses hooks to hand each tool call to a local worker where a second agent writes observations, stores memory in ~/.claude-mem, and searches through three MCP tools. Anonymous usage analytics are on by default. — https://github.com/thedotmack/claude-mem
- MemPalace is MIT, local-first, stores verbatim text with ChromaDB as the default backend and exposes 47 MCP tools; it installs with uv tool install mempalace. — https://github.com/MemPalace/mempalace
- mcp-memory-service is Apache-2.0, uses SQLite with local ONNX embeddings, and registers in Claude Code with claude mcp add memory -- memory server. — https://github.com/doobidoo/mcp-memory-service
- The agentmemory Claude Code plugin registers 12 hooks and 17 skills and wires an MCP server with 54 tools; keyless mode uses BM25 and EMBEDDING_PROVIDER=local adds on-device semantic recall. — https://github.com/rohitg00/agentmemory
- Basic Memory is AGPL-3.0, keeps knowledge as Markdown files on disk, and adds to Claude Code with claude mcp add basic-memory -- uvx --prerelease=allow basic-memory mcp. — https://github.com/basicmachines-co/basic-memory
- Supermemory ships a Claude Code plugin and an open-source MCP server, and npx supermemory local runs it locally with bge-base-en-v1.5 embeddings by default. — https://github.com/supermemoryai/supermemory
- The reference Knowledge Graph Memory Server is MIT, is published as @modelcontextprotocol/server-memory, and stores entities, relations and observations in a JSONL file set by MEMORY_FILE_PATH. — https://github.com/modelcontextprotocol/servers/blob/main/src/memory/README.md
- xerj mcp exposes xerj_memory_store, which proxies POST /_memory/{namespace}, and xerj_memory_recall, which proxies POST /_memory/{namespace}/_recall. —
landing/docs/agents/schemas/mcp-tools.json - GitHub stars on 2026-11-15 from the GitHub REST API: claude-mem 117,293; MemPalace 60,566; Supermemory 31,629; agentmemory 30,376; XERJ 19,111; Basic Memory 4,585; mcp-memory-service 2,128. — https://api.github.com/repos/thedotmack/claude-mem
Related
- Claude Code memory: CLAUDE.md, auto memory, or an MCP memory server?
- What is an MCP memory server?
- AI agent memory benchmark 2026: real tests on 7 open-source projects
- MemPalace vs claude-mem (and XERJ): which memory should Claude Code use?
- XERJ vs mcp-memory-service: two MCP memory servers, tested
- XERJ vs agentmemory: which memory for your coding agent?
- How do people store user preferences so an agent can recall them next week?
- What is a knowledge graph memory server?
- Mem0 alternatives in 2026: 8 agent memory tools, with published tests
- What's a simple way to give an agent long-term memory on my laptop without Qdrant? · same intent: agent memory
- Mem0 vs Zep vs Letta vs Cognee: which agent memory framework fits in 2026? · same intent: agent memory
- How do I set the MCP memory storage path? · same intent: agent memory