DeusData/codebase-memory-mcp

High-performance code intelligence MCP server. Indexes codebases into a persistent knowledge graph — average repo in milliseconds. 158 languages, sub-ms queries, 99% fewer tokens. Single static binary, zero dependencies.

codebase-memory-mcp – Fast, local code‑intelligence engine for AI coding agents

What it is – A native, zero‑runtime executable that builds a persistent knowledge‑graph of a codebase (functions, classes, call‑chains, HTTP routes, infrastructure files, etc.) using Tree‑sitter parsers for 158 languages. The graph can be queried in milliseconds and is meant to be consumed by AI‑powered coding assistants (Claude Code, Codex, OpenCode, etc.) so they can answer structural questions without sending source files to a remote service.

Why it matters – Traditional LLM‑based code tools scan files one‑by‑one, which is slow and token‑hungry. By indexing a repository once and exposing a graph, this tool reduces the token budget by ~120×, cuts tool‑call overhead by >2×, and can answer complex “where is this function used?” or “what impact will this change have?” queries in under a millisecond.


Core capabilities

Feature What it does
Lightning‑fast indexing Full Linux kernel (28 M LOC, 75 k files) indexed in ~3 min; typical repo in seconds.
Hybrid LSP type resolution Deep semantic analysis for 12 major languages (Python, TS/JS, PHP, C#, Go, C/C++, Java, Kotlin, Rust, Perl) using a lightweight C implementation that mimics popular language servers.
Graph & analysis API Functions, classes, imports, call edges, HTTP routes, gRPC/GraphQL services, event‑channel edges, dead‑code detection, community‑detection (Louvain), impact‑mapping for git diffs, ADR management, etc.
Query languages Cypher‑like pattern matching on the graph
Semantic search using bundled Nomic code embeddings (no API key)
BM25 full‑text via SQLite FTS5 with camelCase/snake_case aware tokenizer
Structural/regex search over node labels
Built‑in 3D UI Starts a local web UI (localhost:9749) that visualises the graph across one or many repositories.
Cross‑repo intelligence Nodes can link across multiple indexed repos, enabling fleet‑wide architecture views.
Zero‑runtime, local‑only No Docker, no language runtimes, no external API keys. All processing stays on the developer’s machine.
Agent integration Auto‑detects and configures 43 supported coding‑agent “surfaces” (e.g., Claude Code, Codex, OpenCode) by writing the required MCP entries into the agents’ config files.
Package‑manager distribution Available via npm, PyPI, Homebrew, Scoop, Winget, AUR, and go install.

Typical workflow

  1. Install – One‑line script (curl … | bash on macOS/Linux or PowerShell script on Windows) downloads a verified binary and a tiny install helper.
  2. Index – After installation the tool auto‑detects your coding agent; you tell the agent “index this project”. The daemon builds the graph and stores it under ~/.cache/codebase-memory-mcp/.
  3. Query – From the agent or via the CLI you run commands like search_graph, detect_changes, or a custom Cypher query. The agent can now answer structural questions instantly.
  4. Visualise – Run codebase-memory-mcp --ui=true --port=9749 to explore the graph in a browser.
  5. Update / uninstall – The same install script handles upgrades; codebase-memory-mcp uninstall cleans up config entries and optional indexes.

Who should use it

  • Developers who rely on LLM‑based coding assistants and want deterministic, low‑latency answers about their own code.
  • Teams that need a shared, version‑controlled representation of a codebase (the .codebase-memory/graph.db.zst artifact can be committed to avoid re‑indexing).
  • Researchers exploring code‑graph‑based prompting or tool‑calling strategies for LLMs.

Limitations & considerations

  • Local only – No cloud service; you must run the binary on each machine that needs the graph.
  • Initial indexing cost – The first full index can be memory‑intensive (in‑memory SQLite, LZ4 compression) but releases memory after completion.
  • False‑positive antivirus alerts – Some scanners (e.g., Microsoft Defender) flag the binary; the project provides hashes and VirusTotal scans to verify integrity.
  • Supported languages – While 158 grammars are bundled, deep semantic type resolution (Hybrid LSP) is limited to the 12 listed languages.
  • Agent compatibility – Integration works out‑of‑the‑box for the 43 listed agents; other tools may need manual MCP entry configuration.

Quick start snippet

# macOS / Linux
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
notepad install.ps1   # optional inspection
Unblock-File .\install.ps1
.\install.ps1

After installation, restart your coding assistant and issue an “index this project” command.


Where to learn more

  • Research paperCodebase‑Memory: Tree‑Sitter‑Based Knowledge Graphs for LLM Code Exploration via MCP (arXiv:2603.27277).
  • Documentation – The repository’s README, SECURITY.md, and the UI screenshot in the repo give deeper details on the graph schema and daemon coordination.
  • Releases – Each release includes three identical binaries (unstripped, debug‑stripped, stripped) that are VirusTotal‑scanned and signed with a SHA‑256 hash.

Bottom linecodebase-memory-mcp provides a self‑contained, high‑performance code‑graph engine that lets AI coding agents work with your codebase locally, dramatically cutting token usage and latency while keeping everything under your control.

Related

  • Project
  • Project
  • Project
  • Project
  • Project