MCP Server Hub

Guide

GitLab MCP Server: Official Setup, Tools, and How to Connect

Updated December 4, 2026

Connect GitLab’s official MCP server at gitlab.com/api/v4/mcp. OAuth with the mcp scope, Claude, Cursor, and Codex setup, self-managed URLs, and how it differs from the older reference server.

What the official GitLab MCP server does

GitLab’s MCP server is part of GitLab. A compatible assistant can read and change the projects, merge requests, work items, repositories, and pipelines your GitLab user can already reach. GitLab made it generally available in GitLab 19.5, on the Free, Premium, and Ultimate tiers, for GitLab.com, GitLab Self-Managed, and GitLab Dedicated. Behavior, tools, and auth rules are defined in GitLab’s MCP server docs. If this walkthrough and those docs disagree, follow GitLab.

People looking up “gitlab mcp url”, “gitlab mcp server”, or “gitlab mcp server official documentation” usually want that built-in endpoint. The general pattern for any client is in how to install an MCP server. The rest of this page is GitLab-specific, including self-managed hosts and the older reference server that still ranks for the same words.

The /s/gitlab listing is the older reference server

The directory page GitLab on MCP Server Hub documents the older reference server at modelcontextprotocol/servers, src/gitlab. That project is a local stdio process. Its README tells you to run the Docker image mcp/gitlab or npx @modelcontextprotocol/server-gitlab, and to set GITLAB_PERSONAL_ACCESS_TOKEN. GITLAB_API_URL there defaults to the REST API at https://gitlab.com/api/v4.

GitLab’s official server does not use that package, that image, or a legacy personal access token. It is the HTTP endpoint below. A config copied from the directory listing will not connect you to the official server, and a token that worked for the reference server is rejected by the official one.

Endpoint

On GitLab.com the URL is https://gitlab.com/api/v4/mcp. On GitLab Self-Managed and GitLab Dedicated, replace the host and keep the path: https://gitlab.example.com/api/v4/mcp. A self-hosted installation, including GitLab CE, uses that same path. GitLab does not publish a separate Community Edition URL.

Stop at /api/v4/mcp. The REST root https://gitlab.com/api/v4 is the API the reference server called. It is not the MCP endpoint.

GitLab recommends HTTP, which connects with no extra package. stdio through mcp-remote is also documented. That proxy needs Node.js 20 or later, and it still talks to the same HTTP URL. GitLab’s Amazon Q instructions say not to pin mcp-remote to a specific version. Pinning was a workaround for how the OAuth scope was requested, and the server now defaults that scope during dynamic client registration. The troubleshooting page says not to pin one unless you are chasing a version-specific bug.

Allow access before the client will connect

A client can use the endpoint only where an owner or administrator has allowed MCP. The switch is different on GitLab.com and on an instance you run.

  • GitLab.com, top-level group. Access is on by default for every top-level group, unless an Owner turned it off. GitLab turned it on for existing top-level groups in 19.6, with that same exception, and new top-level groups have had it on since 19.5. An Owner changes it from the top bar: Search or go to the top-level group, then Settings, General, Permissions and group features, MCP client access, and the Allow connection to GitLab checkbox. The docs for this control are group access and permissions.
  • GitLab Self-Managed and GitLab Dedicated, the instance. Access is an instance setting, and GitLab says it is on by default. An upgrade to 19.5 turns it on unless an administrator had already turned it off. An administrator changes it from the upper-right Admin area: Settings, General, Visibility and access controls, MCP client access, and the same Allow connection to GitLab checkbox. Turning it off makes the MCP API reject every request. The docs are control access and visibility.

Authentication

The documented client flows use OAuth. The server accepts two credentials.

  • An OAuth access token with the mcp scope. On first connect, dynamic client registration creates an OAuth application, you approve it, and the client stores the token. A pre-registered OAuth application is the other path. You must use one when an administrator has turned dynamic registration off. It is optional otherwise. Shared egress IPs are limited to 10 registrations an hour, so a corporate network or VPN can fail registration even when MCP is enabled. Every user still authorizes with their own GitLab account. A shared application is the OAuth client identity. The redirect URI on that application has to match the URI the client sends. For a Claude organization connector, GitLab’s documented redirect URI is https://claude.ai/api/mcp/auth_callback.
  • A fine-grained personal access token with the MCP tool resource and the Execute permission. GitLab’s token docs put that resource on the User boundary. Create it from your avatar, Edit profile, Access, Personal access tokens, then Fine-grained token. The interactive setups below do not paste this token into a config file. GitLab does not publish a bearer-header example for it on the MCP client pages.

