This GitLab MCP Server provides an interface between AI assistants and GitLab repositories, allowing you to interact with GitLab projects, issues, merge requests, and more through the Model Context Protocol (MCP).
The server can be installed and run using either npx or Docker. Choose the method that best fits your environment.
To run the GitLab MCP server with npx, create a mcp.json
configuration file with the following content:
{
"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"
}
}
}
}
Replace your_gitlab_token
with your actual GitLab personal access token and your_gitlab_api_url
with your GitLab API URL (defaults to https://gitlab.com/api/v4 if not specified).
Create a mcp.json
file with the following configuration:
{
"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, create a mcp.json
file with this configuration:
{
"mcpServers": {
"GitLab communication server": {
"url": "http://localhost:3333/sse"
}
}
}
The GitLab MCP server can be configured using the following environment variables:
GITLAB_PERSONAL_ACCESS_TOKEN
: Your GitLab personal access token (required)GITLAB_API_URL
: Your GitLab API URL (defaults to https://gitlab.com/api/v4
)GITLAB_READ_ONLY_MODE
: When set to 'true', restricts operations to read-onlyUSE_GITLAB_WIKI
: When set to 'true', enables wiki-related toolsUSE_MILESTONE
: When set to 'true', enables milestone-related toolsUSE_PIPELINE
: When set to 'true', enables pipeline-related toolsThe GitLab MCP server provides 65 different tools for interacting with GitLab. Here are some of the key tools:
create_or_update_file
- Create or update a single file in a GitLab projectsearch_repositories
- Search for GitLab projectscreate_repository
- Create a new GitLab projectget_file_contents
- Get the contents of a file or directorypush_files
- Push multiple files in a single commitfork_repository
- Fork a GitLab projectcreate_branch
- Create a new branchcreate_issue
- Create a new issuelist_issues
- List issues with filtering optionsget_issue
- Get details of a specific issueupdate_issue
- Update an issuecreate_merge_request
- Create a new merge requestget_merge_request
- Get merge request detailsupdate_merge_request
- Update a merge requestcreate_note
- Create a comment on an issue or merge requestcreate_merge_request_thread
- Create a new thread on a merge requestmr_discussions
- List discussion items for a merge requestlist_issue_discussions
- List discussions for an issuelist_wiki_pages
- List wiki pagesget_wiki_page
- Get details of a specific wiki pagecreate_wiki_page
- Create a new wiki pageupdate_wiki_page
- Update an existing wiki pagedelete_wiki_page
- Delete a wiki pagelist_pipelines
- List pipelines with filtering optionsget_pipeline
- Get details of a specific pipelinecreate_pipeline
- Create a new pipelineretry_pipeline
- Retry a failed or canceled pipelinecancel_pipeline
- Cancel a running pipelinelist_milestones
- List milestones with filtering optionsget_milestone
- Get details of a specific milestonecreate_milestone
- Create a new milestoneedit_milestone
- Edit an existing milestonedelete_milestone
- Delete a milestoneTo 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