GitLab MCP Code Review
Enables 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.
README
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 集成
克隆此仓库:
git clone https://gitea.ffpy.site/ffpy/gitlab-mcp-code-review.git
cd gitlab-mcp-code-review
要将此 MCP 与 Cursor IDE 一起使用,请将以下配置添加到你的 ~/.cursor/mcp.json 文件中:
{
"mcpServers": {
"gitlab-mcp-code-review": {
"command": "uv",
"args": [
"--directory",
"/path/to/your/gitlab-mcp-code-review",
"run",
"server.py"
],
"env": {
"GITLAB_HOST": "gitlab.com",
"GITLAB_TOKEN": "xxx"
}
}
}
}
- 将
/path/to/your/gitlab-mcp-code-review替换为你克隆仓库的实际路径。 - 将
GITLAB_HOST修改为你的Gitlab地址 - 将
GITLAB_TOKEN修改为你的AccessToken
可用工具
MCP 服务器提供以下工具用于与 GitLab 交互:
| 工具 | 描述 |
|---|---|
fetch_merge_request |
获取有关合并请求的完整信息 |
compare_versions |
比较不同的分支、标签或提交 |
add_merge_request_comment |
向合并请求添加评论 |
approve_merge_request |
批准合并请求 |
unapprove_merge_request |
取消批准合并请求 |
get_project_merge_requests |
获取项目的合并请求列表 |
故障排除
如果遇到问题:
- 验证你的 GitLab 令牌是否具有适当的权限 (api, read_api)
- 确保你的 MCP 配置路径正确
- 使用以下命令测试连接:
curl -H "Private-Token: your-token" https://gitlab.com/api/v4/projects
许可证
本项目根据 MIT 许可证授权 - 有关详细信息,请参阅 LICENSE 文件。
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.