Codebase Memory MCP is a code intelligence server that indexes a repository into a persistent knowledge graph and exposes it to AI coding agents over the Model Context Protocol (MCP). It parses source with tree-sitter grammars for 162 languages, compiled into one native executable for macOS, Linux, and Windows, and stores the graph in SQLite. Nodes cover functions, classes, HTTP routes, Kubernetes resources, and Kustomize modules. Edges cover calls, imports, inheritance, data flow, cross-service HTTP calls, pub-sub channels, spawned processes, and near-clone similarity.
The server contains no LLM. The MCP client (Claude Code or any MCP-compatible agent) is the intelligence layer: it translates a question such as "what calls ProcessOrder?" into a graph call like trace_path, and the server returns structured results in under a millisecond. The project reports five structural queries costing about 3,400 tokens against about 412,000 tokens for file-by-file grep exploration, and its preprint, evaluated across 31 repositories, reports 83% answer quality, 10x fewer tokens, and 2.1x fewer tool calls than file-by-file exploration.
Indexing runs in two passes. A tree-sitter pass extracts definitions, calls, and imports for every language. A second pass, called Hybrid LSP, is a C implementation of type-resolution algorithms modeled on language servers such as tsserver, pyright, gopls, Roslyn, Eclipse JDT, and rust-analyzer. It refines call edges with type information for Python, TypeScript and JavaScript, PHP, C#, Go, C, C++, Java, Kotlin, Rust, and Perl without running a language server process. Languages without a Hybrid LSP pass fall back to textual resolution.
Performance figures measured on an Apple M3 Pro:
| Operation | Time | Notes |
|---|---|---|
| Linux kernel full index | 3 min | 28M LOC, 75K files, 4.81M nodes, 7.72M edges |
| Linux kernel fast index | 1m 12s | 1.88M nodes |
| Django full index | ~6s | 49K nodes, 196K edges |
| Cypher query | <1ms | relationship traversal |
| Name search (regex) | <10ms | SQL LIKE pre-filtering |
| Dead code detection | ~150ms | full graph scan with degree filtering |
| Trace call path (depth 5) | <10ms | BFS traversal |
The install command configures 45 client surfaces, 39 detected automatically and 6 conditional, including Claude Code, Codex, Gemini CLI, OpenCode, Aider, Kilo Code, Cursor, Windsurf, OpenClaw, Hermes, OpenHands, Cline, Qwen Code, Goose, Continue, Roo Code, Pi, and Warp. Where a client has a custom-agent format, it installs three agent definitions from one contract: Scout (a few narrow calls for provisional discovery), Verify (the default, task-directed graph evidence with coverage checks), and Auditor (bounded scope with explicit unresolved limitations). A per-account coordination daemon is shared across every configured client and owns the background watchers, shared indexing jobs, and the optional 3D graph visualization UI served from the binary.
Features
- Graph tools: 17 MCP tools covering search, call-path tracing, architecture overview, git-diff impact analysis, index-coverage checks, Cypher queries, dead code detection, cross-service HTTP linking, and Architecture Decision Records
- Semantic search: vector search over the whole graph with bundled Nomic nomic-embed-code embeddings compiled into the binary, combined with 11 scoring signals such as TF-IDF, AST profiles, data flow, and MinHash, with no API key or external service
- Full-text and structural search: BM25 search through SQLite FTS5 with a camelCase and snake_case aware tokenizer, regex name patterns with label, degree, and file filters, and graph-augmented grep over indexed files
- Cross-service linking: HTTP route to call-site matching with confidence scores, gRPC, GraphQL, and tRPC service detection, and EMITS and LISTENS_ON channel edges for Socket.IO, EventEmitter, and pub-sub patterns across 8 languages
- Cross-repo intelligence: CROSS_* edges link nodes across repositories indexed in the same store, with a multi-galaxy 3D layout and a combined architecture summary across the fleet
- Hybrid LSP: type-aware call resolution for Python, TypeScript and JavaScript, PHP, C#, Go, C, C++, Java, Kotlin, Rust, and Perl, embedded in the executable with no language server process
- Infrastructure-as-code indexing: Dockerfiles, Kubernetes manifests, and Kustomize overlays become graph nodes with IMPORTS edges to referenced resources
- Package resolution: bare import specifiers resolve through manifest scanning for npm, Go, Cargo, Python, Composer, Dart, Maven, Gradle, Mix, and RubyGems projects
- Team-shared graph artifact: an opt-in zstd-compressed SQLite snapshot committed next to the source lets teammates import the graph and index only their local diff, with a two-tier export and an integrity-checked import
- Auto-index and watcher: new projects index on first MCP connection, and a background watcher polls the git projects open sessions are rooted in and re-indexes them on change
- Multi-client install: one command configures 45 client surfaces and installs Scout, Verify, and Auditor agent definitions where the client supports custom agents, with fail-open, context-only hooks
- Release verification: every release is scanned by VirusTotal, carries SLSA Level 3 provenance and Sigstore cosign signatures, and ships SHA-256 checksums, with CodeQL blocking a release on open alerts



