GitLab MCP server

Developer tools

GitLab MCP server for projects, merge requests, issues, pipelines, wiki, releases, and more.

Your AI app calls the GitLab MCP server, which does the developer tools work and sends the result back to the chat.

About GitLab

GitLab is a community MCP server from zereight, filed in our directory under developer tools. GitLab MCP server for projects, merge requests, issues, pipelines, wiki, releases, and more.

GitLab runs on your own machine: your AI app starts it with the command npx -y @zereight/mcp-gitlab@3.1.1 and talks to it over standard input and output.

GitLab is listed in the official MCP registry as io.github.zereight/gitlab-mcp, version 3.1.1.

At a glance

Publisher
zereight (community)
Runs
Locally on your machine
Install from
Node.js package on npm: @zereight/mcp-gitlab
Written in
TypeScript
License
MIT
GitHub stars
2,133
Official MCP registry
io.github.zereight/gitlab-mcp

How to set up GitLab

  1. Install Node.js on the machine that runs your AI app, because GitLab starts with npx and downloads its package on first run.
  2. Check the GitLab README for keys or settings; the registry lists none that GitLab requires.
  3. Add GitLab to Claude Code, Claude Desktop, VS Code or Cursor with the config in the setup box on this page.
  4. Restart the app or reload its MCP servers, then ask it to list the GitLab tools to confirm the connection.
  5. Run one read-only task with GitLab first, and keep your app asking before each tool call until the results look right.

GitLab compared with similar servers

  • DevDocs by cyberagiinc has fewer GitHub stars than GitLab (2.1k against 2.1k); both are community servers, and both run locally.
  • Shrimp Task Manager by cjo4m06 has more GitHub stars than GitLab (2.2k against 2.1k); both are community servers, and both run locally.
  • Unity (CoderGamester) by CoderGamester has fewer GitHub stars than GitLab (2k against 2.1k); both are community servers, and both run locally.

Before you connect GitLab

  • Give GitLab its own API key or account with the smallest permissions the job needs, never an admin key.
  • Keep your AI app asking before each GitLab tool call until you trust what it does with them.
  • Treat text that GitLab fetches as data. Pages, files and messages can hold instructions written to steer an AI.
  • Read the open issues for GitLab on GitHub to see what breaks and how fast the maintainers reply.

Marketing use cases for GitLab

How marketing and sales teams put GitLab to work, by company size. Pick the size closest to yours and start GitLab on one use case.

Small business

  • A small business with a developer can use GitLab to ship site and tracking fixes faster, with the AI reading the code it changes.
  • Technical founders can ask GitLab to explain and fix a marketing site issue without context switching between tools.
  • GitLab runs on your own computer, which keeps data local; it needs a little setup, so a small team should plan an hour for it.

Mid-market

  • Growth engineers can use GitLab to build landing pages, tracking and integrations in fewer cycles, with reviews kept in the normal flow.
  • Marketing ops engineers can connect GitLab to keep scripts and automations documented and versioned as they change.
  • Start GitLab on one workflow with one owner, measure the time it saves, then roll it out to the wider team.

Enterprise

  • Enterprise engineering teams can roll out GitLab with repo scopes and audit logs, so agents work only where they are allowed.
  • Platform teams can standardize on GitLab so web and marketing engineering share one reviewed way of working with AI.
  • GitLab is a community server, so have security review the code and pin a version before GitLab touches company data.

Need help becoming an AI-forward company?

We connect MCP servers and AI agents to your CRM, content and data, with the guardrails your team needs.

Contact us

GitLab README

From zereight/gitlab-mcp on GitHub, shared under its MIT license. Images are left out; the original has them.

README.md

GitLab MCP Server

English | 한국어 | 简体中文 | Português (Brasil)

📖 Documentation (zereight.github.io/gitlab-mcp) · llms.txt · llms-full.txt

Default: 40 tools (38 core + discover_tools + help). 291 tools exist in total (288 in toolsets + execute_graphql + discover_tools + help). Start lean; call discover_tools to activate more for this session.

Token budget: MCP clients send the whole tools/list to the model at session start. Keep the default (~40 tools, ~12k schema tokens). Call discover_tools to activate a category for this session (session-only; with OAUTH_STATELESS_MODE=true persist a named GITLAB_TOOLSETS list), or use Skill + CLI and skip MCP schemas. Do not set GITLAB_TOOLSETS=all, it loads ~all tools and costs ~73k schema tokens. See tools/list size and comparison.

