The GitLab MCP Server allows you to interact with GitLab for repository and project management through the GitLab API. With this server, you can:
- File Operations: Create, update, or push single/multiple files in a commit while maintaining Git history
- Project Management: Create new repositories, search for projects, fork repositories, and create branches
- Issue Tracking: Create and manage issues with labels, assignees, and milestones
- Merge Requests: Create and manage merge requests, including draft MRs and collaboration settings
- Content Retrieval: Fetch contents of files or directories from specific branches, tags, or commits
- Batch Support: Perform operations like pushing multiple files in a single commit
- Error Handling: Receive clear feedback for common issues
Allows interaction with GitLab repositories including project management, file operations, branch creation, issue tracking, merge request management, repository forking, and project search capabilities through the GitLab API
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:
project_id
(string): Project ID or URL-encoded pathfile_path
(string): Path where to create/update the filecontent
(string): Content of the filecommit_message
(string): Commit messagebranch
(string): Branch to create/update the file inprevious_path
(optional string): Path of the file to move/rename
- Returns: File content and commit details
push_files
- Push multiple files in a single commit
- Inputs:
project_id
(string): Project ID or URL-encoded pathbranch
(string): Branch to push tofiles
(array): Files to push, each withfile_path
andcontent
commit_message
(string): Commit message
- Returns: Updated branch reference
search_repositories
- Search for GitLab projects
- Inputs:
search
(string): Search querypage
(optional number): Page number for paginationper_page
(optional number): Results per page (default 20)
- Returns: Project search results
create_repository
- Create a new GitLab project
- Inputs:
name
(string): Project namedescription
(optional string): Project descriptionvisibility
(optional string): 'private', 'internal', or 'public'initialize_with_readme
(optional boolean): Initialize with README
- Returns: Created project details
get_file_contents
- Get contents of a file or directory
- Inputs:
project_id
(string): Project ID or URL-encoded pathfile_path
(string): Path to file/directoryref
(optional string): Branch/tag/commit to get contents from
- Returns: File/directory contents
create_issue
- Create a new issue
- Inputs:
project_id
(string): Project ID or URL-encoded pathtitle
(string): Issue titledescription
(optional string): Issue descriptionassignee_ids
(optional number[]): User IDs to assignlabels
(optional string[]): Labels to addmilestone_id
(optional number): Milestone ID
- Returns: Created issue details
create_merge_request
- Create a new merge request
- Inputs:
project_id
(string): Project ID or URL-encoded pathtitle
(string): MR titledescription
(optional string): MR descriptionsource_branch
(string): Branch containing changestarget_branch
(string): Branch to merge intodraft
(optional boolean): Create as draft MRallow_collaboration
(optional boolean): Allow commits from upstream members
- Returns: Created merge request details
fork_repository
- Fork a project
- Inputs:
project_id
(string): Project ID or URL-encoded pathnamespace
(optional string): Namespace to fork to
- Returns: Forked project details
create_branch
- Create a new branch
- Inputs:
project_id
(string): Project ID or URL-encoded pathbranch
(string): Name for new branchref
(optional string): Source branch/commit for new branch
- 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:
api
for full API accessread_api
for read-only accessread_repository
andwrite_repository
for repository operations
- Create the token and save it securely
Usage with Claude Desktop
Add the following to your claude_desktop_config.json
:
Docker
NPX
Usage with VS Code
For quick installation, use one of the one-click installation buttons below...
For manual installation, add the following JSON block to your User Settings (JSON) file in VS Code. You can do this by pressing Ctrl + Shift + P
and typing Preferences: Open User Settings (JSON)
.
Optionally, you can add it to a file called .vscode/mcp.json
in your workspace. This will allow you to share the configuration with others.
Note that the
mcp
key is not needed in the.vscode/mcp.json
file.
Docker
NPX
Build
Docker build:
Environment Variables
GITLAB_PERSONAL_ACCESS_TOKEN
: Your GitLab personal access token (required)GITLAB_API_URL
: Base URL for GitLab API (optional, defaults tohttps://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.
You must be authenticated.
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
Tools
MCP Server for the GitLab API, enabling project management, file operations, and more.
Related MCP Servers
- AsecurityAlicenseAqualityMCP Server for the GitHub API, enabling file operations, repository management, search functionality, and more.Last updated -1721,60849,365JavaScriptMIT License
- AsecurityFlicenseAqualityMCP Server for the GitHub API, providing features for file operations, repository management, and advanced search, with automatic branch creation and comprehensive error handling.Last updated -1843TypeScript
- AsecurityAlicenseAqualityMCP Tool Server for Gitee, supporting the management of repository files/branches, Issues, and Pull Requests.Last updated -20104TypeScriptMIT License
- AsecurityFlicenseAqualityMCP server for managing Git operations on local repositories, allowing users to list repositories, get and create tags, list commits, push tags, and refresh repositories through a standardized interface.Last updated -6Python