codedb mcp runs as a stdio JSON-RPC server speaking the
Model Context Protocol. It exposes
21 tools for code intelligence — search, outline, callers, deps, edit,
context, etc. — backed by the indexes in ~/.codedb/projects/<hash>/.
This guide covers per-client setup, how codedb decides which project to scan, and the most common failure modes.
codedb is a context tool, not an editor. Its job is to help an agent find and understand code — fast structural search, symbol/caller lookup, dependency graph, outlines, and task-shaped context. Edits belong to your client's native file tools;
codedb_editexists only as a fallback for clients that have no native editing capability.
curl -fsSL https://codedb.codegraff.com/install.sh | bashThe installer downloads the binary for your platform, drops it in
~/.local/bin/ (or /usr/local/bin/ on root installs), and auto-registers
codedb as an MCP server in every client it can find — Claude Code, Codex,
Gemini CLI, Cursor, opencode. It prints the exact codedb mcp command it
registered.
If you prefer to wire it up by hand, the client-specific snippets below all work directly.
All clients launch codedb mcp as a stdio child process. Replace
/usr/local/bin/codedb with which codedb output on your system.
claude mcp add codedb -s user -- /usr/local/bin/codedb mcpOr edit ~/.claude.json directly:
{
"mcpServers": {
"codedb": {
"command": "/usr/local/bin/codedb",
"args": ["mcp"]
}
}
}Verify: claude mcp list should show codedb: /usr/local/bin/codedb mcp - ✓ Connected.
Edit ~/Library/Application Support/Claude/claude_desktop_config.json
(macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):
{
"mcpServers": {
"codedb": {
"command": "/usr/local/bin/codedb",
"args": ["mcp"]
}
}
}Restart Claude Desktop. The tools should appear in the slash-command menu.
Edit ~/.cursor/mcp.json (per-user) or <project>/.cursor/mcp.json
(per-project):
{
"mcpServers": {
"codedb": {
"command": "/usr/local/bin/codedb",
"args": ["mcp"]
}
}
}Cursor advertises the open workspace via the roots/list MCP handshake,
so codedb scans the right project automatically (see Root Resolution
below).
Same mcpServers block as Cursor, scoped to whichever extension you use.
codex mcp add codedb -- /usr/local/bin/codedb mcpBoth read MCP configuration from ~/.gemini/mcp.json (Gemini) and
~/.config/opencode/mcp.json (opencode):
{
"mcpServers": {
"codedb": {
"command": "/usr/local/bin/codedb",
"args": ["mcp"]
}
}
}codedb mcp figures out the project root in this order (first match wins):
-
MCP
roots/listhandshake (preferred). When a client supports it (Cursor, Windsurf, recent VS Code MCP extensions), codedb requestsroots/listimmediately afterinitializeand uses the first workspace root the client returns. This is the most reliable path — codedb scans exactly the project the user has open in their editor. -
Per-call
projectargument. Every tool accepts an optionalproject: "<abs path>"field that switches the active project for that single call. Useful for cross-project queries:{ "name": "codedb_search", "arguments": { "query": "scheduleUpdateOnFiber", "project": "/Users/me/code/react" } } -
Process
cwd. If the client doesn't speakroots/listand no per-callprojectis set, codedb falls back to the directory it was launched from. Some editors launch MCP servers from/Applicationsor~, which is almost certainly the wrong directory — set theprojectarg explicitly for those.
System directories (/, /Applications, /usr, /opt, ~,
/tmp, etc.) are blocked from being indexed as project roots — see
docs/rfc-346-mcp-root-resolution.md
for the full safety logic.
Drop a .codedbrc at the root of any project to override defaults for
that project. INI-style key = value pairs, one per line, # for
comments. Unknown keys are ignored.
# .codedbrc
max_cached = 16384 # in-memory ContentCache size (files); default 16384
max_versions = 100 # versions kept per file in the change log; default 100
rerank_trace = false # write per-search rerank-trace.jsonl (debug only)Pass an alternative path with --config-file <path> to the CLI for
testing.
codedb --version # codedb 0.2.5815 (or later)
codedb status # one-line: indexed file count + scan phaseIn a client, the simplest tool to smoke-test is codedb_status — it
takes no arguments and returns files: N, seq: N, scan: ready in <50 ms.
The MCP server hasn't received a project root. Either:
- the client doesn't speak
roots/list, or - the client launched codedb from a system directory that's blocked from
indexing (
/Applications,/usr,~, etc.).
Fix: pass project: "/abs/path/to/your/project" on the first tool
call, or restart the client from inside the project directory.
Fixed in v0.2.5815 — codedb_find now accepts query, name, path,
pattern, and q as aliases. If you're still seeing this error,
codedb --version will show < 0.2.5815; rerun the installer.
codedb_context was added in v0.2.5815. Older binaries expose only
20 tools. Upgrade with codedb update (or the installer one-liner above)
and verify with codedb --version.
The watcher debounces filesystem events for ~500 ms. If your editor saves
files in quick succession (e.g. a formatter that rewrites everything),
back-to-back saves can extend the scan phase. Check codedb status —
scan: ready means it's caught up.
The first time you run a fresh codedb binary on macOS, Gatekeeper may quarantine it. Apple Silicon release binaries from v0.2.5811+ are signed with a Developer ID and notarized via Apple — verify with:
spctl -a -vv -t install /usr/local/bin/codedb
# expected: accepted, source=Notarized Developer IDThe Intel codedb-darwin-x86_64 release slice is temporarily unsigned.
Signed Zig 0.16 x86_64-macos binaries can segfault on macOS 26 and under
Rosetta after codesign, so the release workflow leaves that artifact
unsigned and relies on the published SHA256 checksum instead.
If you built from source on Apple Silicon, codesign the binary locally:
codesign --force --sign - /usr/local/bin/codedbAvoid codesigning locally built x86_64-macos binaries on macOS 26 until the upstream Zig/Mach-O issue is resolved.
macOS caches codesignatures by path. After replacing the binary, re-codesign Apple Silicon builds or the MCP server may fail to launch:
codesign --force --sign - /usr/local/bin/codedbThe installer does this for you.
Every MCP tool result carries the data block the model consumes
(audience: assistant). Interactive clients also get two audience: user
blocks: a colored one-line summary and a follow-up hint. Well-behaved clients
render those in a preview pane and keep them out of the model context — but
many forward everything to the model, where they cost output tokens for output
the model can't render (they add ~34% to a small result like codedb_symbol).
codedb decides per session, from the clientInfo.name sent at initialize:
- Agent harnesses default lean (data block only) —
claude-code,codex, and any client not on the rich allowlist. - Human-facing GUI clients get the rich blocks — currently
claude-ai(Claude Desktop).
Override the default:
| Env var | Effect |
|---|---|
CODEDB_MCP_LEAN=1 |
Force lean for every client (data block only). |
CODEDB_MCP_RICH=1 |
Force rich for every client. |
CODEDB_MCP_RICH_CLIENTS=name1,name2 |
Add clients (by clientInfo.name, case-insensitive) to the rich allowlist. |
CODEDB_MCP_LEAN takes precedence over CODEDB_MCP_RICH.
- Architecture — engine internals, index layout
- CLI reference — every command, every flag
- Skill base & context files —
agents.md,CLAUDE.md,GEMINI.md, and the per-project skill hierarchy - RFC #346 — MCP root resolution — full design + safety logic for project-root detection
- Telemetry — what codedb sends, how to disable