GitLab MCP server

Integrates with GitLab to enable repository management, file operations, issue tracking, and merge request handling using a TypeScript implementation configured with a personal access token.
Back to servers
Setup instructions
Provider
Harsh Maur
Release date
Mar 18, 2025
Language
TypeScript
Package
Stats
1.1K downloads
1 star

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).

Installation

The server can be installed and run using either npx or Docker. Choose the method that best fits your environment.

Using with npx

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).

Using with Docker

Standard (stdio) Mode

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

SSE (Server-Sent Events) Mode

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

Configuration Options

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-only
  • USE_GITLAB_WIKI: When set to 'true', enables wiki-related tools
  • USE_MILESTONE: When set to 'true', enables milestone-related tools
  • USE_PIPELINE: When set to 'true', enables pipeline-related tools

Available Tools

The GitLab MCP server provides 65 different tools for interacting with GitLab. Here are some of the key tools:

Repository Management

  • create_or_update_file - Create or update a single file in a GitLab project
  • search_repositories - Search for GitLab projects
  • create_repository - Create a new GitLab project
  • get_file_contents - Get the contents of a file or directory
  • push_files - Push multiple files in a single commit
  • fork_repository - Fork a GitLab project
  • create_branch - Create a new branch

Issues & Merge Requests

  • create_issue - Create a new issue
  • list_issues - List issues with filtering options
  • get_issue - Get details of a specific issue
  • update_issue - Update an issue
  • create_merge_request - Create a new merge request
  • get_merge_request - Get merge request details
  • update_merge_request - Update a merge request

Comments & Discussions

  • create_note - Create a comment on an issue or merge request
  • create_merge_request_thread - Create a new thread on a merge request
  • mr_discussions - List discussion items for a merge request
  • list_issue_discussions - List discussions for an issue

Wiki Management (when enabled)

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

CI/CD Pipeline Management (when enabled)

  • list_pipelines - List pipelines with filtering options
  • get_pipeline - Get details of a specific pipeline
  • create_pipeline - Create a new pipeline
  • retry_pipeline - Retry a failed or canceled pipeline
  • cancel_pipeline - Cancel a running pipeline

Milestone Management (when enabled)

  • list_milestones - List milestones with filtering options
  • get_milestone - Get details of a specific milestone
  • create_milestone - Create a new milestone
  • edit_milestone - Edit an existing milestone
  • delete_milestone - Delete a milestone

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