MCP.so
Sign In

GitLab MCP ServerFeatured

@modelcontextprotocol

Basic information

Category

Version Control

License

NOASSERTION

Transports

stdio

Author

modelcontextprotocol

About GitLab MCP Server

Model Context Protocol Servers

GitLab MCP Server config

Add this server to your MCP-compatible client using the configuration below.

{
  "mcpServers": {
    "gitlab": {
      "command": "npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-gitlab"
      ],
      "env": {
        "GITLAB_PERSONAL_ACCESS_TOKEN": "<YOUR_TOKEN>",
        "GITLAB_API_URL": "https://gitlab.com/api/v4"
      }
    }
  }
}

GitLab MCP Server tools

9

Create or update a single file in a GitLab project

Search for GitLab projects

Create a new GitLab project

Get the contents of a file or directory from a GitLab project

Push multiple files to a GitLab project in a single commit

Create a new issue in a GitLab project

Create a new merge request in a GitLab project

Fork a GitLab project to your account or specified namespace

Create a new branch in a GitLab project

Overview

What is GitLab MCP Server?

GitLab MCP Server is a gitlab mcp integration that lets AI assistants search projects, read files, push commits, and open issues, branches, forks and merge requests through the GitLab API. This listing is the archived reference version; GitLab now ships an official, maintained MCP server.

The listed package, @modelcontextprotocol/server-gitlab, was one of the reference servers published by the Model Context Protocol project. It has moved to the servers-archived repository, which states that the servers there are no longer maintained and come with no security guarantees, and the npm package is marked as no longer supported. For new setups, use the official GitLab MCP server, a remote endpoint built into GitLab itself at /api/v4/mcp. Both options are covered below.

How to use GitLab MCP Server?

Official GitLab MCP server (recommended)

Prerequisites: access to the MCP server must be allowed for your top-level group on GitLab.com, or for the instance on GitLab Self-Managed and GitLab Dedicated. Authentication uses OAuth: on first connect the client registers itself (OAuth 2.0 Dynamic Client Registration), opens your browser, and you approve the request. The server also accepts a fine-grained personal access token with the MCP tool permission, but not legacy personal, project or group access tokens.

Replace <gitlab.example.com> with gitlab.com or your self-managed instance URL in the examples below.

Claude Code

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

Start claude, type /mcp, select the GitLab server and approve the authorization in your browser.

Claude Desktop

Requires Node.js 20 or later. Add this to claude_desktop_config.json and restart Claude Desktop:

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

Cursor

In Settings > Cursor Settings > Tools & MCP, add a new MCP server to mcp.json:

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

VS Code

Open the Command Palette, run MCP: Add Server, choose HTTP, enter https://<gitlab.example.com>/api/v4/mcp with the ID GitLab, then approve the OAuth request.

Codex

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

GitLab's docs also ask you to enable rmcp_client under [features] in ~/.codex/config.toml.

Archived reference server (the config on this page)

Create a GitLab personal access token with the api scope (or read_api for read-only access), then run the package with npx:

{
  "mcpServers": {
    "gitlab": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-gitlab"],
      "env": {
        "GITLAB_PERSONAL_ACCESS_TOKEN": "<YOUR_TOKEN>",
        "GITLAB_API_URL": "https://gitlab.com/api/v4"
      }
    }
  }
}

GITLAB_API_URL is optional and only needed for self-hosted instances. The README also documents a Docker image, mcp/gitlab.

Key features of GitLab MCP Server

  • Official server is built into GitLab and available on Free, Premium and Ultimate for GitLab.com, Self-Managed and Dedicated; it became generally available in GitLab 19.5.
  • No local install for HTTP clients: connect to https://<instance>/api/v4/mcp and sign in with OAuth.
  • Tool groups (toolsets) such as core, merge_requests, work_items, repository and ci, selectable with the X-Gitlab-Enabled-Mcp-Server-Toolsets header.
  • Optional tool-name prefix through the X-Gitlab-Mcp-Server-Tool-Name-Prefix header, useful when you connect several GitLab instances.
  • Every tool call checks your own project and namespace permissions.
  • The archived server creates missing branches automatically when creating or updating files, and supports single-file and multi-file commits without force pushing.

