Introduction
Codebase Memory MCP is an open-source MCP (Model Context Protocol) server that builds a persistent knowledge graph from your source code. It supports 158 programming languages, delivers sub-millisecond query responses, and ships as a single static binary with no external dependencies. Designed for AI coding agents, it reduces token usage by providing precise, structured code context.
What Codebase Memory MCP Does
- Indexes entire codebases into a persistent knowledge graph stored locally
- Supports 158 programming languages via tree-sitter parsing
- Delivers sub-millisecond query performance for symbol lookups and code navigation
- Integrates with AI coding agents through the MCP protocol
- Ships as a single static binary with zero runtime dependencies
Architecture Overview
Codebase Memory MCP uses tree-sitter grammars to parse source files across 158 languages, extracting symbols, relationships, and structural information into a Cypher-queryable knowledge graph backed by SQLite. The graph captures functions, classes, imports, call sites, and type hierarchies. Queries resolve in sub-millisecond time because the graph is pre-computed and stored locally, avoiding repeated file scanning. The MCP protocol layer exposes this graph to any compatible AI agent or IDE.
Self-Hosting & Configuration
- Download a single binary from the GitHub releases page for Linux, macOS, or Windows
- No Docker, Python, or Node.js runtime required
- Configure indexed directories and exclusion patterns via CLI flags or a config file
- Knowledge graph data persists in a local SQLite database between sessions
- Integrates with Claude Code, Cursor, Codex, and other MCP-compatible clients via stdio or SSE
Key Features
- 158-language support through comprehensive tree-sitter grammar coverage
- Sub-millisecond queries over the full knowledge graph
- Single static binary under 20 MB with no dependencies
- Persistent indexing that survives restarts without re-scanning unchanged files
- MCP-native interface for direct integration with AI coding workflows
Comparison with Similar Tools
- Sourcegraph — full-featured code search platform requiring server infrastructure; Codebase Memory MCP is a single binary
- ctags/etags — symbol indexing only without relationship graphs or MCP integration
- Language servers (LSP) — per-language setup and no MCP protocol support
- GitHub code search — cloud-hosted and limited to GitHub repositories
- Repomix — packs repos into a single file for LLMs but does not provide a queryable graph
FAQ
Q: Does Codebase Memory MCP require a database server? A: No. It uses an embedded SQLite database. Everything runs from the single binary.
Q: How large can the indexed codebase be? A: It handles repositories with millions of lines of code. Indexing time scales linearly with codebase size, and incremental updates only re-index changed files.
Q: Which AI agents support the MCP protocol? A: Claude Code, Cursor, OpenAI Codex CLI, Gemini CLI, and other tools that implement the Model Context Protocol.
Q: Is the knowledge graph queryable outside of AI agents? A: Yes. The graph supports Cypher-style queries, so you can query it from scripts or custom tooling.