What it is
The GitLab MCP Server is a Model Context Protocol server for the GitLab API that supports project management and file operations. It exposes nine tools covering files, repositories, issues, merge requests, forks and branches. Branches are created automatically when files are created, updated or pushed to a branch that doesn't exist, and operations keep Git history without force pushing. The repository is archived (the URL is under servers-archived).
Who it's for
- Developers who want an MCP client such as Claude Desktop or VS Code to work with GitLab projects
- Teams using GitLab.com or self-hosted GitLab instances via a configurable API URL
Requirements
Requirements
- A GitLab Personal Access Token, set as GITLAB_PERSONAL_ACCESS_TOKEN (required)
- Token scopes such as api, read_api, or read_repository and write_repository, depending on the operations needed
- Either Docker (image mcp/gitlab) or npx (package @modelcontextprotocol/server-gitlab) to run the server
- Optional GITLAB_API_URL for self-hosted instances (defaults to https://gitlab.com/api/v4)
Setup
Create a Personal Access Token
In GitLab go to User Settings > Access Tokens and select the required scopes (api for full access, read_api for read-only, read_repository and write_repository for repository operations). Create the token and save it securely.
Claude Desktop config (NPX)
Add this to claude_desktop_config.json. GITLAB_API_URL is optional and intended for self-hosted instances.
json{ "mcpServers": { "gitlab": { "command": "npx", "args": [ "-y", "@modelcontextprotocol/server-gitlab" ], "env": { "GITLAB_PERSONAL_ACCESS_TOKEN": "<YOUR_TOKEN>", "GITLAB_API_URL": "https://gitlab.com/api/v4" // Optional, for self-hosted instances } } } }Claude Desktop config (Docker)
Alternatively, run the server through Docker using the mcp/gitlab image.
json{ "mcpServers": { "gitlab": { "command": "docker", "args": [ "run", "--rm", "-i", "-e", "GITLAB_PERSONAL_ACCESS_TOKEN", "-e", "GITLAB_API_URL", "mcp/gitlab" ], "env": { "GITLAB_PERSONAL_ACCESS_TOKEN": "<YOUR_TOKEN>", "GITLAB_API_URL": "https://gitlab.com/api/v4" // Optional, for self-hosted instances } } } }Build the Docker image (optional)
To build the image locally:
bashdocker build -t vonwig/gitlab:mcp -f src/gitlab/Dockerfile .
Examples
Push multiple files in one commit
json{
"project_id": "<project ID or URL-encoded path>",
"branch": "<branch>",
"files": [
{ "file_path": "<path>", "content": "<content>" }
],
"commit_message": "<message>"
}What it does: Input shape for the push_files tool, which commits several files at once and returns the updated branch reference. The branch is created if it doesn't exist.
Create an issue
json{
"project_id": "<project ID or URL-encoded path>",
"title": "<issue title>",
"description": "<optional description>",
"labels": ["<label>"]
}What it does: Input shape for create_issue. Optional fields include description, assignee_ids, labels and milestone_id.
Create a merge request
json{
"project_id": "<project ID or URL-encoded path>",
"title": "<MR title>",
"source_branch": "<branch with changes>",
"target_branch": "<branch to merge into>",
"draft": true
}What it does: Input shape for create_merge_request. The draft flag optionally creates the MR as a draft.
Pros & cons
Pros
- Pro:Covers common GitLab workflows through nine tools: files, repositories, issues, merge requests, forks and branches
- Pro:Automatically creates branches and preserves Git history without force pushing
- Pro:Supports multi-file commits via push_files as well as single-file operations
- Pro:Works with self-hosted GitLab via the GITLAB_API_URL setting
Cons
- Con:The repository is archived (hosted under servers-archived), so it may no longer be actively maintained
- Con:Tool set has no documented tools for listing or updating issues and merge requests, or for commenting on them
- Con:Requires a personal access token with appropriately broad scopes
Images
