gitlab-mcp
Provides tools to interact with GitLab merge requests, including retrieving basic info, commits, diffs, discussions, approvals, pipelines, and full merge request details.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@gitlab-mcp Show me the details of merge request 42"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
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
Related MCP server: GitLab MCP Code Review
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 installBuild the project:
npm run buildCreate a
.envfile based on.env.example:
cp .env.example .envEdit
.envand add your GitLab credentials:
GITLAB_INSTANCE_URL=https://gitlab.com
GITLAB_API_TOKEN=your-personal-access-token
GITLAB_PROJECT_ID=your-project-idGetting Your GitLab Configuration
GitLab Instance URL:
For gitlab.com:
https://gitlab.comFor 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_apiscopeCopy 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 buildWatch mode (auto-rebuild on changes)
npm run watchTroubleshooting
Authentication Errors
Verify your
GITLAB_API_TOKENis correct and has the necessary scopesCheck that the token hasn't expired
Resource Not Found
Verify the
GITLAB_PROJECT_IDis correctEnsure 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
Available Tools
7 toolsget_merge_requestC
Get basic information about a merge request
Inputs: merge_request_iid (required).
get_merge_request_approvalsB
Get approval status and information for a merge request
Inputs: merge_request_iid (required).
get_merge_request_commitsA
Get all commits in a merge request
Inputs: merge_request_iid (required).
get_merge_request_diffsA
Get all file changes and diffs in a merge request
Inputs: merge_request_iid (required).
get_merge_request_discussionsA
Get all discussions and comments on a merge request
Inputs: merge_request_iid (required).
get_merge_request_fullB
Get complete information about a merge request (all data in one call)
Inputs: merge_request_iid (required).
get_merge_request_pipelinesA
Get CI/CD pipeline information for a merge request
Inputs: merge_request_iid (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 7 tools
Each tool targets a distinct facet of a merge request (basic info, commits, diffs, discussions, approvals, pipelines, full aggregate), so there is no overlap or ambiguity between them. The 'full' tool is comprehensive but clearly distinguished as a combined superset.
All tools follow the exact same 'get_merge_request_*' pattern, making the naming highly predictable and consistent. The resource and action are clearly identified in every name.
Seven tools is a well-scoped set for a read-only merge request inspection server. Each tool covers a meaningful data aspect without adding unnecessary clutter, and the aggregate 'full' tool reduces the need for more granular additions.
The server thoroughly covers all major data dimensions of an individual merge request, including a 'full' option. The only notable gap is the absence of a list/search tool to discover merge requests, which may require external context to work with.
Related MCP Connectors
Unofficial GitLab MCP — wraps the GitLab REST API v4 (BYO API key)
Operate GitHub from your AI assistant: repos, PRs, issues, Actions. Previews and read-only mode.
Writes your daily standup from GitLab or GitHub merge request state: what's ready, blocked or waiting on your review, and why a pipeline is red, read from the failing job log. OAuth sign-in, no API keys; can post the note to Slack, Discord or Google Chat on a schedule.
Code intelligence for LLMs. Analyze, search, and retrieve code from any public git repository.
Related MCP Servers
- AlicenseAqualityDmaintenanceConnects AI assistants to GitLab, allowing users to manage merge requests, view reviews, and interact with discussions through natural language queries.1225MIT
- AlicenseAqualityDmaintenanceEnables 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.124MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to review GitLab merge requests by fetching diffs, analyzing code changes, adding comments, and managing approvals through the GitLab API. Supports comprehensive merge request analysis and version comparison for automated code review workflows.3MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to interact with GitLab repositories, allowing them to manage merge requests and issues including listing projects, fetching MR details and diffs, adding comments, and updating MR titles and descriptions.94MIT