Legacy personal access tokens, project access tokens, and group access tokens are rejected, even when their scope is mcp or api. The response is 403 Forbidden with insufficient_scope. That is the token the reference server asked for. GitLab’s docs say support for those tokens is proposed in issue 586184.

A listed tool still checks your project and namespace permissions when it runs. Listing a tool does not grant access. GitLab’s client instructions also say you are responsible for guarding against prompt injection, and to use these tools only on GitLab objects you trust.

Connect GitLab in Cursor

Cursor uses HTTP. GitLab’s steps are Settings, Cursor Settings, Tools and MCP, then New MCP Server. Add this definition to the mcpServers key in the mcp.json file that opens. For a self-managed instance, replace gitlab.com with your host.

{
  "mcpServers": {
    "GitLab": {
      "type": "http",
      "url": "https://gitlab.com/api/v4/mcp"
    }
  }
}

Save the file and wait for the browser to open the OAuth page. If it does not, close and restart Cursor, then approve the request. There is no personal access token in this file. GitLab includes "type": "http" in this block.

Connect GitLab in Claude

Claude Code uses HTTP. In a terminal, with your host in place of gitlab.com when the instance is self-managed:

claude mcp add -s user --transport http GitLab https://gitlab.com/api/v4/mcp

-s user makes the server available in every project. Without it, the entry is local to the directory where you ran the command, and a local entry wins over a user entry with the same name. claude mcp add does not overwrite an entry that is already there. Run claude mcp list, remove a stale local entry with claude mcp remove GitLab -s local, then add it again. Start Claude Code, run /mcp, select GitLab, and approve OAuth. Run /mcp again to confirm it is connected.

Claude Desktop uses stdio and mcp-remote. Install Node.js 20 or later and keep node on your PATH. Open Settings, Developer, Edit Config, or edit claude_desktop_config.json directly. On macOS that file is ~/Library/Application Support/Claude/claude_desktop_config.json. If npx is not global, use its full path as command.

{
  "mcpServers": {
    "GitLab": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-remote",
        "https://gitlab.com/api/v4/mcp"
      ]
    }
  }
}

Save, restart Claude Desktop, and approve the OAuth window. Then check Settings, Developer, and Settings, Connectors. GitLab’s Claude Desktop tutorial tests the connection by asking which MCP server version is in use, then asks Claude to find a project and create an issue. Its permission example uses the tool name create_issue. The tools reference marks create_issue as unlisted and superseded, so use the name the client actually lists if it differs from the tutorial.

A Claude Team or Enterprise owner can add GitLab as a custom connector so members avoid editing config files. In Claude, go to Organization settings, Connectors, Add, Custom, Web. The name is GitLab and the URL is the same /api/v4/mcp endpoint. Members still sign in themselves, from Customize, Connectors, GitLab. The connector is available in Claude Desktop and Claude on the web. It is not a central config for every Claude Code login: someone who signs in to Claude Code with an API key still adds the server with the command above. On Self-Managed and Dedicated, Claude on the web connects from Anthropic’s cloud, so the instance has to be reachable from the internet or allow Anthropic’s IP addresses. If it is not, each person uses a local setup.

Connect GitLab in ChatGPT

GitLab does not publish a chatgpt.com click-path. The OpenAI client in the MCP server docs is Codex, and the general-availability post lists OpenAI Codex among the documented clients. Add the server, then log in. Replace the host for a self-managed instance.

codex mcp add GitLab --url "https://gitlab.com/api/v4/mcp"
codex mcp login GitLab

GitLab says to confirm ~/.codex/config.toml contains one [mcp_servers.GitLab] table. A duplicate table keeps Codex from loading the file. Remove the extra one. If your ChatGPT plan can add a remote MCP server, the URL and the OAuth consent are the same ones above. Treat menu labels you find outside GitLab’s docs as unverified.

Toolsets

