Provides tools for GitLab merge request management, including analyzing merge requests with full details and diffs, comparing different branches/tags/commits, adding comments, and managing approvals through the GitLab API.
GitLab MCP 代码审查工具
本项目 fork 自 cayirtepeomer/gerrit-code-review-mcp 并为 GitLab 集成进行了适配。
一个用于将 Claude 等 AI 助手与 GitLab 的合并请求集成的 MCP (Model Context Protocol) 服务器。这使得 AI 助手可以通过 GitLab API 直接审查代码变更。
功能
完整的合并请求分析: 获取合并请求的全部详情,包括差异、提交和评论
文件特定的差异: 分析合并请求中特定文件的变更
版本比较: 比较不同的分支、标签或提交
审查管理: 添加评论、批准或取消批准合并请求
项目概览: 获取项目中的所有合并请求列表
安装
先决条件
Python 3.10+
uv
具有 API 范围 (read_api, api) 的 GitLab 个人访问令牌
用于 MCP 集成的 Cursor IDE 或 Claude 桌面应用
Cursor IDE 集成
克隆此仓库:
要将此 MCP 与 Cursor IDE 一起使用,请将以下配置添加到你的 ~/.cursor/mcp.json 文件中:
将
/path/to/your/gitlab-mcp-code-review替换为你克隆仓库的实际路径。将
GITLAB_HOST修改为你的Gitlab地址将
GITLAB_TOKEN修改为你的AccessToken
可用工具
MCP 服务器提供以下工具用于与 GitLab 交互:
工具 | 描述 |
| 获取有关合并请求的完整信息 |
| 比较不同的分支、标签或提交 |
| 向合并请求添加评论 |
| 批准合并请求 |
| 取消批准合并请求 |
| 获取项目的合并请求列表 |
故障排除
如果遇到问题:
验证你的 GitLab 令牌是否具有适当的权限 (api, read_api)
确保你的 MCP 配置路径正确
使用以下命令测试连接:
curl -H "Private-Token: your-token" https://gitlab.com/api/v4/projects
许可证
本项目根据 MIT 许可证授权 - 有关详细信息,请参阅 LICENSE 文件。
Related Resources
Related MCP Servers
- -securityFlicense-qualityA custom server implementation that allows AI assistants to interact with GitLab repositories, providing capabilities for searching, fetching files, creating/updating content, and managing issues and merge requests.Last updated -1
- -securityAlicense-qualityIntegrates GitLab merge request analysis with Confluence documentation, allowing users to fetch merge request details, analyze code changes, and store analysis results in Confluence pages.Last updated -MIT License
- -securityAlicense-qualityAn MCP server that integrates AI assistants like Claude with GitLab's merge requests, allowing them to review code changes, add comments, and approve/unapprove merge requests directly through the GitLab API.Last updated -36MIT License
- -securityFlicense-qualityProvides GitLab integration for AI assistants using Model Context Protocol, enabling repository operations, file management, issue tracking, merge requests, and branch/tag administration through natural language.Last updated -2