
Security News
GitHub Actions Checkout Now Blocks Risky pull_request_target Checkouts
GitHub Actions checkout now blocks risky pull_request_target checkouts by default to help prevent pwn request supply chain attacks.
ai-code-review-mcp
Advanced tools
基于 MCP (Model Context Protocol) 的智能代码审查系统,集成 DeepSeek AI 和 Gitee 平台,为代码审查提供智能化支持。
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐
│ MCP Client │ │ MCP Server │ │ External APIs │
│ (Claude等) │◄──►│ (本系统) │◄──►│ DeepSeek/Gitee │
└─────────────────┘ └─────────────────┘ └─────────────────┘
# 全局安装
npm install -g ai-code-review-mcp
# 初始化配置
ai-code-review-mcp --setup
# 启动服务
ai-code-review-mcp
# 克隆项目
git clone <repository-url>
cd ai-code-review
# 安装依赖
npm install
# 初始化配置
npm run setup
# 启动服务
npm start
# DeepSeek API配置
export DEEPSEEK_API_KEY="your_deepseek_api_key"
# Gitee API配置
export GITEE_ACCESS_TOKEN="your_gitee_access_token"
# DeepSeek API配置
export DEEPSEEK_BASE_URL="https://api.deepseek.com" # 默认值
export DEEPSEEK_MODEL="deepseek-coder" # 默认值
# 日志配置
export LOG_LEVEL="INFO" # 默认值
export LOG_FILE="logs/mcp_server.log" # 默认值
# MCP服务配置
export MCP_SERVER_NAME="ai-code-review" # 默认值
export MCP_SERVER_VERSION="1.0.0" # 默认值
创建 .env 文件:
# 复制示例配置
cp .env.example .env
# 编辑配置文件
vim .env
或者在用户主目录创建全局配置:
# 创建全局配置文件
touch ~/.ai-code-review-mcp.env
# 添加配置
echo "DEEPSEEK_API_KEY=your_key_here" >> ~/.ai-code-review-mcp.env
echo "GITEE_ACCESS_TOKEN=your_token_here" >> ~/.ai-code-review-mcp.env
在支持 MCP 的客户端(如 Claude Desktop)中配置:
{
"mcpServers": {
"ai-code-review": {
"command": "ai-code-review-mcp",
"args": []
}
}
}
# 显示帮助
ai-code-review-mcp --help
# 显示版本
ai-code-review-mcp --version
# 初始化配置
ai-code-review-mcp --setup
# 启动服务(默认)
ai-code-review-mcp
系统提供以下 MCP 工具:
审查代码片段或文件
参数:
code: 要审查的代码内容language: 编程语言 (可选)context: 额外上下文信息 (可选)审查 Gitee Pull Request
参数:
repo_url: 仓库 URLpr_number: PR 编号review_scope: 审查范围 (可选: 'full', 'diff', 'files')获取 Pull Request 信息
参数:
repo_url: 仓库 URLpr_number: PR 编号创建审查评论
参数:
repo_url: 仓库 URLpr_number: PR 编号comment: 评论内容file_path: 文件路径 (可选)line_number: 行号 (可选)ai-code-review/
├── bin/ # 可执行脚本
│ └── ai-code-review-mcp
├── mcp/ # MCP服务核心
│ ├── __init__.py
│ ├── mcp_server.py # MCP服务器
│ ├── mcp_adapter.py # MCP适配器
│ ├── mcp_config.py # 配置管理
│ └── services/ # 业务服务
│ ├── code_review_service.py
│ ├── deepseek_service.py
│ ├── gitee_service.py
│ └── pr_automation_service.py
├── start_mcp.py # 启动脚本
├── requirements.txt # Python依赖
├── package.json # npm配置
└── README.md
# 安装开发依赖
pip install -r requirements.txt
# 运行测试
pytest
# 代码格式化
black .
# 类型检查
mypy .
环境变量未设置
错误: 缺少必要的环境变量: DEEPSEEK_API_KEY
解决: 设置相应的环境变量或创建 .env 文件
Python 版本不兼容
错误: 未找到python3命令
解决: 安装 Python 3.8+
依赖安装失败
错误: 无法安装Python依赖
解决: 检查网络连接,或使用国内镜像源
# 查看服务日志
tail -f logs/mcp_server.log
# 查看错误日志
grep ERROR logs/mcp_server.log
git checkout -b feature/AmazingFeature)git commit -m 'Add some AmazingFeature')git push origin feature/AmazingFeature)本项目采用 MIT 许可证 - 查看 LICENSE 文件了解详情。
如有问题或建议,请:
FAQs
AI代码审查MCP服务 - 基于DeepSeek和Gitee的智能代码审查工具
The npm package ai-code-review-mcp receives a total of 46 weekly downloads. As such, ai-code-review-mcp popularity was classified as not popular.
We found that ai-code-review-mcp demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
GitHub Actions checkout now blocks risky pull_request_target checkouts by default to help prevent pwn request supply chain attacks.

Product
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.

Product
Socket MCP now lets AI assistants review org alerts, investigate threats using the Socket threat feed, and inspect package files in addition to dependency scoring.