Tools are grouped into toolsets. With no extra headers, the server returns the default groups. Opt-in groups stay hidden until you name them or send all. The catalog, including individual tool names, is GitLab’s tools reference. Names there change before this page does. The groups documented today are:

  • meta. Always included. Information about the MCP server, such as its version.
  • core. On by default. Projects, users, groups, members, to-dos, milestones, notes, search, semantic code search, and GitLab Pages content.
  • merge_requests. On by default. Create, update, read, list, review, and accept merge requests, and apply suggestions.
  • work_items. On by default. Create, update, read, list, and link work items, plus work item types and saved views.
  • repository. On by default. Branches, commits, files, the repository tree, releases, tags, and forks.
  • ci. On by default. Pipelines, jobs, artifacts, and pipeline schedules, including run, retry, cancel, and manual jobs.
  • duo_agent_platform. On by default when GitLab Duo Agent Platform is available to you. List Duo agents and flows, start a session, check status, and send input. The session runs as a CI job.
  • wikis. Opt in. List and read wiki pages.
  • code_security. Opt in. Vulnerabilities and security scan profiles. Each tool is listed only when that Ultimate feature is available to you.
  • orbit. Opt in. Query GitLab Orbit and read an entity and its graph neighborhood, when you meet the Orbit requirements.

duo_agent_platform is listed only when GitLab Duo Agent Platform is available to you, even if you request that toolset or send all. On GitLab.com that means a Premium or Ultimate top-level group with Duo Agent Platform turned on, or access through GitLab credits, plus a seat that is allowed to use it. Self-Managed and Dedicated add their own checks: GitLab Duo is not set to Always off, the license or GitLab credits include Duo Agent Platform, the organization has it turned on, and you have a seat. GitLab’s MCP page lists those checks. code_security tools are listed only when the feature behind each tool is available. Vulnerability tools need the security dashboard, and attach_scan_profile needs security scan profiles. Both are Ultimate features. orbit is listed only when you request that toolset or send all, and only when you meet the Orbit requirements. Naming an Orbit tool in the individual-tools header does not list it.

To limit the list, send the header X-Gitlab-Enabled-Mcp-Server-Toolsets with a comma-separated list. Names are matched without regard to case. An unknown name returns HTTP 400. Cursor puts the header on the HTTP entry:

{
  "mcpServers": {
    "GitLab": {
      "type": "http",
      "url": "https://gitlab.com/api/v4/mcp",
      "headers": {
        "X-Gitlab-Enabled-Mcp-Server-Toolsets": "core,work_items"
      }
    }
  }
}

Claude Code passes the same header with --header on claude mcp add. Claude Desktop and other mcp-remote clients pass --header as an argument. On Windows, a space inside those args is not escaped, so GitLab’s docs put the toolset list in an environment variable. There is a second header, X-Gitlab-Enabled-Mcp-Server-Tools, for individual tool names. If you set that header and omit the toolset header, the server returns only the tools you named, with no default groups and no meta tools. If you set both, you get the union of the two lists.

On GitLab.com, MCP requests are also limited per user by plan. The per-minute limits, generally available in GitLab 19.6, are 60 on Free and 600 on Premium and Ultimate. The docs also list hourly limits of 3,600 on Free and 5,000 on Premium and Ultimate, and say those hourly limits are still controlled by feature flags. One person shares one allowance across every MCP client they connect. A rejected request is HTTP 429 with Retry-After and RateLimit-Name, and it is plain text, so the client cannot read it as an MCP message. A tool that hits a limit on the GitLab API behind it is different: the MCP call returns HTTP 200 and a tool result with isError: true and error.type of rate_limited. On Self-Managed, GitLab says the MCP server limit is disabled by default, and an administrator can set a single instance limit.

