Gerrit Review MCP Server
Gerrit 审查 MCP 服务器
该 MCP 服务器提供与 Gerrit 代码审查系统的集成,允许 AI 助手通过简单的界面审查代码更改及其详细信息。
特征
该服务器提供了一套精简的代码审查工具集:
获取更改详细信息
fetch_gerrit_change(change_id: str, patchset_number: Optional[str] = None)获取完整的变更信息,包括文件和补丁集
显示每个修改文件的详细差异信息
显示文件更改、插入和删除
支持审查特定补丁集
返回全面的变更详细信息,包括:
项目和分支信息
作者和审阅者详细信息
评论和评论历史
具有不同内容的文件修改
当前补丁集信息
比较补丁集差异
fetch_patchset_diff(change_id: str, base_patchset: str, target_patchset: str, file_path: Optional[str] = None)比较两个补丁集之间的差异
查看特定文件差异或所有更改的文件
分析跨补丁集版本的代码修改
通过审查迭代跟踪变化的演变
示例用法
审查完整的变更:
# Fetch latest patchset of change 23824
change = fetch_gerrit_change("23824")比较特定的补丁集:
# Compare differences between patchsets 1 and 2 for change 23824
diff = fetch_patchset_diff("23824", "1", "2")查看具体文件变更:
# Get diff for a specific file between patchsets
file_diff = fetch_patchset_diff("23824", "1", "2", "path/to/file.swift")Related MCP server: Chromium CodeSearch MCP
先决条件
Python 3.10 或更高版本(推荐 Python 3.11)
Gerrit HTTP 访问凭据
从 Gerrit 设置生成的 HTTP 密码
访问
mcp[cli]包存储库(私有包)
安装
克隆此存储库:
git clone <repository-url>
cd gerrit-review-mcp创建并激活虚拟环境:
# For macOS/Linux:
python -m venv .venv
source .venv/bin/activate
# For Windows:
python -m venv .venv
.venv\Scripts\activate以可编辑模式安装此包及其依赖项:
pip install -e .配置
设置环境变量:
export GERRIT_HOST="gerrit.example.com" # Your Gerrit server hostname
export GERRIT_USER="your-username" # Your Gerrit username
export GERRIT_HTTP_PASSWORD="your-http-password" # Your Gerrit HTTP password或者创建一个.env文件:
GERRIT_HOST=gerrit.example.com
GERRIT_USER=your-username
GERRIT_HTTP_PASSWORD=your-http-password生成 HTTP 密码:
登录您的 Gerrit Web 界面
前往“设置”>“HTTP 凭证”
生成新密码
将密码复制到您的环境或 .env 文件
MCP 配置
要将此 MCP 服务器与 Cursor 一起使用,您需要将其配置添加到~/.cursor/mcp.json文件中。以下是所需的配置:
{
"mcpServers": {
"gerrit-review-mcp": {
"command": "/path/to/your/workspace/gerrit-code-review-mcp/.venv/bin/python",
"args": [
"/path/to/your/workspace/gerrit-code-review-mcp/server.py",
"--transport",
"stdio"
],
"cwd": "/path/to/your/workspace/gerrit-code-review-mcp",
"env": {
"PYTHONPATH": "/path/to/your/workspace/gerrit-code-review-mcp",
"VIRTUAL_ENV": "/path/to/your/workspace/gerrit-code-review-mcp/.venv",
"PATH": "/path/to/your/workspace/gerrit-code-review-mcp/.venv/bin:/usr/local/bin:/usr/bin:/bin"
},
"stdio": true
}
}
}将/path/to/your/workspace替换为您的实际工作区路径。例如,如果您的项目位于/Users/username/projects/gerrit-code-review-mcp ,请使用该路径。
确保配置中的所有路径都指向:
你的虚拟环境的 Python 解释器
项目的
server.py文件正确的工作目录
虚拟环境的 bin 目录在 PATH 中
实现细节
服务器使用 Gerrit REST API 与 Gerrit 交互,提供:
快速可靠的变更信息检索
使用 HTTP 摘要式身份验证进行安全身份验证
支持各种 Gerrit REST 端点
干净且可维护的代码库
HTTPS 加密,实现安全通信
故障排除
如果遇到连接问题:
验证您的 HTTP 密码是否设置正确
检查 GERRIT_HOST 设置
确保 Gerrit 服务器上启用了 HTTPS 访问
使用 curl 测试连接:
curl -u "username:http-password" https://your-gerrit-host/a/changes/验证您帐户的 Gerrit 访问权限
执照
该项目已获得 MIT 许可。
贡献
欢迎投稿!请:
分叉存储库
创建功能分支
进行更改
提交拉取请求
This server cannot be installed
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
- AlicenseAqualityDmaintenanceEnables AI assistants to review GitLab merge requests by fetching changes, analyzing diffs, adding comments, and managing approvals through the GitLab API. Supports complete merge request analysis, file-specific reviews, and version comparisons.124MIT
- AlicenseAqualityNot gradedmaintenanceEnables AI assistants to search and explore Chromium and PDFium source code, check Gerrit code reviews with test results and bot errors, search issues, and analyze commit history through Google's official APIs.16232619
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to interact with Phabricator for task management and code review workflows, including viewing and commenting on tasks, managing differential revisions, and providing intelligent review analysis with code context.7MIT
- AlicenseAqualityCmaintenanceMCP Server providing AI agents with tooling for Gerrit code review workflows via stdio transport.18141MIT
Related MCP Connectors
Connect AI assistants to GitHub - manage repos, issues, PRs, and workflows through natural language.
Connect AI assistants to your GitHub-hosted Obsidian vault to seamlessly access, search, and analy…
Git-backed platform for skills, tools, and context for AI agents
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/cayirtepeomer/gerrit-code-review-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server