# Getting Started

Install and configure GitLab MCP Server in under five minutes — via Docker, native binary, npm, PyPI or NuGet — for VS Code, Claude, Cursor, and other MCP clients.

Source: https://docs.jmrp.io/gitlab-mcp-server/getting-started/
Updated: 2026-11-24

---

> **At a glance**
>
> - **Ten ways to install**: a native binary (direct download or the install script), Homebrew, winget, Docker, the npm launcher, the PyPI wheels, the NuGet tool, the Claude Desktop extension, Agent Plugins, or the hosted endpoint. [Choose a path](https://docs.jmrp.io/gitlab-mcp-server/install/overview/).
> - **The minimum configuration is one value** — a GitLab personal access token with `api` scope in `GITLAB_TOKEN`. Set `GITLAB_URL` only for self-managed instances.
> - **The default surface is dynamic mode**: your client sees two tools, and they reach every GitLab operation on demand.

GitLab MCP Server connects your AI assistant to GitLab in under five minutes. You install the server — as a Docker image, a native binary, or through a one-click button — give it a GitLab Personal Access Token, and register it with an MCP-compatible client such as VS Code, Claude Desktop, Cursor, or Claude Code. This guide covers every install path and how to verify the connection.

GitLab MCP Server exposes 875 GitLab operations on Free/CE and up to 1111 on GitLab.com Ultimate through three tool modes (dynamic, meta-tool, and individual), so a single token unlocks the entire GitLab API surface its tier offers.

## Prerequisites

Before you begin, make sure you have:

1. **A GitLab instance** — GitLab.com, self-hosted CE, or EE
2. **A Personal Access Token (PAT)** with the `api` scope
3. **An MCP-compatible AI client** — VS Code + Copilot, Claude Desktop, Cursor, or Claude Code

Running it headless, in a pipeline with no interactive client? See [CI/CD Usage](https://docs.jmrp.io/gitlab-mcp-server/operations/ci-cd/).

### Creating a personal access token

1. In GitLab, select your avatar, then **Edit profile** > **Access** > **Personal access tokens**
2. Create a new token with the **`api`** scope
3. Copy the token — you'll need it for configuration

> **Tip**
>
> For read-only setups, use a token with the `read_api` scope: the server detects the scope at startup and serves the actions GitLab accepts from it, on stdio as in HTTP mode. Asked to run an action GitLab answers only from `api`, `gitlab_execute_action` answers that the action exists and that GitLab requires the `api` scope for it, rather than calling it unknown. GitLab accepts `read_api` for a few actions that write, such as downloading a package to a local file, so a setup that must write nothing sets `GITLAB_MCP_READ_ONLY=true` as well; that switch serves the read-only surface less what the token's scope does not reach, and `gitlab_execute_action` then answers that the deployment withholds a write, while the two reads GitLab answers only from `api`, `template.lint` and `project.dependency_firewall_evaluate`, are still answered as withheld for the `api` scope. Each action's entry in the [tool reference](https://docs.jmrp.io/gitlab-mcp-server/reference/tools/) says which scope it needs.

## Quick install

Pick one: each path ends with you typing a prompt to your assistant. Every channel also has its own page with the full set of commands and the verify, upgrade and uninstall steps; start at [Choose a path](https://docs.jmrp.io/gitlab-mcp-server/install/overview/) if you are not sure which one fits. For the full per-client reference, see [Manual configuration](https://docs.jmrp.io/gitlab-mcp-server/getting-started/#manual-configuration) below.

> **Want to look before installing?**
>
> The [browser inspector](https://mcp.jmrp.io/inspector/?server=gitlab) signs in with OAuth and calls the [hosted endpoint](https://docs.jmrp.io/gitlab-mcp-server/getting-started/#try-it-without-installing-anything-hosted-endpoint) (`https://mcp.jmrp.io/gitlab`) read-only from a browser tab, with nothing downloaded. Running it yourself is still the way to keep using it.

### One-click buttons

These register a **Docker**-based server (it auto-pulls the image on first run; you need [Docker](https://www.docker.com/) installed). VS Code prompts for your token; Cursor / LM Studio / Kiro add a `YOUR_GITLAB_TOKEN` placeholder you replace.

[![Install in VS Code](https://img.shields.io/badge/Install_in-VS_Code-0098FF?style=flat-square&logo=visualstudiocode&logoColor=white)](https://insiders.vscode.dev/redirect/mcp/install?name=gitlab&config=%7B%22command%22%3A%22docker%22%2C%22args%22%3A%5B%22run%22%2C%22-i%22%2C%22--rm%22%2C%22-e%22%2C%22GITLAB_TOKEN%22%2C%22ghcr.io%2Fjmrplens%2Fgitlab-mcp-server%3Alatest%22%5D%2C%22env%22%3A%7B%22GITLAB_TOKEN%22%3A%22%24%7Binput%3Agitlab_token%7D%22%7D%2C%22inputs%22%3A%5B%7B%22id%22%3A%22gitlab_token%22%2C%22type%22%3A%22promptString%22%2C%22description%22%3A%22GitLab%20Personal%20Access%20Token%20%28api%20scope%29%22%2C%22password%22%3Atrue%7D%5D%7D)
[![Install in VS Code Insiders](https://img.shields.io/badge/Install_in-VS_Code_Insiders-24bfa5?style=flat-square&logo=visualstudiocode&logoColor=white)](https://insiders.vscode.dev/redirect/mcp/install?name=gitlab&config=%7B%22command%22%3A%22docker%22%2C%22args%22%3A%5B%22run%22%2C%22-i%22%2C%22--rm%22%2C%22-e%22%2C%22GITLAB_TOKEN%22%2C%22ghcr.io%2Fjmrplens%2Fgitlab-mcp-server%3Alatest%22%5D%2C%22env%22%3A%7B%22GITLAB_TOKEN%22%3A%22%24%7Binput%3Agitlab_token%7D%22%7D%2C%22inputs%22%3A%5B%7B%22id%22%3A%22gitlab_token%22%2C%22type%22%3A%22promptString%22%2C%22description%22%3A%22GitLab%20Personal%20Access%20Token%20%28api%20scope%29%22%2C%22password%22%3Atrue%7D%5D%7D&quality=insiders)
[![Install in Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/install-mcp?name=gitlab&config=eyJjb21tYW5kIjoiZG9ja2VyIiwiYXJncyI6WyJydW4iLCItaSIsIi0tcm0iLCItZSIsIkdJVExBQl9UT0tFTiIsImdoY3IuaW8vam1ycGxlbnMvZ2l0bGFiLW1jcC1zZXJ2ZXI6bGF0ZXN0Il0sImVudiI6eyJHSVRMQUJfVE9LRU4iOiJZT1VSX0dJVExBQl9UT0tFTiJ9fQ%3D%3D)
[![Add to LM Studio](https://files.lmstudio.ai/deeplink/mcp-install-dark.svg)](https://lmstudio.ai/install-mcp?name=gitlab&config=eyJjb21tYW5kIjoiZG9ja2VyIiwiYXJncyI6WyJydW4iLCItaSIsIi0tcm0iLCItZSIsIkdJVExBQl9UT0tFTiIsImdoY3IuaW8vam1ycGxlbnMvZ2l0bGFiLW1jcC1zZXJ2ZXI6bGF0ZXN0Il0sImVudiI6eyJHSVRMQUJfVE9LRU4iOiJZT1VSX0dJVExBQl9UT0tFTiJ9fQ%3D%3D)
[![Add to Kiro](https://kiro.dev/images/add-to-kiro.svg)](https://kiro.dev/launch/mcp/add?name=gitlab&config=%7B%22command%22%3A%22docker%22%2C%22args%22%3A%5B%22run%22%2C%22-i%22%2C%22--rm%22%2C%22-e%22%2C%22GITLAB_TOKEN%22%2C%22ghcr.io%2Fjmrplens%2Fgitlab-mcp-server%3Alatest%22%5D%2C%22env%22%3A%7B%22GITLAB_TOKEN%22%3A%22YOUR_GITLAB_TOKEN%22%7D%7D)

For **Claude Desktop**, download the [.mcpb desktop extension](https://docs.jmrp.io/gitlab-mcp-server/claude-desktop/)
instead: a native one-click install (macOS universal, Windows, and Linux x64 and arm64) with no Docker.
A bundle per operating system is published from the first release after 3.1.0; every release publishes
the universal `gitlab-mcp-server.mcpb`, which carries all three and is the one to download when the
latest release predates the per-system bundles. On Linux, install it through **Extensions > Install Extension...** in Claude Desktop.

Every button runs the container image; the [Docker](https://docs.jmrp.io/gitlab-mcp-server/install/docker/) page covers its tags, the HTTP mode and how to update it.

### Claude Code (`claude mcp add`)

Docker (no install — pulls the image on first run):

```bash
# Prompts for the token without echoing it, so it stays out of shell history
printf 'GitLab token: ' && read -rs GITLAB_TOKEN && export GITLAB_TOKEN && echo
claude mcp add gitlab --transport stdio \
  -- docker run -i --rm -e GITLAB_TOKEN ghcr.io/jmrplens/gitlab-mcp-server:latest
```

The registration command never carries the token. `-e GITLAB_TOKEN` with no value forwards the variable from the environment Claude Code hands `docker`, so export it where you launch the client (your shell profile makes that durable) or add it to the entry's `env` block afterwards.

Any other channel registers the same way once `gitlab-mcp-server` is on your PATH, and there the token goes in a file the server reads instead:

```bash
printf 'GitLab token: ' && read -rs t && printf 'GITLAB_TOKEN=%s\n' "$t" > ~/.gitlab-mcp-server.env && unset t && echo
chmod 600 ~/.gitlab-mcp-server.env
claude mcp add gitlab -- gitlab-mcp-server
```

- [Docker](https://docs.jmrp.io/gitlab-mcp-server/install/docker/): stdio for a desktop client, HTTP mode on a port, environment variables, tags, the Docker Hub mirror, updating

### npm / npx (any platform)

Published as [`@jmrp.io/gitlab-mcp-server`](https://www.npmjs.com/package/@jmrp.io/gitlab-mcp-server). npm downloads only the prebuilt binary for your platform: nothing compiles, and nothing runs at install time, so it works with `--ignore-scripts` and behind a proxy.

```bash
npx -y @jmrp.io/gitlab-mcp-server
```

Point any MCP client at `npx` with no install at all:

```json
{
  "mcpServers": {
    "gitlab": {
      "command": "npx",
      "args": ["-y", "@jmrp.io/gitlab-mcp-server"],
      "env": { "GITLAB_URL": "https://gitlab.com", "GITLAB_TOKEN": "glpat-…" }
    }
  }
}
```

- [npm and npx](https://docs.jmrp.io/gitlab-mcp-server/install/npm/): Global install with npm or pnpm, the Node.js requirement, the musl caveat, updating and uninstalling

### PyPI / uvx (any platform)

Published as [`jmrplens-gitlab-mcp-server`](https://pypi.org/project/jmrplens-gitlab-mcp-server/) using the same model as `uv` and `ruff`: each platform wheel carries the native binary, the installer places it on the scripts path as the `gitlab-mcp-server` command itself, and no Python runs when the server does. The Linux wheels need glibc; on musl systems such as Alpine, use the Docker image instead.

```bash
uvx jmrplens-gitlab-mcp-server
```

```json
{
  "mcpServers": {
    "gitlab": {
      "command": "uvx",
      "args": ["jmrplens-gitlab-mcp-server"],
      "env": { "GITLAB_URL": "https://gitlab.com", "GITLAB_TOKEN": "glpat-…" }
    }
  }
}
```

- [PyPI, uvx and pipx](https://docs.jmrp.io/gitlab-mcp-server/install/pypi/): pipx and pip installs, the two installed commands, why the name carries a prefix, updating and uninstalling

### NuGet / dnx (any platform)

Published on NuGet.org as [`gitlab-mcp-server`](https://www.nuget.org/packages/gitlab-mcp-server), a .NET tool in the layout the .NET 10 SDK uses for tools that ship a native executable: a pointer package names one package per runtime identifier, each carrying the same binary, and the SDK runs it directly. It needs the .NET 10 SDK or newer, and no .NET code runs once the server is up. The Linux packages need glibc; on musl systems such as Alpine, use the Docker image instead.

```bash
dnx gitlab-mcp-server
```

```json
{
  "mcpServers": {
    "gitlab": {
      "command": "dnx",
      "args": ["gitlab-mcp-server"],
      "env": { "GITLAB_URL": "https://gitlab.com", "GITLAB_TOKEN": "glpat-…" }
    }
  }
}
```

Arguments meant for the server go after `--` (`dnx gitlab-mcp-server -- --version`), because `dnx` reads its own options anywhere on the line; and `dnx` installs the tool without asking when its standard input is not a terminal, which is how a client starts it, so the configuration needs no extra flag.

- [NuGet and dnx](https://docs.jmrp.io/gitlab-mcp-server/install/nuget/): dnx and dotnet tool install, the seven packages, the two dnx habits, updating and uninstalling

### One-line installer (native binary)

Installs the binary onto your PATH, then registers it. Updates come from whatever installed it (`brew upgrade`, `winget upgrade`, or re-running the script); the server does not update itself.

```bash
# Linux/macOS (script; verifies the SHA-256 against checksums.txt before installing)
curl -fsSL https://raw.githubusercontent.com/jmrplens/gitlab-mcp-server/main/scripts/install.sh | sh

# Prompts for the token without echoing it, so it stays out of shell history
printf 'GitLab token: ' && read -rs t && printf 'GITLAB_TOKEN=%s\n' "$t" > ~/.gitlab-mcp-server.env && unset t && echo
chmod 600 ~/.gitlab-mcp-server.env
claude mcp add gitlab -- gitlab-mcp-server
```

Homebrew, winget and the PowerShell installer put the same binary on your PATH; each has its own page with the command, where the binary lands, and how to upgrade and uninstall:

- [Native binary](https://docs.jmrp.io/gitlab-mcp-server/install/binary/): Install scripts for Linux, macOS and Windows, manual download, checksum and signature verification

- [Homebrew](https://docs.jmrp.io/gitlab-mcp-server/install/homebrew/): brew install jmrplens/tap/gitlab-mcp-server on macOS and Linux

- [Windows (winget)](https://docs.jmrp.io/gitlab-mcp-server/install/winget/): winget install --id jmrplens.gitlab-mcp-server -e, where the portable binary lands, upgrade and uninstall

Self-managed GitLab? Add `GITLAB_URL=https://gitlab.example.com` to the same file (and `GITLAB_MCP_SKIP_TLS_VERIFY=true` for self-signed certs), one `KEY=value` per line.

### Try it without installing anything (hosted endpoint)

A public instance runs at **`https://mcp.jmrp.io/gitlab`** — nothing to install, no account beyond your own GitLab token. Point any HTTP-capable MCP client at it:

```json
{
  "mcpServers": {
    "gitlab": {
      "type": "http",
      "url": "https://mcp.jmrp.io/gitlab",
      "headers": { "Authorization": "Bearer glpat-xxxxxxxxxxxx" }
    }
  }
}
```

The endpoint runs in OAuth mode, so the credential travels as `Authorization: Bearer`: a GitLab personal access token works there, verified exactly like an OAuth one. It travels per request and is never stored on the server. A client that speaks the OAuth flow needs no header at all: the `401` carries a `WWW-Authenticate: Bearer` challenge (RFC 6750) naming the RFC 9728 metadata document, which it follows to authorize in the browser. `PRIVATE-TOKEN` is the legacy-mode header and is not accepted here; the instance is fixed to `https://gitlab.com`, so `GITLAB-URL` is ignored. A `read_api` token is accepted and served the actions GitLab accepts from it.

Two pages make it easier still. The [server card](https://mcp.jmrp.io/servers/gitlab/) lists the whole catalog with no credential at all and carries copy-paste config for Claude Code, Cursor and VS Code — including the OAuth client ID those clients need. The [browser inspector](https://mcp.jmrp.io/inspector/?server=gitlab) calls the same endpoint read-only from a browser tab: sign in with OAuth, pick a tool, read the raw JSON-RPC it returns — nothing installed.

It is the fastest way to try the server, and the right way to keep using it is still **locally** (any option above), for one concrete reason: your token and every request pass through someone else's machine. Running it locally keeps both on your own computer — the only sensible option for a private self-managed instance.

The endpoint is **stateless streamable HTTP** on the default `dynamic` surface: `POST` is the transport and an _authenticated_ `GET` answers `405` by design; with no credential, any method answers `401` carrying that same challenge, which an OAuth client follows, so a bare `curl` that gets `401` is the endpoint working, not failing. `https://mcp.jmrp.io/gitlab/health` needs no credential and answers `200` with `{"status":"ok",…}`. It is one of the servers listed at [mcp.jmrp.io](https://mcp.jmrp.io/), a directory of the MCP servers maintained by this author, each reachable at its own endpoint; [`https://mcp.jmrp.io/servers.json`](https://mcp.jmrp.io/servers.json) is the same list for automated clients.

It is a personal service, run by one person and offered as-is: no SLA, no support channel, and no promise it is unchanged next week. It adds no quota of its own — every call spends GitLab.com's own limits, under your own token. And it moves on its own, normally to the newest release, so what it serves is never a pinned version.

- [Hosted endpoint](https://docs.jmrp.io/gitlab-mcp-server/install/hosted/): OAuth and token modes, the server card and the browser inspector, what the endpoint cannot do, and how to self-host the same setup

## Download

Prefer to place the binary yourself? Download the latest binary for your platform from the [GitHub Releases](https://github.com/jmrplens/gitlab-mcp-server/releases/latest) page:

| Platform | Binary |
| --- | --- |
| Linux (x86_64) | `gitlab-mcp-server-linux-amd64` |
| Linux (ARM64) | `gitlab-mcp-server-linux-arm64` |
| macOS (universal) | `gitlab-mcp-server-darwin-all` |
| macOS (Intel) | `gitlab-mcp-server-darwin-amd64` |
| macOS (Apple Silicon) | `gitlab-mcp-server-darwin-arm64` |
| Windows (x86_64) | `gitlab-mcp-server-windows-amd64.exe` |
| Windows (ARM64) | `gitlab-mcp-server-windows-arm64.exe` |
| Claude Desktop | `gitlab-mcp-server-darwin.mcpb`, `-windows.mcpb` or `-linux.mcpb` from the first release after 3.1.0, and `gitlab-mcp-server.mcpb` for all three in every release; see [Claude Desktop Extension](https://docs.jmrp.io/gitlab-mcp-server/claude-desktop/) |

### Make it executable (Linux/macOS)

```bash run
chmod +x gitlab-mcp-server-*
```

Optionally, move it to a directory in your PATH:

```bash run
sudo mv gitlab-mcp-server-linux-amd64 /usr/local/bin/gitlab-mcp-server
```

Checking the download against `checksums.txt` and its Cosign signature, upgrading and uninstalling are on the [Native binary](https://docs.jmrp.io/gitlab-mcp-server/install/binary/) page.

## Running the binary by hand

There is no setup wizard. MCP configuration belongs in your client's own JSON file, which is what [Manual configuration](https://docs.jmrp.io/gitlab-mcp-server/getting-started/#manual-configuration) below documents, and a wizard writing a dotfile on one machine could not put it there.

Running the binary in a terminal without both `GITLAB_TOKEN` and `GITLAB_URL` set (either one missing is enough), or double-clicking it, prints what the server is, the two values it needs, and where the per-client JSON is documented, then waits for Enter so a double-clicked window on Windows does not close before you can read it. An MCP client never sees that screen: a client connects pipes rather than a terminal, so the server starts normally.

> **Keeping the token out of client JSON**
>
> This is the file every registration command on this page writes to. The server reads `~/.gitlab-mcp-server.env` for values it does not already have in its environment, one `KEY=value` per line, so nothing needs an `env` block in the client configuration:
>
> ```bash
> GITLAB_URL=https://gitlab.com
> GITLAB_TOKEN=glpat-xxxx
> ```
>
> An explicit environment variable takes precedence over it, and so does a file named in `GITLAB_MCP_ENV_FILE`. A `.env` in the working directory is not read at all: that directory comes from whatever repository your editor opened, so its contents were chosen by someone else. One that exists is named at `WARN` on startup, with the keys it wanted to set.

## Install as an Agent Plugin (Cursor / Claude Code / VS Code)

This repository ships an [Agent Plugins](https://agent-plugins.org/) 1.0 manifest (root `plugin.json` and MCP config `mcp.json`), plus the legacy Open Plugins manifest (`.plugin/plugin.json`) for older hosts, so the server installs in one step on a conformant host (Cursor, Claude Code, VS Code, OpenCode). Providing the token is a separate step, described below:

```bash
# Cursor / Claude Code (when supported by your version)
/plugin install jmrplens/gitlab-mcp-server
```

The plugin runs the published Docker image `ghcr.io/jmrplens/gitlab-mcp-server:latest` through `docker run -i --rm` and passes no transport flag, so you need [Docker](https://docs.docker.com/get-docker/) installed and running. The image reads the transport off stdin and `-i` is what puts a pipe there, so keep the `-i` if you copy the Docker configuration into VS Code or another stdio client; without it the container gets `/dev/null`, starts an HTTP listener, and the client waits forever for a stdio `initialize` response.

- [Agent Plugins](https://docs.jmrp.io/gitlab-mcp-server/install/agent-plugin/): The bundled manifest, every variable it forwards, how the token reaches the server, and swapping Docker for the native binary

### Required environment

`GITLAB_TOKEN` is the one required value; `GITLAB_URL` matters only for a self-managed instance. The bundled config forwards both into the container, but **your host has to put them in the plugin's environment first**: Agent Plugins §9.1 lets a client "inherit, omit, or sanitize" ambient variables, and the spec defines no portable way for a plugin to reference a secret, so a token cannot travel inside `mcp.json` itself. If the server reports an authorization failure, set `GITLAB_TOKEN` the way your host documents, or add it to the `env` block of the installed plugin's local `mcp.json`. The full table of forwarded variables is on the [Agent Plugins](https://docs.jmrp.io/gitlab-mcp-server/install/agent-plugin/) page.

### Prefer a native binary instead of Docker?

Install the plugin, then edit the installed plugin's local `mcp.json` (commonly under `.agents/plugins/gitlab-mcp-server/`) and replace the Docker `command` / `args` with the path to a binary from any channel above. The [Agent Plugins](https://docs.jmrp.io/gitlab-mcp-server/install/agent-plugin/) page has the exact file to write, and why a `${GITLAB_TOKEN}` placeholder in it would reach the server literally. For detached HTTP deployments, do not use a stdio entry: run the image in HTTP mode and configure the client with `type: "http"` and a URL such as `http://localhost:8080/mcp`, as described in [HTTP Server Mode](https://docs.jmrp.io/gitlab-mcp-server/operations/http-server/).

## Manual configuration

`GITLAB_URL` defaults to `https://gitlab.com`; add it only for self-managed GitLab instances.

If you prefer to configure manually, choose your AI client. [Client configuration](https://docs.jmrp.io/gitlab-mcp-server/install/clients/) has every client's entry, over stdio and over HTTP with a token or with OAuth.

- **VS Code / Copilot**

  Create or edit `.vscode/mcp.json` in your workspace root:

  ```json
  {
    "servers": {
      "gitlab": {
        "type": "stdio",
        "command": "/path/to/gitlab-mcp-server",
        "env": {
          "GITLAB_TOKEN": "glpat-xxxxxxxxxxxxxxxxxxxx"
        }
      }
    }
  }
  ```

  > **Secure token storage**
  >
  > Use VS Code input variables to avoid storing the token in plain text:
  >
  > ```json
  > {
  >   "inputs": [
  >     {
  >       "type": "promptString",
  >       "id": "gitlab-token",
  >       "description": "GitLab Personal Access Token",
  >       "password": true
  >     }
  >   ],
  >   "servers": {
  >     "gitlab": {
  >       "type": "stdio",
  >       "command": "/path/to/gitlab-mcp-server",
  >       "env": {
  >         "GITLAB_TOKEN": "${input:gitlab-token}"
  >       }
  >     }
  >   }
  > }
  > ```

- **Claude Desktop**

  > **Easiest path**
  >
  > Claude Desktop also installs with one click via the
  > [.mcpb desktop extension](https://docs.jmrp.io/gitlab-mcp-server/claude-desktop/) — no JSON
  > editing, and the token encrypted with a key from the operating system's
  > credential store where one exists.

  Edit `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) or `%APPDATA%\Claude\claude_desktop_config.json` (Windows):

  ```json
  {
    "mcpServers": {
      "gitlab": {
        "command": "/path/to/gitlab-mcp-server",
        "env": {
          "GITLAB_TOKEN": "glpat-xxxxxxxxxxxxxxxxxxxx"
        }
      }
    }
  }
  ```

- **Cursor**

  Create or edit `.cursor/mcp.json` in your project root:

  ```json
  {
    "mcpServers": {
      "gitlab": {
        "command": "/path/to/gitlab-mcp-server",
        "env": {
          "GITLAB_TOKEN": "glpat-xxxxxxxxxxxxxxxxxxxx"
        }
      }
    }
  }
  ```

- **Claude Code**

  Write the token where the server reads it, then add the server using the CLI:

  ```bash
  # Prompts for the token without echoing it, so it stays out of shell history
  printf 'GitLab token: ' && read -rs t && printf 'GITLAB_TOKEN=%s\n' "$t" > ~/.gitlab-mcp-server.env && unset t && echo
  chmod 600 ~/.gitlab-mcp-server.env

  claude mcp add gitlab \
    --transport stdio \
    -- /path/to/gitlab-mcp-server
  ```

  Add `GITLAB_URL=https://gitlab.example.com` to the same file for a self-managed instance, or write the whole file in an editor. Nothing names the token on the command line, so it stays out of `argv`, out of shell history and out of Claude Code's own configuration file.

- **Windsurf**

  Edit `~/.codeium/windsurf/mcp_config.json`:

  ```json
  {
    "mcpServers": {
      "gitlab": {
        "command": "/path/to/gitlab-mcp-server",
        "env": {
          "GITLAB_TOKEN": "glpat-xxxxxxxxxxxxxxxxxxxx"
        }
      }
    }
  }
  ```

- **JetBrains**

  1. Open **Settings** > **Tools** > **AI Assistant** > **Model Context Protocol (MCP)**
  2. Select **Add**, then the **STDIO** transport
  3. Paste the JSON configuration below
  4. Choose the server level (the current project, or every project), then select **OK** and **Apply**

  ```json
  {
    "mcpServers": {
      "gitlab": {
        "command": "/path/to/gitlab-mcp-server",
        "args": []
      }
    }
  }
  ```

  JetBrains documents the entry as a `command` and its `args` with no environment block, so put the token in `~/.gitlab-mcp-server.env` (as in the Claude Code tab), with `GITLAB_URL` beside it for a self-managed instance. The server reads that file on its own.

- **Zed**

  Edit your Zed `settings.json` and add:

  ```json
  {
    "context_servers": {
      "gitlab": {
        "command": "/path/to/gitlab-mcp-server",
        "args": [],
        "env": {
          "GITLAB_TOKEN": "glpat-xxxxxxxxxxxxxxxxxxxx"
        }
      }
    }
  }
  ```

- **Kiro**

  Create or edit `.kiro/settings/mcp.json` in your workspace, or `~/.kiro/settings/mcp.json` for every workspace:

  ```json
  {
    "mcpServers": {
      "gitlab": {
        "command": "/path/to/gitlab-mcp-server",
        "args": [],
        "env": {
          "GITLAB_TOKEN": "glpat-xxxxxxxxxxxxxxxxxxxx"
        }
      }
    }
  }
  ```

- **Cline**

  In the Cline panel, select the **MCP Servers** icon, open the **Configure** tab and select **Configure MCP Servers**, or edit the settings file directly:

  - **macOS**: `~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json`
  - **Linux**: `~/.config/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json`
  - **Windows**: `%APPDATA%\Code\User\globalStorage\saoudrizwan.claude-dev\settings\cline_mcp_settings.json`

  ```json
  {
    "mcpServers": {
      "gitlab": {
        "command": "/path/to/gitlab-mcp-server",
        "env": {
          "GITLAB_TOKEN": "glpat-xxxxxxxxxxxxxxxxxxxx"
        }
      }
    }
  }
  ```

- **Codex**

  Add the server to `~/.codex/config.toml`. Pre-approving its tools matters: without it Codex asks before every tool that is not read-only, and a non-interactive `codex exec` run cancels those calls.

  ```toml title="~/.codex/config.toml"
  [mcp_servers.gitlab]
  command = "/path/to/gitlab-mcp-server"
  args = ["--transport", "stdio"]
  default_tools_approval_mode = "approve"

  [mcp_servers.gitlab.env]
  GITLAB_TOKEN = "glpat-xxxxxxxxxxxxxxxxxxxx"
  ```

  The [compatibility page](https://docs.jmrp.io/gitlab-mcp-server/compatibility/#per-client-compatibility-profiles) explains the one adjustment the server makes for Codex on its own.

## Using a dotenv file

Instead of placing secrets in client config files, you can put them in a dotenv file:

```bash title="~/.gitlab-mcp-server.env"
GITLAB_TOKEN=glpat-xxxxxxxxxxxxxxxxxxxx
```

Add `GITLAB_URL=https://gitlab.example.com` for self-managed GitLab.

The server reads `~/.gitlab-mcp-server.env` for values its environment does not already carry. To keep the file somewhere else, name it by absolute path in `GITLAB_MCP_ENV_FILE`.

A `.env` in the working directory is **not** read. Your editor sets that directory to the workspace it opened, so the file arrives with the repository rather than from you; one that exists is named in the startup log with the keys it wanted to set. See [Configuration](https://docs.jmrp.io/gitlab-mcp-server/configuration/) for the full load order.

## HTTP mode

For team deployments, you can run the server in HTTP mode where each user authenticates with their own token:

```bash run=background
gitlab-mcp-server --http --http-addr=0.0.0.0:8080 --gitlab-url=https://gitlab.com
```

Each client connects via HTTP and provides its own GitLab token on every request, in a `PRIVATE-TOKEN` header in the default (legacy) authentication mode; the entry for each client is on [Client configuration](https://docs.jmrp.io/gitlab-mcp-server/install/clients/). See [HTTP Server Mode](https://docs.jmrp.io/gitlab-mcp-server/operations/http-server/) for details.

### OAuth mode (recommended for production)

For zero-config token management, use OAuth mode. Users authorize through the browser — no token copying or distribution required:

```bash
gitlab-mcp-server --http --gitlab-url=https://gitlab.com --auth-mode=oauth --public-url=https://mcp.example.com/mcp
```

Configure each client with that exact `--public-url` value as the server's URL: a client discards the RFC 9728 metadata when its `resource` differs from the URL it used.

MCP clients that support OAuth 2.1 (VS Code, Claude Code) discover the authorization server automatically via `/.well-known/oauth-protected-resource`. The server verifies every Bearer token against the instance's `GET /api/v4/user` and reads its scopes, then caches the identity for `--oauth-cache-ttl` (15 minutes by default); see [Token caching](https://docs.jmrp.io/gitlab-mcp-server/operations/http-server/#token-caching). See [OAuth application](https://docs.jmrp.io/gitlab-mcp-server/operations/oauth-app/) for creating the required GitLab OAuth Application.

> **Caution**
>
> Clients must be configured with the `clientId` of a GitLab OAuth Application that has the scope the deployment asks for checked: `api` on a deployment that can write, `read_api` on one that runs `--read-only` or `--safe-mode`. GitLab refuses the authorization with `invalid_scope` when the application lacks the scope a client asks for. Without `clientId`, clients fall back to Dynamic Client Registration (DCR) which assigns the `mcp` scope instead of `api`, causing most operations to fail. See [Client configuration](https://docs.jmrp.io/gitlab-mcp-server/install/clients/) for per-client examples.

## Self-hosted GitLab

If you're connecting to a self-hosted GitLab instance (Community Edition or Enterprise Edition), the setup is the same — just make sure `GITLAB_URL` points to your internal instance:

```bash title="~/.gitlab-mcp-server.env"
GITLAB_URL=https://gitlab.internal.company.com
GITLAB_TOKEN=glpat-xxxxxxxxxxxxxxxxxxxx
```

### Self-signed certificates

Many self-hosted instances use self-signed or internal CA certificates. If you see `x509: certificate signed by unknown authority` errors, add:

```bash title="~/.gitlab-mcp-server.env"
GITLAB_MCP_SKIP_TLS_VERIFY=true
```

> **Caution**
>
> Skipping TLS verification disables certificate validation for all GitLab API requests. Only use this for internal instances where you trust the network. For production, configure your system's CA trust store instead.

### Common configurations

- **Internal HTTPS**

  ```bash title="~/.gitlab-mcp-server.env"
  GITLAB_URL=https://gitlab.internal.company.com
  GITLAB_TOKEN=glpat-xxxxxxxxxxxxxxxxxxxx
  ```

- **Custom port**

  ```bash title="~/.gitlab-mcp-server.env"
  GITLAB_URL=https://gitlab.company.com:8443
  GITLAB_TOKEN=glpat-xxxxxxxxxxxxxxxxxxxx
  ```

- **HTTP (dev only)**

  ```bash title="~/.gitlab-mcp-server.env"
  GITLAB_URL=http://gitlab.local:3000
  GITLAB_TOKEN=glpat-xxxxxxxxxxxxxxxxxxxx
  ```

  > **Caution**
  >
  > HTTP connections transmit tokens in plaintext. Only use HTTP for local development instances.

- **Self-signed cert**

  ```bash title="~/.gitlab-mcp-server.env"
  GITLAB_URL=https://gitlab.internal.company.com
  GITLAB_TOKEN=glpat-xxxxxxxxxxxxxxxxxxxx
  GITLAB_MCP_SKIP_TLS_VERIFY=true
  ```

Both GitLab CE (free) and EE (Premium/Ultimate) are fully supported. For EE-exclusive features like DORA metrics, epics, and vulnerability management, set `GITLAB_MCP_TIER=premium` (or `GITLAB_MCP_TIER=ultimate`) in stdio mode or use `--tier=premium`/`--tier=ultimate` in HTTP mode. When unset, the tier is detected from the plan the instance reports to every token from GitLab 19.6 (`plan` in `GET /version`), then from the instance license (`GET /license`), then from the plans of the namespaces the token administers (`GET /namespaces`), then from the plans of the groups the token is a member of (on GitLab.com, and on an Enterprise Edition instance from 18.11), falling back to `free`. The `GITLAB_ENTERPRISE` environment variable was removed in 3.0.0 and is ignored, and there is no `--enterprise` flag. See [Configuration](https://docs.jmrp.io/gitlab-mcp-server/configuration/) for all available options.

## Verify the setup

Your MCP client starts the server itself when it connects, so there is nothing to launch beforehand; a client that lists its MCP servers shows `gitlab` there once it is running. Once configured, open your AI client and ask:

```text translated
Who am I on GitLab?
```

The server should return your GitLab user profile, confirming the connection is working. Then ask for your projects:

```text translated
List my GitLab projects
```

On the default dynamic surface the assistant finds the `project.list` action with `gitlab_find_action` and runs it with `gitlab_execute_action`; with `GITLAB_MCP_TOOL_SURFACE=meta` it calls `gitlab_project` with the `list` action, and with `GITLAB_MCP_TOOL_SURFACE=individual` it calls `gitlab_project_list`. The answer carries a Markdown table like this one, beside the structured JSON the assistant reads:

```text
## Projects (2)

| ID | Name | Path | Visibility | ⭐ |
| --- | --- | --- | --- | --- |
| 12 | [my-app](https://gitlab.example.com/user/my-app) | user/my-app | private | 3 |
| 15 | [api-service](https://gitlab.example.com/user/api-service) | user/api-service | internal | 1 |
```

You can also try:

```text translated
Show me the branches in project my-app
```

```text translated
Show me the contents of README.md in project my-app
```

```text translated
List my assigned merge requests
```

```text translated
Show recent pipelines in my-project
```

You do not need to know project IDs, endpoints or JSON: the assistant works them out. If you see results, you're all set! More prompts, by task, are in [Usage examples](https://docs.jmrp.io/gitlab-mcp-server/examples/usage/).

> **Caution**
>
> If you get connection errors, check:
>
> - The `GITLAB_URL` is correct and reachable from your machine
> - The token has the `api` scope, or `read_api` for the actions GitLab accepts from it
> - For self-signed certificates, set `GITLAB_MCP_SKIP_TLS_VERIFY=true`

## Understanding tool surfaces

By default, the server runs in **dynamic find/execute mode** with `gitlab_find_action` and `gitlab_execute_action`. Every GitLab operation is a catalog action with a canonical `domain.action` ID: the assistant finds the one it needs (with its exact parameter schema) and then executes it. Creating an issue looks like this:

```json
{
  "tool": "gitlab_execute_action",
  "arguments": {
    "action": "issue.create",
    "params": {
      "project_id": "my-group/my-project",
      "title": "Fix login redirect"
    }
  }
}
```

Set `GITLAB_MCP_TOOL_SURFACE=meta` to use **34 domain-level meta-tools** on Free/CE (40 on self-managed Premium and 41 on GitLab.com Premium, 51 on self-managed Ultimate, 52 on GitLab.com Ultimate with Orbit) that cover the same functionality through consolidated domain dispatchers. Instead of separate `gitlab_issue_list`, `gitlab_issue_create` and `gitlab_issue_update` tools (the `GITLAB_MCP_TOOL_SURFACE=individual` shape), there is a single `gitlab_issue` tool with an `action` parameter: the same call goes to `gitlab_issue` as `{ "action": "create", "params": { ... } }`. Meta-tools accept only `action` and `params` at the top level, so the parameters stay nested under `params` on both surfaces. `GITLAB_MCP_TOOL_SURFACE=individual` registers one tool per operation instead: 875 on Free/CE, 1030 on Premium, 1096 on self-managed Ultimate and 1111 on GitLab.com Ultimate with Orbit.

This is transparent to you: your AI client handles the routing. You just ask naturally, _"create an issue for the login bug"_, and on the default dynamic surface the assistant finds `issue.create` and executes it; with `GITLAB_MCP_TOOL_SURFACE=meta` it picks the `gitlab_issue` meta-tool and the `create` action instead.

> **Tip**
>
> You do not need to set anything to get the two-tool catalog: dynamic is the default, and `GITLAB_MCP_TOOL_SURFACE=dynamic` only makes that explicit. The server exposes only `gitlab_find_action` and `gitlab_execute_action`, backed by the same canonical GitLab action catalog. See [Dynamic toolset](https://docs.jmrp.io/gitlab-mcp-server/tools/dynamic-tools/) for how discovery and execution work.
>
> Meta-tools cut the visible tool count by more than 95% compared with individual tools, and the tool-schema tokens by roughly three quarters, while preserving full functionality. See [Meta-tools](https://docs.jmrp.io/gitlab-mcp-server/tools/meta-tools/) for the complete reference.
>
> Pair dynamic mode with `GITLAB_MCP_CAPABILITY_SURFACE=minimal` to keep only the `gitlab://tools` manifest (and its `gitlab://tools/{id}` template), and omit optional resources, workflow guides, and prompts when you need the smallest initial MCP context. Dynamic keeps inline schemas through `gitlab_find_action`.

## Next steps

- [Configuration](https://docs.jmrp.io/gitlab-mcp-server/configuration/) — Fine-tune environment variables and optional features
- [Environment variables](https://docs.jmrp.io/gitlab-mcp-server/reference/environment/) and [command line](https://docs.jmrp.io/gitlab-mcp-server/reference/cli/): every setting, with its default, its bounds and the flag or variable that sets it
- [Dynamic toolset](https://docs.jmrp.io/gitlab-mcp-server/tools/dynamic-tools/) — How the default find/execute surface discovers and runs every operation
- [Meta-tools](https://docs.jmrp.io/gitlab-mcp-server/tools/meta-tools/) — The consolidated domain dispatchers behind `GITLAB_MCP_TOOL_SURFACE=meta`
- [Architecture](https://docs.jmrp.io/gitlab-mcp-server/architecture/) — Understand how the server works under the hood
- [Tools Reference](https://docs.jmrp.io/gitlab-mcp-server/tools/overview/) — Explore all available tools by domain
- [Usage examples](https://docs.jmrp.io/gitlab-mcp-server/examples/usage/): real-world prompts for issues, merge requests, pipelines and more
- [Troubleshooting](https://docs.jmrp.io/gitlab-mcp-server/operations/troubleshooting/): common issues and how to solve them

## Frequently asked questions

### What GitLab token scope does GitLab MCP Server need?

GitLab MCP Server needs a Personal Access Token with the api scope for full read and write access to the GitLab REST and GraphQL API. For a read-only setup, create a token with the read_api scope, which the server detects at startup and serves the actions GitLab accepts from it, and set GITLAB_MCP_READ_ONLY=true, which withholds every write whatever the token carries, including the few GitLab accepts from read_api. Create tokens in GitLab under your avatar, then Edit profile, Access and Personal access tokens.

### How do I connect GitLab MCP Server to a self-managed GitLab instance?

Point GITLAB_URL at your instance, for example GITLAB_URL=https://gitlab.example.com. GITLAB_URL defaults to https://gitlab.com, so you set it only for self-managed Community or Enterprise Edition instances. If the instance uses a self-signed or internal CA certificate, also set GITLAB_MCP_SKIP_TLS_VERIFY=true to bypass certificate verification on a trusted network.

### Which tool mode does GitLab MCP Server use by default?

By default GitLab MCP Server runs in dynamic mode, which exposes only two tools — gitlab_find_action and gitlab_execute_action — to keep the AI client's context small while still reaching every GitLab operation. Set GITLAB_MCP_TOOL_SURFACE=meta for consolidated domain-level meta-tools, or GITLAB_MCP_TOOL_SURFACE=individual for one tool per operation.

### Why does my AI client fail to connect to GitLab MCP Server?

A failed connection usually means GitLab MCP Server cannot reach GitLab or cannot authenticate. Confirm that GITLAB_URL is correct and reachable from your machine, that the token carries the api scope (or read_api, which is served the actions GitLab accepts from it) and has not expired, and that self-signed certificates are handled by setting GITLAB_MCP_SKIP_TLS_VERIFY=true.