Install the zereight-mcp-gitlab binary first with npm install -g @zereight/mcp-gitlab, or Homebrew brew tap zereight/gitlab-mcp https://github.com/zereight/gitlab-mcp and brew install zereight/gitlab-mcp/zereight-mcp-gitlab. Official MCP Registry listing: io.github.zereight/gitlab-mcp. One-liner: npx -y @zereight/mcp-gitlab@latest.

Without → With

Without this MCP With this MCP
Paste MR URLs and diffs into chat list_merge_request_changed_files → batched get_merge_request_file_diff
Hunt job logs in the GitLab UI get_pipeline_job_output with pagination
Re-explain the project path every turn project_id=group%2Fproject and merge_request_iid=123
Three install paths
Path When How
Local IDE Cursor, Claude Code, Codex on your machine stdio + PAT or local OAuth
Shared HTTP Team or hosted MCP Streamable HTTP URL + remote auth or MCP OAuth
Claude.ai Claude web connectors Public HTTPS + GITLAB_MCP_OAUTH
Install

Install the binary first (npm install -g @zereight/mcp-gitlab, or Homebrew brew tap zereight/gitlab-mcp https://github.com/zereight/gitlab-mcp then brew install zereight/gitlab-mcp/zereight-mcp-gitlab). Read the token without echo:

read -rs GITLAB_PERSONAL_ACCESS_TOKEN && export GITLAB_PERSONAL_ACCESS_TOKEN
# Claude Code
claude mcp add gitlab --transport stdio --scope local --env GITLAB_PERSONAL_ACCESS_TOKEN="$GITLAB_PERSONAL_ACCESS_TOKEN" --env GITLAB_API_URL=https://gitlab.com/api/v4 -- zereight-mcp-gitlab

# Codex
codex mcp add gitlab --env GITLAB_PERSONAL_ACCESS_TOKEN="$GITLAB_PERSONAL_ACCESS_TOKEN" --env GITLAB_API_URL=https://gitlab.com/api/v4 -- zereight-mcp-gitlab

Other clients: VS Code · GitHub Copilot · JSON clients · Cursor details

Agent paste-prompt

Copy this into an agent that can edit MCP config:

Install the GitLab MCP server (@zereight/mcp-gitlab) for this workspace.
Binary: zereight-mcp-gitlab (npm i -g @zereight/mcp-gitlab, or npx -y @zereight/mcp-gitlab@latest).
Auth: GITLAB_PERSONAL_ACCESS_TOKEN plus GITLAB_API_URL=https://gitlab.com/api/v4 (or GITLAB_USE_OAUTH=true).
Local: claude mcp add gitlab --transport stdio --scope local --env GITLAB_PERSONAL_ACCESS_TOKEN="$GITLAB_PERSONAL_ACCESS_TOKEN" --env GITLAB_API_URL=https://gitlab.com/api/v4 -- zereight-mcp-gitlab
Or: codex mcp add gitlab --env GITLAB_PERSONAL_ACCESS_TOKEN="$GITLAB_PERSONAL_ACCESS_TOKEN" --env GITLAB_API_URL=https://gitlab.com/api/v4 -- zereight-mcp-gitlab
Cursor: use the README deeplink or docs/clients/cursor.md.
Remote HTTP: point the client at https://mcp.example.com/mcp (Streamable HTTP). Claude.ai needs GITLAB_MCP_OAUTH on that host.
Default list: 40 tools (38 core + discover_tools + help). Call discover_tools to expand. Do not set GITLAB_TOOLSETS=all (loads ~all schemas, ~73k tokens). Do not enable the api toolset unless you accept its bypass risk.
Equal non-MCP path: npx skills add zereight/gitlab-mcp --skill gitlab-mcp-skill plus the zereight-mcp-gitlab CLI.
Remote HTTP

First-class option for a hosted or self-hosted server. Point the client at a Streamable HTTP URL:

{
  "mcpServers": {
    "gitlab": {
      "type": "http",
      "url": "https://mcp.example.com/mcp"
    }
  }
}
  • Hosted / Claude.ai: GITLAB_MCP_OAUTH=true on the server (see MCP OAuth)
  • Per-user PAT headers: REMOTE_AUTHORIZATION=true (see Remote Authorization)
  • Local Docker examples are in Usage
Skill + CLI (no MCP required)

Skill + CLI is an equal path, not a fallback. Same workflows, full payloads in a terminal, no MCP registration.

npx skills add zereight/gitlab-mcp --skill gitlab-mcp-skill
zereight-mcp-gitlab user whoami
zereight-mcp-gitlab mr list

See CLI without MCP and skills/gitlab-mcp/.

MCP vs Human CLI
Use MCP when Use the CLI when
The agent needs structured tools in chat You need the full payload (diffs, logs, artifacts)
jmespath or compact results are enough GITLAB_MCP_COMPACT_RESULTS is on and you want the rest in a terminal
You already registered the server You have a PAT or ran auth and do not want MCP

Human CLI is never compacted. Destructive tools and GITLAB_TOOL_POLICY_APPROVE tools need --yes.

Tips

project_id is a numeric ID or a URL-encoded path. Example: group group, project project, merge request !123 → project_id=group%2Fproject, merge_request_iid=123. Nested groups use %2F between every segment (group%2Fsubgroup%2Fproject).

FAQ

How do I authenticate? Local desktop: GITLAB_PERSONAL_ACCESS_TOKEN (or GITLAB_PERSONAL_ACCESS_TOKEN_FILE) is the simplest. Local OAuth is GITLAB_USE_OAUTH=true. Remote Claude.ai uses GITLAB_MCP_OAUTH. Multi-user HTTP uses REMOTE_AUTHORIZATION and a per-request token header.

Why do I only see ~40 tools? The default core toolset is 38 tools plus always-on discover_tools and help. That is intentional: a client sends every listed schema to the model up front. Call discover_tools with no args to list categories, then pass a category (pipelines, wiki, …) to activate it for this session. Session-only; with OAUTH_STATELESS_MODE=true persist a named GITLAB_TOOLSETS list. Do not set GITLAB_TOOLSETS=all, it loads all schemas (73k tokens) and still does not enable api.

Local OAuth vs MCP OAuth vs remote auth? Local OAuth opens a browser on the same machine as the server. MCP OAuth is for a public HTTPS server and clients such as Claude.ai. Remote authorization forwards the caller's PAT or job token; there is no OAuth dance.

How do I shrink huge replies? Pass jmespath on any tool call. Or set GITLAB_MCP_COMPACT_RESULTS=true so oversized MCP replies become a preview plus a CLI command. Use the CLI when you need the full payload. Recommended opt-in settings (both default off): GITLAB_MCP_LIST_SUMMARY_DEFAULT=true (--list-summary-default=true) returns summaries for most supported list tools unless a call passes summary: false, and GITLAB_MCP_COMPACT_TOOLS (--compact-tools) compacts oversized replies from only the tools you name, such as get_pipeline_job_output. See Environment Variables.

Why is the api toolset dangerous? gitlab_api_request bypasses group/project allowlists, other tool filters, and per-tool safety checks. Prompt injection can drive it. Enable it only by listing api in GITLAB_TOOLSETS. all, discover_tools, and GITLAB_TOOLS do not.

Cursor rule / CLAUDE.md snippet
GitLab merge requests, issues, and pipelines go through this MCP (@zereight/mcp-gitlab).
Start with the default core tools. Call discover_tools to expand. Do not set GITLAB_TOOLSETS=all.
Prefer list_merge_request_changed_files, then batched get_merge_request_file_diff.
Use jmespath or compact results; use the CLI for full diffs and job logs.

@zereight/mcp-gitlab

Agent-workflow-optimized GitLab MCP, manage projects, merge requests, issues, pipelines, wiki, releases, tags, milestones, and more through stdio, SSE, and Streamable HTTP.

Supports PAT, OAuth, read-only mode, dynamic API URLs, and remote authorization for VS Code, Claude, Cursor, Copilot, and other MCP clients.

Why use this GitLab MCP?
  • Default 40 tools (38 core + discover_tools + help); 291 total, start lean; call discover_tools to activate more without CQRS-style grouping. GITLAB_TOOLSETS=all loads all schemas (73k tokens); prefer discover-on-demand or Skill + CLI
  • MR 2-step review, list_merge_request_changed_files → batched get_merge_request_file_diff
  • Agent Skill built in, workflow guidance in skills/gitlab-mcp/
  • Flexible auth, Personal Access Token, local OAuth2 browser flow, MCP OAuth proxy, and per-request remote authorization
  • Multiple transports, stdio for local clients, SSE for legacy clients, and Streamable HTTP for modern remote deployments
  • Client-friendly setup, examples for Claude Code, Codex, Antigravity, OpenCode, Copilot, Cline, Roo Code, Cursor, Kilo Code, and Amp Code
  • Self-hosted ready, works with custom GitLab instances, proxy settings, and dynamic API URL routing
  • JMESPath result filtering, optional jmespath on tool calls (see tools/list) shrinks JSON results without changing GitLab API requests; when response masking is enabled, JMESPath runs on masked data.
How we compare
@zereight/mcp-gitlab GitLab MCP A (community CQRS-style) GitLab official MCP server
Best for AI agent workflows Enterprise multi-instance / grouped tools Built into GitLab, no separate install
Tool model 291 tools: 288 in toolsets + execute_graphql + discover_tools + help ~50–60 grouped browse_* / manage_* tools Toolsets chosen with an HTTP header
MR review 2-step batched diff Varies get_merge_request with diffs
Node.js >=20.0.0 Often >=24 Node.js 20+ for stdio via mcp-remote
License MIT Varies Part of GitLab
tools/list size (measured 2026-11-14)

A client sends the whole tools/list result to the model at session start. Token estimate is UTF-8 bytes / 4.

Profile Tools JSON bytes Est. tokens
Default (core + discover_tools + help) 40 47,822 11,956
GITLAB_TOOL_PROFILE=slim 39 46,814 11,704
GITLAB_TOOLSETS=all 286 295,933 73,984

Re-measure with npm run build && npm run test:mock (test/tools-list-budget.test.ts) after description or schema changes.

GitLab also ships an official MCP server.

  • Free, Premium, and Ultimate. Moved from Premium to Free in GitLab 19.2. Generally available in GitLab 19.5.
  • On GitLab.com, a top-level group Owner allows access to the MCP server. On GitLab Self-Managed and GitLab Dedicated, an administrator controls the instance setting. Default rules are on the official page.
  • Remote clients use HTTP https://<gitlab.example.com>/api/v4/mcp with OAuth 2.0 dynamic client registration.
  • stdio goes through mcp-remote and needs Node.js 20 or later.
  • Toolsets use the X-Gitlab-Enabled-Mcp-Server-Toolsets header. An optional X-Gitlab-Mcp-Server-Tool-Name-Prefix header keeps the first 32 characters of a tool-name prefix.

Full comparison with the official GitLab MCP server →

Quick start: choose either Personal Access Token or OAuth2 setup below, install @zereight/mcp-gitlab, and use zereight-mcp-gitlab in your MCP client configuration.

Client Setup Guides

Usage

Setup Overview
Authentication Methods

The server supports four authentication methods:

For local/desktop use (most common):

  1. Personal Access Token (GITLAB_PERSONAL_ACCESS_TOKEN or GITLAB_PERSONAL_ACCESS_TOKEN_FILE), simplest setup
  2. OAuth2, Local Browser (GITLAB_USE_OAUTH), recommended for better security

For server/remote deployments:

  1. OAuth2, MCP Proxy (GITLAB_MCP_OAUTH), for remote MCP clients such as Claude.ai
  2. Remote Authorization (REMOTE_AUTHORIZATION), multi-user deployments where each caller provides their own token
Quick setup paths

For the simplest local setup, start with a Personal Access Token. For browser-based local auth, use OAuth2. For remote or multi-user deployments, continue to the MCP OAuth and Remote Authorization sections later in this README.

Install the server once:

brew tap zereight/gitlab-mcp https://github.com/zereight/gitlab-mcp
brew install zereight/gitlab-mcp/zereight-mcp-gitlab

Or with npm:

npm install -g @zereight/mcp-gitlab

Or with Nix, by adding this flake to your own:

# flake.nix
inputs.gitlab-mcp.url = "github:zereight/gitlab-mcp";

# wherever you configure your MCP client:
command = lib.getExe inputs.gitlab-mcp.packages.${system}.default;

The store path is pinned by your lock file; update it with nix flake update gitlab-mcp.

The examples use zereight-mcp-gitlab, a less collision-prone alias for the legacy mcp-gitlab binary. If your MCP client cannot find it, use the absolute path from which zereight-mcp-gitlab.

No global install? Pin npx to the previous stable release (the version these docs recommend), for example npx -y @zereight/mcp-gitlab@3.1.0. If you set GITLAB_MASKING_ENABLED, use 2.3.29 or later (or @latest): older releases return the values of CI/CD variables that GitLab flags masked or hidden in plain text. If you always want the newest release, use npx -y @zereight/mcp-gitlab@latest instead. To try a fix merged to main before the next stable release, use npx -y @zereight/mcp-gitlab@next, a pre-release build that is not meant for production. The server prints a notice to stderr on startup when a newer version is available (disable with GITLAB_DISABLE_VERSION_CHECK=true).

Claude Desktop one-click install (MCP Bundle)

Every GitHub release after v2.3.1 ships a gitlab-mcp.mcpb MCP Bundle. Download the latest bundle and open it with Claude Desktop (or drag it into Settings → Extensions). Claude Desktop asks for your Personal Access Token (stored as a sensitive value) and lets you set GITLAB_API_URL, GITLAB_PERMISSION_MODE, GITLAB_TOOLSETS, and GITLAB_MASKING_ENABLED. No separate Node.js or npm install is needed.

To build the bundle from source, run npm run pack:mcpb (writes gitlab-mcp.mcpb).

Using CLI Arguments (for clients with env var issues)

Some MCP clients (like GitHub Copilot CLI) have issues with environment variables. Use CLI arguments instead:

{
  "mcpServers": {
    "gitlab": {
      "command": "zereight-mcp-gitlab",
      "args": ["--token=YOUR_GITLAB_TOKEN", "--api-url=https://gitlab.com/api/v4"],
      "tools": ["*"]
    }
  }
}

Available CLI arguments:

  • --token - GitLab Personal Access Token (replaces GITLAB_PERSONAL_ACCESS_TOKEN)
  • --api-url - GitLab API URL (replaces GITLAB_API_URL)
  • --permission-mode - Permission level: readonly, modify (no delete or teardown tools; the opt-in gitlab_api_request still allows POST/PUT/PATCH), or full (replaces GITLAB_PERMISSION_MODE, default full)
  • --toolsets - Named toolsets (replaces GITLAB_TOOLSETS; unset uses the lean core default). Do not pass all unless you accept ~73k schema tokens. gitlab_api_request needs --toolsets=api
  • --tools=list_issues - Add individual tools (replaces GITLAB_TOOLS)
  • --disable-version-check=true - Disable the startup new-version notice (replaces GITLAB_DISABLE_VERSION_CHECK)
  • --masking-enabled=true - Enable text-response masking (replaces GITLAB_MASKING_ENABLED)
  • --masking-config - Path to a masking configuration file (replaces GITLAB_MASKING_CONFIG)
  • --masking-policy-file - Path to a protected managed-policy file (replaces GITLAB_MASKING_POLICY_FILE)
  • --masking-workspace-dir - Directory used to resolve masking files (replaces GITLAB_MASKING_WORKSPACE_DIR)
  • --download-dir - Directory download_attachment and download_job_artifacts save files under (replaces GITLAB_DOWNLOAD_DIR; default .gitlab-mcp-downloads)
  • --compact-results=true - Truncate oversized MCP tool replies and attach a CLI command for the full payload (replaces GITLAB_MCP_COMPACT_RESULTS; default off)
  • --compact-result-chars - Character threshold for compacting (replaces GITLAB_MCP_COMPACT_RESULT_CHARS; default 4000)
  • --compact-tools - Comma-separated tool names to compact when oversized, without turning global compact on (replaces GITLAB_MCP_COMPACT_TOOLS)
  • --list-summary-default=true - list_* tools and mr_discussions treat an omitted summary argument as true; summary: false still returns the full JSON (replaces GITLAB_MCP_LIST_SUMMARY_DEFAULT; default off)
  • --audit-log=true - Opt-in NDJSON audit log of MCP tool calls for SIEM ingestion (replaces GITLAB_AUDIT_LOG; default off)
  • --audit-log-file - Append audit lines to this file; unset writes NDJSON to stderr, never stdout (replaces GITLAB_AUDIT_LOG_FILE)
  • --tool-profile - full (default) or slim. slim drops draft notes, emoji reactions, labels, CI catalog tools, and create_group from the initial list. Ignored when GITLAB_TOOLSETS is set (replaces GITLAB_TOOL_PROFILE)

If you already set GITLAB_TOOLSETS or --toolsets, append wiki, milestones, or pipelines to that list instead of replacing it. If you already set GITLAB_TOOLS or --tools, append validate_ci_lint and validate_project_ci_lint to that list instead of replacing it. An explicit list replaces the default core toolset; it does not merge.

CLI arguments take precedence over environment variables.

zereight-mcp-gitlab auth is a subcommand (not an MCP server flag). It runs GitLab device flow and exits. See CLI Arguments.

The same binary is also a gh-style GitLab CLI (tool <name> or curated forms such as mr list). No MCP registration is needed, set a PAT, or run auth and set GITLAB_USE_OAUTH=true: see CLI without MCP. setup --cursor / setup --claude prints client config; doctor checks token, API URL, toolsets, and version. Use it for the full payload in a terminal. MCP replies stay in the chat unless you set GITLAB_MCP_COMPACT_RESULTS=true (or --compact-results), which replaces oversized tool replies with a preview and a CLI command. The reply carries a cli command only when every value is shell-safe on POSIX shells, cmd.exe, and PowerShell; otherwise it carries cli_argv (an argv array) to run without a shell. Human CLI is never compacted. Same permission mode, toolsets, denied-tools regex, and tool-policy filters. Destructive tools and GITLAB_TOOL_POLICY_APPROVE tools need --yes. See Human CLI.

Fine-grained tool filtering: use GITLAB_PERMISSION_MODE=modify to allow create/update while blocking every delete tool and the destructive teardown tools (cancel_pipeline, cancel_pipeline_job, stop_environment, stop_stale_environments, unprotect_branch, unprotect_tag), including destructive mutations (deletion and teardown verbs) through execute_graphql and push_files delete/move actions, or GITLAB_PERMISSION_MODE=readonly for read-only access. modify only partly covers gitlab_api_request (opt-in api toolset): in modify the tool rejects DELETE but still allows POST, PUT, and PATCH, including teardown endpoints (see the caution below). You can also enable toolset groups with GITLAB_TOOLSETS=<group,…>, allow-list individual tools with GITLAB_TOOLS=<tool,…> (e.g. read-only groups plus a few specific write tools), and deny-list by pattern with GITLAB_DENIED_TOOLS_REGEX. The legacy USE_GITLAB_WIKI / USE_MILESTONE / USE_PIPELINE flags are removed in v3.0.0. Use GITLAB_TOOLSETS=core,wiki, core,milestones, or core,pipelines (USE_PIPELINE also needs validate_ci_lint,validate_project_ci_lint appended to an existing GITLAB_TOOLS list instead of replacing it). If you already set GITLAB_TOOLSETS, append the toolset to your existing list instead of replacing it. If GITLAB_TOOLS is unset, set GITLAB_TOOLS=validate_ci_lint,validate_project_ci_lint. If it is already set, append validate_ci_lint,validate_project_ci_lint instead of replacing that list. See Tools Reference and Environment Variables.

[!CAUTION] gitlab_api_request (toolset api) bypasses project allowlists, tool-level restrictions (GITLAB_TOOLS, GITLAB_DENIED_TOOLS_REGEX on other tools), and individual tool safety checks. With GITLAB_MCP_OAUTH=true, the GITLAB_OAUTH_ALLOWED_GROUPS membership check still decides who may use the server, but an admitted user can request resources outside those groups. The full token permission scope is exposed. Prompt injection can drive this tool. Operators who rely on these restrictions must NOT enable it. Enable it only by listing api in GITLAB_TOOLSETS (GITLAB_TOOLSETS=all, discover_tools, GITLAB_TOOLS, and GITLAB_TOOL_PROFILE do not). With GITLAB_ALLOWED_PROJECT_IDS or a session project scope, only /projects/:id paths for an allowed project are accepted. Endpoints such as /search, /users, /groups/:id, and /runners are rejected. Body and query parameters that name another project are not checked. GITLAB_PROJECT_ID and OAuth group allowlists are not enforced by this tool.

  • sse

Pass the variable name only. The Docker client copies the exported GITLAB_PERSONAL_ACCESS_TOKEN into the container.

docker run -i --rm \
  -e HOST=0.0.0.0 \
  -e GITLAB_PERSONAL_ACCESS_TOKEN \
  -e GITLAB_API_URL="https://gitlab.com/api/v4" \
  -e GITLAB_PERMISSION_MODE=readonly \
  -e GITLAB_TOOLSETS=core,wiki,milestones,pipelines \
  -e SSE=true \
  -e SSE_AUTH_TOKEN=your_mcp_sse_token \
  -p 3333:3002 \
  zereight050/gitlab-mcp
{
  "mcpServers": {
    "gitlab": {
      "type": "sse",
      "url": "http://localhost:3333/sse",
      "headers": {
        "Authorization": "Bearer your_mcp_sse_token"
      }
    }
  }
}
  • streamable-http
docker run -i --rm \
  -e HOST=0.0.0.0 \
  -e REMOTE_AUTHORIZATION=true \
  -e GITLAB_API_URL="https://gitlab.com/api/v4" \
  -e GITLAB_PERMISSION_MODE=readonly \
  -e GITLAB_TOOLSETS=core,wiki,milestones,pipelines \
  -e STREAMABLE_HTTP=true \
  -p 3333:3002 \
  zereight050/gitlab-mcp
{
  "mcpServers": {
    "gitlab": {
      "type": "streamable-http",
      "url": "http://localhost:3333/mcp",
      "headers": {
        "Authorization": "Bearer glpat-..."
      }
    }
  }
}
Using MCP OAuth Proxy (GITLAB_MCP_OAUTH)

For server/remote deployments only. This mode requires the MCP server to be deployed with a publicly accessible HTTPS URL. For local/desktop use, see GITLAB_USE_OAUTH above.

For remote MCP clients that support the MCP OAuth specification (e.g. Claude.ai). The server acts as a full OAuth 2.0 authorization server, unauthenticated requests receive a 401 + WWW-Authenticate response, which triggers the OAuth browser flow automatically on the client side.

Remote MCP clients such as OpenCode, MCPJam, and Claude.ai can send their own callback URL during authorization. If you cannot register every client callback URL in GitLab, enable GITLAB_OAUTH_CALLBACK_PROXY=true. With callback proxy mode, GitLab only needs one registered redirect URI: {MCP_SERVER_URL}/callback.

GITLAB_OAUTH_REDIRECT_URI is for local OAuth (GITLAB_USE_OAUTH) only. It does not override remote MCP OAuth client callback URLs and should not be used to fix remote Unregistered redirect_uri errors.

This variable exists because the local OAuth flow starts a browser on the same machine as the MCP server and listens for the callback on a local HTTP server, for example http://127.0.0.1:8888/callback.

Remote MCP OAuth is different. In GITLAB_MCP_OAUTH=true mode, the MCP client provides its own callback URL during /authorize. GITLAB_OAUTH_REDIRECT_URI does not replace that client-provided URL.

Mode Enable with Callback variable GitLab redirect URI
Local OAuth GITLAB_USE_OAUTH=true GITLAB_OAUTH_REDIRECT_URI http://127.0.0.1:8888/callback or your local callback
Remote MCP OAuth GITLAB_MCP_OAUTH=true GITLAB_OAUTH_CALLBACK_PROXY=true {MCP_SERVER_URL}/callback

Use GITLAB_OAUTH_REDIRECT_URI only when the MCP server itself owns the local browser callback. Use GITLAB_OAUTH_CALLBACK_PROXY=true when a remote MCP client owns the callback URL.

How it works: You deploy this MCP server somewhere with a public HTTPS URL. MCP clients connect to {MCP_SERVER_URL}/mcp. The server handles the OAuth 2.0 flow, exchanging credentials with GitLab on behalf of the client.

Prerequisites:

  1. A publicly accessible HTTPS server URL (MCP_SERVER_URL), use ngrok for local testing
  2. A pre-registered GitLab OAuth application with api (or read_api) scopes , Go to Admin area → Applications, set Redirect URI to {MCP_SERVER_URL}/callback
Environment Variable Required Description
GITLAB_MCP_OAUTH ✅ Set to true to enable
GITLAB_API_URL ✅ GitLab API base URL. Do not embed credentials (user:pass@) in the URL; they are ignored. A comma in a username or password must be written as %2C; since v3.0.0 a value with a comma that may be inside one is refused at startup.
GITLAB_OAUTH_APP_ID ✅ GitLab OAuth Application ID
MCP_SERVER_URL ✅ Public HTTPS URL of this MCP server
STREAMABLE_HTTP ✅ Must be true
GITLAB_OAUTH_CALLBACK_PROXY optional Set to true to use the MCP server's fixed /callback URL
GITLAB_OAUTH_ALLOWED_REDIRECT_URIS optional Client callback URLs that callback proxy mode will redirect to (default: Claude, ChatGPT, Cursor and loopback callbacks; defaults,<url> to add one)
GITLAB_OAUTH_SCOPES optional Comma-separated scopes (default: api,read_api,read_user)
GITLAB_OAUTH_ALLOWED_GROUPS optional Comma-separated group full paths, only members (and subgroup members) may use the server (replaces removed GITLAB_ALLOWED_GROUPS)
OAUTH_DISABLE_REFRESH_TOKEN optional Set to true to issue no refresh tokens: users re-authorize in the browser each time the GitLab access token expires (2 h), regardless of the session TTL

When STREAMABLE_HTTP=true, server-side GitLab credentials (GITLAB_PERSONAL_ACCESS_TOKEN, GITLAB_JOB_TOKEN, GITLAB_AUTH_COOKIE_PATH, or GITLAB_USE_OAUTH) require REMOTE_AUTHORIZATION=true, GITLAB_MCP_OAUTH=true, or STREAMABLE_HTTP_AUTH_TOKEN.

Troubleshooting Unregistered redirect_uri

Check the redirect_uri in the browser URL. If it points to a client callback such as http://127.0.0.1:xxxxx/.../callback, enable:

GITLAB_OAUTH_CALLBACK_PROXY=true

Do not fix remote MCP OAuth by changing GITLAB_OAUTH_REDIRECT_URI. That variable is for local OAuth (GITLAB_USE_OAUTH) only.

docker run -i --rm \
  -e HOST=0.0.0.0 \
  -e GITLAB_MCP_OAUTH=true \
  -e GITLAB_OAUTH_CALLBACK_PROXY=true \
  -e STREAMABLE_HTTP=true \
  -e MCP_SERVER_URL=https://your-server.example.com \
  -e GITLAB_API_URL="https://gitlab.com/api/v4" \
  -e GITLAB_OAUTH_APP_ID=your_app_id \
  -p 3000:3002 \
  zereight050/gitlab-mcp

MCP client configuration:

{
  "mcpServers": {
    "gitlab": {
      "type": "http",
      "url": "https://your-server.example.com/mcp"
    }
  }
}

Read the rest of the GitLab README on GitHub

Questions about GitLab

What is the GitLab MCP server?

GitLab MCP server for projects, merge requests, issues, pipelines, wiki, releases, and more. GitLab is maintained by zereight on GitHub at zereight/gitlab-mcp, and works with AI apps that support the Model Context Protocol, such as Claude, Cursor and VS Code.

How do I install the GitLab MCP server?

Add GitLab to your AI app's MCP config with the command npx -y @zereight/mcp-gitlab@3.1.1. In Claude Code, run claude mcp add --transport stdio gitlab -- npx -y @zereight/mcp-gitlab@3.1.1. To run GitLab this way you need Node.js installed.

Does GitLab need an API key?

The registry lists no required keys for GitLab. Check the GitLab README for optional settings, and expect a remote server to ask you to sign in the first time you connect.

Is GitLab an official MCP server?

No. GitLab is a community server maintained by zereight. Community servers can be excellent; read the code and the open issues before you give GitLab access to company data.

What license is GitLab under?

GitLab is released under the MIT license, according to its GitHub repository. The license covers the code of GitLab; the service it connects to has its own terms.