Local-first 代码智能图谱支持 MCP/CLI,构建持久代码库地图减少审查上下文
Local-first 代码智能图谱,用于 MCP 和 CLI。它构建一个持久的代码库地图,让 AI 编码工具只读取重要的内容,并在审查和大规模仓库工作流中提供了基准测试的上下文减少。
MCP 服务会以你的权限运行代码或访问你的数据。安装前请先看项目主页与源码,只给必要的权限;密钥请自行填入,不要提交到仓库。
claude mcp add code-review-graph -- uvx code-review-graph==2.3.9
{
"mcpServers": {
"code-review-graph": {
"command": "uvx",
"args": [
"code-review-graph==2.3.9"
]
}
}
}安装方式由项目的发布配置推断,并已核对该包确属此仓库;需要的环境变量 / 密钥请看下方「怎么使用」
摘自项目自己的说明,具体以项目主页为准。
pip install code-review-graph # or: pipx install code-review-graph
code-review-graph install # detect installed AI coding tools and configure each one
code-review-graph build # parse the codebase
install detects which AI coding tools you have, writes an MCP server entry for each, installs hooks and skills where the platform supports them, and adds graph instructions to the platform's rules file. The MCP entry uses poetry run or uv run inside a Poetry or uv project environment, uvx code-review-graph serve when uvx is on PATH, and otherwise the current Python interpreter. Restart the editor or tool afterwards.
To configure one platform, pass --platform with one of codex, claude-code, cursor, windsurf, zed, continue, opencode, antigravity, gemini-cli, qwen, kiro, qoder, copilot, copilot-cli, codebuddy, or hermes:
code-review-graph install --platform cursor
code-review-graph install --platform codebuddy
Config file locations are listed in docs/USAGE.md. Requires Python 3.10+.
uninstall removes CRG-owned files and entries from a Git or SVN working tree and leaves other MCP servers, hooks, skills and JSONC comments alone. Run it from anywhere inside the tree. Shared config files are replaced atomically, so a failed write leaves the original intact.
code-review-graph uninstall --dry-run # preview only
code-review-graph uninstall # preview, confirm, apply
code-review-graph uninstall --yes # apply without prompting
code-review-graph uninstall --all-repos # also clean every registered repository
code-review-graph uninstall --keep-data # remove integrations, keep graph databases
code-review-graph uninstall --keep-user-configs --repo . # this project only
Then open the project and ask the assistant:
Build the code review graph for this project
Build time scales with repository size; a cold build of a ~3,000-file repository took about 40 seconds (measured). After that, hooks and watch mode keep the graph updated. If some files fail to parse, the result has status partial and names them in its summary; the CLI also prints a Warning: line on stderr, and those files keep their previous graph rows.