Back to MCP directory
publicPublicdnsLocal runtime

code-reviewer-fixer-agent

AI代码审查与问题修复代理,用于分析代码库、检测安全漏洞、审查代码质量,并根据Sentry错误日志提供修复建议。

article

README

🚀 21天智能代理系列:第11天——AI代码审查及修复器

这是“每天一个新AI代理!”系列中的第11天代理——AI代码审查及修复器 🛠️🚀 该智能代理可分析代码仓库、检测潜在的安全漏洞、评估代码质量,并根据Sentry错误日志提供修复建议,它使用了Sentry和GitHub MCP服务器!

🚀 快速开始

此AI代码审查及修复器能助力开发者快速检测代码问题并提供修复建议。以下为您详细介绍启动步骤。

📦 安装指南

先决条件

  • Python 3.9或更高版本
  • Git
  • 虚拟环境(推荐)

安装步骤

  1. 克隆仓库:
git clone <repository-url>
cd <repository-folder>
  1. 安装依赖项:
pip install -r requirements.txt
  1. 在项目根目录中创建一个.env文件,并按如下方式配置:
AZURE_OPENAI_ENDPOINT="你的Azure OpenAI端点"
AZURE_OPENAI_API_VERSION="你的Azure OpenAI版本"
AZURE_OPENAI_API_KEY="你的Azure OpenAI API密钥"
GITHUB_PERSONAL_ACCESS_TOKEN="你的GitHub个人访问令牌"
SENTRY_AUTH_TOKEN="你的Sentry认证令牌"

💻 使用示例

启动应用程序

启动FastAPI服务器:

uvicorn upsonicai:app --reload

在浏览器中打开UI界面:

http://127.0.0.1:8000/

MCP配置

修改您的MCP配置以包含GitHub和Sentry:

"mcpServers": {
  "github": {
    "command": "npx",
    "args": ["-y", "@modelcontextprotocol/server-github"],
    "env": {
      "GITHUB_PERSONAL_ACCESS_TOKEN": "你的GitHub令牌"
    }
  },
  "sentry": {
    "command": "python",
    "args": ["-m", "mcp_server_sentry", "--auth-token", "你的Sentry令牌"]
  }
}

✨ 主要特性

  • 获取GitHub/GitLab仓库的最新提交
  • 分析代码质量并检测安全漏洞
  • 从Sentry获取错误日志
  • 提供修复建议和可操作的见解

📚 详细文档

API文档

交互式API文档可通过以下链接访问:

help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client