Setup questions that waste an afternoon

  • HTTP 403, or HTTP 404 on GitLab 19.4 and earlier, right after OAuth. Read the response body. MCP server not enabled for any of your groups means no top-level group you belong to has MCP turned on. MCP server disabled for this instance means a Self-Managed administrator turned the instance setting off. Administrators can also read denial_reason in mcp.log: no_enabled_namespace or instance_setting_disabled. A 403 with insufficient_scope is the token problem above, not the enablement switch.
  • You joined or created a top-level group and still see “not enabled for any of your groups”. GitLab caches that authorization result for up to an hour, and joining a group does not refresh it. An Owner can clear Allow connection to GitLab, save, select it again, and save. If the group is less than 10 minutes old, wait out those 10 minutes before connecting again. Connecting sooner can keep the error for another hour. The steps are on the group access page.
  • The URL from the directory listing returns nothing useful. https://gitlab.com/api/v4 and @modelcontextprotocol/server-gitlab belong to the reference server. Point the client at https://gitlab.com/api/v4/mcp, or at that path on your own host.
  • Every request fails until some later time, with a generic connection error. That can be HTTP 429. Wait the number of seconds in Retry-After. A request the minute limit rejects still counts toward the hourly limit. Retrying immediately can exhaust that hourly allowance when the hourly limit is enabled. A rate_limited tool result is the other case: the MCP server answered 200, and the underlying API asked you to wait.
  • Server's protocol version is not supported: 2025-06-18. GitLab documents this on GitLab 18.6 and earlier, when the client library and the server do not share a protocol version. Current docs say the server supports 2025-03-26, 2025-06-18, and 2025-11-25. A client that asks for 2026-07-28 is answered with 2025-11-25.
  • start_duo_session returns 403 inside a tool result. The HTTP call can still be 200. That tool starts a Duo flow as a CI job. GitLab’s causes are missing Duo Agent Platform access, a role below Developer, foundational flows turned off, or a beta flow whose top-level group has beta and experimental features turned off. Hide that toolset by sending X-Gitlab-Enabled-Mcp-Server-Toolsets without duo_agent_platform when you do not use it.
  • Claude Desktop or mcp-remote keeps a stale login. GitLab says the local auth cache causes false results while you debug. The documented reset is rm -rf ~/.mcp-auth/mcp-remote*. Claude Desktop also needs Node.js 20 or later on PATH.

In Cursor, GitLab’s troubleshooting steps open the Output view and select the channel MCP: user-GitLab when the config name is GitLab. The full list of errors is GitLab’s troubleshooting page.

This walkthrough and the official docs

Use GitLab’s MCP server page for the current client blocks, OAuth rules, and rate limits, and the tools reference before you rely on a tool name. Use this page to pick the URL, the enablement switch, and the credential that the official server accepts. The GitLab listing remains the card for the older reference server. Other repository servers are in developer tools.

Common questions

What is the GitLab MCP server URL?

On GitLab.com the official HTTP endpoint is https://gitlab.com/api/v4/mcp. On GitLab Self-Managed and GitLab Dedicated it is the same path on your instance host, for example https://gitlab.example.com/api/v4/mcp. The REST API root https://gitlab.com/api/v4 is a different URL. GitLab recommends HTTP. stdio through mcp-remote is also documented, and it still calls that HTTP endpoint.

How do I connect a self-hosted or GitLab CE MCP server?

Use your instance host with the path /api/v4/mcp. An administrator allows MCP for the whole instance under Admin, Settings, General, Visibility and access controls, MCP client access. GitLab says this is on by default, including after an upgrade to GitLab 19.5 unless an administrator turned it off. GitLab CE is the free self-managed edition and uses this same endpoint. The docs do not publish a separate CE URL.

Is the GitLab listing on MCP Server Hub the official MCP server?

https://mcpserver.dev/s/gitlab documents the older reference server at https://github.com/modelcontextprotocol/servers/tree/main/src/gitlab. That project runs locally over stdio with a personal access token, using @modelcontextprotocol/server-gitlab or the mcp/gitlab Docker image. GitLab’s official MCP server is built into GitLab, is generally available as of GitLab 19.5, and uses https://gitlab.com/api/v4/mcp.

Will a GitLab personal access token work with the official MCP server?

An OAuth access token needs the mcp scope. Clients get that token from dynamic client registration or a pre-registered OAuth application. A fine-grained personal access token also works when it includes the MCP tool resource and the Execute permission. Legacy personal access tokens, project access tokens, and group access tokens are rejected with 403 Forbidden and insufficient_scope, even when their scope is mcp or api.

Where is the official GitLab MCP documentation?

GitLab maintains the server docs at https://docs.gitlab.com/user/model_context_protocol/mcp_server/, the tool catalog at https://docs.gitlab.com/user/model_context_protocol/mcp_server_tools/, and troubleshooting at https://docs.gitlab.com/user/model_context_protocol/mcp_server_troubleshooting/. This page is a walkthrough of that setup. Tool names, client steps, and auth rules change there first.