Codebase Memory MCP Server

Persistent codebase knowledge graph. Survives session restarts and context compaction.

Local serverstdioPython

What is the Codebase Memory MCP Server?

Persistent codebase knowledge graph. Survives session restarts and context compaction.

What the server does

Built-in 3D graph visualization (UI variant) — explore your knowledge graph at localhost:9749

  • Extreme indexing speed — — Linux kernel (28M LOC, 75K files) in 3 minutes. RAM-first pipeline: LZ4 compression, in-memory SQLite, fused Aho-Corasick pattern matching. Memory released after indexing
  • Plug and play — — single static binary for macOS (arm64/amd64), Linux (arm64/amd64), and Windows (amd64). No Docker, no runtime dependencies, no API keys. Download → install → restart agent → done
  • 158 languages — — vendored tree-sitter grammars compiled into the binary. Nothing to install, nothing that breaks
  • 120x fewer tokens — — 5 structural queries: ~3,400 tokens vs ~412,000 via file-by-file search. One graph query replaces dozens of grep/read cycles
  • Built-in graph visualization — — 3D interactive UI at localhost:9749 (optional UI binary variant)
  • Infrastructure-as-code indexing — — Dockerfiles, Kubernetes manifests, and Kustomize overlays indexed as graph nodes with cross-references. Resource nodes for K8s kinds, Module nodes for Kustomize overlays with IMPORTS edges to referenced resources

Installation

Installation goes through your MCP client rather than a global install: point it at codebase-memory-mcp on npm and it is fetched when the client starts. The copy-paste blocks for Claude Desktop, Claude Code and Cursor are further down this page.

Available tools

The toolset is worth reading before you wire it up, because it tells you what the integration is really for:

  • Built — in graph visualization** — 3D interactive UI at localhost:9749 (optional UI binary variant)
  • Infrastructure-as — code indexing** — Dockerfiles, Kubernetes manifests, and Kustomize overlays indexed as graph nodes with cross-references. Resource nodes for K8s
  • codebase-memory-mcp — -.tar.gz (macOS/Linux) or .zip (Windows) — standard
  • codebase-memory-mcp-ui — -.tar.gz / .zip — with graph visualization
  • install.sh — ** add --ui (see Quick Start)
  • PyPI — ** CBM_VARIANT=ui pip install codebase-memory-mcp
  • Manual — ** download the codebase-memory-mcp-ui-- archive
  • Cypher — like queries**: MATCH (f:Function)-[:CALLS]->(g) WHERE f.name = 'main' RETURN g.name
  • Multi — galaxy 3D UI layout** for cross-repo architecture visualization
  • Cross — repo architecture summary** combining services, routes, and dependencies across the indexed fleet
  • RAM — first pipeline**: LZ4 compression, in-memory SQLite, single dump at end. Memory released after
  • Auto-sync — Background watcher detects file changes and re-indexes automatically

Worth knowing first

  • It runs with your machine's permissions. That is convenient and also the reason to think about what you point it at before you approve a tool call.
  • Keep per-call confirmation enabled while you learn its behaviour; it is the cheapest safeguard you have.

Where it fits

Recorded tools

  • codebase-memory-mcp — -.tar.gz (macOS/Linux) or .zip (Windows) — standard
  • codebase-memory-mcp-ui — -.tar.gz / .zip — with graph visualization
  • install.sh — ** add --ui (see Quick Start)

More MCP options

Compare MCP servers by category, or browse hosted MCP servers if you prefer an endpoint over a local process.

Recorded tools

Check the linked publisher documentation and your connected client's tool list. Names and availability can vary with the server version and account permissions.

ToolWhat it does
index_repositoryIndex a repository into the graph. Auto-sync keeps it fresh after that. Waits for the whole index by default; pass async: true to start it in the daemon and ret
list_projectsList all indexed projects with node/edge counts.
delete_projectRemove a project and all its graph data.
index_statusCheck indexing status of a project.
check_index_coverageCheck whether exact paths or a scope are indexed and fresh. A clean result means no recorded gap, not proof of completeness.
search_graphStructural, BM25, and semantic search. Page structural rows with offset/limit and ranked semantic rows independently with semantic_offset/semantic_limit.
trace_pathBFS traversal — who calls a function and what it calls (alias: trace_call_path). Depth 1-5.
detect_changesMap git diff to affected symbols + blast radius with risk classification.
query_graphExecute Cypher-like graph queries (read-only).
get_graph_schemaNode/edge counts, relationship patterns, property definitions per label. Run this first.
compare_graphsCompare two indexed snapshots: node/edge additions and removals between a base and a target.
get_code_snippetRead source code for a function by qualified name.
get_file_outlineDeclaration outline of one repository-relative file in source order, with optional label filter and paging.
get_architectureCodebase overview: languages, packages, routes, hotspots, clusters, ADR.
search_codeGrep-like text search within indexed project files.
manage_adrCRUD for Architecture Decision Records (get reads, update replaces the whole document, set_sections rewrites only the named sections and leaves every other byte
ingest_tracesIngest runtime traces to validate HTTP_CALLS edges.

How to install the Codebase Memory MCP Server

{
  "mcpServers": {
    "codebase-memory-mcp": {
      "command": "/path/to/codebase-memory-mcp",
      "args": []
    }
  }
}

From the project documentation. Replace placeholders and example paths before connecting.

Example prompts to try

  • “Use Codebase Memory to Built.”
  • “Use Codebase Memory to Infrastructure-as.”
  • “Use Codebase Memory to codebase-memory-mcp.”

Frequently asked questions

Persistent codebase knowledge graph. Survives session restarts and context compaction. Confirm the tools offered by your installed version in the connected client. Tool availability and permissions depend on the server and account configuration.