codebase-memory-mcp: Code Intelligence for AI Agents
Reach for codebase-memory-mcp if your AI agent burns tokens grepping a large codebase and you want it to query structure from a local graph instead; one graph query can replace dozens of read/grep cycles. Skip it if your repo is small enough for plain file reads, or you're wary of a marketing-heavy README whose headline numbers (99% fewer tokens, 158 languages) aren't independently verified. It ships as one static binary with no runtime deps, so trying it is cheap.
Agents Burning Tokens on Grep-and-Read
AI coding agents explore unfamiliar code the slow way: read a file, grep for a symbol, read another file, repeat. On a large repo that burns thousands of tokens and still misses cross-file call chains. The agent has no persistent model of how the code fits together, so every session re-discovers the same structure from scratch.
A Queryable Knowledge Graph, in One Binary
codebase-memory-mcp is an open-source (MIT) code intelligence MCP server that turns a codebase into a queryable knowledge graph. Written in C and shipped as a single static binary, it uses tree-sitter to parse code across many languages — the README claims 158 — plus a 'Hybrid LSP' layer for type resolution in about a dozen. It stores the graph in SQLite and exposes 14 MCP tools for search, call tracing, and impact analysis. There's no built-in LLM — your MCP client is the intelligence layer.
14 MCP Tools for Call Graphs and Dead Code
- ✓Persistent knowledge graph: indexes functions, classes, call chains, HTTP routes, and cross-service links into SQLite that survives across sessions
- ✓14 MCP tools including call-path tracing, dead-code detection, impact analysis on git diffs, and Cypher-like graph queries
- ✓tree-sitter parsing the README puts at 158 languages, with a Hybrid LSP type-resolution layer for about 12 including Python, TypeScript, Go, Java, and Rust
- ✓Semantic search over the graph via bundled nomic-embed-code embeddings compiled into the binary — no API key or external model server
- ✓Single static binary for macOS, Linux, and Windows with zero runtime dependencies; one install command auto-configures 11 coding agents
- ✓Team-shared graph artifact: a zstd-compressed graph.db.zst you can commit so teammates skip the full reindex
- ✓Optional 3D graph visualization UI at localhost:9749 in a separate build variant
Pure C, Bundled Embeddings, No Docker
Giving AI agents a cheap, structural view of a codebase is an active problem, and this one attacks it with an unusual stack: pure C, vendored tree-sitter grammars, in-memory SQLite, and bundled embeddings compiled into the binary — no Docker, no API keys, no Ollama. The README pairs that with an arXiv preprint and aggressive benchmark numbers, and it auto-configures across 11 coding agents from one install command, which lowers the bar to trying it.
One-Line Install, Auto-Configures 11 Agents
codebase-memory-mcp ships as a single static binary. On macOS or Linux the README's one-line install is `curl -fsSL https://raw.githubusercontent.com/DeusData/codebase-memory-mcp/main/install.sh | bash` (add `-s -- --ui` for the graph UI). On Windows you download `install.ps1`, `Unblock-File` it, and run it. It's also on npm, PyPI, Homebrew, Scoop, Winget, Chocolatey, and the AUR. The `install` command auto-detects your coding agents and writes their MCP config, so after a restart you just say 'Index this project'.
Telling Your Agent to 'Index This Project'
After install, restart your agent and index the repo — the README's example is telling the agent 'Index this project.' From then on the agent calls the MCP tools: `trace_path` to follow a call chain, `search_graph` for structural name patterns, `get_architecture` for an overview, or `detect_changes` to map a git diff. There's also a CLI mode, e.g. `codebase-memory-mcp cli search_graph '{"project":"my-project","name_pattern":".*Handler.*"}'`, and an opt-in `auto_index` so new projects index on first connection.
Tracing Call Chains Before You Touch Code
- •Letting a coding agent trace who calls a function across files before you change it
- •Finding dead code — functions with zero callers — across a large repo
- •Mapping the blast radius of an uncommitted git diff to the symbols it affects
- •Giving an agent an architecture overview (languages, entry points, routes, hotspots) in one call instead of many file reads
- •Cutting token spend on repeated codebase exploration in long agent sessions
Where the Token Savings Come From
- ✓One static binary, no Docker, no API keys, no runtime deps — genuinely low setup friction
- ✓Runs 100% locally and the README states it collects no telemetry, so code never leaves your machine
- ✓Replaces many grep/read cycles with a single graph query, which is where the token savings come from
- ✓One install command configures MCP entries and hooks across 11 agents, so you're not hand-editing configs
- ✓MIT-licensed, and the design is backed by an arXiv preprint the README links
Read the Benchmarks With a Grain of Salt
- △The README is heavy on marketing, and its headline numbers (99% fewer tokens, 83% answer quality, 158 languages) come from the authors' own preprint — treat them as vendor benchmarks, not independent results
- △Written in C and distributed as prebuilt binaries; on Windows SmartScreen flags it as unsigned, so you're trusting the signed checksums and antivirus scans the README points to
- △No built-in LLM by design — it's only as good as the MCP client driving it, and a weak agent won't ask the right graph queries
- △It writes to your agent config files and pre-tool hooks during install, which is more invasive than a plain MCP server registration
- △Hybrid LSP type resolution covers only about 12 languages; the other 140-plus rely on tree-sitter parsing alone, so cross-file resolution is weaker there
LightRAG, DesktopCommanderMCP, Sourcegraph, Serena
Who Actually Needs a Code Graph
Developers who run AI coding agents against large or unfamiliar repositories and watch them burn tokens re-exploring the same structure. If you work in a monorepo or a codebase big enough that file-by-file grep is painful, a queryable graph earns its keep. If your project is small, or you'd rather not run a prebuilt binary that edits your agent config, the payoff is thinner.
codebase-memory-mcp Questions, Answered
codebase-memory-mcp is a code intelligence MCP server written in C that indexes a codebase into a persistent knowledge graph. AI coding agents then query that graph — call paths, dead code, architecture — instead of reading files one by one.
The README states it runs 100% locally and collects no telemetry, so your code, queries, and usage stay on your machine. The graph is stored in SQLite under your cache directory.
The README puts tree-sitter parsing at 158 languages, with a deeper Hybrid LSP type-resolution layer for about 12 — including Python, TypeScript/JavaScript, Go, C, C++, Java, Kotlin, Rust, PHP, C#, and Perl.
File access makes the agent grep and read repeatedly; the README reports five structural graph queries used about 3,400 tokens versus roughly 412,000 for file-by-file search. The graph also resolves cross-file call chains that grep misses.
No. It has no built-in LLM and bundles its embeddings into the binary, so there's no API key, Ollama, or Docker to configure — your MCP client is the intelligence layer.
