MCP-CodeReviewer
Automated AI code review on GitHub pull requests, with line-level comments and suggestions.
Triggers automated code reviews via GitHub Actions workflow when a pull request is created.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@MCP-CodeReviewerreview PR #12 for security and style issues"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
🔍 MCP-CodeReviewer
基于 MCP 协议的三层漏斗式 AI 代码审查引擎 通过确定性静态分析与动态模型路由,在保证审查深度的同时降低 70%+ 的 LLM Token 消耗。
🏗️ 架构
PR 触发 → GitHub Actions
→ git diff (宿主机) → Docker 容器
→ ci_runner.py
→ 白名单代码提取 + 正则函数提取
→ RAG 规范检索 (独立降级)
→ 影响面雷达 ripgrep (独立降级)
→ Phase3 Prompt 拼装
→ LLM 审查 (deepseek-v4-flash)
→ 三级防御 L1/L2/L3 → GitHub 行级评论 (含 Suggestion)
→ ReviewMetrics 落盘 → upload-artifactRelated MCP server: Multi-MCP
🚀 快速开始
1. 安装
git clone <repo-url>
cd mcp-code-reviewer
pip install -r requirements.txt2. Mock 模式(无需 API Key)
python orchestrator.py --mock3. 真实审查
export DEEPSEEK_API_KEY=***
python orchestrator.py4. 接入 GitHub PR
# 复制 workflow 到目标仓库
cp .github/workflows/ai-review.yml <target-repo>/.github/workflows/
# 配置 Secrets: DEEPSEEK_API_KEY
# 配置 Actions 权限: Read and write
# 创建 PR,自动触发审查📁 项目结构
├── mcp_server.py # MCP Server (3 Tools)
├── orchestrator.py # MCP Client + Prompt 工程
├── ci_runner.py # CI/CD 桥梁 + 三级防御
├── rag_engine.py # 轻量 RAG (SQLite)
├── impact_analyzer.py # 影响面雷达 (ripgrep)
├── metrics.py # ReviewMetrics 黑匣子
├── Dockerfile # 生产级镜像
├── scripts/
│ └── aggregate_metrics.py # Metrics 聚合分析
└── test_cases/ # 测试用例🛡️ 三级防御
级别 | 方法 | 防护目标 |
L1 | unidiff 行号映射 O(1) 精确匹配 | 防 LLM 幻觉原代码 |
L2 | 物理字符串切片提取缩进 | 防正则跨行漏洞 |
L3 | AST 宽容预检 + 补 pass | 防破坏性提交 |
校验失败不丢弃 issue → 降级为纯文本警告评论。
🧪 测试
python test_static_analysis.py # 15 用例 ✅
python test_complexity_router.py # 9 用例 ✅
python eval_quality.py # LLM 质量评估 (30 bugs)📊 可观测性
每次审查自动生成 review_metrics.json,包含 30+ 指标:
管线各阶段耗时 (RAG/雷达/LLM)
三级防御 L1/L2/L3 通过/失败计数
Suggestion 成功率
RAG 降级率
# 本地聚合分析
python scripts/aggregate_metrics.py ./downloaded_metrics/🔧 技术栈
组件 | 技术 |
MCP Server | Python + mcp SDK + FastAPI |
静态分析 | ast.NodeVisitor |
Diff 解析 | unidiff |
影响面分析 | ripgrep |
RAG | SQLite + numpy |
LLM Gateway | litellm |
容器化 | Docker (python:3.11-slim) |
CI/CD | GitHub Actions |
📝 技术债
License
MIT
This server cannot be deployed
Maintenance
Related MCP Connectors
AI-native git hosting — repos, PRs, issues, CI gates, and AI code review over MCP (60 tools).
AI code review for GitHub PRs with an MCP autofix loop for Claude Code and Cursor
Multi-LLM council: 25+ frontier models in parallel, consensus scoring, verdict-first code review.
Code intelligence platform for AI agents. 20 tools for architecture, security & impact analysis.
Related MCP Servers
- AlicenseAqualityDmaintenanceProvides intelligent code context and analysis through semantic compression, AST parsing, and multi-language support. Offers 60-80% token reduction while enabling AI assistants to understand codebases through local analysis, OpenAI-enhanced insights, and GitHub repository integration.610 npm3MIT
- AlicenseAqualityBmaintenanceA multi-model AI orchestration MCP server for automated code review and LLM-powered analysis, integrating with Claude Code and OpenCode to orchestrate multiple AI models for code quality checks, security analysis, and multi-agent consensus.635MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI-powered, zero-trust code review with multiple models, supporting single files, git diffs, and multiple files, with security, performance, and architecture checks across 10+ languages.13MIT
- FlicenseNot gradedqualityDmaintenanceEnables automated AI-powered code review for pull requests across GitHub, GitLab, Bitbucket, and Azure DevOps via webhooks, and manual code review through MCP tools using Groq, Claude, or GPT-4.1-