GitLab MCP Server
一个模型上下文协议服务器,可以通过自然语言与 GitLab 账户交互,从而管理代码仓库、合并请求、代码审查和 CI/CD 管道。
Tools
gitlab_list_group_members
List members of a group
gitlab_list_users
List GitLab users
gitlab_get_user
Get details of a specific user
gitlab_list_groups
List GitLab groups
gitlab_get_cicd_variable
Get a specific CI/CD variable
gitlab_list_projects
List GitLab projects accessible to the user
gitlab_get_project
Get details of a specific GitLab project
gitlab_list_branches
List branches of a GitLab project
gitlab_list_merge_requests
List merge requests in a GitLab project
gitlab_get_merge_request
Get details of a specific merge request
gitlab_get_merge_request_changes
Get changes (diff) of a specific merge request
gitlab_create_merge_request_note
Add a comment to a merge request
gitlab_create_merge_request_note_internal
Add a comment to a merge request with option to make it an internal note
gitlab_update_merge_request
Update a merge request title and description
gitlab_list_issues
List issues in a GitLab project
gitlab_get_repository_file
Get content of a file in a repository
gitlab_compare_branches
Compare branches, tags or commits
gitlab_list_integrations
List all available project integrations/services
gitlab_get_integration
Get integration details for a project
gitlab_update_slack_integration
Update Slack integration settings for a project
gitlab_disable_slack_integration
Disable Slack integration for a project
gitlab_list_webhooks
List webhooks for a project
gitlab_get_webhook
Get details of a specific webhook
gitlab_add_webhook
Add a new webhook to a project
gitlab_update_webhook
Update an existing webhook
gitlab_delete_webhook
Delete a webhook
gitlab_test_webhook
Test a webhook
gitlab_list_trigger_tokens
List pipeline trigger tokens
gitlab_get_trigger_token
Get details of a pipeline trigger token
gitlab_create_trigger_token
Create a new pipeline trigger token
gitlab_update_trigger_token
Update a pipeline trigger token
gitlab_delete_trigger_token
Delete a pipeline trigger token
gitlab_trigger_pipeline
Trigger a pipeline run
gitlab_list_cicd_variables
List CI/CD variables for a project
gitlab_create_cicd_variable
Create a new CI/CD variable
gitlab_update_cicd_variable
Update a CI/CD variable
gitlab_delete_cicd_variable
Delete a CI/CD variable
gitlab_get_group
Get details of a specific group
gitlab_add_group_member
Add a user to a group
gitlab_list_project_members
List members of a project
gitlab_add_project_member
Add a user to a project
README
GitLab MCP 服务器
一个模型上下文协议 (MCP) 服务器,使您能够与您的 GitLab 帐户进行交互。获取差异、分析合并请求、审查代码、cherry-pick 更改等等。这是模型上下文协议项目中 MCP GitLab 服务器 的扩展版本。
<a href="https://glama.ai/mcp/servers/@rifqi96/mcp-gitlab"> <img width="380" height="200" src="https://glama.ai/mcp/servers/@rifqi96/mcp-gitlab/badge" alt="GitLab Server MCP server" /> </a>
功能
此 MCP 服务器提供用于与 GitLab 存储库交互的综合工具,包括:
核心存储库功能
- 列出项目并检索详细信息
- 管理分支和存储库
- 处理合并请求和差异
- 向合并请求添加评论和内部注释
- 更新合并请求属性
- 列出和处理问题
- 获取和比较存储库文件内容
项目设置和集成
- 管理项目集成和服务
- 配置和控制 Slack 集成
- 设置、更新和测试 Webhook
CI/CD 管理
- 处理管道触发令牌
- 管理 CI/CD 变量
- 触发和控制管道
用户和组管理
- 列出和管理用户
- 处理组和组成员资格
- 管理项目成员和访问级别
安装
前提条件
- Node.js (v16 或更高版本)
- npm
- 具有 API 令牌的 GitLab 帐户
设置
- 克隆存储库:
git clone https://github.com/rifqi96/mcp-gitlab.git
cd mcp-gitlab
- 安装依赖项:
npm install
- 构建服务器:
npm run build
- 安装 git hooks(可选,但建议贡献者使用):
npm run install-hooks
这会安装一个 pre-commit hook,当 src/utils/tools-data.ts 更改时,它会自动重新生成 TOOLS.md。
- 配置您的 GitLab API 令牌:
您需要在 MCP 设置配置文件中提供您的 GitLab API 令牌。该令牌用于向 GitLab API 进行身份验证。
对于 Cursor/Roo Cline,将以下内容添加到您的 MCP 设置文件 (~/Library/Application Support/Cursor/User/globalStorage/rooveterinaryinc.roo-cline/settings/cline_mcp_settings.json):
{
"mcpServers": {
"gitlab": {
"command": "node",
"args": [
"/path/to/mcp-gitlab/build/index.js"
],
"env": {
"GITLAB_API_TOKEN": "YOUR_GITLAB_API_TOKEN",
"GITLAB_API_URL": "https://gitlab.com/api/v4"
}
}
}
}
对于 Claude Desktop,将以下内容添加到您的 MCP 设置文件 (~/Library/Application Support/Claude/claude_desktop_config.json):
{
"mcpServers": {
"gitlab": {
"command": "node",
"args": [
"/path/to/mcp-gitlab/build/index.js"
],
"env": {
"GITLAB_API_TOKEN": "YOUR_GITLAB_API_TOKEN",
"GITLAB_API_URL": "https://gitlab.com/api/v4"
}
}
}
}
将 YOUR_GITLAB_API_TOKEN 替换为您实际的 GitLab API 令牌。您可以在 GitLab 帐户的“设置”>“访问令牌”下生成令牌。
可用工具
有关可用工具及其参数的完整列表,请参见 TOOLS.md。
使用示例
以下是如何将这些工具与支持 MCP 的 AI 助手一起使用的示例:
列出您的项目
Could you list my GitLab projects?
获取有关特定合并请求的信息
Can you show me the details of merge request with ID 123 in the project 'mygroup/myproject'?
向合并请求添加评论
Please add a comment to merge request 123 in project 'mygroup/myproject' saying "This looks good, but please add more tests."
向合并请求添加内部注释
Add an internal note to merge request 123 in project 'mygroup/myproject' that says "Needs security review before merging." Make sure it's only visible to team members.
更新合并请求标题和描述
Update the title of merge request 123 in project 'mygroup/myproject' to "Fix login page performance issues" and update the description to include "This PR addresses the slow loading times on the login page by optimizing database queries."
比较分支
Compare the 'feature-branch' with 'main' in the project 'mygroup/myproject' and show me the differences.
实际工作流程
审查合并请求
1. Show me merge request 123 in project 'mygroup/myproject'
2. Show me the changes for this merge request
3. Add an internal note with my review comments
4. Update the merge request title to better reflect the changes
项目探索
1. List all my GitLab projects
2. Show me the details of project 'mygroup/myproject'
3. List all branches in this project
4. Show me the content of the README.md file in the main branch
可用资源
gitlab://projects
可以使用您的 API 令牌访问的 GitLab 项目列表。
与 AI 助手集成
GitLab MCP 服务器与支持模型上下文协议 (MCP) 的 AI 助手集成。
功能
连接到 AI 助手后,此服务器使助手能够:
-
查看和分析代码:助手可以获取文件内容、查看分支差异以及检查合并请求更改,以更好地理解代码。
-
提供代码审查:助手可以分析合并请求并通过评论或内部注释提供反馈。
-
管理项目工作流程:助手可以更新合并请求属性、添加评论并帮助进行存储库管理任务。
-
探索项目结构:助手可以浏览项目、分支和文件以了解代码库结构。
-
配置 CI/CD 和集成:助手可以帮助设置 Webhook、管理 CI/CD 变量以及配置项目集成。
充分利用 AI 助手集成
- 在询问有关项目、合并请求或文件时,请具体说明
- 尽可能提供项目 ID 或路径
- 通过要求助手分析特定的合并请求,使用助手进行代码审查
- 让助手帮助进行存储库配置和管理任务
- 使用内部注释对合并请求提供仅供团队成员使用的反馈
许可证
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。