crg CLI

A CLI and MCP server that build a code graph with Tree-sitter so an agent reads only needed functions in review, saving tokens

  • 76 ★ on the repository
  • Last commit
  • Apache-2.0
CLI

Extended access

Why this level

  • The graph is stored on disk and holds the structure and snippets of your code
  • HTTP mode opens a port, while the Docker variant is token-protected and listens on loopback only
All reasons and checks

n24q02m/crg

Install

In your terminal, with SkillFoxx CLI

npx skillfoxx add cli/crg

Detects the agents on your machine, shows the access level and pins the version.

Other ways to install

Access and checks

How we review

Extended accessThe tool runs code or makes network calls and only reads external data.

  • The graph is stored on disk and holds the structure and snippets of your code
  • HTTP mode opens a port, while the Docker variant is token-protected and listens on loopback only

This is third-party code. Review the repository files before installing.

What it does

crg parses code with Tree-sitter and builds a graph of functions, classes and imports. The agent gets precise context for a change and reads only what matters instead of walking the whole repo tree. The main surface is the `crg` command and the MCP server comes second. `crg graph build --full-rebuild --repo-root /path` builds the graph and `crg query search --search-query "authentication"` queries it. Semantic search goes through the local ONNX model registry from fastretrieval by default, with no API key and no setup. An optional cloud embedding chain can be switched on. Multi-word search, qualified call resolution and paginated output are fixed against the original code-review-graph, which the project forks. Version 2.0 added `valid_from_sha` and `valid_to_sha` temporal columns to every node and edge and an opt-in security scanner. The repo ships the skills `build-graph`, `review-delta` and `review-pr`, which call the CLI directly and need no MCP. For an always-on setup there is an HTTP server: `n24q02m-crg server start` listens on `127.0.0.1:8000/mcp`, and the Docker variant is token-protected and published on loopback only.

Who it is for. Developers and teams whose agent reviews large repos and burns tokens reading whole files.

Good fit when

  • Reviewing a pull request in a large repo where the agent needs only changed functions and their calls
  • Semantic code search with no API key, on a local model
  • You want to know which functions a change touches, using qualified call resolution
  • The graph should remember state per commit, with `valid_from_sha` on every node
  • Several agents need the same graph through a shared token-protected HTTP server

Not a fit when

  • You need plain text search: `grep` is enough and a graph is overkill
  • You cannot install Python 3.13 or `uv`
  • The code is in a language missing from the project Tree-sitter set

Example request

Build the repo graph and find functions related to authentication, then show what my latest commit touches.

Limitations

It needs Python 3.13. The PyPI distribution is `n24q02m-crg`, and the old name `better-code-review-graph` stays as a command alias. Release 2.0 is a breaking change: the database schema migrates on first open, a copy of the old database is saved as `<graph_db>.pre-2.0.bak` and a return to 1.x is switched on with `CRG_DOWNGRADE_TO_1_X=1`. The security scanner installs as the `[security]` extra. There is no hosted service, and HTTP mode runs only on your machine. Chat, rerank and embedding models each get a provider in `[models.<task>]`.

How to disable. Remove the plugin with `/plugin uninstall crg`, the MCP entry with `claude mcp remove crg` and the package with `pip uninstall n24q02m-crg`. Graphs live in the config directory `~/.crg`, which can be deleted.

FAQ

How do I run crg without installing?

With `uvx --python 3.13 --from n24q02m-crg crg graph build --full-rebuild --repo-root /path/to/repo`. The short `crg` name needs the explicit `--from`.

How do I connect crg to Claude Code over MCP?

With `claude mcp add crg -- uvx --python 3.13 n24q02m-crg` or through the plugin from the n24q02m/claude-plugins marketplace.

Does semantic search need an API key?

No. A local ONNX model runs by default with no key. Cloud embeddings are switched on through `EMBEDDING_MODELS`.

How is crg different from code-review-graph?

It is a fork with fixed multi-word search, qualified call resolution, dual-mode embeddings, output pagination and production CI.

What happens when I upgrade to 2.0?

The schema migrates on first graph open and a copy of the old database stays alongside. Details and rollback are in `BREAKING_CHANGES.md`.

Discussion

No questions or reviews yet.

CLI tools

Local code structure graph: builds a repository map with tree-sitter and serves the assistant only the context a change actually touches over MCP

MCP serverExtended access32.7KRepository stars
Official

A local code graph with version history: an MCP server that tells the agent who calls a function and what an edit breaks

MCP serverExtended access516Repository stars

DevLens analyzes a repo once and serves agents ranked files, call flow and change impact over MCP, no file-by-file reading

MCP serverExtended access70Repository stars

An MCP server that builds a code knowledge graph: semantic search, call graph, HTTP route tracing and change impact analysis.

MCP serverExtended access95Repository stars

An MCP server that builds a code graph of functions, classes, calls and routes and answers the agent's structural queries locally

MCP serverExtended access48.6KRepository stars

README in short

Covers the project rename, the 2.0 migration, install into agents, stdio and HTTP modes, per-task model config, the CLI, features and the trust model.

README badge

Report a problem