Codebase Memory MCP Pro

Developer toolsMemory and knowledge

Community fork of DeusData/codebase-memory-mcp (MIT), incremental-reindex CALLS-edge fix + 9 integrated upstream PRs. Pure-C code knowledge-graph MCP server.

Your AI app calls Codebase Memory MCP Pro, which does the developer tools and memory and knowledge work and sends the result back to the chat.

About Codebase Memory MCP Pro

Codebase Memory MCP Pro is a community MCP server from win4r, filed in our directory under developer tools and memory and knowledge. Community fork of DeusData/codebase-memory-mcp (MIT), incremental-reindex CALLS-edge fix + 9 integrated upstream PRs. Pure-C code knowledge-graph MCP server.

At a glance

Publisher
win4r (community)
Runs
See the README for setup
Written in
C
License
MIT
GitHub stars
260

How to set up Codebase Memory MCP Pro

  1. Follow the install steps in the Codebase Memory MCP Pro README; it is written in C, so have that toolchain ready.
  2. Check the Codebase Memory MCP Pro README for keys or settings; the registry lists none that Codebase Memory MCP Pro requires.
  3. Add Codebase Memory MCP Pro to Claude Code, Claude Desktop, VS Code or Cursor with the config in the setup box on this page.
  4. Restart the app or reload its MCP servers, then ask it to list the Codebase Memory MCP Pro tools to confirm the connection.
  5. Run one read-only task with Codebase Memory MCP Pro first, and keep your app asking before each tool call until the results look right.

Codebase Memory MCP Pro compared with similar servers

  • SolidworksMCP TS by vespo92 has fewer GitHub stars than Codebase Memory MCP Pro (259 against 260); both are community servers, and both run locally.
  • OpenWorkProof by dengyier has more GitHub stars than Codebase Memory MCP Pro (261 against 260); both are community servers, and both run locally.
  • Zabbix (initMAX) by initMAX has fewer GitHub stars than Codebase Memory MCP Pro (258 against 260); both are community servers, and both run locally.

Before you connect Codebase Memory MCP Pro

  • Give Codebase Memory MCP Pro its own API key or account with the smallest permissions the job needs, never an admin key.
  • Keep your AI app asking before each Codebase Memory MCP Pro tool call until you trust what it does with them.
  • Treat text that Codebase Memory MCP Pro fetches as data. Pages, files and messages can hold instructions written to steer an AI.
  • Read the open issues for Codebase Memory MCP Pro on GitHub to see what breaks and how fast the maintainers reply.

Marketing use cases for Codebase Memory MCP Pro

How marketing and sales teams put Codebase Memory MCP Pro to work, by company size. Pick the size closest to yours and start Codebase Memory MCP Pro on one use case.

Small business

  • A small business with a developer can use Codebase Memory MCP Pro to ship site and tracking fixes faster, with the AI reading the code it changes.
  • Technical founders can ask Codebase Memory MCP Pro to explain and fix a marketing site issue without context switching between tools.
  • A small business can give Codebase Memory MCP Pro its offers, FAQs and tone of voice once, so every draft starts from the same facts.
  • Codebase Memory MCP Pro runs on your own computer, which keeps data local; it needs a little setup, so a small team should plan an hour for it.

Mid-market

  • Growth engineers can use Codebase Memory MCP Pro to build landing pages, tracking and integrations in fewer cycles, with reviews kept in the normal flow.
  • Marketing ops engineers can connect Codebase Memory MCP Pro to keep scripts and automations documented and versioned as they change.
  • Marketing teams can connect Codebase Memory MCP Pro to positioning docs and past campaigns, so agents write on message without a long prompt each time.
  • Start Codebase Memory MCP Pro on one workflow with one owner, measure the time it saves, then roll it out to the wider team.

