GitLab-MCP-服务器
提供与 GitLab 集成的模型上下文协议 (MCP) 服务器。它从特定的 GitLab 项目中检索管道故障信息和合并请求结果,并将它们提供给 AI 助手。
概述
该MCP服务器使用GitLab的API向AI助手提供以下信息:
- GitLab Pipeline 中失败作业的控制台输出
- GitLab MR 的未解决问题(评论)
- GitLab MR 中的更改(与本地存储库的当前状态不同)
利用MCP功能,AI助手可以直接从GitLab提取信息,以提供更有针对性的帮助。
安装
准备
您将需要您的 GitLab 访问令牌。要颁发访问令牌,请转到 GitLab 设置 → 访问令牌。发布时,请检查read_api
。
功能
1. 获取管道故障信息并修复( get_pipeline_failed_jobs
)
获取 GitLab 管道中失败作业的控制台输出。 AI助手会根据获取的信息做出修正。
输出:
- 失败作业的控制台输出,包括作业名称、状态和详细日志
2. 获取并更正 MR 的评论( get_review_comments
)
检索并回复 GitLab MR 中的未解决的问题(评论)。已解决的评论和与文件无关的评论将被排除。
输出:
- 在MR中打开文件相关问题(包括评论者、时间、评论内容、文件位置等)
3. 获取并审查 MR 中的变更( get_review_changes
)
获取从 GitLab MR 的基本提交(base_sha)到本地存储库的当前状态的差异。您可以获取与最新本地版本(包括您正在进行的任何未提交的更改)的差异,而不是获取远程差异。将根据所获得的差异进行审查。
输出:
- 从 MR 的基本提交到当前本地状态的更改(每个文件的更改类型和差异)
与人工智能助手合作
AI助手(例如Claude)可以在该MCP服务器上调用以下函数:
get_pipeline_failed_jobs()
:获取管道失败信息get_review_comments()
:获取 MR 的评论get_review_changes()
:获取 MR 中的更改
这些函数自动检索与当前分支相关的 MR 的信息。
Claude 用于桌面设置
将以下内容添加到claude_desktop_config.json
:
使用光标设置
将以下内容添加到项目根目录中的.cursor/mcp.json
中:
注意:在上面的示例配置中,适当替换以下值:
your_gitlab_api_key
:您的 GitLab API 访问令牌/path/to/git/repo
:本地 Git 存储库的绝对路径/path/to/this-mcp-server
:此 MCP 服务器目录的绝对路径
Related MCP Servers
- AsecurityFlicenseAqualityThe Git MCP Server allows AI assistants to perform enhanced Git operations via the Model Context Protocol, supporting core Git functions, branch and tag management, GitHub integration, and more.Last updated -21396TypeScript
- -securityAlicense-qualityAn MCP server that enables communication with GitLab repositories, allowing interaction with GitLab's API to manage projects, issues, and repositories through natural language.Last updated -5,3791JavaScriptMIT License
- AsecurityAlicenseAqualityA Model Context Protocol server that enables interaction with GitLab accounts to manage repositories, merge requests, code reviews, and CI/CD pipelines through natural language.Last updated -418TypeScriptMIT License
- -securityFlicense-qualityA Model Context Protocol server that enables AI assistants to interact with GitLab repositories, allowing tasks like managing merge requests, searching projects, and creating comments through RESTful API integration.Last updated -42TypeScript