G
GitLab
reference
devtools
GitLab API, enabling project management
GitLab MCP Server
MCP Server for the GitLab API, enabling project management, file operations, and more.
Features
- Automatic Branch Creation: When creating/updating files or pushing changes, branches are automatically created if they don't exist
- Comprehensive Error Handling: Clear error messages for common issues
- Git History Preservation: Operations maintain proper Git history without force pushing
- Batch Operations: Support for both single-file and multi-file operations
Tools
-
create_or_update_file
- Create or update a single file in a project
- Inputs:
(string): Project ID or URL-encoded pathproject_id
(string): Path where to create/update the filefile_path
(string): Content of the filecontent
(string): Commit messagecommit_message
(string): Branch to create/update the file inbranch
(optional string): Path of the file to move/renameprevious_path
- Returns: File content and commit details
-
push_files
- Push multiple files in a single commit
- Inputs:
(string): Project ID or URL-encoded pathproject_id
(string): Branch to push tobranch
(array): Files to push, each withfiles
andfile_path
content
(string): Commit messagecommit_message
- Returns: Updated branch reference
-
search_repositories
- Search for GitLab projects
- Inputs:
(string): Search querysearch
(optional number): Page number for paginationpage
(optional number): Results per page (default 20)per_page
- Returns: Project search results
-
create_repository
- Create a new GitLab project
- Inputs:
(string): Project namename
(optional string): Project descriptiondescription
(optional string): 'private', 'internal', or 'public'visibility
(optional boolean): Initialize with READMEinitialize_with_readme
- Returns: Created project details
-
get_file_contents
- Get contents of a file or directory
- Inputs:
(string): Project ID or URL-encoded pathproject_id
(string): Path to file/directoryfile_path
(optional string): Branch/tag/commit to get contents fromref
- Returns: File/directory contents
-
create_issue
- Create a new issue
- Inputs:
(string): Project ID or URL-encoded pathproject_id
(string): Issue titletitle
(optional string): Issue descriptiondescription
(optional number[]): User IDs to assignassignee_ids
(optional string[]): Labels to addlabels
(optional number): Milestone IDmilestone_id
- Returns: Created issue details
-
create_merge_request
- Create a new merge request
- Inputs:
(string): Project ID or URL-encoded pathproject_id
(string): MR titletitle
(optional string): MR descriptiondescription
(string): Branch containing changessource_branch
(string): Branch to merge intotarget_branch
(optional boolean): Create as draft MRdraft
(optional boolean): Allow commits from upstream membersallow_collaboration
- Returns: Created merge request details
-
fork_repository
- Fork a project
- Inputs:
(string): Project ID or URL-encoded pathproject_id
(optional string): Namespace to fork tonamespace
- Returns: Forked project details
-
create_branch
- Create a new branch
- Inputs:
(string): Project ID or URL-encoded pathproject_id
(string): Name for new branchbranch
(optional string): Source branch/commit for new branchref
- Returns: Created branch reference
Setup
Personal Access Token
Create a GitLab Personal Access Token with appropriate permissions:
- Go to User Settings > Access Tokens in GitLab
- Select the required scopes:
for full API accessapi
for read-only accessread_api
andread_repository
for repository operationswrite_repository
- Create the token and save it securely
Usage with Claude Desktop
Add the following to your
claude_desktop_config.json
:Docker
{ "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 } } } }
NPX
{ "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 } } } }
Build
Docker build:
docker build -t vonwig/gitlab:mcp -f src/gitlab/Dockerfile .
Environment Variables
: Your GitLab personal access token (required)GITLAB_PERSONAL_ACCESS_TOKEN
: Base URL for GitLab API (optional, defaults toGITLAB_API_URL
)https://gitlab.com/api/v4
License
This MCP server is licensed under the MIT License. This means you are free to use, modify, and distribute the software, subject to the terms and conditions of the MIT License. For more details, please see the LICENSE file in the project repository.
Related Servers
Adfin
official
The only platform you need to get paid - all payments in one place, invoicing and accounting reconciliations with [Adfin](https://www.adfin.com/).
View Details
APIMatic MCP
official
APIMatic MCP Server is used to validate OpenAPI specifications using [APIMatic](https://www.apimatic.io/). The server processes OpenAPI files and returns validation summaries by leveraging APIMatic’s API.
View DetailsAWS
official
Specialized MCP servers that bring AWS best practices directly to your development workflow.
View Details