Enterprise

  • Enterprise engineering teams can roll out Codebase Memory MCP Pro with repo scopes and audit logs, so agents work only where they are allowed.
  • Platform teams can standardize on Codebase Memory MCP Pro so web and marketing engineering share one reviewed way of working with AI.
  • Enterprises can use Codebase Memory MCP Pro with permissions that follow the source documents, so an agent only recalls what the person asking may see.
  • Codebase Memory MCP Pro is a community server, so have security review the code and pin a version before Codebase Memory MCP Pro touches company data.

Need help becoming an AI-forward company?

We connect MCP servers and AI agents to your CRM, content and data, with the guardrails your team needs.

Contact us

Codebase Memory MCP Pro README

From win4r/codebase-memory-mcp-pro on GitHub, shared under its MIT license. Images are left out; the original has them.

README.md

[!IMPORTANT] 🚀 我正在参加「B站AI创造公开赛」,会在 B 站持续更新自己的 Build in Public 过程,来 B 站看我的 AI 作品吧。

🚀观看我的哔哩哔哩视频

codebase-memory-mcp-pro

🔱 Fork notice, codebase-memory-mcp-pro is a community fork of DeusData/codebase-memory-mcp (MIT License, © 2025 DeusData), maintained by @win4r. It tracks upstream and integrates the following fixes ahead of their upstream merge:

  • Incremental-reindex correctness (#528), preserve inbound cross-file CALLS edges on incremental re-index; editing a file no longer orphans calls into its symbols.
  • Cypher / query_graph, populate node properties carried through WITH aggregation (#465); fix label-filtered traversal silently truncating at 10 rows (#412).
  • MCP tools, detect_changes honors since (#464); definition-preferred name resolution with ambiguity reporting (#466); valid UTF-8 in get_code_snippet (#526).
  • Robustness / build, stack-buffer-overflow fix in append_args_json (#475); JSON control-character escaping (#527); preserve ADRs across a full re-index (#539); libgit2 ≥ 1.8 build fix (#512).
  • Agent-native enhancements (this fork), a new explore MCP tool: one call returns the blast-radius (attributed callers + inline fan-in hotspot flags), nearby neighbors (1-hop callees + same-file siblings, so it covers the surrounding area), and the verbatim line-numbered source of the matched symbols grouped by file, with a query_graph/Cypher escape-hatch, built for AI agents to read like a Read. Plus idiomatic Swift type kinds, struct/enum/actor are distinct graph labels (Struct/Enum/Actor) instead of all being lumped as Class, and Swift enum cases are extracted as distinct EnumCase nodes (including multi-name case a, b, c lines), and a Swift enum-static dedup fix (an enum's static funcs are no longer double-emitted as both a Method and a Function node).
  • Cypher aggregation fix (this fork), a non-aggregate function mixed with an aggregate (e.g. RETURN type(r), count(*)) now groups by the function value (one row per edge type) instead of collapsing every row into a single group.
  • detect_changes blast radius (this fork), the depth parameter now produces a transitive caller blast radius: impacted_symbols includes callers up to depth hops, each tagged with hop + transitive, alongside a deduped impacted_count.

All credit for the original engine belongs to DeusData. License unchanged, see LICENSE.

🛠️ Build this fork from source

This fork ships no prebuilt release binaries, build the integrated binary yourself. Pure C, Apple clang / gcc, zero external runtime dependencies:

git clone https://github.com/win4r/codebase-memory-mcp-pro.git
cd codebase-memory-mcp-pro
./scripts/build.sh          # → build/c/codebase-memory-mcp   (reports version: dev)

The first build compiles all 158 vendored tree-sitter grammars (a few minutes); for iterative rebuilds make -j -f Makefile.cbm cbm is much faster. The macOS libgit2 ≥ 1.8 build fix (#512) is already integrated, so a Homebrew libgit2 compiles cleanly.

Install on your PATH and wire it into Claude Code as an MCP server:

cp build/c/codebase-memory-mcp ~/.local/bin/

# stdio MCP server, available in all projects:
claude mcp add codebase-memory -s user -- ~/.local/bin/codebase-memory-mcp
# tools: explore, index_repository, query_graph, trace_path, get_code_snippet, detect_changes … (15 total)

Confirm the integrated fixes are live (e.g. #465, node properties survive a WITH aggregation, which returns blank on stock upstream):

codebase-memory-mcp cli index_repository '{"repo_path":"/path/to/repo"}'
codebase-memory-mcp cli query_graph '{"project":"<name>","query":"MATCH (a)-[:CALLS]->(b) WITH b, count(a) AS c RETURN b.file_path, c LIMIT 1"}'
# a non-empty file_path means you are running the cherry-picked build

⚠️ Do not run the binary's update subcommand, it pulls the official upstream release and overwrites this integrated build. Re-run ./scripts/build.sh to update instead.

The upstream README follows.

The fastest and most efficient code intelligence engine for AI coding agents. Full-indexes an average repository in milliseconds, the Linux kernel (28M LOC, 75K files) in 3 minutes. Answers structural queries in under 1ms. Ships as a single static binary for macOS, Linux, and Windows, download, run install, done.

High-quality parsing through tree-sitter AST analysis across all 158 languages, enhanced with Hybrid LSP semantic type resolution for Python, TypeScript / JavaScript / JSX / TSX, PHP, C#, Go, C, C++, Java, Kotlin, and Rust, producing a persistent knowledge graph of functions, classes, call chains, HTTP routes, and cross-service links. 14 MCP tools. Zero dependencies. Plug and play across 11 coding agents.

Research, The design and benchmarks behind this project are described in the preprint Codebase-Memory: Tree-Sitter-Based Knowledge Graphs for LLM Code Exploration via MCP (arXiv:2603.27277). Evaluated across 31 real-world repositories: 83% answer quality, 10× fewer tokens, 2.1× fewer tool calls vs. file-by-file exploration.

Security & Trust, This tool reads your codebase and writes to your agent configuration files. That is what it is designed to do. If you prefer to audit before running, the full source is here, every release binary is signed, checksummed, and scanned by 70+ antivirus engines. All processing happens 100% locally; your code never leaves your machine. Found a security issue? We want to know, see SECURITY.md. Security is Priority #1 for us.


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

Why codebase-memory-mcp

  • 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.
  • 11 agents, one command, install auto-detects Claude Code, Codex CLI, Gemini CLI, Zed, OpenCode, Antigravity, Aider, KiloCode, VS Code, OpenClaw, and Kiro, configures MCP entries, instruction files, and pre-tool hooks for each.
  • 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.
  • 14 MCP tools, search, trace, architecture, impact analysis, Cypher queries, dead code detection, cross-service HTTP linking, ADR management, and more.

Quick Start

One-line install (macOS / Linux):

curl -fsSL https://raw.githubusercontent.com/DeusData/codebase-memory-mcp/main/install.sh | bash

With graph visualization UI:

curl -fsSL https://raw.githubusercontent.com/DeusData/codebase-memory-mcp/main/install.sh | bash -s -- --ui

Windows (PowerShell):

# 1. Download the installer
Invoke-WebRequest -Uri https://raw.githubusercontent.com/DeusData/codebase-memory-mcp/main/install.ps1 -OutFile install.ps1

# 2. (Optional but recommended) Inspect the script
notepad install.ps1

# 3. Run it
.\install.ps1

Options: --ui (graph visualization), --skip-config (binary only, no agent setup), --dir=<path> (custom location).

Restart your coding agent. Say "Index this project", done.

Manual install
  1. Download the archive for your platform from the latest release:

    • codebase-memory-mcp-<os>-<arch>.tar.gz (macOS/Linux) or .zip (Windows), standard
    • codebase-memory-mcp-ui-<os>-<arch>.tar.gz / .zip, with graph visualization
  2. Extract and install (each archive includes install.sh or install.ps1):

    macOS / Linux:

    tar xzf codebase-memory-mcp-*.tar.gz
    ./install.sh
    

    Windows (PowerShell):

    Expand-Archive codebase-memory-mcp-windows-amd64.zip -DestinationPath .
    .\install.ps1
    
  3. Restart your coding agent.

The install command automatically strips macOS quarantine attributes and ad-hoc signs the binary, no manual xattr/codesign needed.

The install command auto-detects all installed coding agents and configures MCP server entries, instruction files, skills, and pre-tool hooks for each.

Graph Visualization UI

If you downloaded the ui variant:

codebase-memory-mcp --ui=true --port=9749

Open http://localhost:9749 in your browser. The UI runs as a background thread alongside the MCP server, it's available whenever your agent is connected.

Auto-Index

Enable automatic indexing on MCP session start:

codebase-memory-mcp config set auto_index true

When enabled, new projects are indexed automatically on first connection. Previously-indexed projects are registered with the background watcher for ongoing git-based change detection. Configurable file limit: config set auto_index_limit 50000.

Keeping Up to Date
codebase-memory-mcp update

The MCP server also checks for updates on startup and notifies on the first tool call if a newer release is available.

Uninstall
codebase-memory-mcp uninstall

Removes all agent configs, skills, hooks, and instructions. Does not remove the binary or SQLite databases.

Features

Graph & analysis
  • Architecture overview: get_architecture returns languages, packages, entry points, routes, hotspots, boundaries, layers, and clusters in a single call
  • Architecture Decision Records: manage_adr persists architectural decisions across sessions
  • Louvain community detection: Discovers functional modules by clustering call edges
  • Git diff impact mapping: detect_changes maps uncommitted changes to affected symbols with risk classification
  • Call graph: Resolves function calls across files and packages (import-aware, type-inferred)
  • Dead code detection: Finds functions with zero callers, excluding entry points
  • Cypher-like queries: MATCH (f:Function)-[:CALLS]->(g) WHERE f.name = 'main' RETURN g.name
Search
  • Semantic search (semantic_query): vector search across the entire graph, powered by bundled Nomic nomic-embed-code embeddings (40K tokens, 768d int8) compiled into the binary, no API key, no Ollama, no Docker. 11-signal combined scoring (TF-IDF, RRI, API/Type/Decorator signatures, AST profiles, data flow, Halstead-lite, MinHash, module proximity, graph diffusion).
  • BM25 full-text search via SQLite FTS5 with cbm_camel_split tokenizer (camelCase / snake_case aware)
  • Structural search (search_graph): regex name patterns, label filters, min/max degree, file scoping
  • Code search (search_code): graph-augmented grep over indexed files only
Cross-service linking
  • HTTP route ↔ call-site matching with confidence scoring
  • gRPC, GraphQL, tRPC service detection with protobuf Route extraction
  • Channel detection (EMITS / LISTENS_ON) for Socket.IO, EventEmitter, and generic pub-sub patterns across 8 languages with constant resolution
Cross-repo intelligence
  • CROSS_* edges link nodes across multiple repos indexed under the same store
  • Multi-galaxy 3D UI layout for cross-repo architecture visualization
  • Cross-repo architecture summary combining services, routes, and dependencies across the indexed fleet
Edge types (selected)
  • CALLS, IMPORTS, DEFINES, IMPLEMENTS, INHERITS
  • HTTP_CALLS, ASYNC_CALLS (cross-service)
  • EMITS, LISTENS_ON (channels)
  • DATA_FLOWS with arg-to-param mapping + field access chains
  • SIMILAR_TO (MinHash + LSH near-clone detection, Jaccard scored)
  • SEMANTICALLY_RELATED (vocabulary-mismatch, same-language, score ≥ 0.80)
Indexing pipeline
  • 158 vendored tree-sitter grammars compiled into the binary
  • Generic package / module resolution, bare specifiers like @myorg/pkg, github.com/foo/bar, use my_crate::foo resolved via manifest scanning (package.json, go.mod, Cargo.toml, pyproject.toml, composer.json, pubspec.yaml, pom.xml, build.gradle, mix.exs, *.gemspec)
  • Infrastructure-as-code indexing, Dockerfiles, Kubernetes manifests, Kustomize overlays as graph nodes
  • Hybrid LSP semantic type resolution for Python, TypeScript / JavaScript / JSX / TSX, PHP, C#, Go, C, C++, Java, Kotlin, and Rust, a lightweight C implementation of language type-resolution algorithms, structurally inspired by and compatible with major language servers including tsserver / typescript-go, pyright, gopls, Roslyn, Eclipse JDT, and rust-analyzer (parameter binding, return-type inference, generic substitution, JSX component dispatch, JSDoc inference for plain JS files, namespace + trait + late-static-binding resolution for PHP, file-scoped namespaces + records + LINQ method syntax for C#, class-hierarchy + overload + lambda resolution for Java, extension-function + scope-function resolution for Kotlin, trait-method + UFCS resolution for Rust)
  • RAM-first pipeline: LZ4 compression, in-memory SQLite, single dump at end. Memory released after.
Distribution & operation
  • Single static binary, zero infrastructure: SQLite-backed, persists to ~/.cache/codebase-memory-mcp/
  • Auto-sync: Background watcher detects file changes and re-indexes automatically
  • Route nodes: REST endpoints are first-class graph entities
  • CLI mode: codebase-memory-mcp cli search_graph '{"name_pattern": ".*Handler.*"}'
  • Available on: npm, PyPI, Homebrew, Scoop, Winget, Chocolatey, AUR, go install

Team-Shared Graph Artifact

Commit a single compressed file to your repo and your teammates skip the reindex.

.codebase-memory/graph.db.zst is a zstd-compressed snapshot of the knowledge graph that lives next to your source. When you index, the artifact is written or refreshed; when a teammate clones the repo and runs codebase-memory-mcp for the first time, the artifact is decompressed and incremental indexing fills in their local diff.

  • Format: SQLite database, indexes stripped, VACUUM INTO compacted, then zstd 1.5.7 compressed (8–13:1 ratio typical)
  • Two tiers:
    • Best (zstd -9 + index strip + VACUUM INTO), written on explicit index_repository
    • Fast (zstd -3), written by the watcher for low-latency incremental updates
  • Bootstrap: when no local DB exists but the artifact is present, index_repository imports the artifact first, then runs incremental indexing, avoiding the full reindex cost
  • No merge pain: a .gitattributes line with merge=ours is auto-created on first export, so concurrent edits don't produce conflicts on the binary artifact
  • Optional: never committed unless you want it. Add .codebase-memory/ to .gitignore if you prefer everyone to reindex from scratch.

The result is similar in spirit to graphify's graphify-out/ directory, but as a single compressed file with explicit two-tier export, integrity-checked import, and zero merge friction.

How It Works

codebase-memory-mcp is a structural analysis backend, it builds and queries the knowledge graph. It does not include an LLM. Instead, it relies on your MCP client (Claude Code, or any MCP-compatible agent) to be the intelligence layer.

You: "what calls ProcessOrder?"

Agent calls: trace_path(function_name="ProcessOrder", direction="inbound")

codebase-memory-mcp: executes graph query, returns structured results

Agent: presents the call chain in plain English

Why no built-in LLM? Other code graph tools embed an LLM for natural language → graph query translation. This means extra API keys, extra cost, and another model to configure. With MCP, the agent you're already talking to is the query translator.

Performance

Benchmarked on 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

RAM-first pipeline: All indexing runs in memory (LZ4 HC compressed read, in-memory SQLite, single dump at end). Memory is released back to the OS after indexing completes.

Token efficiency: Five structural queries consumed ~3,400 tokens via codebase-memory-mcp versus ~412,000 tokens via file-by-file grep exploration, a 99.2% reduction.

Installation

Pre-built Binaries
Platform Standard With Graph UI
macOS (Apple Silicon) codebase-memory-mcp-darwin-arm64.tar.gz codebase-memory-mcp-ui-darwin-arm64.tar.gz
macOS (Intel) codebase-memory-mcp-darwin-amd64.tar.gz codebase-memory-mcp-ui-darwin-amd64.tar.gz
Linux (x86_64) codebase-memory-mcp-linux-amd64.tar.gz codebase-memory-mcp-ui-linux-amd64.tar.gz
Linux (ARM64) codebase-memory-mcp-linux-arm64.tar.gz codebase-memory-mcp-ui-linux-arm64.tar.gz
Windows (x86_64) codebase-memory-mcp-windows-amd64.zip codebase-memory-mcp-ui-windows-amd64.zip

Every release includes checksums.txt with SHA-256 hashes. All binaries are statically linked, no shared library dependencies.

Windows note: SmartScreen may show a warning for unsigned software. Click "More info" → "Run anyway". Verify integrity with checksums.txt.

Setup Scripts
Automated download + install

macOS / Linux:

curl -fsSL https://raw.githubusercontent.com/DeusData/codebase-memory-mcp/main/scripts/setup.sh | bash

Windows (PowerShell):

irm https://raw.githubusercontent.com/DeusData/codebase-memory-mcp/main/scripts/setup-windows.ps1 | iex
AUR (Arch Linux)
yay -S codebase-memory-mcp-bin
paru -S codebase-memory-mcp-bin

The codebase-memory-mcp-bin package is available at: https://aur.archlinux.org/packages/codebase-memory-mcp-bin

Install via Claude Code
You: "Install this MCP server: https://github.com/DeusData/codebase-memory-mcp"
Build from Source
Prerequisites: C compiler + zlib
Requirement Check Install
C compiler (gcc or clang) gcc --version or clang --version macOS: xcode-select --install, Linux: apt install build-essential
C++ compiler g++ --version or clang++ --version Same as above
zlib , macOS: included, Linux: apt install zlib1g-dev
Git git --version Pre-installed on most systems
git clone https://github.com/DeusData/codebase-memory-mcp.git
cd codebase-memory-mcp
scripts/build.sh                    # standard binary
scripts/build.sh --with-ui          # with graph visualization
# Binary at: build/c/codebase-memory-mcp
Manual MCP Configuration
If you prefer not to use the install command

Add to ~/.claude/.mcp.json (global) or project .mcp.json:

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

Restart your agent. Verify with /mcp, you should see codebase-memory-mcp with 14 tools.

Multi-Agent Support

install auto-detects and configures all installed agents:

Agent MCP Config Instructions Hooks
Claude Code .claude/.mcp.json 4 Skills PreToolUse (Grep/Glob graph augment, non-blocking)
Codex CLI .codex/config.toml .codex/AGENTS.md SessionStart reminder
Gemini CLI .gemini/settings.json .gemini/GEMINI.md BeforeTool (grep reminder) + SessionStart reminder
Zed settings.json (JSONC) , ,
OpenCode opencode.json AGENTS.md ,
Antigravity .gemini/config/mcp_config.json (shared) antigravity-cli/AGENTS.md SessionStart reminder
Aider , CONVENTIONS.md ,
KiloCode mcp_settings.json ~/.kilocode/rules/ ,
VS Code Code/User/mcp.json , ,
OpenClaw openclaw.json , ,
Kiro .kiro/settings/mcp.json , ,

Hooks are structurally non-blocking (exit code 0, every failure path). For Claude Code, the PreToolUse hook intercepts Grep/Glob (never Read, gating Read breaks the read-before-edit invariant) and, when the search token matches indexed symbols, injects them as additionalContext via search_graph so the agent gets structured context alongside its normal search results. For Codex, Gemini CLI, and Antigravity, a SessionStart hook injects a one-line code-discovery reminder as session context (Gemini CLI also keeps its BeforeTool reminder). The installed Claude shim file is named cbm-code-discovery-gate for backward compatibility with existing installs; despite the legacy name it never gates and never blocks.

CLI Mode

Every MCP tool can be invoked from the command line:

codebase-memory-mcp cli index_repository '{"repo_path": "/path/to/repo"}'
codebase-memory-mcp cli search_graph '{"name_pattern": ".*Handler.*", "label": "Function"}'
codebase-memory-mcp cli trace_path '{"function_name": "Search", "direction": "both"}'
codebase-memory-mcp cli query_graph '{"query": "MATCH (f:Function) RETURN f.name LIMIT 5"}'
codebase-memory-mcp cli list_projects
codebase-memory-mcp cli --raw search_graph '{"label": "Function"}' | jq '.results[].name'

MCP Tools

Indexing
Tool Description
index_repository Index a repository into the graph. Auto-sync keeps it fresh after that.
list_projects List all indexed projects with node/edge counts.
delete_project Remove a project and all its graph data.
index_status Check indexing status of a project.
Querying
Tool Description
search_graph Structured search by label, name pattern, file pattern, degree filters. Pagination via limit/offset.
trace_path BFS traversal, who calls a function and what it calls (alias: trace_call_path). Depth 1-5.
detect_changes Map git diff to affected symbols + blast radius with risk classification.
query_graph Execute Cypher-like graph queries (read-only).
get_graph_schema Node/edge counts, relationship patterns, property definitions per label. Run this first.
get_code_snippet Read source code for a function by qualified name.
get_architecture Codebase overview: languages, packages, routes, hotspots, clusters, ADR.
search_code Grep-like text search within indexed project files.
manage_adr CRUD for Architecture Decision Records.
ingest_traces Ingest runtime traces to validate HTTP_CALLS edges.

Graph Data Model

Node Labels

Project, Package, Folder, File, Module, Class, Function, Method, Interface, Enum, Type, Route, Resource

Edge Types

CONTAINS_PACKAGE, CONTAINS_FOLDER, CONTAINS_FILE, DEFINES, DEFINES_METHOD, IMPORTS, CALLS, HTTP_CALLS, ASYNC_CALLS, IMPLEMENTS, HANDLES, USAGE, CONFIGURES, WRITES, MEMBER_OF, TESTS, USES_TYPE, FILE_CHANGES_WITH

Qualified Names

get_code_snippet uses qualified names: <project>.<path_parts>.<name>. Use search_graph to discover them first.

Supported Cypher (openCypher read subset)

query_graph is a read-only openCypher subset:

  • Clauses: MATCH, OPTIONAL MATCH, multiple MATCH, WHERE, WITH (+ WITH … WHERE), RETURN, ORDER BY, SKIP, LIMIT, DISTINCT, UNWIND, UNION / UNION ALL, CASE.
  • Patterns: labelled nodes, label alternation (n:A|B), relationship types/direction, variable-length paths [*1..3], inline property maps.
  • WHERE: = <> < <= > >=, AND/OR/XOR/NOT, IN, CONTAINS, STARTS WITH, ENDS WITH, IS [NOT] NULL, regex =~, label test n:Label, and EXISTS { (n)-[:TYPE]->() } (single-hop existence, great for dead-code, e.g. WHERE NOT EXISTS { (f)<-[:CALLS]-() }).
  • Aggregates: count (+DISTINCT), sum, avg, min, max, collect.
  • Functions: labels, type, id, keys, properties; toLower/toUpper/toString/toInteger/toFloat/toBoolean; size, length, trim/ltrim/rtrim, reverse; coalesce, substring, replace, left, right.

Anything outside this subset (write/MERGE/CALL clauses, unsupported functions, list/map literals, comprehensions, path functions, parameters) fails with a clear unsupported … error rather than returning empty results.

Ignoring Files

Layered: hardcoded patterns (.git, node_modules, etc.) → .gitignore hierarchy → .cbmignore (project-specific, gitignore syntax). Symlinks are always skipped.

Configuration

codebase-memory-mcp config list                          # show all settings
codebase-memory-mcp config set auto_index true           # auto-index on session start
codebase-memory-mcp config set auto_index_limit 50000    # max files for auto-index
codebase-memory-mcp config reset auto_index              # reset to default
Environment Variables
Variable Default Description
CBM_CACHE_DIR ~/.cache/codebase-memory-mcp Override the database storage directory. All project indexes and config are stored here.
CBM_DIAGNOSTICS false Set to 1 or true to enable periodic diagnostics output to /tmp/cbm-diagnostics-<pid>.json.
CBM_DOWNLOAD_URL (GitHub releases) Override the download URL for updates. Used for testing or self-hosted deployments.
CBM_LOG_LEVEL info Set the minimum log level. Accepted values (case-insensitive): debug, info, warn, error, none, or their numeric equivalents 0–4 matching the internal enum. Logs go to stderr; stdout is reserved for MCP JSON-RPC.
CBM_WORKERS (detected) Override the parallel-indexing worker count returned by cbm_default_worker_count. Useful inside containers where sysconf(_SC_NPROCESSORS_ONLN) reports host CPUs rather than the cgroup's effective quota. Range 1–256; invalid values are ignored with a warning.
# Store indexes in a custom directory
export CBM_CACHE_DIR=~/my-projects/cbm-data

Custom File Extensions

Map additional file extensions to supported languages via JSON config files. Useful for framework-specific extensions like .blade.php (Laravel) or .mjs (ES modules).

Per-project (in your repo root):

// .codebase-memory.json
{"extra_extensions": {".blade.php": "php", ".mjs": "javascript"}}

Global (applies to all projects):

// ~/.config/codebase-memory-mcp/config.json  (or $XDG_CONFIG_HOME/...)
{"extra_extensions": {".twig": "html", ".phtml": "php"}}

Project config overrides global for conflicting extensions. Unknown language values are silently skipped. Missing config files are ignored.

Persistence

SQLite databases stored at ~/.cache/codebase-memory-mcp/. Persists across restarts (WAL mode, ACID-safe). To reset: rm -rf ~/.cache/codebase-memory-mcp/.

Troubleshooting

Problem Fix
/mcp doesn't show the server Check .mcp.json path is absolute. Restart agent. Test: echo '{}' | /path/to/binary should output JSON.
index_repository fails Pass absolute path: index_repository(repo_path="/absolute/path")
trace_path returns 0 results Use search_graph(name_pattern=".*PartialName.*") first to find the exact name.
Queries return wrong project results Add project="name" parameter. Use list_projects to see names.
Binary not found after install Add to PATH: export PATH="$HOME/.local/bin:$PATH"
UI not loading Ensure you downloaded the ui variant and ran --ui=true. Check http://localhost:9749.

Read the rest of the Codebase Memory MCP Pro README on GitHub

Questions about Codebase Memory MCP Pro

What is the Codebase Memory MCP Pro MCP server?

Community fork of DeusData/codebase-memory-mcp (MIT), incremental-reindex CALLS-edge fix + 9 integrated upstream PRs. Pure-C code knowledge-graph MCP server. Codebase Memory MCP Pro is maintained by win4r on GitHub at win4r/codebase-memory-mcp-pro, and works with AI apps that support the Model Context Protocol, such as Claude, Cursor and VS Code.

How do I install the Codebase Memory MCP Pro MCP server?

Codebase Memory MCP Pro doesn't publish a one-line install in the MCP registry, so follow the setup steps in its README on GitHub (win4r/codebase-memory-mcp-pro). Like most servers, Codebase Memory MCP Pro ends with a command or URL you paste into your AI app's MCP config.

Does Codebase Memory MCP Pro need an API key?

The registry lists no required keys for Codebase Memory MCP Pro. Check the Codebase Memory MCP Pro README for optional settings, and expect a remote server to ask you to sign in the first time you connect.

Is Codebase Memory MCP Pro an official MCP server?

No. Codebase Memory MCP Pro is a community server maintained by win4r. Community servers can be excellent; read the code and the open issues before you give Codebase Memory MCP Pro access to company data.

What license is Codebase Memory MCP Pro under?

Codebase Memory MCP Pro is released under the MIT license, according to its GitHub repository. The license covers the code of Codebase Memory MCP Pro; the service it connects to has its own terms.