home / mcp / gitlab mr mcp server

GitLab MR MCP Server

Interact seamlessly with GitLab repositories to manage merge requests and issues. Fetch details, add comments, and streamline your code review process with ease.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "kevinlin-gitlab-mr-mcp": {
      "command": "npx",
      "args": [
        "[email protected]"
      ],
      "env": {
        "MR_MCP_GITLAB_HOST": "your_gitlab_host",
        "MR_MCP_GITLAB_TOKEN": "your_gitlab_token",
        "MR_MCP_MIN_ACCESS_LEVEL": "10",
        "MR_MCP_PROJECT_SEARCH_TERM": "my-project"
      }
    }
  }
}

You can run a dedicated MCP server that lets AI agents interact with GitLab projects, manage merge requests, review code, and post comments. This server exposes tools to list projects, fetch merge requests, view diffs, and add comments or update titles and descriptions, enabling seamless automation with your AI assistant.

How to use

Start by running the MCP server in your environment. You have two straightforward options depending on whether you want to run the server directly on your machine or invoke it via a package runner.

How to use

Option A: Run with npx (recommended for quick starts) and provide your GitLab host and token as environment variables.

How to use

Set your environment variables and start the server using npx. This launches the GitLab MR MCP server with the necessary credentials.

How to use

Option B: Run manually by starting the local server with Node.js using a local path to the index file. This is useful if you clone the project and want to run from source.

How to use

Once the server is running, connect your MCP client to it using the same environment variables and the appropriate command from the examples below. You can then call tools such as listing projects, retrieving merge request details, or adding comments directly from your AI assistant.

How to use

Typical workflows include: getting a list of accessible GitLab projects, selecting a project, listing open merge requests, inspecting a merge request’s details and comments, fetching diffs, and adding comments or line-specific notes to code. You can also fetch issue details and update a merge request’s title or description as part of your automation pipeline.

Available tools

get_projects

Fetches a list of GitLab projects accessible with your token.

list_open_merge_requests

Lists all open merge requests for a specified project.

get_merge_request_details

Retrieves detailed information about a specific merge request.

get_merge_request_comments

Fetches comments on a merge request, including discussions and diff notes.

add_merge_request_comment

Adds a general comment to a merge request.

add_merge_request_diff_comment

Adds a comment to a specific line in a file within a merge request diff.

get_merge_request_diff

Retrieves the diff for a merge request.

get_issue_details

Fetches detailed information about a specific issue.

set_merge_request_title

Updates the title of a merge request.

set_merge_request_description

Updates the description of a merge request.