better-code-review-graph
Knowledge graph for token-efficient code reviews. Builds a structural map of your codebase with Tree-sitter, tracks changes incrementally, and gives AI agents precise context via MCP tools. Features fixed multi-word search, qualified call resolution, dual-mode embedding (ONNX local + LiteLLM cloud), and output pagination.
README
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.
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_KEYSorLITELLM_PROXY_URLset -> LiteLLM. Otherwise -> local ONNX. - Override:
EMBEDDING_BACKEND=localorEMBEDDING_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
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
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。