Skip to main content

Knowledge graph for token-efficient code reviews — fixed search, configurable embeddings, qualified call resolution

Project description

better-code-review-graph

mcp-name: io.github.n24q02m/better-code-review-graph

Knowledge graph for token-efficient code reviews -- fixed search, configurable embeddings, qualified call resolution.

CI codecov PyPI Docker License: MIT

Python MCP semantic-release Renovate

Fork of code-review-graph with critical bug fixes, configurable embeddings, and production CI/CD. Parses your codebase with Tree-sitter, builds a structural graph of functions/classes/imports, and gives Claude (or any MCP client) precise context so it reads only what matters.


Why Better

Feature code-review-graph better-code-review-graph
Multi-word search Broken (literal substring) AND-logic word splitting
callers_of/callees_of Empty results (bare name targets) Qualified name resolution + bare fallback
Embedding sentence-transformers + torch (1.1 GB) qwen3-embed ONNX + LiteLLM (200 MB), dual-mode
Output size Unbounded (500K+ chars) Paginated (max_results, truncated flag)
Tool design 9 individual tools 3-tier: graph (mega) + config + help
Plugin hooks Invalid PostEdit/PostGit Valid PostToolUse

All fixes are submitted upstream as standalone PRs (see Upstream PRs). If all are merged, this repo will be archived.


Installation

Claude Code

claude mcp add better-code-review-graph -- uvx --python 3.13 better-code-review-graph serve

Claude Code Plugin

claude plugin install n24q02m/better-code-review-graph@better-code-review-graph

Cursor (~/.cursor/mcp.json)

{
  "mcpServers": {
    "better-code-review-graph": {
      "command": "uvx",
      "args": ["--python", "3.13", "better-code-review-graph", "serve"]
    }
  }
}

Codex (~/.codex/config.toml)

[mcp_servers.better-code-review-graph]
command = "uvx"
args = ["--python", "3.13", "better-code-review-graph", "serve"]

Gemini CLI (~/.gemini/settings.json)

{
  "mcpServers": {
    "better-code-review-graph": {
      "command": "uvx",
      "args": ["--python", "3.13", "better-code-review-graph", "serve"]
    }
  }
}

OpenCode (~/.opencode.json)

{
  "mcpServers": {
    "better-code-review-graph": {
      "command": "uvx",
      "args": ["--python", "3.13", "better-code-review-graph", "serve"]
    }
  }
}

Windsurf (~/.codeium/windsurf/mcp_config.json)

{
  "mcpServers": {
    "better-code-review-graph": {
      "command": "uvx",
      "args": ["--python", "3.13", "better-code-review-graph", "serve"]
    }
  }
}

Cline (cline_mcp_settings.json)

{
  "mcpServers": {
    "better-code-review-graph": {
      "command": "uvx",
      "args": ["--python", "3.13", "better-code-review-graph", "serve"]
    }
  }
}

Amp (~/.config/amp/settings.json)

{
  "mcpServers": {
    "better-code-review-graph": {
      "command": "uvx",
      "args": ["--python", "3.13", "better-code-review-graph", "serve"]
    }
  }
}

Docker

docker run -i --rm n24q02m/better-code-review-graph

pip

pip install better-code-review-graph
better-code-review-graph serve

Tools

graph -- Knowledge graph operations

Actions: build | update | query | search | impact | review | embed | stats | large_functions

Action Description
build Full or incremental graph build. Set full_rebuild=true to re-parse all files.
update Alias for build with full_rebuild=false (incremental).
query Run predefined queries: callers_of, callees_of, imports_of, importers_of, children_of, tests_for, inheritors_of, file_summary.
search Search code entities by name/keyword or semantic similarity.
impact Blast radius of changed files. Auto-detects from git diff. Paginated with max_results.
review Token-optimized review context with structural summary, source snippets, and review guidance.
embed Compute vector embeddings for semantic search. Dual-mode: local ONNX or cloud LiteLLM.
stats Graph size, languages, node/edge breakdown, embedding count.
large_functions Find functions/classes exceeding a line-count threshold.

config -- Server configuration

Actions: status | set | cache_clear

