mcp-gitlab — Claude Code MCP server: features and setup
Connect an AI agent to GitLab projects, merge requests, pipelines, and issues. A read-only setting removes write tools from the server.
claude mcp add mcp-gitlab -e GITLAB_TOKEN=<GITLAB_TOKEN> -e GITLAB_URL=<GITLAB_URL> -e GITLAB_OAUTH_CLIENT_SECRET=<GITLAB_OAUTH_CLIENT_SECRET> -e GITLAB_OAUTH_JWT_KEY=<GITLAB_OAUTH_JWT_KEY> -e GITLAB_HTTP_BEARER_TOKEN=<GITLAB_HTTP_BEARER_TOKEN> -- uvx mcp-gitlabWhat mcp-gitlab does
mcp-gitlab connects an agent to the GitLab REST API. It can work with projects, merge requests, pipelines, CI/CD variables, approvals, and issues, and assist with code reviews. The server supports GitLab.com and self-hosted GitLab CE/EE instances.
Run it with uvx mcp-gitlab. You need uv, a GitLab instance address in GITLAB_URL, and a token in GITLAB_TOKEN; other token environment variables and sign-in through mcp-gitlab auth login are supported too. Set MCP_READ_ONLY=true to keep write tools and write-workflow prompts out of the agent’s available options. That setting prevents the agent from making changes through this server.
What it helps with
- browse GitLab projects
- inspect merge requests and approvals
- investigate a failed CI/CD pipeline
- manage issues and CI/CD variables
- review code with an AI agent
Example prompts for the agent
- Find the GitLab project for this repository and show its open merge requests.
- Inspect the latest pipeline failure and summarize the related issues.
- Review this merge request and identify unresolved feedback.
How to install mcp-gitlab
Platform CLI
claude mcp add mcp-gitlab -e GITLAB_TOKEN=<GITLAB_TOKEN> -e GITLAB_URL=<GITLAB_URL> -e GITLAB_OAUTH_CLIENT_SECRET=<GITLAB_OAUTH_CLIENT_SECRET> -e GITLAB_OAUTH_JWT_KEY=<GITLAB_OAUTH_JWT_KEY> -e GITLAB_HTTP_BEARER_TOKEN=<GITLAB_HTTP_BEARER_TOKEN> -- uvx mcp-gitlabReplace <…> with your own values. 6 more environment variables are in the server README. uvx runs the command named after the package; if the README names another one, use uvx --from mcp-gitlab <command>
Platform CLI
codex mcp add mcp-gitlab --env GITLAB_TOKEN=<GITLAB_TOKEN> --env GITLAB_URL=<GITLAB_URL> --env GITLAB_READ_ONLY=<GITLAB_READ_ONLY> --env MCP_READ_ONLY=<MCP_READ_ONLY> --env GITLAB_AUTH=<GITLAB_AUTH> -- uvx mcp-gitlabReplace <…> with your own values. 6 more environment variables are in the server README. uvx runs the command named after the package; if the README names another one, use uvx --from mcp-gitlab <command>
Config file
{
"mcpServers": {
"mcp-gitlab": {
"command": "uvx",
"args": [
"mcp-gitlab"
],
"env": {
"GITLAB_TOKEN": "<GITLAB_TOKEN>",
"GITLAB_URL": "<GITLAB_URL>",
"GITLAB_READ_ONLY": "<GITLAB_READ_ONLY>",
"MCP_READ_ONLY": "<MCP_READ_ONLY>",
"GITLAB_AUTH": "<GITLAB_AUTH>"
}
}
}
}Replace <…> with your own values. 6 more environment variables are in the server README. uvx runs the command named after the package; if the README names another one, use uvx --from mcp-gitlab <command>
Config file
{
"servers": {
"mcp-gitlab": {
"type": "stdio",
"command": "uvx",
"args": [
"mcp-gitlab"
],
"env": {
"GITLAB_TOKEN": "<GITLAB_TOKEN>",
"GITLAB_URL": "<GITLAB_URL>",
"GITLAB_READ_ONLY": "<GITLAB_READ_ONLY>",
"MCP_READ_ONLY": "<MCP_READ_ONLY>",
"GITLAB_AUTH": "<GITLAB_AUTH>"
}
}
}
}Replace <…> with your own values. 6 more environment variables are in the server README. uvx runs the command named after the package; if the README names another one, use uvx --from mcp-gitlab <command>
Platform CLI
gemini mcp add -e GITLAB_TOKEN=<GITLAB_TOKEN> -e GITLAB_URL=<GITLAB_URL> -e GITLAB_READ_ONLY=<GITLAB_READ_ONLY> -e MCP_READ_ONLY=<MCP_READ_ONLY> -e GITLAB_AUTH=<GITLAB_AUTH> mcp-gitlab uvx mcp-gitlabReplace <…> with your own values. 6 more environment variables are in the server README. uvx runs the command named after the package; if the README names another one, use uvx --from mcp-gitlab <command>
Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more
Questions about mcp-gitlab
How do I install mcp-gitlab in Claude Code?
Install uv first, then run `claude mcp add mcp-gitlab -e GITLAB_TOKEN=<GITLAB_TOKEN> -e GITLAB_URL=<GITLAB_URL> -e GITLAB_OAUTH_CLIENT_SECRET=<GITLAB_OAUTH_CLIENT_SECRET> -e GITLAB_OAUTH_JWT_KEY=<GITLAB_OAUTH_JWT_KEY> -e GITLAB_HTTP_BEARER_TOKEN=<GITLAB_HTTP_BEARER_TOKEN> -- uvx mcp-gitlab`. Replace the placeholders with your GitLab values.
What does mcp-gitlab do?
It gives an AI agent access to GitLab REST API tasks involving projects, merge requests, pipelines, CI/CD, and issues. It also supports approvals and code review work.
Can I prevent the agent from changing GitLab data?
Yes. Set MCP_READ_ONLY=true to hide write tools and write-workflow prompts from the agent.