gitlab-mcp
Enables retrieving comprehensive information about GitLab merge requests, including details, commits, diffs, discussions, approvals, and CI/CD status, through natural language.
README
GitLab MCP Server
A Model Context Protocol (MCP) server that provides tools to interact with GitLab merge requests. This server runs as a local tool using stdio transport, allowing MCP clients (like Claude Desktop) to retrieve comprehensive information about GitLab merge requests.
Features
- Get merge request basic information
- Retrieve all commits in a merge request
- Get file changes and diffs
- Access discussions and comments
- View approval status
- Check CI/CD pipeline status
- Get all information at once with a single command
Prerequisites
- Node.js 18 or higher
- GitLab account with API access
- GitLab personal access token with
apiorread_apiscope
Installation
- Clone or download this repository
- Install dependencies:
npm install
- Build the project:
npm run build
- Create a
.envfile based on.env.example:
cp .env.example .env
- Edit
.envand add your GitLab credentials:
GITLAB_INSTANCE_URL=https://gitlab.com
GITLAB_API_TOKEN=your-personal-access-token
GITLAB_PROJECT_ID=your-project-id
Getting Your GitLab Configuration
GitLab Instance URL:
- For gitlab.com:
https://gitlab.com - For self-hosted: Your GitLab instance URL (e.g.,
https://gitlab.example.com)
API Token:
- Go to GitLab → User Settings → Access Tokens
- Create a personal access token with
apiorread_apiscope - Copy the token (you won't be able to see it again!)
Project ID:
- Found on your project's main page under the project name
- Or in Settings → General
Configuration for Claude Desktop
Add the following to your Claude Desktop MCP settings file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"gitlab": {
"command": "node",
"args": ["/absolute/path/to/gitlab-mcp/dist/index.js"],
"env": {
"GITLAB_INSTANCE_URL": "https://gitlab.com",
"GITLAB_API_TOKEN": "your-api-token",
"GITLAB_PROJECT_ID": "12345678"
}
}
}
}
Replace /absolute/path/to/gitlab-mcp with the actual path to this project.
Alternatively, if you want to use the .env file, you can omit the env section, but make sure the .env file is in the project root.
Available Tools
get_merge_request
Get basic information about a merge request.
Parameters:
merge_request_iid(number): The IID (internal ID) of the merge request
Returns: Basic MR info including title, description, state, branches, author, assignees, reviewers, labels, and merge status.
get_merge_request_commits
Get all commits in a merge request.
Parameters:
merge_request_iid(number): The IID of the merge request
Returns: Array of commits with messages, authors, timestamps, and SHAs.
get_merge_request_diffs
Get all file changes and diffs in a merge request.
Parameters:
merge_request_iid(number): The IID of the merge request
Returns: Array of file changes with line-by-line diffs.
get_merge_request_discussions
Get all discussions and comments on a merge request.
Parameters:
merge_request_iid(number): The IID of the merge request
Returns: Array of discussion threads with notes, including review comments and system notes.
get_merge_request_approvals
Get approval status and information for a merge request.
Parameters:
merge_request_iid(number): The IID of the merge request
Returns: Approval state including required approvals, approvals left, and who approved.
get_merge_request_pipelines
Get CI/CD pipeline information for a merge request.
Parameters:
merge_request_iid(number): The IID of the merge request
Returns: Array of pipelines with status, ref, SHA, and timestamps.
get_merge_request_full
Get complete information about a merge request (all data in one call).
Parameters:
merge_request_iid(number): The IID of the merge request
Returns: Complete merge request data including MR info, commits, diffs, discussions, approvals, pipelines, and latest pipeline jobs.
Usage Example
Once configured in Claude Desktop, you can use natural language to interact with your GitLab merge requests:
"Show me the details of merge request 42"
"What commits are in MR 15?"
"Get the diffs for merge request 8"
"Show me all comments on MR 23"
"What's the approval status of merge request 10?"
"Get everything about merge request 5"
Development
Build
npm run build
Watch mode (auto-rebuild on changes)
npm run watch
Troubleshooting
Authentication Errors
- Verify your
GITLAB_API_TOKENis correct and has the necessary scopes - Check that the token hasn't expired
Resource Not Found
- Verify the
GITLAB_PROJECT_IDis correct - Ensure the merge request IID exists in the project
- Check that you have access to the project
Permission Denied
- Verify your GitLab account has at least Reporter access to the project
- Check that your API token has the
apiorread_apiscope
GitLab API Permissions
The API token needs one of the following scopes:
api- Full API access (recommended)read_api- Read-only API access (minimum required)
Additionally, your GitLab account needs at least Reporter level access to the project to view merge request information.
License
ISC
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。