Omniscio

OmniscioGuidesGitLab MCP server

Connecting GitLab's MCP server to Claude Code

MCP is the Model Context Protocol, the standard that lets Claude Code call an outside service's tools. GitLab ships a server for it now, so Claude Code can read a project, pull the issues, and work through merge requests without a wrapper script around the API.

Here the token is the whole story. GitLab accepts two kinds of credential and refuses three that look like they should work, and that refusal is the message a first attempt usually meets.

Sources read November 25, 2026. By the Omniscio team. Updated .

Which GitLab server, and where it runs

This is GitLab's own MCP server, documented in GitLab's user docs rather than in a community repository. GitLab marks it generally available and offers it on GitLab.com, on GitLab Self-Managed and on GitLab Dedicated, across the Free, Premium and Ultimate tiers.

It became generally available in GitLab 19.5, after an experiment in 18.3 and a beta in 18.6. On an older instance the endpoint may exist and still be switched off, which is worth checking on the instance before blaming the Claude Code side.

One consequence of it being per-instance: the URL is not a single hosted address. It is your GitLab host plus /api/v4/mcp, which on GitLab.com means https://gitlab.com/api/v4/mcp.

GitLab also lists one prerequisite that has to be set before any of this works: access to the MCP server has to be allowed — for the top-level group on GitLab.com, or for the whole instance on Self-Managed and Dedicated.

What Claude Code can do with it

GitLab describes the server as a way for AI tools to access project information, retrieve issue and merge request data, and perform GitLab-specific operations, with each call checked against your own project and namespace permissions.

The important half of that sentence is the last part: listing a tool does not grant access. A server that connects cleanly and then refuses one action is usually reporting a permission on the GitLab side, not a broken MCP setup.

The command

This is GitLab's own line for Claude Code, on GitLab.com. Run it in your terminal, not inside a session:

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

On GitLab Self-Managed or Dedicated, replace gitlab.com with your instance's host and keep the rest of the path.

GitLab's line carries the name GitLab with a capital G. That name is what every later command uses — /mcp, claude mcp get GitLab, and the remove command — so keep it rather than retyping a lowercase version.

If you have configured a GitLab server before, note what GitLab says about it: claude mcp add does not overwrite an existing entry. List what you have with claude mcp list, remove the old one at its scope, then add it again — otherwise the old URL stays in place and the new one never appears.

The .mcp.json equivalent

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

This is GitLab's own JSON block. The entry is a hosted one — type and url — and headers is how the extra GitLab headers go. A toolset is one of the groups GitLab sorts its tools into; leave headers out entirely and the server returns its default toolsets.

If you are configuring by hand rather than with the command, this file is what to write at the project root, and it is what the project scope means.

Which scope to use

Local is the default: the server loads only in the project where you added it. --scope project writes .mcp.json at the repository root so the team shares it, and --scope user makes it available in every project you open.

GitLab's published line puts it at user scope, and GitLab says why: without it the server is added at local scope and works only in the directory where you ran the command. If the whole team works in one GitLab project, project scope is the alternative — the URL travels with the repository, and each person still authenticates as themselves. Each of them also approves the .mcp.json server on first use; until they do, it reads ⏸ Pending approval rather than connected.

The auth step

The first route needs nothing created by hand. GitLab supports OAuth 2.0 Dynamic Client Registration, so the first connection registers Claude Code as an OAuth application on your instance, asks you to authorize it, and receives an access token carrying the mcp scope — add the server, then open /mcp in a session and follow the sign-in.

The other route is a fine-grained personal access token that carries the MCP tool resource and the Execute permission. It travels as a bearer token in a header — --header "Authorization: Bearer YOUR_TOKEN", the form Claude Code documents for a token — and it is the route to choose when you want a credential you can scope, rotate and revoke yourself.

What does not work is the token most people already have. Legacy personal access tokens, project access tokens and group access tokens cannot carry the mcp scope at all, so the server returns 403 Forbidden with an insufficient_scope error even for a token that has api.

Choosing the toolsets

