Skip to content

Guide · Open source

How to use code-review-graph: install, build and review with MCP

Updated · written with AI from the project's own documentation and checked against our catalogue data

code-review-graph is an open-source Python tool that builds a local map of your code's functions, classes, imports and calls, then serves that map to AI coding assistants over MCP. This guide shows you how to install it, configure your assistant, build the graph and ask for reviews that focus on the files a change affects. You need Python 3.10 or newer and an MCP-compatible AI coding tool.

code-review-graphtirth8205/code-review-graph · ★ 32.6k · MIT

Quick start

  1. 1Install the package. Run pip install code-review-graph in an environment running Python 3.10 or newer.
  2. 2Configure your tools. Run code-review-graph install to detect your AI coding tools and write their MCP entries.
  3. 3Restart your editor. Restart the editor or AI tool so it loads the new MCP server entry.
  4. 4Build the graph. Run code-review-graph build from your project to parse the codebase into the graph.
  5. 5Ask for a review. Ask your assistant to build or use the code review graph, then request a review of your change.

What code-review-graph does

AI coding tools often re-read large parts of a codebase to review a change. code-review-graph parses the code with Tree-sitter, keeps the structural map updated incrementally, and serves compact context over MCP so the assistant reads only the files a change touches.

The graph is stored locally. The source describes it as a local-first tool, so the code map stays on your machine rather than going to a hosted service.

Install code-review-graph with pip

The tool is published on PyPI and requires Python 3.10+. Install it with pip, or with pipx if you prefer an isolated tool install.

  • Requirement: Python 3.10 or newer
  • Package name on PyPI: code-review-graph
pip install code-review-graph # or: pipx install code-review-graph

Configure your AI coding tools

Run the install command. It detects which AI coding tools you have, writes an MCP server entry for each, installs hooks and skills where the platform supports them, and adds graph instructions to the platform's rules file. Restart the editor or tool afterwards.

To configure a single platform, pass --platform with one of the supported names, such as cursor or claude-code. Config file locations are listed in the project's docs/USAGE.md.

  • Supported names include codex, claude-code, cursor, windsurf, zed, continue, opencode, gemini-cli, kiro, copilot and hermes
  • The MCP entry uses poetry run or uv run inside a Poetry or uv project, uvx when it is on PATH, and otherwise the current Python interpreter
code-review-graph install code-review-graph install --platform cursor

Build the graph for your project

Run the build command from your project. It parses the codebase into the graph. Build time grows with repository size. The README reports that a cold build of a roughly 3,000-file repository took about 40 seconds.

You can also ask your assistant in plain language. After that, hooks and watch mode keep the graph updated. If some files fail to parse, the result has status partial and names them in its summary, and those files keep their previous graph rows.

  • If the CLI prints a Warning line on stderr, check which files failed to parse
  • Hooks and watch mode handle later updates
code-review-graph build Build the code review graph for this project

How reviews use the graph

When a file changes, the graph traces its callers, dependents and tests. This is called blast-radius analysis. The assistant then reads those files instead of scanning the whole project.

Incremental updates work by diffing changed files, finding their dependents through import and call edges, and re-parsing only files whose SHA-256 hash changed. The README reports that on a roughly 3,000-file project a two-file edit re-indexes in about 2.5 seconds on the hook path, of which about 1.4 seconds is process start-up.

  • Blast radius: callers, dependents and tests of a changed function or file
  • Incremental: only files with a changed SHA-256 hash are re-parsed

Remove code-review-graph cleanly

The uninstall command removes CRG-owned files and entries from a Git or SVN working tree. It leaves other MCP servers, hooks, skills and JSONC comments alone. Use --dry-run to preview the changes first.

Shared config files are replaced atomically, so a failed write leaves the original intact.

  • --dry-run previews only
  • --yes applies without prompting
  • --keep-data removes integrations but keeps graph databases
  • --keep-user-configs with --repo limits the change to one project
code-review-graph uninstall --dry-run code-review-graph uninstall --keep-data

What people use it for

  • Reviewing a pull request on a large repository, where the assistant reads only the files affected by the change
  • Checking which callers, dependents and tests a function change could affect
  • Keeping a code map on your own machine while using an MCP-compatible assistant
  • Setting up supported tools such as Claude Code, Cursor or Codex with one install command

Frequently asked questions

Is code-review-graph free and open source?

Yes. The repository is licensed under the MIT licence, as shown on its badges and project metadata. Check the LICENSE file in the repository for the full terms.

What do I need to run code-review-graph?

You need Python 3.10 or newer and an MCP-compatible AI coding assistant. The main interface is through MCP, so it is not useful on its own for people who do not use such a tool.

Which programming languages does code-review-graph support?

The README lists Python, JavaScript, TypeScript, TSX, Go, Rust, Java, C and C++, C#, VB.NET, Ruby, Kotlin, Swift, PHP, Scala, Solidity, Dart, R, Perl and Lua, plus Jupyter and Databricks notebooks. Projects in other languages are outside the listed coverage.

Does code-review-graph send my code to a server?

The project describes itself as local-first and says the code map is kept local rather than sent to a hosted service. The source does not describe every network interaction your AI assistant may make, so check your assistant's own data settings.

How much does code-review-graph reduce the context my assistant reads?

The README reports one 2026-08-02 capture of its own repository where about 208,821 source tokens became about 3,190 tokens per question. The project notes the repository has grown since then, so current numbers are likely larger, and savings on your project may differ.

Why does my build show a partial status or a warning?

Some files failed to parse. The result has status partial and names those files in its summary, and the CLI prints a Warning line on stderr. Those files keep their previous graph rows until they parse successfully.

New agent skills, repos and AI tools — every week

The best new skills and open-source projects, the fastest-growing repos, and one free prompt. Five minutes to read. Unsubscribe anytime.

Our verdict

code-review-graph suits developers and teams who use an MCP-compatible assistant on a large repository in a supported language and want the code map kept local. If you do not use MCP, or your project is written in a language outside the supported list, pick a different approach. Treat the published token savings as a snapshot, not a guarantee for your codebase.

Install options & downloads