Skip to content

Codegraph

Serve layer · colbymchenry/codegraph

Pre-indexed code knowledge graph for Claude Code, Cursor, Codex, Gemini, and other agents: fewer tokens, fewer tool calls, 100% local.

Division of Labor

SourceAnswers
LightRAGWhy it was designed this way (cross-session decisions)
CodegraphWhere it's used, who calls whom, blast radius
GrepExact strings / i18n keys / error messages

Quick Start

1. Install CLI

bash
npm install -g @colbymchenry/codegraph
# or one-shot
npx @colbymchenry/codegraph

2. Wire Agents

bash
codegraph install

Auto-configures Cursor, Claude Code, Codex CLI, OpenCode, Gemini, etc.

3. Initialize Project

bash
cd your-project && codegraph init -i

Creates .codegraph/. Without it, MCP tools are unavailable — workflow falls back to Grep + Read.

4. Restart Agent

Restart Cursor (or other host) to load the MCP server.

How It Works

Source files → tree-sitter index → .codegraph/ SQLite graph → MCP tools
  • Auto-sync: OS file events, 2s debounce, incremental
  • Stale banner: Lagging files flagged; Agent Read only those
  • Connect-time catch-up: Reconcile on MCP reconnect

CLI Commands

bash
codegraph init -i
codegraph index --force
codegraph sync
codegraph status
codegraph serve --mcp
codegraph uninit
codegraph uninstall

Team Deployment

ComponentNotes
ScriptStartScript/MCP_Codegraph_serve.sh
Port9623 (HTTP bridge)
Project dirSet PROJECT_DIR in script

Server names: project-0-ui-codegraph or codegraph — equivalent.

MCP Tools

See MCP Tools · Codegraph.

Troubleshooting

IssueFix
Not initializedcodegraph init -i
MCP won't connectVerify index; test codegraph serve --mcp
Missing symbolsWait 2s or codegraph sync
database is lockedRestart MCP; check duplicate instances