NxtSoftLabs
CGRAPH DOCS — CONTENTS
CGRAPH

AI Agent Integration

Once CGraph is built, registering it with a coding agent is a one-line MCP setup. The agent then has eight graph tools alongside its usual file and shell access.

Register the MCP server

Point your agent's MCP configuration at the built cgraph-mcp binary.

claude mcp add cgraph -- "$PWD/build/default/src/mcp/cgraph-mcp"
Tip

Use the absolute path to cgraph-mcp unless it's on your PATH. Claude Code sets CLAUDE_PROJECT_DIR, which CGraph uses to resolve the project root automatically — so no --root is needed there.

What the agent gains

With the server registered, the agent can navigate the codebase as a graph:

AskTool
"What is Parser and where is it used?"graph_query, graph_explain
"What breaks if I change this signature?"graph_impact
"How do these two modules connect?"graph_path
"Give me the relevant context, within budget."graph_context
"Is the graph up to date?"graph_status, graph_update

Why this beats grepping

An agent without a graph re-derives structure from search on every turn. With CGraph it asks precise questions and gets precise answers from a warm, persistent graph — fewer tokens spent rediscovering the codebase, more spent on the task. See Context Packing for how graph_context fits a neighborhood into the agent's budget.

Requirements

  • A built cgraph-mcp (see Installation).
  • An agent that supports MCP servers over stdio.
  • The daemon (graphd) reachable — cgraph-mcp discovers it next to the binary or via CGRAPH_DAEMON_PATH.