code-review-graph
Local-first knowledge graph for token-efficient code review through MCP and CLI
What it is and what it does
code-review-graph parses your repository into a structural graph of functions, classes, imports, and their call relationships using Tree-sitter, then makes that graph queryable via MCP (Model Context Protocol) so AI coding assistants can pinpoint exactly which files matter for a code review instead of re-reading your entire codebase. It tracks changes incrementally—when a file is saved or committed, the graph updates in under 2 seconds by diffing only what changed and recomputing affected dependents.
The tool integrates directly into AI coding platforms through a single `install` command that auto-detects your setup and writes the right MCP configuration. It also runs as a GitHub Action to post risk-scored PR reviews. For languages not yet built in, you can add custom parsers by dropping a TOML file into `.code-review-graph/` with grammar and node-type mappings—no fork or code changes needed.
Use it for:
- Reduce token spend in monorepo reviews: exclude thousands of unrelated files and focus context on the files actually affected by a change.
- Integrate code review into CI/CD: run as a GitHub Action on pull requests to post automated, risk-scored reviews without sending source code externally.
- Speed up incremental analysis: keep the graph updated via file-save hooks or watch mode so each review query runs against fresh, minimal context.
- Support languages beyond the built-in set: add custom languages by writing a TOML config that maps file extensions to Tree-sitter grammars.
- Trace blast radius for refactoring: see every caller, dependent, and test that could break when you change a function or class.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Builds a structural knowledge graph of your codebase using Tree-sitter and serves it via MCP to AI coding tools, so they read only the files affected by a change instead of scanning the whole project.
Yes. The package is actively maintained, has no known vulnerabilities, low install friction, and solves a real problem—AI code review tools waste tokens by re-reading large parts of your codebase. If you use supported AI coding platforms and want to cut review costs and latency, this is worth trying. The initial setup is one command, and the graph updates automatically. Start with a small project to verify the token savings match your use case.
Install
code-review-graph on PyPI
pip
pip install code-review-graphuv
uv add code-review-graphpoetry
poetry add code-review-graphInstalling code-review-graph
Before you install
Low friction: pure Python wheel with eight runtime dependencies (networkx, tree-sitter, pyyaml, tomli, watchdog, fastmcp, mcp, tree-sitter-language-pack). Active maintenance—last commit 2026-08-02, 30124 stars, released 2.3.7 just 27 days ago.
License in practice
MIT license (permissive): you can use, modify, and distribute freely with minimal restrictions. No copyleft obligations.
Quickstart
pip install code-review-graph
code-review-graph install
code-review-graph build
# Then ask your AI assistant:
# "Build the code review graph for this project"
Requires Python 3.10 or later. For best experience, install uv (optional but recommended for MCP config generation).
Verify before relying
- Whether the 82x median token reduction benchmark holds across diverse codebases in production use.
- Performance characteristics on projects larger than the 2,900-file test case mentioned.
- Stability of custom language support via languages.toml across different Tree-sitter grammar versions.
Package facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 8 — fastmcp, mcp, networkx, pyyaml, tomli, tree-sitter-language-pack, tree-sitter, watchdog |
| Maintenance | actively maintained — 27 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 417,955/month — #6,805 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: code_review_graph-2.3.7-py3-none-any.whl
Keywords: ai-coding-tools, code-review, knowledge-graph, mcp, tree-sitter
Tags
More Quality Assurance packages
Coverage.py measures which lines of Python code…
permissive · top 1,000 on PyPI
ruffRuff is a Python linter and code formatter…
permissive · top 1,000 on PyPI
pexpectPexpect spawns and controls interactive console…
permissive · top 1,000 on PyPI
blackBlack reformats Python source code to a…
permissive · top 1,000 on PyPI
pytest-xdistpytest-xdist distributes pytest tests across…
permissive · top 1,000 on PyPI
cfn-lintValidates AWS CloudFormation templates in YAML…
permissive · top 1,000 on PyPI
graphifyyParses code, docs, PDFs, images, and video into…
permissive · top 5,000 on PyPI
jcodemunch-mcpAn MCP server that retrieves precise source…
unclear · top 15,000 on PyPI
trailmarkParses source code into a queryable graph of…
permissive · top 15,000 on PyPI
tree-sitter-zigProvides a tree-sitter grammar for parsing Zig…
permissive · top 5,000 on PyPI
tree-sitter-phpProvides a PHP language grammar for…
permissive · top 5,000 on PyPI
tree-sitter-javaProvides a Java language grammar for…
permissive · top 5,000 on PyPI
tree-sitter-objcProvides a tree-sitter grammar for parsing…
permissive · top 5,000 on PyPI
tree-sitter-swiftProvides a tree-sitter grammar for parsing…
permissive · top 5,000 on PyPI
tree-sitter-jsonProvides a JSON grammar parser for tree-sitter,…
permissive · top 5,000 on PyPI
tree-sitter-typescriptProvides TypeScript and TSX language grammars…
permissive · top 5,000 on PyPI