@shareworker/code-review-mcp
OfficialThe @shareworker/code-review-mcp server provides deterministic engineering tools for code review workflows, designed to be called by AI agents (Claude Code, Cursor, Codex, Devin) without the server itself invoking any LLM.
get_review_targets— Identifies files requiring review from a git diff (workspace, range, or commit), applying filtering and returning adiff_reffor downstream tools.get_file_bundle— Groups related files (e.g., test/source pairs, i18n variants) into smart review bundles with a 20,000-character cap, optimized for LLM context.match_rules— Matches a file path against project-specific or built-in review rules and returns aprompt_sectionfor the host LLM to inject into its review prompt.search_code— Performs cross-file text search viagit grepto gather evidence for potential issues.read_file_context— Extracts specific, bounded slices of file content based on anchors or explicit line ranges.position_comment— Precisely locates exact line numbers for a review comment using text matching, hunk alignment, and fuzzy matching to avoid position drift.reflect_comment— Deterministically validates a positioned review comment (no LLM involved), running checks likeline_in_hunkandexisting_code_in_diffto decide whether to keep or drop it.get_lint_findings— Runs project linters (ESLint, golangci-lint, ruff) on changed files for ground-truth findings.scan_secrets— Detects hardcoded secrets (AWS keys, PEM, API tokens) in added diff lines, with masked output.check_dependency_diff— Compares dependency manifests (e.g.,package.json,requirements.txt,go.mod) to detect added, removed, or unpinned dependencies.get_file_history_stats— Provides commit statistics (total commits, fix-commit ratio, last modified) to help prioritize review attention.run_affected_tests— Executesnpm run test(or configured equivalent) on affected code with a timeout to check for regressions.get_importers— Finds all files that import a given file via static analysis (reverse dependency lookup).dedupe_comments— Removes redundant review comments based on Jaccard text similarity and existing code matching.
@shareworker/code-review-mcp
English
An MCP server that exposes the deterministic engineering layer of code review as tools, callable by host agents (Claude Code, Cursor, Codex, Devin) within their own LLM loops. The server never calls an LLM — all reasoning happens in the host session.
Why
General-purpose agents doing code review via Skills suffer from: incomplete coverage (skipping files on large changesets), position drift (line numbers don't match actual code), and unstable quality (minor prompt variations cause large quality swings). This server enforces hard constraints on the review process — file selection, smart bundling, rule matching, comment positioning, and comment reflection — so quality is stable regardless of host model variation.
Tools
Tool | Purpose |
| Git diff → file filtering → |
| Smart bundling (test/source + i18n) with 20000 char cap, density-sorted, i18n key consistency diff |
| Path-based rule matching → |
| Cross-file text search via |
| Bounded file slice reader — anchored or explicit line range, ref-then-worktree fallback |
| Text match + hunk align + fuzzy match → precise line numbers |
| Deterministic validation (keep/drop) — 4 checks including |
| Run project linters (ESLint, golangci-lint, ruff) on changed files → ground-truth findings |
| Scan added diff lines for hardcoded secrets (AWS keys, PEM, API tokens) — masked output |
| Compare package.json/requirements.txt/go.mod before vs after → added/removed/unpinned deps |
| File commit history → total commits, fix-commit ratio, last modified — prioritize review attention |
| Execute |
| Reverse dependency lookup — find all files that import a given file (static analysis) |
| Deduplicate review comments by Jaccard text similarity + existing_code match — no LLM |
Design Lineage
This project's split between deterministic engineering and LLM reasoning is inspired by alibaba/open-code-review, a battle-tested CLI that runs both halves itself (agent loop, concurrency, multi-tier comment positioning, language-specific rules). This project exposes only the deterministic half as MCP tools, so any MCP-compatible host agent can supply the reasoning half using its own model. It is a narrower, host-agnostic subset, not a feature-equivalent reimplementation.
Installation
Run this in your project directory:
npx @shareworker/code-review-mcp@latest setupThis detects which agents are present (.claude/, .cursor/, .devin/, .codex/),
writes the MCP config entry, and installs the skill for each. Restart your agent
and the code-review MCP server is available. Works on macOS, Linux, and Windows.
Optional flags:
--global: write the MCP config and skill to your user home directory instead of the current project, so the server is available across all your projects--agent <name>: set up only the specified agent (claude,cursor,devin,codex); can be combined with--global
npx @shareworker/code-review-mcp@latest setup --global --agent claudeUninstall
Remove this package's MCP entry and installed skill, while preserving other agent configuration and review rules:
npx @shareworker/code-review-mcp@latest uninstall
npx @shareworker/code-review-mcp@latest uninstall --agent devin
# remove from user home directory
npx @shareworker/code-review-mcp@latest uninstall --global
npx @shareworker/code-review-mcp@latest uninstall --global --agent devinFor each detected agent (or only the one passed via --agent):
Removes the
code-reviewentry from the agent's MCP config (leaves other entries intact)Deletes the installed skill file (
SKILL.md, orcode-review.mdcfor Cursor) and the skill directory if it becomes empty
It does not remove the agent directory, other skills, .code-review/rules.json, or the npm package.
Add to your agent's MCP config (.mcp.json at project root for Claude Code / .cursor/mcp.json / .devin/config.json / .codex/config.toml):
{
"mcpServers": {
"code-review": {
"command": "npx",
"args": ["-y", "@shareworker/code-review-mcp@latest"]
}
}
}For Codex (TOML format), add this section to .codex/config.toml instead:
[mcp_servers.code-review]
command = "npx"
args = ["-y", "@shareworker/code-review-mcp@latest"]Configuration
Optional — the server works out of the box with built-in default rules:
language-specific rules for TS/JS/TSX/JSX, Python, Go, Java, C/C++, Rust, QML/Qt,
JSON, YAML, XML (SQL mapper), GitHub Actions workflows, Dockerfiles, and
package.json, plus a generic default covering correctness, security,
performance, maintainability, and test coverage.
Only create .code-review/rules.json when you need project-specific rules.
To generate an example config in your repo:
npx @shareworker/code-review-mcp@latest init-configOr create .code-review/rules.json manually (or ~/.code-review/rules.json
for global config):
{
"filters": {
"exclude": ["**/*.lock", "**/*.min.js", "**/*.map"],
"include": ["**/*.ts", "**/*.js"]
},
"rules": [
{
"path": "**/*.ts",
"rule": "Check for any types and proper null handling"
},
{
"path": "**/*mapper*.xml",
"rule": "Check SQL for injection risks and missing closing tags"
}
]
}Configuration Resolution Priority
--rule <path>flag (highest) — not exposed via MCP, reserved for future CLI<repo>/.code-review/rules.json— project-level~/.code-review/rules.json— global/user-levelBuilt-in defaults (lowest) — covers correctness, security, performance, maintainability, test coverage
For MVP, only layers 2-4 are active (the --rule flag is not yet exposed via the CLI).
The first matching user rule replaces the built-in system rule at the same layer.
filters
exclude: glob patterns for files to exclude (merged with built-in defaults)include: glob patterns — when present, only matching files are reviewed
rules
Array of { "path": "<glob>", "rule": "<text>" }. First match wins. The rule
text is returned as prompt_section for the host LLM to inject into its review
prompt.
Development
npm install
npm run build # compile TypeScript
npm test # run unit tests
npm run dev # watch modeLicense
MIT
Related MCP server: grippy-code-review
中文
一个 MCP 服务器,将代码审查的确定性工程层封装为工具,供宿主代理(Claude Code、 Cursor、Codex、Devin)在自身的 LLM 循环中调用。服务器自身不调用任何 LLM —— 所有推理 都在宿主会话中完成。
为什么需要
通用代理通过 Skill 做代码审查时存在三大问题:覆盖不完整(大变更集时跳过文件)、 定位漂移(行号与实际代码不匹配)、质量不稳定(提示词微小变化导致质量大幅波动)。 本服务器对审查流程施加硬约束 —— 文件选择、智能打包、规则匹配、评论定位、 评论反思 —— 使质量不受宿主模型变化影响。
工具
工具 | 职责 |
| Git diff → 文件过滤 → 返回 |
| 智能打包(测试/源码配对 + i18n 配对),20000 字符上限,密度排序,i18n key 一致性 diff |
| 路径匹配规则 → 返回 |
| 跨文件文本检索( |
| 有限范围文件读取 —— 锚点或显式行区间,ref/worktree 回退 |
| 文本匹配 + hunk 对齐 + 模糊匹配 → 精确行号 |
| 确定性验证(保留/丢弃)—— 4 项检查含 |
| 运行项目 linter(ESLint、golangci-lint、ruff)→ ground-truth 发现 |
| 扫描新增 diff 行中的硬编码密钥(AWS key、PEM、API token)—— 输出已脱敏 |
| 对比 package.json/requirements.txt/go.mod 变更前后 → 新增/删除/未锁定依赖 |
| 文件提交历史 → 总提交数、修复提交比例、最后修改时间 —— 用于审查优先级 |
| 执行 |
| 反向依赖查找 —— 找出所有 import 指定文件的文件(静态分析) |
| 按 Jaccard 文本相似度 + existing_code 匹配去重评论 —— 不调用 LLM |
安装
在项目目录下运行:
npx @shareworker/code-review-mcp@latest setup自动检测项目中存在哪些 agent(.claude/、.cursor/、.devin/、.codex/),
为每个 agent 写入 MCP 配置并安装 skill。重启 agent 即可使用。适用于 macOS、Linux、Windows。
可选参数:
--global:将 MCP 配置和 skill 写入用户主目录而非当前项目,使服务器对所有项目生效--agent <name>:仅安装指定 agent(claude、cursor、devin、codex),可与--global组合
npx @shareworker/code-review-mcp@latest setup --global --agent claude卸载
移除本包写入的 MCP 配置和安装的 skill,保留其他 agent 配置与 review 规则:
npx @shareworker/code-review-mcp@latest uninstall
npx @shareworker/code-review-mcp@latest uninstall --agent devin
# 移除用户主目录中的配置
npx @shareworker/code-review-mcp@latest uninstall --global
npx @shareworker/code-review-mcp@latest uninstall --global --agent devin对每个检测到的 agent(或通过 --agent 指定的 agent):
从 agent 的 MCP 配置中移除
code-review条目(保留其他条目)删除已安装的 skill 文件(
SKILL.md,Cursor 为code-review.mdc),若 skill 目录因此变空则一并删除
不会删除 agent 目录、其他 skill、.code-review/rules.json 或 npm 包。
将以下内容添加到 agent 的 MCP 配置(Claude Code 为项目根目录的 .mcp.json / .cursor/mcp.json / .devin/config.json / .codex/config.toml):
{
"mcpServers": {
"code-review": {
"command": "npx",
"args": ["-y", "@shareworker/code-review-mcp@latest"]
}
}
}Codex 使用 TOML 格式,请在 .codex/config.toml 中添加以下段落:
[mcp_servers.code-review]
command = "npx"
args = ["-y", "@shareworker/code-review-mcp@latest"]配置
可选 —— 服务器开箱即用,内置默认规则:针对 TS/JS/TSX/JSX、Python、Go、Java、
C/C++、Rust、QML/Qt、JSON、YAML、XML(SQL Mapper)、GitHub Actions workflow、
Dockerfile、package.json 的语言专属规则,以及覆盖正确性、安全性、性能、
可维护性、测试覆盖率的通用默认规则。
仅在需要项目特定规则时才创建 .code-review/rules.json。
在仓库中生成示例配置:
npx @shareworker/code-review-mcp@latest init-config或手动创建 .code-review/rules.json(或 ~/.code-review/rules.json 作为全局配置):
{
"filters": {
"exclude": ["**/*.lock", "**/*.min.js", "**/*.map"],
"include": ["**/*.ts", "**/*.js"]
},
"rules": [
{
"path": "**/*.ts",
"rule": "检查 any 类型和空值处理"
},
{
"path": "**/*mapper*.xml",
"rule": "检查 SQL 注入风险和标签闭合"
}
]
}配置优先级
--rule <path>命令行参数(最高)—— MCP 未暴露,预留给未来 CLI<repo>/.code-review/rules.json—— 项目级~/.code-review/rules.json—— 全局/用户级内置默认规则(最低)—— 覆盖正确性、安全性、性能、可维护性、测试覆盖率
MVP 版本仅启用 2-4 层(--rule 参数尚未通过 CLI 暴露)。同一层中首个匹配的用户规则
替换内置系统规则。
filters
exclude:排除文件的 glob 模式(与内置默认黑名单合并)include:包含文件的 glob 模式 —— 存在时仅审查匹配的文件
rules
{ "path": "<glob>", "rule": "<文本>" } 数组。首个匹配生效。rule 文本作为
prompt_section 返回,供宿主 LLM 注入审查提示词。
开发
npm install
npm run build # 编译 TypeScript
npm test # 运行单元测试
npm run dev # 监听模式许可证
MIT
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseBqualityDmaintenanceA code review tool server based on Model Context Protocol (MCP), providing multi-dimensional code review and scoring functions.42Apache 2.0
- Alicense-qualityCmaintenanceOpen-source AI code review MCP server for local git diff auditing with deterministic security rules and AI-powered analysis using any OpenAI-compatible model.4MIT
- Alicense-qualityFmaintenanceA code review tool server based on Model Context Protocol (MCP) providing multi-dimensional code review and scoring.7MIT
- Alicense-qualityCmaintenanceMCP server for reviewing code changes using LLMs, supporting Copilot, Ollama, and OpenAI-compatible endpoints.MIT
Related MCP Connectors
MCP server providing access to the Scorecard API to evaluate and optimize LLM systems.
MCP server for generating rough-draft project plans from natural-language prompts.
MCP server for AI agents to plan, verify, and deploy Cloudflare-native apps.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/shareworker/code-review'
If you have feedback or need assistance with the MCP directory API, please join our Discord server