CodeGraph
CodeGraph indexes a project into a knowledge graph — every symbol, where it is defined, what calls it and what it calls — and serves that graph to the agent over MCP. Instead of grepping and reading its way through the code, the agent asks one question and gets back the relevant source, the call paths between the pieces and the blast radius of a change, in a single tool call. Fewer tool calls, fewer tokens, better answers.
CoDev Code ships a codev codegraph command that does the wiring for you.
Enable
Run this once, from inside a project you want indexed:
codev codegraph enableIt does three things:
-
Makes the
codegraphbinary available. If it is not already on yourPATH, it installs the@colbymchenry/codegraphnpm package globally — with npm, or with bun when npm is not around. If neither is installed, it prints the install command for you to run by hand and stops. -
Wires the MCP server into your global config. It writes this entry into
~/.config/codev/codev.json— orcodev.jsonc, whichever you already have:codev.json { "mcp": { "codegraph": { "type": "local", "command": ["codegraph", "serve", "--mcp"], "enabled": true } } }The edit preserves comments and any other servers in the file. Running
enableagain is a no-op: it reports the server as already configured and leaves the file byte-for-byte unchanged. -
Offers to index the current project. The MCP wiring is global, but the graph is built per project. Answer yes and it runs
codegraph initin the current directory; pass--yesto skip the prompt (a non-interactive run skips it too). A project that already has a.codegraph/folder is left alone.
Start a new session afterwards so it picks up the server.
Installed, but "codegraph: command not found"
Your package manager's global bin folder isn't on PATH. enable warns about this rather than failing, because the config entry it wrote is correct as-is — open a new terminal and it works.
Index projects
enable only indexes the project you ran it in. For every other project, build its graph once from the project root:
codegraph initThat creates a .codegraph/ folder holding the index. From then on the MCP server keeps the graph in sync as you edit: it watches the project with native file events and re-indexes changed source files after a two-second quiet window, and it reconciles against the working tree when a session starts, so edits made while no session was running — a git pull, another editor — are picked up too.
| Command | What it does |
|---|---|
codegraph status | Index status and statistics for the current project |
codegraph sync | Sync changes since the last index — normally automatic |
codegraph index | Rebuild the full index from scratch |
codegraph uninit | Remove CodeGraph from the project by deleting .codegraph/ |
Slow filesystems
On WSL2 /mnt drives and the like, the file watcher can cost more than it saves. Add --no-watch to the server command in your config — ["codegraph", "serve", "--mcp", "--no-watch"] — and run codegraph sync yourself when you want the graph refreshed.
What the agent gets
The server exposes one tool by default, codegraph_explore, and hands the agent its usage guidance in the MCP handshake — there is nothing to add to your AGENTS.md. One call answers "how does X work", "how does X reach Y" or "what is in this area" with the relevant symbols' verbatim source grouped by file, the call paths between them (dynamic-dispatch hops included) and a summary of what a change would affect. Name a file or symbol in the query to read its current source with line numbers.
The narrower tools — codegraph_node, codegraph_search, codegraph_callers, codegraph_callees, codegraph_impact, codegraph_files and codegraph_status — stay available but unlisted, since everything they return already arrives inline. To put some of them back on the menu, set CODEGRAPH_MCP_TOOLS in the server entry's environment:
{
"mcp": {
"codegraph": {
"type": "local",
"command": ["codegraph", "serve", "--mcp"],
"environment": {
"CODEGRAPH_MCP_TOOLS": "explore,callers,impact"
},
"enabled": true
}
}
}Like any MCP server it adds to your context. See MCP servers for the tradeoffs, and for how to turn a server off in one project — "enabled": false — without removing it.
Disable
codev codegraph disableThat removes the codegraph entry from your global config and leaves every other MCP server in place (if it was the only one, the empty mcp block goes too). Your project indexes are untouched; delete those per project with codegraph uninit.