Codebase Memory — Claude Code MCP server: code graph for agents
A local MCP server that maps your repo's code, docs and infrastructure into a graph. Gives the agent structural context without re-reading files.
claude mcp add codebase-memory-mcp -- npx -y codebase-memory-mcpWhat Codebase Memory does
Codebase Memory indexes a repository and keeps the links between source, documentation, config and infrastructure in a persistent graph on your machine. Your agent talks to it over MCP and gets structural answers: which function calls which, what depends on a file, where a symbol lives. Queries run against the graph instead of re-reading the whole project, so fewer tokens go to file reads.
The backend is written in C, ships its own parsers and exposes 17 MCP tools; Hybrid LSP adds type resolution for some languages. The installer can write client configuration, skills, agent profiles and hooks. No hosted service or API key is involved — source analysis and graph storage stay local.
Alongside the server there is CBM Lens, a visual layer that renders the graph as maps, a hierarchy and a 3D view, opens sources and offers a local chat over the code. It is still in open beta, so treat it as an experiment rather than a daily driver. The MCP server itself is the main piece.
What it helps with
- locate an unfamiliar function and its callers in a new repo
- follow a call across service boundaries
- trace a deployment back to its source
- see which parts of a project a change touches
- cut repeated file reads by the agent
Example prompts for the agent
- Find where this function is called from and show the call path
- Which files depend on
arena.c? - Show the module structure and its dependencies
How to install Codebase Memory
Platform CLI
claude mcp add codebase-memory-mcp -- npx -y codebase-memory-mcpPlatform CLI
codex mcp add codebase-memory -- npx -y codebase-memory-mcpConfig file
{
"mcpServers": {
"codebase-memory": {
"command": "npx",
"args": [
"-y",
"codebase-memory-mcp"
]
}
}
}Config file
{
"servers": {
"codebase-memory": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"codebase-memory-mcp"
]
}
}
}Platform CLI
gemini mcp add codebase-memory npx -y codebase-memory-mcpStep by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more
Questions about Codebase Memory
How do I install Codebase Memory in Claude Code?
Run claude mcp add codebase-memory-mcp -- npx -y codebase-memory-mcp.
What does Codebase Memory do?
It builds a local graph of code, docs and infrastructure and serves it to your agent over MCP: symbol search, callers, dependencies, source snippets.
Does it need an API key or a hosted service?
No. Indexing and graph queries run on your machine.