Action Description
status Server info: version, graph path, node/edge counts, embedding backend.
set Update runtime settings (e.g., log_level).
cache_clear Remove all computed embeddings.

help -- Full documentation

Topics: graph | config

Returns complete documentation for each tool. Use when the compressed descriptions above are insufficient.


Embedding Backends

Backend Config Size Description
local (default) Nothing needed ~570 MB (first use) qwen3-embed ONNX. Zero-config.
litellm API_KEYS or LITELLM_PROXY_URL 0 MB Cloud providers via LiteLLM.
  • Auto-detection: API_KEYS or LITELLM_PROXY_URL set -> LiteLLM. Otherwise -> local ONNX.
  • Override: EMBEDDING_BACKEND=local or EMBEDDING_BACKEND=litellm.
  • Fixed 768-dim storage: Switching backends does NOT invalidate existing vectors.

Configuration

Variable Default Description
EMBEDDING_BACKEND (auto-detect) local or litellm
EMBEDDING_MODEL gemini/gemini-embedding-001 LiteLLM model (when backend=litellm)
API_KEYS - LLM API keys (format: ENV_VAR:key,...). Enables LiteLLM.
LITELLM_PROXY_URL - LiteLLM Proxy URL. Enables LiteLLM via proxy.
LITELLM_PROXY_KEY - LiteLLM Proxy virtual key.

Ignore files

Create .code-review-graphignore in your project root:

generated/**
*.generated.ts
vendor/**
node_modules/**

Supported Languages

Python, TypeScript, JavaScript, Go, Rust, Java, C#, Ruby, Kotlin, Swift, PHP, C/C++


Upstream PRs

All fixes are submitted to code-review-graph:

  • #37 -- Multi-word search AND logic
  • #38 -- Parser call target resolution (fixes #20)
  • #39 -- Impact radius output pagination

If all upstream PRs are merged, this repository will be archived.


Build from Source

git clone https://github.com/n24q02m/better-code-review-graph
cd better-code-review-graph
uv sync --group dev
uv run pytest
uv run better-code-review-graph serve

Requirements: Python 3.13, uv


Compatible With

Claude Desktop Claude Code Cursor VS Code Copilot Antigravity Gemini CLI OpenAI Codex OpenCode

Also by n24q02m

Server Description Install
wet-mcp Web search, content extraction, library docs uvx --python 3.13 wet-mcp@latest
mnemo-mcp Persistent AI memory with hybrid search uvx mnemo-mcp@latest
better-notion-mcp Notion API for AI agents npx -y @n24q02m/better-notion-mcp@latest
better-email-mcp Email (IMAP/SMTP) for AI agents npx -y @n24q02m/better-email-mcp@latest
better-godot-mcp Godot Engine for AI agents npx -y @n24q02m/better-godot-mcp@latest
better-telegram-mcp Telegram Bot API + MTProto for AI agents uvx --python 3.13 better-telegram-mcp@latest

License

MIT - See LICENSE

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

better_code_review_graph-2.0.0.tar.gz (1.2 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

better_code_review_graph-2.0.0-py3-none-any.whl (47.8 kB view details)

Uploaded Python 3

File details

Details for the file better_code_review_graph-2.0.0.tar.gz.

File metadata

  • Download URL: better_code_review_graph-2.0.0.tar.gz
  • Upload date:
  • Size: 1.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for better_code_review_graph-2.0.0.tar.gz
Algorithm Hash digest
SHA256 3ad0a117ae73f2bce1483bb1924ee0d2d8f03f4d17d862d23a1092dfa10d270a
MD5 f47fa5d6d6ba61ec3543d343a1c3379a
BLAKE2b-256 e4740a0866e320e543d280825adf2e1aee382aa45065627278adf6e4c2c5f603

See more details on using hashes here.

File details

Details for the file better_code_review_graph-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: better_code_review_graph-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 47.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.12 {"installer":{"name":"uv","version":"0.10.12","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for better_code_review_graph-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 844d6e2885dcd16c87494f0891564ff8c3af9ada42e1976e20f417c96406aa73
MD5 6e7c7acbad1c9c44a0fa2ed381678b97
BLAKE2b-256 6a797a5307115dc3a6e87b0e2c27b76bc81e946cdc676a9d1940799743fa8037

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page