GitLab MCP server

Integrates with GitLab's API to enable repository management, issue tracking, merge request handling, and file operations for automated development workflows.
Back to servers
Setup instructions
Provider
zereight
Release date
Feb 11, 2025
Language
TypeScript
Package
Stats
62.1K downloads
427 stars

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.

Installation Options

Using NPX

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"
      }
    }
  }
}

Using VSCode

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"
      }
    }
  }
}

Using Docker

Standard stdio 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"
      }
    }
  }
}

SSE Server:

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"
    }
  }
}

Streamable HTTP Server:

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"
    }
  }
}

Configuration Options

Environment Variables

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 operations
  • GITLAB_ALLOWED_PROJECT_IDS: Comma-separated list of allowed project IDs
    • Single value (e.g., 123): Restricts to one project and sets it as default
    • Multiple values (e.g., 123,456,789): Allows access to listed projects only
  • GITLAB_READ_ONLY_MODE: When true, restricts to read-only operations
  • USE_GITLAB_WIKI: When true, enables wiki-related tools
  • USE_MILESTONE: When true, enables milestone-related tools
  • USE_PIPELINE: When true, enables pipeline-related tools
  • GITLAB_AUTH_COOKIE_PATH: Path to an authentication cookie file for GitLab instances requiring cookie-based auth
  • SSE: When true, enables Server-Sent Events transport
  • STREAMABLE_HTTP: When true, enables Streamable HTTP transport

Available Tools

The server provides numerous tools for interacting with GitLab, including:

Repository Management

  • get_repository_tree - List files and directories
  • get_file_contents - Get file or directory contents
  • create_or_update_file - Create or update a file
  • push_files - Push multiple files in a single commit
  • create_branch - Create a new branch
  • create_repository - Create a new project
  • fork_repository - Fork a project

Issues

  • list_issues - List issues with filtering
  • get_issue - Get issue details
  • create_issue - Create a new issue
  • update_issue - Update an existing issue
  • delete_issue - Delete an issue
  • create_issue_note - Add a comment to an issue
  • update_issue_note - Update an issue comment
  • list_issue_discussions - List issue discussions

Merge Requests

  • list_merge_requests - List merge requests
  • get_merge_request - Get merge request details
  • create_merge_request - Create a new merge request
  • update_merge_request - Update a merge request
  • get_merge_request_diffs - Get the changes in a merge request
  • list_merge_request_diffs - List merge request diffs
  • create_merge_request_note - Add a comment to a merge request

Wiki

  • list_wiki_pages - List wiki pages
  • get_wiki_page - Get wiki page details
  • create_wiki_page - Create a new wiki page
  • update_wiki_page - Update a wiki page
  • delete_wiki_page - Delete a wiki page

CI/CD Pipelines

  • list_pipelines - List pipelines
  • get_pipeline - Get pipeline details
  • create_pipeline - Create a new pipeline
  • retry_pipeline - Retry a failed pipeline
  • cancel_pipeline - Cancel a running pipeline
  • list_pipeline_jobs - List jobs in a pipeline
  • get_pipeline_job - Get job details
  • get_pipeline_job_output - Get job output/logs

Many more tools are available for working with milestones, labels, project members, and other GitLab resources.

How to install this MCP server

For Claude Code

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.

For Cursor

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.

Adding an MCP server to Cursor globally

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"
            }
        }
    }
}

Adding an MCP server to a project

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.

How to use the MCP server

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.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.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

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later