home / mcp / 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.
Configuration
View docs{
"mcpServers": {
"kopfrechner-gitlab-mr-mcp": {
"command": "node",
"args": [
"/path/to/gitlab-mr-mcp/index.js"
],
"env": {
"MR_MCP_GITLAB_HOST": "your_gitlab_host",
"MR_MCP_GITLAB_TOKEN": "your_gitlab_token",
"MR_MCP_MIN_ACCESS_LEVEL": "min_access_level",
"MR_MCP_PROJECT_SEARCH_TERM": "term"
}
}
}
}You can run a GitLab MR MCP server to let AI agents interact with GitLab merge requests and issues. It exposes tools to list projects, fetch MR details and comments, fetch diffs, add comments (including line-specific comments), manage issues, and update MR titles and descriptions. This enables automated workflows, review automation, and context-aware AI assistance around your GitLab projects.
Start by configuring your MCP client to connect to the GitLab MR MCP server. You will interact with the server through a standard MCP client, performing actions such as listing projects, retrieving merge request details and comments, and adding comments or diffs.
Prerequisites you need on your machine before installing this MCP server are Node.js, a GitLab access token with API access, and one or more GitLab project IDs.
Option 1 — Install via Smithery (recommended for Claude Desktop):
npx -y @smithery/cli@latest install @kopfrechner/gitlab-mr-mcp --client claude --config '"{\"gitlabMrMcpToken\":\"YOUR_GITLAB_TOKEN\", \"gitlabMrMcpHost\": \"YOUR_GITLAB_HOST\"}"'Option 2 — Manual installation (local server):
Prerequisites: Node.js, a GitLab API access token, and access to your GitLab projects.
Steps to set up the MCP server locally:
# 1) Clone the repository
# (use your preferred method to obtain the source code)
# 2) Install dependencies
npm install
# 3) Run the MCP server via the MCP client configuration below
```
Note: Use the following MCP client configuration snippet to connect to this server. It defines how to start the server and which environment variables to provide.Config snippet you can place in your MCP client configuration (environment variables can be adjusted to your setup):
{
"mcpServers": {
"gitlab-mr-mcp": {
"command": "node",
"args": ["/path/to/gitlab-mr-mcp/index.js"],
"env": {
"MR_MCP_GITLAB_TOKEN": "your_gitlab_token",
"MR_MCP_GITLAB_HOST": "your_gitlab_host"
}
}
}
}Security notes: Ensure your GitLab token has only the scopes required for your use case (api, read_api as needed) and restrict token access to trusted systems. When embedding tokens in configuration, prefer environment variables and avoid committing secrets to version control.
Troubleshooting: If you encounter permissions issues (403 Forbidden), verify that your GitLab token has the proper scopes, that the token user has access to the relevant projects, and that the project IDs you intend to access are correct.
Development tips: You can run an inspector for development and testing with the following command to start MCP client integration tooling.
export MR_MCP_GITLAB_TOKEN=your_gitlab_token
export MR_MCP_GITLAB_HOST=your_gitlab_host
# Optional filters for development
export MR_MCP_MIN_ACCESS_LEVEL=min_access_level
export MR_MCP_PROJECT_SEARCH_TERM=term
npx -y @modelcontextprotocol/inspector npm startRetrieves a list of GitLab projects accessible with your token.
Lists all open merge requests for a specified GitLab project.
Fetches detailed information about a specific merge request.
Fetches comments from a specific merge request, including discussion and diff notes.
Adds a general comment to a merge request.
Adds a comment to a specific line in a file within a merge request diff.
Retrieves the diff for a merge request.
Fetches detailed information about a specific issue.
Updates the title of a merge request.
Updates the description of a merge request.