
Better Code Review Graph
io.github.n24q02m由 GitHub 帳號 n24q02m 發布v3.29.6更新於 Oct 5, 2026
Token-efficient code review knowledge graph: semantic search and call-graph resolution.
發布方自己的服務:Review Expert
概覽
以 Tree-sitter 為程式碼庫建立知識圖譜,讓助理進行語意搜尋、呼叫關係查詢,並產生節省 token 的審查脈絡。
- 可以做什麼
- 建立、增量更新、向量化、匯出與摘要程式碼圖譜,支援多儲存庫聯合
- 依名稱或語意相似度搜尋程式碼實體,並查詢呼叫者、被呼叫者、匯入、測試、繼承等關係
- 分析變更檔案的影響範圍、過大函式、行號位移以及提交之間的圖譜差異
- 依 git diff 產生精簡的審查脈絡與重構差異
- 執行啟發式或 Semgrep 安全掃描,輸出 JSON 或 SARIF 報告
- 檢視與修改伺服器設定及憑證狀態
- 適用情境
- 適合助理在大型程式碼庫中進行程式碼審查或導覽,只讀取相關函式而非整棵目錄樹。也適合需要呼叫圖推理、影響面分析,或與 git diff 連結之審查脈絡的本機開發流程。
- 執行需求
- 以本機 stdio 程序執行,透過 uvx 或 pip 安裝(Python 3.13),CLI 為主要使用方式。零設定即可使用,首次向量化會下載約 570 MB 的本機 ONNX 模型。選用的雲端向量化或摘要需設定服務商及 COHERE_API_KEY、OPENROUTER_API_KEY 等金鑰。Semgrep 掃描需額外安裝。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Better Code Review Graph,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
Better Code Review Graph
Renamed: repo is
crg, PyPI distribution isn24q02m-crg(formerlybetter-code-review-graph, kept as a legacy command alias) — CLI-first (crgcommand); MCP server is a secondary surface.
mcp-name: io.github.n24q02m/crg
Knowledge graph for token-efficient code reviews -- semantic search and call-graph resolution across your codebase.
[Mode] [CI] [codecov] [PyPI] [License: Apache-2.0]
[Python] [MCP] [semantic-release] [Renovate]
Sister projects from n24q02m (click to expand)
An MCP server that 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 instead of the whole tree. Semantic search runs through the local ONNX model registry from fastretrieval by default (zero config, no API key), with an optional cloud embedding chain. Fork of code-review-graph with fixed multi-word search, qualified call resolution, dual-mode embeddings, output pagination, and production CI/CD.
v2.0 migration (BREAKING)
v2.0 adds temporal columns (valid_from_sha / valid_to_sha on every node + edge) and an opt-in security scanner. The schema migration is auto-applied on first GraphStore open, and a backup of the pre-2.0 DB is saved to <graph_db>.pre-2.0.bak so you can roll back. See BREAKING_CHANGES.md for the full schema-change list, behavior changes, environment requirements, and the downgrade procedure (CRG_DOWNGRADE_TO_1_X=1 uv run crg).
Table of contents
- v2.0 migration (BREAKING)
- Install
- Usage
- Smithery
- Configuration
- Tools
- CLI
- Features
- Comparison
- Security
- Build from source
- Trust model
- Migration & changelog
- Documentation
- License
Install
For OMP and other local coding harnesses, the primary surface is the package CLI
plus the bundled skills/ workflows. The skills invoke the CLI directly and do
not require an MCP server mapping.
The optional Semgrep engine for deeper security scans is a separate extra:
MCP stdio remains a secondary protocol adapter for clients that require it:
Install matrix (stdio unless noted; the CLI-first usage above stays the primary surface):
Install with an AI agent -- paste this to your AI coding agent:
Install MCP server
crgfollowing the steps at https://raw.githubusercontent.com/n24q02m/claude-plugins/main/plugins/crg/setup-with-agent.md
Full CLI usage is in CLI. Optional per-client MCP setup is at docs.n24q02m.com/servers/crg/setup/.
Usage
Two ways to run the server, plus the surfaces to consume it.
Dev: uv, no auth (loopback only)
Always-on: docker (token auth)
The compose file builds the Dockerfile's http target (image crg:http),
publishes the container on host loopback only
(127.0.0.1:${CRG_PORT:-8772}:8080), and mounts
./docker-config/config.toml read-only at the container's config dir
(CRG_CONFIG_DIR=/data/config); graph state persists in the crg-data
named volume. All state stays on your machine.
Consuming: CLI or MCP
CLI (local graphs, no server needed):
MCP over HTTP (remote/always-on): point any MCP client at
http://127.0.0.1:8772/mcp with Authorization: Bearer <token>:
Per-task model configuration
Each task (embed / rerank / chat / jev_score) resolves its own OpenAI-spec
provider cell from [models.<task>] in the instance config: an independent
base_url + api_key + model. Cloud or local is purely a config choice —
point base_url at OpenRouter, a vendor, or your own local gateway
(e.g. http://host.docker.internal:11434/v1). API keys are host-only
material: keep them in config.toml (gitignored under docker-config/) or
supply via HULL_<TASK>_API_KEY env; they are never end-user supplied.
Local-first boundary
CRG is local-first for coding workflows:
- CLI and bundled Skills are the primary surfaces for graph build/query, impact analysis, review context, security scans, and repository onboarding.
- MCP stdio is the secondary protocol adapter over the same local domain services; it does not maintain a separate graph implementation.
- Graph state stays in
<repo>/.crg/graph.dbunless an explicit multi-user/self-host configuration selects another data directory. - PyPI, CI, security scanning, GitHub releases, and eligible stable MCP Registry publication remain active. Historical public OCI tags are retained, but new public Docker Hub/GHCR images are no longer published.
- CRG has no hosted Cloudflare runtime in the target topology.
Smithery
The repo ships a smithery.yaml so the server can be built and
run through Smithery. It deploys over stdio and needs
no startup configuration -- the config schema is empty, and any optional cloud
embedding/summary keys are supplied at runtime through the server's own config
flow (see Configuration below). The launch command is the same
uvx invocation as a local install:
Configuration
Everything works out of the box with zero configuration -- semantic search
uses the local ONNX registry from fastretrieval
(Qwen3-Embedding-0.6B is the current built-in reference entry, ~570 MB
downloaded on first graph embed). This reference entry is not a Qwen-only
boundary: any built-in registry ID or valid non-Qwen artifact manifest follows
the same resolver. All environment variables below are optional and only needed
for cloud embeddings, LLM summaries, or an explicit BYO local artifact.
Model selection
Embeddings select the first provider/model entry in EMBEDDING_MODELS; later
entries are retained as configuration but are not runtime fallbacks. The summary
model comes from the model field of the [models.chat] cell (an unconfigured
cell disables summaries). Transport always comes from the per-task
[models.<task>] cell (OpenRouter pre-wired default) — model-name prefixes
only select wire details, never keys.
Cohere embed-v4.0 requests and stores 1024 dimensions; other backends retain
768-dimensional storage. CRG never slices, pads, or silently accepts a different
provider width. The embedding row's model and byte width must match before reuse.
Run graph(action="embed") after changing models or upgrading an old 768-wide
Cohere index. Searches reject incompatible widths before a provider call; graph
nodes are retained and re-embedding replaces only stale vectors.
Provider API keys
The key lives in the per-task cell's api_key (host-only; see the table below).
Keys alone never select models: an empty embedding chain stays local, and an empty summary
chain stays disabled. A configured cloud error does not fall back to local or
another provider. Summarizers require a chat-completion model.
Vendor-specific key env vars (JINA_AI_API_KEY, GEMINI_API_KEY,
OPENAI_API_KEY, GOOGLE_VERTEX_EXPRESS_API_KEY, …) are not read by
crg; the removed per-vendor dispatch lived in the pre-de-host stack.
Advanced
When LOCAL_RERANK_MODEL is configured, semantic vector search retrieves a
bounded candidate pool of min(max(limit * 4, limit), 100) rows, applies the
existing kind, repo, and live-row filters, then reranks that pool and returns
at most limit rows. The response uses search_mode="semantic_reranked" and
adds rerank_score while preserving similarity_score. Blank keeps the
existing limit * 2 vector path and search_mode="semantic". Configured
reranker failures return an explicit error; CRG does not silently fall back to
vector or keyword results. Keyword searches, including as_of snapshots, do
not invoke the reranker.
Example -- cloud embeddings + summaries
~/.crg/config.toml (write by hand, or start from hull config init which
pre-wires OpenRouter defaults):
Equivalent env surface for the MCP server entry (keys override the cells;
model names still come from EMBEDDING_MODELS / the model field):
Cohere embedding is paid. Authorize a bounded budget before a live index/query;
the Minimax-free completion choice does not make embeddings free. Model-name
prefixes (cohere/…, openrouter/…) select wire details only — transport and
credentials come from the [models.*] cells, which the host owns.
CRG currently has no cloud rerank call: LOCAL_RERANK_MODEL is its only
reranking path. Setting RERANK_MODELS or RERANK_API_BASE does not enable one.
Tools
Six tools, each grouping related actions to keep the tool surface small.
graph -- Graph lifecycle
Actions: build | update | stats | embed | export | summarize
query -- Graph queries
Actions: query | search | impact | large_functions | spot_check | renamed_in_diff | diff
Most read actions accept as_of=<sha> for temporal (point-in-time) snapshots
and repo=<repo_id> to scope a federated multi-repo graph.
review -- Code review context
Actions: context (default) | delta
Token-optimized review context with structural summary, impacted nodes, source
snippets, and review guidance. context auto-detects changed files from the
git diff; delta (with from_sha/to_sha, optional show_line_shifts)
surfaces refactor moves between two commits.
config -- Server configuration and credential setup
Actions: status | set | cache_clear | setup_status | setup_start | setup_skip | setup_reset | setup_complete
security -- Security scanning
Actions: scan | report | suppress | rule_list
The semgrep engine requires the [security] extra and runs Semgrep's
p/auto registry pack plus a 3-rule curated overlay.
help -- Full documentation
Topics: graph | query | review | config | security | recipes
Returns complete documentation for each tool. Use when the compressed descriptions above are insufficient.
CLI
The package installs two console scripts: crg (primary) and
crg (legacy long name). Running either with no
arguments starts the MCP server over stdio; a leading positional argument
routes to a local CLI subcommand that calls the same domain services used by
the MCP adapter. Run them directly after pip install, or without a
persistent install via uvx --python 3.13 --from n24q02m-crg crg ....
CLI subcommands print structured JSON and exit non-zero on an error.
Features
What this fork fixes versus the upstream code-review-graph:
Comparison
How crg stacks up against direct competitors in each pillar:
Sources: Greptile · Greptile pricing · Sourcegraph MCP · CodeGraph. Cells marked ? are capabilities the competitor does not publicly document, not confirmed absences.
Security
- Explicit selection -- Cloud embedding errors are reported; the runtime does not silently switch models or fall back to local ONNX.
- Error handling -- Tools return error strings with fix suggestions, never crash.
- Read-only mount -- Docker mode mounts the repo as
:ro(read-only). - SSRF-guarded endpoints -- Custom
[models.*]cellbase_urlvalues are validated before any outbound call.
To report a vulnerability, see SECURITY.md.
Build from source
Requirements: Python 3.13, uv.
Trust model
This plugin implements TC-Local (machine-bound, single trust principal). See the mcp-core trust model for full classification.
Migration & changelog
Graph, security scan cache, and suppression state now use the package-owned
.crg/ directory. Run graph(action="build", full_rebuild=true)
once after upgrading, followed by graph(action="embed") if semantic search is
needed. The old .better-code-review-graph/ state directory plus the ambiguous
.code-review-graph/ and .code-review-graph.db paths and their SQLite
sidecars are left untouched, not migrated. Review and reapply any desired
suppression rules explicitly.
The v2.0 release added temporal columns (valid_from_sha / valid_to_sha
on every node and edge) plus an opt-in security scanner. The schema migration
is auto-applied on first GraphStore open, and a backup of the pre-2.0 DB is
written to <graph_db>.pre-2.0.bak. To downgrade and restore it:
Full schema-change list, behavior changes, and rollback procedure: BREAKING_CHANGES.md. Release-by-release history: CHANGELOG.md.
Documentation
Full docs at docs.n24q02m.com/servers/crg/setup/:
- Setup -- install methods for Claude Code, Codex, Gemini CLI, Cursor, Windsurf, mcp.json
- Modes overview -- stdio / http
- Multi-user setup -- per-JWT-sub credential model
Use the help tool from any MCP client for inline per-tool reference.
License
Apache-2.0 -- See LICENSE.
來源:README.md,提交 787823f
工具
0版本歷史
17- v3.29.6最新Sep 30, 2026
- v3.29.4Sep 27, 2026
- v3.29.0Sep 27, 2026
- v3.28.1Sep 27, 2026
- v3.27.3Sep 27, 2026
- v3.27.1Sep 26, 2026
- v3.27.0Sep 26, 2026
- v3.26.26Sep 26, 2026
- v3.26.24Sep 25, 2026
- v3.26.23Sep 21, 2026
- v3.26.22Sep 21, 2026
- v3.26.20Sep 20, 2026
- v3.26.18Sep 20, 2026
- v3.26.15Sep 19, 2026
- v3.26.14Sep 19, 2026
- v3.26.13Sep 17, 2026
- v3.26.12Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分
其他 Review 整合

Review Expert
expert.review官方發布者
讓助理讀取、搜尋、分析 App Store 與 Google Play 評論並草擬回覆,需 OAuth 登入。

DECIDE: Migration Discovery Risk Review
由 GitHub 帳號 stratus-consulting 發布
遠端風險審查服務:提交遷移探索發現,依嚴重程度回傳未決風險,並指出下一步該問誰、問什麼。

Arch theological review
由 GitHub 帳號 tnvolman 發布
Cursor/Grok 外掛,讓助理對信仰文本進行付費的 Arch 神學審閱,並提供免費的離線欽定版聖經經文查詢。

ReviewBot App Reviews
由 GitHub 帳號 fahimk 發布
讀取收集到的 App Store 和 Google Play 留言以及有界反饋統計資料。AI 翻譯

Khavion Architecture Review
com.khavion
本機 MCP 伺服器,為助理提供附原文引用的雲端最佳實務,並對 Terraform、CloudFormation 與 Kubernetes 檔案做基於規則的確定性審查。