The GitLab MCP Server is a powerful integration with the GitLab API, designed to simplify project management, file operations, and repository workflows. This server enables seamless interaction with GitLab projects, offering features like automatic branch creation, batch operations, and comprehensive error handling.
create_or_update_fileproject_id, file_path, content, commit_message, branch, previous_path (optional).push_filesproject_id, branch, files, commit_message.search_repositoriessearch, page (optional), per_page (optional).create_repositoryname, description (optional), visibility (optional), initialize_with_readme (optional).get_file_contentsproject_id, file_path, ref (optional).create_issueproject_id, title, description (optional), assignee_ids (optional), labels (optional), milestone_id (optional).create_merge_requestproject_id, title, description (optional), source_branch, target_branch, draft (optional), allow_collaboration (optional).fork_repositoryproject_id, namespace (optional).create_branchproject_id, branch, ref (optional).To use the GitLab MCP Server, you need a GitLab Personal Access Token with the appropriate permissions:
- Scopes: api, read_api, read_repository, write_repository.
- Steps: Go to User Settings > Access Tokens in GitLab, select the required scopes, and create the token.
Add the following configuration to your claude_desktop_config.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"
}
}
}
}
{
"mcpServers": {
"gitlab": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-gitlab"],
"env": {
"GITLAB_PERSONAL_ACCESS_TOKEN": "<YOUR_TOKEN>",
"GITLAB_API_URL": "https://gitlab.com/api/v4"
}
}
}
}
To build the Docker image:
docker build -t vonwig/gitlab:mcp -f src/gitlab/Dockerfile .
GITLAB_PERSONAL_ACCESS_TOKEN: Your GitLab personal access token (required).GITLAB_API_URL: Base URL for GitLab API (optional, defaults to https://gitlab.com/api/v4).This MCP server is licensed under the MIT License. You are free to use, modify, and distribute the software, subject to the terms and conditions of the MIT License. For more details, see the LICENSE file in the project repository.