The server groups its tools into toolsets and returns a default set when you say nothing. GitLab's own example asks for core,work_items, and the header takes a comma-separated list; setting it to all requests every toolset, including the opt-in ones — though GitLab lists the Duo Agent Platform, code security and Orbit tools only when the feature behind each is available to you, whatever the header says.

If you already added the server with the line above, remove that entry first — GitLab documents that claude mcp add will not overwrite it — or put the header in the headers object of .mcp.json instead:

claude mcp add -s user --transport http GitLab https://gitlab.com/api/v4/mcp \
  --header "X-Gitlab-Enabled-Mcp-Server-Toolsets: core,work_items"

Names are matched without regard to case, and a name the server does not recognise fails loudly with a 400 instead of being ignored.

A second header, X-Gitlab-Mcp-Server-Tool-Name-Prefix, prefixes every tool name to avoid clashes with other MCP servers or with several GitLab instances in one configuration; anything past 32 characters is cut off.

Confirm it connected

claude mcp list
claude mcp get GitLab

The list prints a health status beside each server, such as ✔ Connected, ! Needs authentication or ✘ Failed to connect. For GitLab, "needs authentication" is the expected state until you finish the OAuth flow in /mcp. A token you put in a header and GitLab then refuses reports the other way: Claude Code treats that as a failed connection rather than an unfinished sign-in, and shows the detail on an Issue: line. A project-scope server you have not approved yet reads ⏸ Pending approval.

Inside a session, /mcp lists the server's tools. Then ask for something checkable in a project you know, such as the last few issues, before asking it to change anything.

The failure people hit

The one that stops a first attempt is 403 Forbidden with insufficient_scope. It reads like a permissions problem on the project, and it is not: the token type itself is refused, because only a fine-grained token or an OAuth token can carry the mcp scope. The fix is a new token, not a wider one.

The second is a 400 from the toolset header, which means a name in the list is not a toolset the server knows. Drop back to no header, confirm the base setup works, then add groups one at a time.

The third is subtler: naming individual tools with X-Gitlab-Enabled-Mcp-Server-Tools while leaving the toolsets header off. GitLab documents that this returns only the tools you named, without any default toolsets and without the meta tools — a setup that looks connected and behaves as if the server were half empty.

The general messages are collected in the MCP errors guide, and the flags and scopes in Add an MCP server to Claude Code.

Sources

Every line on this page rests on one of these. The date beside each one is the day we read it.

  • GitLab: GitLab MCP server, for the tiers and offerings, the version history, the endpoint, the token rules and the insufficient_scope refusal, the Claude Code command, the toolset headers, the JSON block and the rule that claude mcp add does not overwrite. Read November 25, 2026.
  • Anthropic: Connect Claude Code to tools via MCP, for the scope table, the health statuses, --header and claude mcp get. Read November 25, 2026.

Common questions

What is the command to add the GitLab MCP server to Claude Code?

claude mcp add -s user --transport http GitLab https://gitlab.com/api/v4/mcp, with your own host in place of gitlab.com on a self-managed instance. GitLab documents that line for Claude Code.

Why does my personal access token return 403 Forbidden?

Legacy personal access tokens, project access tokens and group access tokens cannot carry the mcp scope, so the server rejects them with 403 and an insufficient_scope error. Create a fine-grained personal access token with the MCP tool resource and the Execute permission instead.

Do I need to register an OAuth application first?

No. The server supports OAuth 2.0 Dynamic Client Registration, so the AI tool registers itself with your GitLab instance the first time it connects, then asks for authorization.

How do I get fewer GitLab tools?

Send the X-Gitlab-Enabled-Mcp-Server-Toolsets header with the groups you want, for example core,work_items, or all for every toolset. An unrecognized toolset name returns a 400 error, and some tool groups appear only when the feature behind them is available to you.

Which GitLab versions have the MCP server?

GitLab documents it as generally available, on GitLab.com, Self-Managed and Dedicated, across the Free, Premium and Ultimate tiers. It started as an experiment in GitLab 18.3 and became generally available in 19.5.

Every session, one window

Omniscio runs several agent sessions side by side in one window, each with its own context and its own diff view. Any model, any harness — Claude Code, Codex, OpenCode, Devin, Pi, and Hermes all supported.