The GitLab MCP Server is an improved implementation of the Model Context Protocol server for GitLab integration. It allows AI assistants to interact with GitLab repositories, issues, merge requests, and more through a standardized interface, with several bugfixes and enhancements over the original implementation.
The easiest way to use the GitLab MCP server is through NPX:
{
"mcpServers": {
"GitLab communication server": {
"command": "npx",
"args": ["-y", "@zereight/mcp-gitlab"],
"env": {
"GITLAB_PERSONAL_ACCESS_TOKEN": "your_gitlab_token",
"GITLAB_API_URL": "your_gitlab_api_url",
"GITLAB_PROJECT_ID": "your_project_id",
"GITLAB_ALLOWED_PROJECT_IDS": "",
"GITLAB_READ_ONLY_MODE": "false",
"USE_GITLAB_WIKI": "false",
"USE_MILESTONE": "false",
"USE_PIPELINE": "false"
}
}
}
}
For VSCode integration, create a .vscode/mcp.json
file:
{
"inputs": [
{
"type": "promptString",
"id": "gitlab-token",
"description": "Gitlab Token to read API",
"password": true
}
],
"servers": {
"GitLab-MCP": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@zereight/mcp-gitlab"],
"env": {
"GITLAB_PERSONAL_ACCESS_TOKEN": "${input:gitlab-token}",
"GITLAB_API_URL": "your-fancy-gitlab-url",
"GITLAB_READ_ONLY_MODE": "true"
}
}
}
}
{
"mcpServers": {
"GitLab communication server": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"-e",
"GITLAB_PERSONAL_ACCESS_TOKEN",
"-e",
"GITLAB_API_URL",
"-e",
"GITLAB_READ_ONLY_MODE",
"-e",
"USE_GITLAB_WIKI",
"-e",
"USE_MILESTONE",
"-e",
"USE_PIPELINE",
"iwakitakuma/gitlab-mcp"
],
"env": {
"GITLAB_PERSONAL_ACCESS_TOKEN": "your_gitlab_token",
"GITLAB_API_URL": "https://gitlab.com/api/v4",
"GITLAB_READ_ONLY_MODE": "false",
"USE_GITLAB_WIKI": "true",
"USE_MILESTONE": "true",
"USE_PIPELINE": "true"
}
}
}
}
First, run the Docker container:
docker run -i --rm \
-e GITLAB_PERSONAL_ACCESS_TOKEN=your_gitlab_token \
-e GITLAB_API_URL="https://gitlab.com/api/v4" \
-e GITLAB_READ_ONLY_MODE=true \
-e USE_GITLAB_WIKI=true \
-e USE_MILESTONE=true \
-e USE_PIPELINE=true \
-e SSE=true \
-p 3333:3002 \
iwakitakuma/gitlab-mcp
Then configure the MCP client:
{
"mcpServers": {
"GitLab communication server": {
"type": "sse",
"url": "http://localhost:3333/sse"
}
}
}
First, run the Docker container:
docker run -i --rm \
-e GITLAB_PERSONAL_ACCESS_TOKEN=your_gitlab_token \
-e GITLAB_API_URL="https://gitlab.com/api/v4" \
-e GITLAB_READ_ONLY_MODE=true \
-e USE_GITLAB_WIKI=true \
-e USE_MILESTONE=true \
-e USE_PIPELINE=true \
-e STREAMABLE_HTTP=true \
-p 3333:3002 \
iwakitakuma/gitlab-mcp
Then configure the MCP client:
{
"mcpServers": {
"GitLab communication server": {
"url": "http://localhost:3333/mcp"
}
}
}
The server behavior can be customized with these environment variables:
GITLAB_PERSONAL_ACCESS_TOKEN
: Your GitLab personal access token (required)GITLAB_API_URL
: Your GitLab API URL (default: https://gitlab.com/api/v4
)GITLAB_PROJECT_ID
: Default project ID to use for all operationsGITLAB_ALLOWED_PROJECT_IDS
: Comma-separated list of allowed project IDs
123
): Restricts to one project and sets it as default123,456,789
): Allows access to listed projects onlyGITLAB_READ_ONLY_MODE
: When true
, restricts to read-only operationsUSE_GITLAB_WIKI
: When true
, enables wiki-related toolsUSE_MILESTONE
: When true
, enables milestone-related toolsUSE_PIPELINE
: When true
, enables pipeline-related toolsGITLAB_AUTH_COOKIE_PATH
: Path to an authentication cookie file for GitLab instances requiring cookie-based authSSE
: When true
, enables Server-Sent Events transportSTREAMABLE_HTTP
: When true
, enables Streamable HTTP transportThe server provides numerous tools for interacting with GitLab, including:
get_repository_tree
- List files and directoriesget_file_contents
- Get file or directory contentscreate_or_update_file
- Create or update a filepush_files
- Push multiple files in a single commitcreate_branch
- Create a new branchcreate_repository
- Create a new projectfork_repository
- Fork a projectlist_issues
- List issues with filteringget_issue
- Get issue detailscreate_issue
- Create a new issueupdate_issue
- Update an existing issuedelete_issue
- Delete an issuecreate_issue_note
- Add a comment to an issueupdate_issue_note
- Update an issue commentlist_issue_discussions
- List issue discussionslist_merge_requests
- List merge requestsget_merge_request
- Get merge request detailscreate_merge_request
- Create a new merge requestupdate_merge_request
- Update a merge requestget_merge_request_diffs
- Get the changes in a merge requestlist_merge_request_diffs
- List merge request diffscreate_merge_request_note
- Add a comment to a merge requestlist_wiki_pages
- List wiki pagesget_wiki_page
- Get wiki page detailscreate_wiki_page
- Create a new wiki pageupdate_wiki_page
- Update a wiki pagedelete_wiki_page
- Delete a wiki pagelist_pipelines
- List pipelinesget_pipeline
- Get pipeline detailscreate_pipeline
- Create a new pipelineretry_pipeline
- Retry a failed pipelinecancel_pipeline
- Cancel a running pipelinelist_pipeline_jobs
- List jobs in a pipelineget_pipeline_job
- Get job detailsget_pipeline_job_output
- Get job output/logsMany more tools are available for working with milestones, labels, project members, and other GitLab resources.
To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "GitLab-communication-server" '{"command":"npx","args":["-y","@zereight/mcp-gitlab"],"env":{"GITLAB_PERSONAL_ACCESS_TOKEN":"your_gitlab_token","GITLAB_API_URL":"your_gitlab_api_url","GITLAB_READ_ONLY_MODE":"false","USE_GITLAB_WIKI":"false","USE_MILESTONE":"false","USE_PIPELINE":"false"}}'
See the official Claude Code MCP documentation for more details.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"GitLab communication server": {
"command": "npx",
"args": [
"-y",
"@zereight/mcp-gitlab"
],
"env": {
"GITLAB_PERSONAL_ACCESS_TOKEN": "your_gitlab_token",
"GITLAB_API_URL": "your_gitlab_api_url",
"GITLAB_READ_ONLY_MODE": "false",
"USE_GITLAB_WIKI": "false",
"USE_MILESTONE": "false",
"USE_PIPELINE": "false"
}
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
2. Add this to your configuration file:
{
"mcpServers": {
"GitLab communication server": {
"command": "npx",
"args": [
"-y",
"@zereight/mcp-gitlab"
],
"env": {
"GITLAB_PERSONAL_ACCESS_TOKEN": "your_gitlab_token",
"GITLAB_API_URL": "your_gitlab_api_url",
"GITLAB_READ_ONLY_MODE": "false",
"USE_GITLAB_WIKI": "false",
"USE_MILESTONE": "false",
"USE_PIPELINE": "false"
}
}
}
}
3. Restart Claude Desktop for the changes to take effect