πŸ€– AI Toolset

📅 2026-05-25 Β· 11 min read

CodeGraph Explained: The GitHub Trending MCP Layer for Coding Agents

The repo climbing GitHub Trending is not another chat UI β€” it is a local code knowledge graph for MCP agents. Here is how to evaluate it without mistaking marketing benchmarks for your own results.

What CodeGraph Is

CodeGraph is an open-source (MIT) CLI and MCP server that indexes your repository into a SQLite database under .codegraph/. Parsing uses tree-sitter across 19+ languages (TypeScript, Python, Go, Rust, Java, and more). Symbols, call edges, imports, and full-text search (FTS5) live on disk β€” not in a vendor cloud.

The product pitch is narrow and clear: give coding agents structured code intelligence so they stop spawning explore sub-agents that hammer the filesystem. It pairs with editors and terminals you may already use β€” see our guides for Cursor, Codex CLI, and Claude Code, or the longer best AI coding tools roundup.

How It Works (Index + MCP)

The pipeline has four beats:

  1. Extract β€” tree-sitter walks source files and builds nodes (functions, classes, routes) and edges (calls, extends, imports).
  2. Store β€” everything lands in .codegraph/codegraph.db with FTS5 for name search.
  3. Resolve β€” cross-references link callers to definitions, including framework routes (Django, Express, FastAPI, NestJS, and others).
  4. Serve β€” codegraph serve --mcp exposes tools such as codegraph_context, codegraph_trace, codegraph_search, and codegraph_impact to the agent.

A file watcher keeps the graph fresh: native OS events, debounced sync, respect for .gitignore and default excludes like node_modules. No API keys and no outbound code upload β€” important for regulated teams.

MCP tool (examples)Typical use
codegraph_contextMap a feature area in one call
codegraph_traceFollow how X reaches Y across hops
codegraph_impactSee blast radius before editing
codegraph_exploreBatch related symbol sources

Supported Agents & Quick Start

The installer auto-detects and wires MCP config for Claude Code, Cursor, Codex CLI, opencode, and Hermes Agent. You can also install via npm:

npx @colbymchenry/codegraph
            cd your-repo
            codegraph init -i

Restart your agent so the MCP server loads. When .codegraph/ exists, upstream docs instruct agents to answer architecture questions directly via CodeGraph instead of delegating to a file-reading sub-agent β€” that behavioral nudge is part of why benchmarks show fewer tool calls.

Official docs and install scripts: colbymchenry.github.io/codegraph.

Author Benchmarks (Read Carefully)

Disclaimer: The following figures come from the project README (v0.9.4, re-validated 2026-05-24). They are author-published medians across seven open-source repos and four runs per arm using Claude Opus headless β€” not verified by AI Toolset.

  • ~35% lower cost (median across repos)
  • ~71% fewer tool calls
  • ~57% fewer tokens and ~46% faster wall time (author-reported averages)

Gains scale with repo size: large codebases (VS Code, Excalidraw in their table) show dramatic drops in reads; tiny repos (e.g. Gin) see smaller margins because native search was already cheap. Treat this as directional marketing data β€” run your own repo and task mix before changing team workflow.

Who Should (and Shouldn't) Use It

Good fit:

  • Daily users of MCP-capable coding agents on medium-to-large monorepos
  • Teams that need local-only indexing for privacy
  • Engineers who often ask β€œhow does X flow to Y?” across many files

Poor fit / caveats:

  • Tiny repos where grep is already instant β€” overhead may dominate
  • Projects on network filesystems without WAL β€” README warns about lock issues; prefer local disks
  • Expecting CodeGraph to replace code review, tests, or production observability
  • Assuming benchmark medians apply to your model vendor, prompt style, or private codebase without measurement

CodeGraph complements β€” does not replace β€” your chosen agent. Compare agent pricing and workflows on coding plan pricing and Cursor vs Codex vs Claude Code.

FAQ

More structured Q&A is in page schema; highlights below.

Is CodeGraph free? The OSS tool is MIT-licensed; you still pay for whichever LLM/agent subscription you use.