
Gitlab 的 MCP 服务器用来获取合并请求的审核
概览
将你的 AI 助手连接到 GitLab。直接在聊天中问诸如“列出未完成合并请求”、“显示MR #123的评价”、“获取MR #456提交讨论”或“查找功能分支的合并请求”等问题。 建议使用 pipx 或 uv 工具,因为它们会自动将 gitlab-mcp 命令添加到你的 PATH 中。如果使用 pip 安装,确保你的 Python 脚本目录在 PATH,或者使用命令的完整路径。 1. 进入 GitLab →设置→访问令牌 2.创建带权限的令牌(如果你想写权限,可以添加 API 范围) 3.复制令牌 对于使用 ,添加到你的全局 MCP 配置中(光标用 ~/.cursor/mcp.json): 这个单一配置可以跨越 。使用 search_projects 或 list_my_projects 查找项目 ID,然后在请求中指定project_id。 对于使用 ,你可以设置默认的项目 ID: 重启你的MCP客户端,开始向GitLab提问! 连接好后,在聊天中尝试以下指令:
概述(AI 翻译)
把你的AI助手连接到GitLab。直接在你的聊天里问诸如_“列表未合并请求”、“显示MR #123的评价”、“获取MR #456提交讨论”或“查找功能分支的合并请求”_。
目录
- 快速设置
- 你能做的事
- 配置选项
- 故障排除
- 工具参考
- 路线图
- 发展
- 安全说明
- 支持
快速布置
安装
注意: 建议使用
pipx或uv tool,因为它们会自动将gitlab-mcp命令添加到你的 PATH。如果使用pip install,请确保你的 Python 脚本目录在 PATH,或者使用命令的完整路径。
获取你的GitLab令牌
- 进入GitLab→设置→访问令牌
- 创建带有
read_api作用域的令牌(如果你想要写权限,可以添加 [api作用域) - 复制令牌
配置你的MCP客户端
多项目设置(推荐)
对于处理多个GitLab项目,请在你的全局MCP配置中添加(~/.cursor/mcp.json用于Cursor):
这个单一配置适用于你所有的项目。使用 search_projects 或 list_my_projects 查找项目ID,然后在请求中指定project_id。
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
GitLab MR MCP
Connect your AI assistant to GitLab. Ask questions like “List open merge requests”, “Show me reviews for MR #123”, “Get commit discussions for MR #456”, or “Find merge requests for the feature branch” directly in your chat.
Table of Contents
- Quick Setup
- What You Can Do
- Configuration Options
- Troubleshooting
- Tool Reference
- Roadmap
- Development
- Security Notes
- Support
Quick Setup
Installation
# Using pipx (recommended)
pipx install gitlab-mr-mcp
# Or using uv
uv tool install gitlab-mr-mcp
# Or using pip
pip install gitlab-mr-mcp
Note: Using
pipxoruv toolis recommended as they automatically add thegitlab-mcpcommand to your PATH. If usingpip install, ensure your Python scripts directory is in PATH, or use the full path to the command.
Get your GitLab token
- Go to GitLab → Settings → Access Tokens
- Create token with
read_apiscope (addapiscope if you want write access) - Copy the token
Configure your MCP client
Multi-Project Setup (Recommended)
For working with multiple GitLab projects, add to your global MCP config (~/.cursor/mcp.json for Cursor):
{
"mcpServers": {
"gitlab-mcp": {
"command": "gitlab-mcp",
"env": {
"GITLAB_URL": "https://gitlab.com",
"GITLAB_ACCESS_TOKEN": "glpat-xxxxxxxxxxxxxxxxxxxx"
}
}
}
}
This single configuration works across all your projects. Use search_projects or list_my_projects to find project IDs, then specify project_id in your requests.
Single-Project Setup
For working with a single project, you can set a default project ID:
{
"mcpServers": {
"gitlab-mcp": {
"command": "gitlab-mcp",
"env": {
"GITLAB_URL": "https://gitlab.com",
"GITLAB_ACCESS_TOKEN": "glpat-xxxxxxxxxxxxxxxxxxxx",
"GITLAB_PROJECT_ID": "12345"
}
}
}
}
Restart your MCP client and start asking GitLab questions!
What You Can Do
Once connected, try these commands in your chat:
Multi-Project Workflow
- “What projects do I have access to?”
- “Search for the backend project”
- “Show open MRs for project 12345”
安装
This server does not publish a one-line install command.
Open the repository installation guide 新手?先看 mcpskill.org 教程 →配置
{
"mcpServers": {
"gitlab-mcp": {
"command": "gitlab-mcp",
"env": {
"GITLAB_URL": "https://gitlab.com",
"GITLAB_ACCESS_TOKEN": "glpat-xxxxxxxxxxxxxxxxxxxx"
}
}
}
}