Create or update a single file in a project
Push multiple files in a single commit
Search for GitLab projects
Create a new GitLab project
Get contents of a file or directory
Create a new issue
Create a new merge request
Fork a project
Create a new branch
The GitLab MCP server provides a comprehensive interface to GitLab's API, enabling AI assistants to manage repositories, files, issues, and merge requests. It supports both single and batch file operations while maintaining proper Git history, and includes features like automatic branch creation and detailed error handling. With this MCP, AI assistants can search for repositories, create or update files, push multiple files in a single commit, create issues and merge requests, fork repositories, and more. It works with both gitlab.com and self-hosted GitLab instances.
The GitLab MCP server enables AI assistants to interact with GitLab repositories and project management features. It provides a seamless interface to GitLab's API, allowing for repository management, file operations, issue tracking, and merge request handling.
To use the GitLab MCP server, you'll need:
api
for full API accessread_api
for read-only accessread_repository
and write_repository
for repository operationsYou can use the GitLab MCP server with various AI assistants that support the Model Context Protocol. Here are the installation methods:
Add the following configuration to your AI assistant's MCP configuration:
{
"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"
}
}
}
}
Add the following configuration to your AI assistant's MCP configuration:
{
"mcpServers": {
"gitlab": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-gitlab"
],
"env": {
"GITLAB_PERSONAL_ACCESS_TOKEN": "<YOUR_TOKEN>",
"GITLAB_API_URL": "https://gitlab.com/api/v4"
}
}
}
}
GITLAB_PERSONAL_ACCESS_TOKEN
: Your GitLab personal access token (required)GITLAB_API_URL
: The API URL for your GitLab instance (optional, defaults to https://gitlab.com/api/v4)Add the configuration to your claude_desktop_config.json
file.
For VS Code users, you can use the one-click installation buttons provided in the repository README, or manually add the configuration to your VS Code settings.
Here are some examples of how to use the GitLab MCP server with an AI assistant:
You can create a new file in my GitLab repository with the following details:
- Project ID: myusername/myproject
- File path: src/utils/helpers.js
- Content: A utility function to format dates
- Branch: feature/date-utils
- Commit message: "Add date formatting utility function"
Please create a new issue in my GitLab project:
- Project ID: myusername/myproject
- Title: "Implement user authentication"
- Description: "We need to add user authentication using OAuth2 with support for Google and GitHub providers."
- Labels: ["feature", "security"]
Create a merge request for the changes I've made:
- Project ID: myusername/myproject
- Title: "Add date formatting utilities"
- Source branch: feature/date-utils
- Target branch: main
- Description: "This PR adds utility functions for formatting dates in various formats."
If you encounter issues with the GitLab MCP server:
For more detailed information, refer to the GitLab API documentation.