# GitLab — MCP Server

> Review merge requests, read pipeline logs and search code from an MCP client.

**Source:** https://mcpplaygroundonline.com/mcp-servers/gitlab  
**Transport:** http  
**Requires auth:** Yes

---

## What it does

The GitLab MCP server lives on the GitLab API itself at /api/v4/mcp rather than being a wrapper someone else maintains, so it tracks the platform directly and works the same way against GitLab.com and Self-Managed instances. Its strongest area is the merge-request and pipeline loop: an agent can list and read merge requests, pull their diffs, commits, notes and pipelines, and post review comments back. On the CI side it can list pipelines, fetch jobs and — most usefully for debugging — retrieve raw job logs, then run, retry or cancel a pipeline. It also covers issues and work items, wiki pages, label and instance-wide search, and semantic code search that returns relevant snippets rather than literal string matches.

## Tools exposed

- list_merge_requests / get_merge_request — search MRs and read them with diffs, commits, notes and pipelines
- get_merge_request_diffs / get_merge_request_commits — the actual change under review
- create_merge_request / create_merge_request_note — open MRs and post review comments
- list_pipelines / get_pipeline / get_pipeline_jobs — CI/CD state
- get_job_log — raw trace output for a failed job, which is what you actually need to debug
- save_pipeline / manage_pipeline — run, retry, cancel or delete a pipeline
- create_issue / get_issue / create_workitem_note / link_work_items — issue and work-item tracking
- search / search_labels / semantic_code_search — instance-wide search and meaning-based code lookup
- get_repository_file / add_branch / list_wiki_pages — repository and wiki reads

## Example queries you can run

- "Read the diffs on merge request !412 and tell me what could break in production."
- "Pipeline 88231 failed — pull the job log and explain the root cause."
- "Find where we handle refund idempotency in this project using semantic code search."
- "List open merge requests older than two weeks and summarise what each is blocked on."

## Details

- **Recommended model:** anthropic/claude-sonnet-5 — Reading a diff and a failed job log together is a reasoning task, not a retrieval one — Sonnet 5 holds both in context and explains the failure rather than restating the log.
- **Transport:** http
- **Authentication:** Required — OAuth against GitLab with the `mcp` scope, or a personal access token. Self-Managed uses the same path on your own host.
- **Hosted endpoint:** https://gitlab.com/api/v4/mcp
- **Official source:** [GitLab MCP server docs](https://docs.gitlab.com/user/model_context_protocol/mcp_server/)

## Connecting to GitLab

URL format:

```
https://<your-gitlab-host>/api/v4/mcp
```

### Connection examples

**GitLab.com**

```
https://gitlab.com/api/v4/mcp
```

The hosted instance. Authorises over OAuth with the `mcp` scope.

**GitLab Self-Managed**

```
https://gitlab.example.com/api/v4/mcp
```

Same path on your own host — swap in your instance domain.

## Frequently asked questions

### Does GitLab have an official MCP server?

Yes. It is served by the GitLab API itself at /api/v4/mcp — on GitLab.com that is https://gitlab.com/api/v4/mcp — and documented in GitLab's own docs. Because it is part of the API rather than a third-party wrapper, it tracks platform changes directly and does not depend on an outside maintainer keeping up.

### Does it work with GitLab Self-Managed?

Yes, at the same path on your own host: https://gitlab.example.com/api/v4/mcp. This is one of the clearer advantages over community GitLab MCP servers, which often assume gitlab.com. For self-managed instances behind a VPN, your MCP client needs network access to the host like any other API consumer.

### What authentication does the GitLab MCP server use?

OAuth against GitLab, with a dedicated `mcp` scope — its protected-resource metadata lists gitlab.com as the authorization server and `mcp` as the only supported scope. A personal access token also works. Either way the agent acts with your permissions, so scope the token to the projects you actually want reachable.

### What can it do that a plain Git clone cannot?

The useful surface is everything around the code rather than the code itself: merge-request discussions, CI pipeline state, and raw job logs via get_job_log. "Why did this pipeline fail" is a question a clone cannot answer. It also offers semantic_code_search, which returns relevant snippets by meaning rather than the literal-string matching you get from grep.

### Can an agent approve or merge my merge requests?

The documented tools cover creating merge requests, posting notes, and managing pipelines — running, retrying, cancelling and deleting. Pipeline control is the one to think about before granting write access, since retrying a deploy pipeline has real consequences. Start read-only and watch the calls in MCP Agent Studio before you widen the token.

---

_Test this server across 40+ models on MCP Playground: https://mcpplaygroundonline.com/mcp-servers/gitlab — free, no install._
