crg — Claude Code MCP server: what it does, how to install
Builds a code knowledge graph using Tree-sitter. Delivers precise structural context for reviews so agents do not load whole repositories.
claude mcp add --env EMBEDDING_MODELS=<EMBEDDING_MODELS> --env LOCAL_EMBEDDING_MODEL=<LOCAL_EMBEDDING_MODEL> --env LOCAL_RERANK_MODEL=<LOCAL_RERANK_MODEL> --env LOCAL_EMBEDDING_DIM=<LOCAL_EMBEDDING_DIM> --env LOCAL_EMBEDDING_MODEL_FILE=<LOCAL_EMBEDDING_MODEL_FILE> --transport stdio crg -- uvx better-code-review-graphWhat crg does
The server parses codebases with Tree-sitter to index relationships among functions, classes, and imports. Default semantic search runs offline through local ONNX models via fastretrieval, avoiding mandatory external embedding API keys.
This design keeps token consumption predictable during reviews. Instead of reading complete directories, the client queries call graphs and resolves qualified symbols directly over MCP.
Remember that the CLI binary is crg, but the PyPI package is named better-code-review-graph. Running it via uvx requires Python 3.13.
What it helps with
- build call graphs for functions and class hierarchies
- run local semantic code search without API tokens
- reduce prompt context overhead during pull request reviews
- trace dependency chains across imported modules
Example prompts for the agent
- Build the call graph for the authentication handler and display callers
- Search the codebase semantically for database connection retry logic
- Map imported dependencies for the payment processing class
How to install crg
Platform CLI
claude mcp add --env EMBEDDING_MODELS=<EMBEDDING_MODELS> --env LOCAL_EMBEDDING_MODEL=<LOCAL_EMBEDDING_MODEL> --env LOCAL_RERANK_MODEL=<LOCAL_RERANK_MODEL> --env LOCAL_EMBEDDING_DIM=<LOCAL_EMBEDDING_DIM> --env LOCAL_EMBEDDING_MODEL_FILE=<LOCAL_EMBEDDING_MODEL_FILE> --transport stdio crg -- uvx better-code-review-graphReplace <…> with your own values. 5 more environment variables are in the server README. uvx runs the command named after the package; if the README names another one, use uvx --from better-code-review-graph <command>
Platform CLI
codex mcp add crg --env EMBEDDING_MODELS=<EMBEDDING_MODELS> --env LOCAL_EMBEDDING_MODEL=<LOCAL_EMBEDDING_MODEL> --env LOCAL_RERANK_MODEL=<LOCAL_RERANK_MODEL> --env LOCAL_EMBEDDING_DIM=<LOCAL_EMBEDDING_DIM> --env LOCAL_EMBEDDING_MODEL_FILE=<LOCAL_EMBEDDING_MODEL_FILE> -- uvx better-code-review-graphReplace <…> with your own values. 5 more environment variables are in the server README. uvx runs the command named after the package; if the README names another one, use uvx --from better-code-review-graph <command>
Config file
{
"mcpServers": {
"crg": {
"command": "uvx",
"args": [
"better-code-review-graph"
],
"env": {
"EMBEDDING_MODELS": "<EMBEDDING_MODELS>",
"LOCAL_EMBEDDING_MODEL": "<LOCAL_EMBEDDING_MODEL>",
"LOCAL_RERANK_MODEL": "<LOCAL_RERANK_MODEL>",
"LOCAL_EMBEDDING_DIM": "<LOCAL_EMBEDDING_DIM>",
"LOCAL_EMBEDDING_MODEL_FILE": "<LOCAL_EMBEDDING_MODEL_FILE>"
}
}
}
}Replace <…> with your own values. 5 more environment variables are in the server README. uvx runs the command named after the package; if the README names another one, use uvx --from better-code-review-graph <command>
Config file
{
"servers": {
"crg": {
"type": "stdio",
"command": "uvx",
"args": [
"better-code-review-graph"
],
"env": {
"EMBEDDING_MODELS": "<EMBEDDING_MODELS>",
"LOCAL_EMBEDDING_MODEL": "<LOCAL_EMBEDDING_MODEL>",
"LOCAL_RERANK_MODEL": "<LOCAL_RERANK_MODEL>",
"LOCAL_EMBEDDING_DIM": "<LOCAL_EMBEDDING_DIM>",
"LOCAL_EMBEDDING_MODEL_FILE": "<LOCAL_EMBEDDING_MODEL_FILE>"
}
}
}
}Replace <…> with your own values. 5 more environment variables are in the server README. uvx runs the command named after the package; if the README names another one, use uvx --from better-code-review-graph <command>
Platform CLI
gemini mcp add -e EMBEDDING_MODELS=<EMBEDDING_MODELS> -e LOCAL_EMBEDDING_MODEL=<LOCAL_EMBEDDING_MODEL> -e LOCAL_RERANK_MODEL=<LOCAL_RERANK_MODEL> -e LOCAL_EMBEDDING_DIM=<LOCAL_EMBEDDING_DIM> -e LOCAL_EMBEDDING_MODEL_FILE=<LOCAL_EMBEDDING_MODEL_FILE> crg uvx better-code-review-graphReplace <…> with your own values. 5 more environment variables are in the server README. uvx runs the command named after the package; if the README names another one, use uvx --from better-code-review-graph <command>
Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more
Questions about crg
How to install crg in Claude Code?
Run claude mcp add crg -e HULL_EMBED_API_KEY=<HULL_EMBED_API_KEY> -e HULL_CHAT_API_KEY=<HULL_CHAT_API_KEY> -- uvx better-code-review-graph.
What does crg do?
It constructs a structural knowledge graph from source code using Tree-sitter. MCP clients can then fetch exact function call relationships without loading irrelevant files.
Does crg require paid API keys to operate?
Not by default. It includes an offline ONNX embedding pipeline powered by fastretrieval, while cloud embedding providers remain an optional alternative.