Codebase memory MCP servers for Claude Code, compared
For codebase memory in Claude Code, start with the information you need to retrieve. A code index answers where a function is used; a session store helps resume a task; a decision record explains why an approach was chosen or rejected. Some servers cover more than one of these jobs.
If you are looking for a codebase-memory-mcp alternative, Selvedge fits the decision-history part of the problem. It does not replace a code structure index or call graph. You can also keep codebase-memory-mcp and add Selvedge for recorded reasons and outcomes.
We maintain Selvedge. This is a documentation-based comparison, reviewed September 24, 2026, with versioned sources below. It is not a benchmark of the other tools.
The four jobs
Section titled “The four jobs”| Job | The question it answers | Starting points |
|---|---|---|
| Code intelligence | How is the code structured, and what depends on this function? | codebase-memory-mcp, OpenLore |
| Session context | What task was in progress, and what should resume next? | Memory Keeper |
| General memory | What facts and preferences should an agent retrieve later? | mem0, the reference MCP memory server, claude-code-memory |
| Decision history | Why did we choose this, what did we reject, and when should we reconsider? | Selvedge, maintained ADRs; also inspect the decision features in the tools above |
These are selection questions, not exclusive categories. For example, codebase-memory-mcp now documents an ADR-management tool, OpenLore documents anchored decisions, and Memory Keeper can store decisions as context items.
The servers, side by side
Section titled “The servers, side by side”| Server | Documented focus | Storage and setup considerations |
|---|---|---|
| codebase-memory-mcp | A persistent code graph, structural and semantic queries, and architecture decision records | Native executable and release assets; SQLite-backed local storage. Its documentation states no required hosted service or API key. |
| OpenLore | Static analysis, code relationships, anchored notes and decisions, and optional change guardrails | Local-first index; its core path requires no API key. Check the documented configuration of optional features. |
| Memory Keeper | Persistent task context, decisions, progress and checkpoints across sessions | Node-based MCP server with SQLite storage; agents must save and restore the relevant context. |
| mem0 | Memory extraction and retrieval for agents and applications | Self-hosted and managed options. The documented default uses an LLM and embeddings; inspect provider and storage configuration before assuming offline operation. |
| Reference MCP memory server | Entities, relationships and observations in a knowledge graph | Local JSONL file; configure its location so later sessions use the same store. |
| claude-code-memory | Coding activity, patterns and relationships | Requires a separately configured Neo4j database, local or cloud. |
| Selvedge | Recorded reasons and outcomes for functions, columns, routes and other entities | Local SQLite under .selvedge/; MCP and CLI. Core queries require no LLM. Recording and retrieval are explicit. |
A local memory server does not make the whole coding workflow offline: the connected agent may send retrieved content to its model provider. Installation and optional models can also require downloads.
Which one to pick
Section titled “Which one to pick”- Need code navigation or impact analysis? Start with codebase-memory-mcp or OpenLore. Check language coverage and the queries you need on your own repository.
- Need to resume an interrupted Claude Code session? Start with Memory Keeper’s save/checkpoint/restore workflow.
- Need facts or preferences across an application? Compare mem0’s extraction and retrieval approach with a simpler explicitly maintained knowledge graph.
- Need the reason an approach was rejected? Try Selvedge’s entity-keyed
prior_attempts, or maintain an indexed set of instructions and ADRs. Other servers also store decisions; compare their retrieval and revision behavior before choosing.
Before adding another server, check whether your current tool already stores the information you need. Multiple servers can coexist, but overlapping records need a clear source of truth and a retrieval rule.
A small test for any memory server
Section titled “A small test for any memory server”- Save one actual decision, the reason for it, and what would change your mind.
- Start a new coding session in the same project.
- Ask for that decision before editing the affected code.
- Inspect whether the answer includes the reason, outcome and source.
- Change the underlying constraint and check how the old record is revised or superseded.
This tests your configuration and workflow. It does not establish that the agent will always retrieve or follow the record. See the distinction between agent memory and retrieval.
What Selvedge is
Section titled “What Selvedge is”Selvedge is a local MCP server and CLI for recorded code decisions. log_change saves the stated reason; prior_attempts retrieves recorded attempts and outcomes by entity. An explicit reject or revert can report confidence: "exact", which describes the recorded evidence, not whether the decision is correct.
pip install selvedgeselvedge setup --agent claude-codeFollow the Claude Code setup guide, then the record-and-retrieve walkthrough. For other clients, use the quickstart. Claude Code hooks do not automatically apply to other agents.
What is the best MCP server for codebase memory with Claude Code?
There is no single choice for every workflow. Match code navigation, session context, general memory or decision history to the task, then verify a later-session retrieval in your repository.
Is Selvedge a replacement for codebase-memory-mcp?
Not for code indexing, call graphs or structural search. Selvedge focuses on reasons and outcomes that agents or people explicitly record. codebase-memory-mcp also documents ADR storage, so assess whether its existing decision features already meet your need.
Can I use more than one memory server?
Yes, if your client supports multiple MCP servers. Give each record a clear owner and tell the agent which source to consult. More available tools alone do not guarantee better decisions.
Does local storage mean no data leaves my computer?
No. Local storage describes where the server keeps records. A connected coding agent may include retrieved records in requests to its model provider; provider configuration and optional features also matter.
Sources and scope
Section titled “Sources and scope”The descriptions above summarize these repository documentation snapshots. We have not run a comparative reliability, speed or memory benchmark. Features and setup can change; consult the current upstream instructions before installation.