Skip to content

Codebase Memory MCP (CBM) — local code-graph index across all 104 Care repos

Set up: 2026-12-01 on macOS (Darwin 25.2.0, 24 GB RAM), codebase-memory-mcp 0.12.1. Source: https://github.com/DeusData/codebase-memory-mcp Question answered: how to install CBM, index every repo under ~/Office/Work/repo/Care/, and open the Lens UI — plus the four things the upstream README gets wrong.

Headline: all 104 git repos under /Care are indexed into one shared local store (~/.cache/codebase-memory-mcp, 7.7 GB), queryable from any repo's session. Indexing the whole ecosystem takes ~3 minutes, not hours. Everything runs locally — no cloud, no API keys.


What it is

A local MCP server that builds a symbol/dependency graph per repo and exposes it as tools:

index_repository, search_graph, query_graph, trace_path, get_code_snippet,
get_file_outline, get_graph_schema, compare_graphs, get_architecture,
search_code, list_projects, delete_project, index_status,
check_index_coverage, detect_changes, manage_adr, ingest_traces

It ships a browser UI ("CBM Lens") for architecture / explore / galaxy views over the graph.


Install

Do not pipe the installer straight into bash. Download and read it first:

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

The installer is well-behaved — HTTPS-only with redirect pinning, mandatory SHA-256 verification against checksums.txt, and a strict four-member archive allowlist before extraction. It installs to ~/.local/bin/codebase-memory-mcp and appends that directory to ~/.zshrc.

⚠️ Always pass --skip-config. Without it the installer rewrites MCP config for 45 client surfaces it finds on the machine — Cursor, VS Code, Zed, Codex, Windsurf, Copilot CLI and 39 others. Register the one client you actually want instead:

claude mcp add -s user codebase-memory-mcp "$HOME/.local/bin/codebase-memory-mcp"
claude mcp list | grep codebase-memory      # → ✔ Connected

Restart Claude Code afterwards; the mcp__codebase-memory-mcp__* tools only appear in sessions started after registration.


Indexing every Care repo

Modes: full (all files + semantic) · moderate (filtered + semantic) · fast (filtered, no semantics) · cross-repo-intelligence (link services).

The working split for this ecosystem — full on the six core repos, moderate on the rest:

CARE=~/Office/Work/repo/Care
CORE="care care_fe care_abdm care_scribe care_radiology care_deployment"

for d in $CORE; do
  codebase-memory-mcp cli --quiet index_repository --repo-path "$CARE/$d" --mode full
done

cd "$CARE"
for p in */; do
  d="${p%/}"
  [ -d "$CARE/$d/.git" ] || continue
  case " $CORE " in *" $d "*) continue ;; esac
  codebase-memory-mcp cli --quiet index_repository --repo-path "$CARE/$d" --mode moderate
done

Result: 104 / 104 repos indexed, ~3 minutes wall clock, 7.7 GB store. care_abdm alone is 1,565 nodes / 6,867 edges in 1.2 s.

Verify:

codebase-memory-mcp cli --quiet list_projects | grep -E '^(total|returned|has_more):'
# total: 104

Gotchas

1. timeout does not exist on macOS

A guard of timeout 3600 codebase-memory-mcp ... fails with exit 127 per repo, and the loop happily reports "done" having indexed nothing. There is no timeout in the macOS base system. Use gtimeout (coreutils) or omit it — CBM applies its own backpressure.

2. Large vendored subtrees blow the memory budget

DRF-Endpoint-Mapper (973 MB of care-api-data/ + care-api-docs/) fails with:

{"status":"error","reason":"over_memory_budget","budget_mb":3306,"peak_rss_mb":5418}

The hint is worth reading: peak_rss_mb is where indexing was stopped, not what the repo needs — retrying just above the peak fails again. What worked:

CBM_MEM_BUDGET_MB=7439 CBM_WORKERS=2 codebase-memory-mcp cli --quiet \
  index_repository --repo-path "$CARE/DRF-Endpoint-Mapper" --mode moderate
# → indexed, 21,940 nodes

Lowering CBM_WORKERS or excluding the vendored subtree are the other levers.

3. daemon is a real subcommand, hidden from --help

codebase-memory-mcp --help does not list it, and the upstream README's daemon start --open --port=9749 is stale — the port is persisted separately, not a flag on daemon start. These all work:

codebase-memory-mcp daemon status
codebase-memory-mcp daemon start --open    # permanent daemon + opens Lens
codebase-memory-mcp daemon stop
codebase-memory-mcp --port=9749            # persist a different UI port

4. Cross-repo intelligence is thin here, and the anchor repo matters

--mode cross-repo-intelligence --target-projects '["*"]' links the anchor repo's outbound service calls to the other projects. Anchoring on a docs repo finds nothing:

Anchor Projects scanned Cross edges
care-learnings 103 0 (docs repo — no service calls)
care 103 4 (HTTP)
care_fe 103 0

It detects service-to-service calls (HTTP / gRPC / GraphQL / tRPC / async / channel). Care's plugin architecture is in-process Django/React rather than service-to-service, so this mode adds little. The real linkage is the shared store — all 104 projects live in one index, so a session in any repo can query every other repo without explicit linking.


Opening the Lens UI

codebase-memory-mcp daemon start --open    # or just visit the URL below

→ http://127.0.0.1:9749 (title: CBM Lens Beta)

In Lens: project menu → pick a project → Architecture, Explore, or Galaxy workspace.

⚠️ Lens is local-only and cannot be deployed to GitHub Pages or any static host. The page is a 5 MB Vite SPA that calls a live backend on the daemon (/api/tree, /api/flow, /api/trace, /api/index, /api/adr, …) backed by the 7.7 GB local index. There is no static-export capability. Beyond the technical blocker, the graph encodes the structure of 104 private Care repos and must not be published.

The daemon started with daemon start is permanent — it survives session ends. Retire it with codebase-memory-mcp daemon stop.


Keeping indexes fresh

codebase-memory-mcp config list                      # current settings
codebase-memory-mcp config set auto_index true       # off by default
codebase-memory-mcp config set auto_watch true       # on by default
codebase-memory-mcp config set watch_non_git true    # off by default
codebase-memory-mcp cli detect_changes --repo-path "$CARE/care"

Six directories under /Care are not git repos and are skipped unless watch_non_git is on: Claude, Design, care_abdm_mock, care_abdm_proxy, care_learnings, stagging-care.

Storage, update, uninstall

Index store ~/.cache/codebase-memory-mcp (7.7 GB for 104 repos)
Per-repo logs ~/.cache/codebase-memory-mcp/logs/<project>-<ts>.log
Binary ~/.local/bin/codebase-memory-mcp
Update codebase-memory-mcp update
Uninstall codebase-memory-mcp uninstall (keeps indexes; --delete-indexes to purge)

--persistence true on index_repository additionally writes .codebase-memory/graph.db.zst inside the repo — leave it off for Care repos unless the file is gitignored.