GitLab MCP Server tools

The archived reference server exposes the nine tools listed on this page:

  • Repository and files: search_repositories, create_repository, fork_repository, create_branch, get_file_contents.
  • Commits: create_or_update_file writes one file, and push_files pushes several files in a single commit.
  • Collaboration: create_issue and create_merge_request (with draft support).

The official GitLab MCP server has a much larger, maintained set, including get_merge_request_diffs, save_merge_request_review, list_pipelines, get_job, list_work_items, semantic_search and vulnerability tools on Ultimate. See GitLab's MCP server tools documentation for the current list.

Use cases of GitLab MCP Server

  • Code review: "Summarize the diff in merge request !42 and list risky changes."
  • Issue triage: "Create an issue in my-group/api titled 'Login timeout' with the label bug."
  • Small fixes from chat: "Create a branch fix-readme, update README.md and open a draft merge request."
  • CI debugging (official server): "Why did the latest pipeline on main fail? Show the failing job log."
  • Codebase questions: "Read src/config.ts on the develop branch and explain the defaults."

GitLab MCP Server vs alternatives

  • Official GitLab MCP server vs this archived package: the official one is maintained by GitLab, uses OAuth instead of a long-lived token, covers pipelines, work items and reviews, and needs no local process for HTTP clients. The archived package only covers basic repository, issue and merge request operations.
  • Community GitLab servers: projects such as GitLab MR MCP focus on merge requests and issues.
  • GitHub instead of GitLab: use the GitHub MCP Server.

Troubleshooting GitLab MCP Server

  • 403 Forbidden from the official server (404 Not Found in GitLab 19.4 and earlier): the MCP server is not allowed for your group or instance, or you used a legacy personal, project or group access token. Check the prerequisites and use OAuth or a fine-grained token.
  • 429 Too Many Requests: you hit the MCP or API rate limit; requests fail until the limit resets.
  • OAuth keeps failing with mcp-remote: delete the local auth cache with rm -rf ~/.mcp-auth/mcp-remote* and reconnect.
  • Archived server returns auth errors: confirm GITLAB_PERSONAL_ACCESS_TOKEN has the api scope and that GITLAB_API_URL ends in /api/v4 for self-hosted GitLab.

Frequently asked questions

1

Is there an official GitLab MCP server?

Yes. GitLab ships its own MCP server at `/api/v4/mcp` on GitLab.com, Self-Managed and Dedicated. The `@modelcontextprotocol/server-gitlab` package listed here is an archived reference implementation, not GitLab's product.

2

Is the GitLab MCP server free?

GitLab's docs list the official server for the Free, Premium and Ultimate tiers. Some toolsets need paid features, for example vulnerability tools require Ultimate. The archived package is MIT-licensed open source.

3

Is @modelcontextprotocol/server-gitlab still maintained?

No. It now lives in the servers-archived repository, which says it receives no updates or security fixes, and npm marks the package as no longer supported.

4

Which token or API key do I need?

The official server uses OAuth through your browser, or a fine-grained personal access token with the MCP tool permission. The archived server needs a personal access token in `GITLAB_PERSONAL_ACCESS_TOKEN`.

5

Does the GitLab MCP server work with Claude Code, Cursor and VS Code?

Yes. GitLab documents setup for Claude Code, Claude Desktop, Cursor, GitHub Copilot in VS Code, Codex, Gemini CLI, Kiro, OpenCode, Zed and Amazon Q Developer.

6

Is it remote or local?

The official gitlab mcp server is remote over HTTP; clients without HTTP support use the `mcp-remote` proxy over stdio. The archived server runs locally over stdio through `npx` or Docker.

7

Does it work with self-hosted GitLab?

Yes. Point the official server URL at your instance, or set `GITLAB_API_URL` for the archived server.

8

Is it safe to give an AI agent GitLab access?

Tools act with your permissions, so the agent can only reach what you can. GitLab warns that you are responsible for guarding against prompt injection, so use the tools only on GitLab content you trust.

Comments

More Version Control MCP servers