Skip to content

MCP Server

CodeGraph runs as a Model Context Protocol server. Start it with:

Terminal window
codegraph serve --mcp

Agents configured by the installer launch this automatically. When a .codegraph/ index exists, the agent uses the tools below.

ToolPurpose
codegraph_searchFind symbols by name across the codebase
codegraph_contextBuild relevant code context for a task — composes search + node + callers + callees in one call
codegraph_traceTrace the call path between two symbols (“how does X reach Y”) in one call — each hop with its body inline, following dynamic-dispatch hops (callbacks, React re-render, interface→impl) that grep can’t
codegraph_callersFind what calls a function
codegraph_calleesFind what a function calls
codegraph_impactAnalyze what code is affected by changing a symbol
codegraph_nodeGet details about a specific symbol (optionally with source code)
codegraph_exploreReturn source for several related symbols grouped by file, plus a relationship map, in one call
codegraph_filesGet the indexed file structure (faster than filesystem scanning)
codegraph_statusCheck index health and statistics

CodeGraph is the pre-built search index. For “how does X work?”, architecture, trace, or where-is-X questions, an agent should answer in a handful of CodeGraph calls and stop — typically with zero file reads — rather than re-deriving the answer with grep + Read. A direct CodeGraph answer is a handful of calls; a grep/read exploration is dozens.

The installer writes this guidance into each agent’s instructions file automatically.