codebase-memory-mcp is a code intelligence engine for AI coding agents-or, put plainly, a persistent codebase memory MCP server. As of late July 2026 it sits at 35,958 stars, 2,812 forks, MIT license, pure C, with v0.9.0 released-less than 5 months after the first commit on February 24, 2026. What it does in one sentence: index an entire repository into a knowledge graph (functions, classes, call chains, HTTP routes, cross-service links) and expose it through 15 MCP tools to 43 agent clients including Claude Code, Codex, Cursor, Windsurf, Gemini CLI, OpenCode, and KiloCode, so the agent queries the graph instead of grep-ing file by file. The arXiv paper (2603.27277) benchmarks 31 real-world repositories: 83% answer quality, 10× fewer tokens, 2.1× fewer tool calls. The Linux kernel (28M LOC, 75K files) indexes in 3 minutes; queries return in under 1ms.
What Pain It Solves
Anyone who's used an AI coding agent has hit these: the context window is finite, the agent can't see the whole repo, so it greps blind and the cross-file call chain breaks halfway; onboarding a new project, the agent has no memory, every session starts from scratch, re-reading files, forgetting yesterday's architecture; you change one function and the agent doesn't know the blast radius, either not telling you or missing things; HTTP routes, gRPC, event channels-these cross-service links are invisible to the agent; and tokens burn fast-the team measured 5 structural queries at 412,000 tokens via file-by-file search. codebase-memory-mcp pre-indexes the whole repo into a knowledge graph, persists it to SQLite, and the agent queries the graph for structured results, one graph query replacing dozens of grep/read cycles. The core shift is from "let the agent read code file by file" to "let the agent query the code graph"-no matter how big the repo, how many sessions, or how many restarts, the graph stays put.
How the Knowledge Graph Is Built: tree-sitter + Hybrid LSP + Cross-Service Linking
The fundamental split from plain code search is here: ordinary search is text matching, codebase-memory-mcp is structural graph building, and it runs in two layers. The first is tree-sitter AST-158 language grammars all vendored and compiled into the binary, extracting definitions, calls, imports. The second is Hybrid LSP semantic type resolution, deepened for 10 languages (Python, TypeScript, PHP, C#, Go, C/C++, Java, Kotlin, Rust, Perl)-it can tell you that user.profile.display_name() resolves to Profile.display_name declared three modules away, which tree-sitter alone can't do because it doesn't track imports, generics, or inheritance. This layer is a lightweight C implementation, compatible with tsserver/pyright/gopls/rust-analyzer, without spawning a language server, no API key. The indexing pipeline is RAM-first: LZ4 compression, in-memory SQLite, Aho-Corasick matching, a single dump at the end, memory released to the OS-the Linux kernel indexes in 3 minutes into 4.81M nodes and 7.72M edges. Edge types go beyond CALLS/IMPORTS/DEFINES to cross-service HTTP_CALLS, event EMITS/LISTENS_ON, DATA_FLOWS, and near-clone SIMILAR_TO; cross-service linking covers HTTP route matching, gRPC/GraphQL/tRPC detection, and pub-sub channels (8 languages). Even Dockerfiles and Kubernetes manifests are indexed as graph nodes, and Louvain community detection clusters call edges to surface functional modules.
15 MCP Tools + Cypher: How Agents Query the Graph
The 15 tools split into four groups: indexing (index_repository/list_projects); querying (search_graph by label/name-regex/degree, trace_path BFS traversal depth 1-5, get_architecture returning languages/routes/hotspots/layers in one call); analysis (detect_changes mapping git diff to affected symbols + blast radius + risk, dead code detection finding zero-caller functions, manage_adr persisting architecture decisions); Cypher (query_graph running an openCypher read-only subset with MATCH/WHERE/variable-length paths [*1..3]/EXISTS {}-dead code is just WHERE NOT EXISTS { (f)<-[:CALLS]-() }). One design trade-off: it has no built-in LLM, it's a structural analysis backend-other code graph tools embed an LLM for natural-language-to-graph translation, at the cost of extra API keys; it goes the MCP route, so the agent you're talking to is the query translator. You say "what calls ProcessOrder," the agent itself calls trace_path, it runs the graph query and returns structured results, and the agent explains it in plain English. Search goes beyond graph queries: semantic_query does vector search with bundled Nomic embeddings (40K tokens, 768d int8, compiled into the binary-no API key/Ollama/Docker), BM25 full-text runs on SQLite FTS5 with a camelCase/snake_case-aware tokenizer. 3D visualization ships at localhost:9749. Token efficiency is a hard metric: 5 queries ~3,400 tokens vs. 412,000 file-by-file, down 99.2%.
43 Agent Clients + Team-Shared Graph
Install once and it auto-configures 43 client surfaces (37 auto + 6 conditional), covering Claude Code, Codex, Cursor, Windsurf, Gemini CLI, OpenCode, KiloCode, and more. The install command writes each client's MCP config plus durable instructions/skills/hooks-Claude Code gets SessionStart and a non-blocking PreToolUse (observes Grep/Glob and injects graph symbols), Codex CLI gets AGENTS.md + three read-only agents. Every client gets three-tier profiles: Scout (Tier 1, fast positive discovery), Verify (Tier 2, default, graph evidence + source checks), Auditor (Tier 3, bounded scope + complete pagination); Cursor, Cline, and others where child MCP is unsafe go through parent handoff. Cross-session coordination runs through a single per-account daemon: Claude Code, Codex, and OpenCode share one daemon-the first session starts it, the last shuts it down, owning watchers and shared indexing. Team collaboration hinges on one committed artifact: .codebase-memory/graph.db.zst is a zstd compressed snapshot of the knowledge graph (8-13:1 ratio); a teammate clones the repo and decompresses it for incremental indexing instead of a full rebuild, in two tiers-Best (zstd -9) and Fast (zstd -3)-with a .gitattributes merge=ours line preventing conflicts. Persistence is SQLite (WAL mode, ACID-safe) at ~/.cache/codebase-memory-mcp/, surviving restarts, with auto_watch tracking git changes for auto-reindex. Distribution is a single static binary across macOS/Linux/Windows with zero runtime dependencies.
Three-Minute Setup
# 1. One-line install (macOS / Linux, add --ui for 3D visualization)
curl -fsSL https://raw.githubusercontent.com/DeusData/codebase-memory-mcp/main/install.sh | bash
# Windows (PowerShell)
Invoke-WebRequest -Uri https://raw.githubusercontent.com/DeusData/codebase-memory-mcp/main/install.ps1 -OutFile install.ps1
Unblock-File .\install.ps1; .\install.ps1
# 2. install auto-detects installed agents and writes MCP config (43 client surfaces)
# 3. Restart your agent, say "Index this project" - doneManual config: add an MCP server entry to ~/.claude.json or .mcp.json; verify with /mcp-you should see 15 tools. If you already have a coding agent, tell Claude Code "Install this MCP server: https://github.com/DeusData/codebase-memory-mcp" and it installs itself.
Who It's For + Five Pitfalls
For: people taking over large repos who want to read the graph first; users of Claude Code / Codex / Cursor who want to give their agent code memory and save tokens; anyone doing code review, dead-code cleanup, or impact analysis; teams on cross-service architectures tracing HTTP/gRPC links. Five pitfalls: one, it has no built-in LLM-it's a structural analysis backend, and natural-language-to-graph translation is done by the agent you're already using; two, Hybrid LSP only covers 10 languages, the other 148 fall back to textual resolution (you get an answer, but not necessarily a precise one), with OCaml/Haskell in the functional tier (<75%); three, memory-large repos spike RAM during indexing, released after, use CBM_MEM_BUDGET_MB to pin a budget inside containers; four, Windows hooks for some clients (GitLab Duo, Devin, Factory) are withheld; five, security-reads codebase and writes agent config, but 100% local, zero telemetry, and binaries are signed, SLSA Level 3, and VirusTotal-scanned. Also: CBM_CACHE_DIR allows only one cache root per account at a time.
vs. the Competition
Against graphify, graphify is an AI coding skill (triggered by /graphify, on-demand, lightweight) while codebase-memory-mcp is an MCP server (resident, 15 tools, heavy full-index); graphify outputs a graphify-out/ directory, codebase-memory-mcp outputs a single compressed artifact (two-tier compression, integrity-checked, conflict-free), and the two stack. Against Cline-style agent memory, Cline remembers conversation/preferences/decisions, while codebase-memory-mcp remembers code structure-who calls whom, where the dead code is, what breaks if you change one spot; they don't conflict, and Cline is itself one of the 43 supported clients. Against plain RAG (vector search over code), RAG finds semantically similar chunks but doesn't know call chains or cross-file structure, so it can't answer "who calls ProcessOrder and what breaks if I change it"; codebase-memory-mcp gives a structural graph, tokens down 99.2%. In one line: for agent conversation/preference memory use Cline memory, for on-demand graphing use graphify, for a resident, queryable, team-shareable code-structure memory for your agent, use codebase-memory-mcp.
References
- codebase-memory-mcp GitHub repo (35,958 stars, MIT, pure C): https://github.com/DeusData/codebase-memory-mcp
- arXiv paper (31 real repos, 83% answer quality, 10× fewer tokens, 2.1× fewer tool calls): https://arxiv.org/abs/2603.27277
- Latest release v0.9.0 (macOS/Linux/Windows static binaries): https://github.com/DeusData/codebase-memory-mcp/releases/latest
- Hybrid LSP docs (10-language semantic type resolution): https://github.com/DeusData/codebase-memory-mcp#hybrid-lsp
- Installation & configuration (43 client surfaces, environment variables, CLI mode): https://github.com/DeusData/codebase-memory-mcp#configuration