> ## Documentation Index
> Fetch the complete documentation index at: https://docs.apexgenius.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# GitLab MCP Setup

> Connect GitLab.com to ApexGenius with a read-only personal access token. Read projects, issues, merge requests, files and pipelines from your AI.

**Status: Available.** GitLab connects with a GitLab.com personal access token
that has only the `read_api` scope. Every call is a read. Your AI can read
projects, groups, issues, merge requests, repository files, commits and CI/CD
pipelines, and it cannot change anything in GitLab.

[Explore the GitLab connector](https://www.apexgenius.ai/connectors/gitlab).

## Which token to create

Create a **legacy personal access token** on GitLab.com:

1. Select your avatar, then **Edit profile**.
2. In the left sidebar, open **Access**, then **Personal access tokens**.
3. From **Generate token**, choose **Legacy token**.
4. Name the token and set an expiry date.
5. Pick only the **read\_api** scope.
6. Choose **Generate token** and copy the token once.

GitLab can pre-fill the form:
[Create a read\_api token](https://gitlab.com/-/user_settings/personal_access_tokens?name=ApexGenius\&description=ApexGenius+GitLab+connection.+Read-only.\&scopes=read_api).

When you connect, ApexGenius reads the token's own scopes from GitLab. It
refuses a token without `read_api`. It also refuses a token with any other
scope except `read_user` and `read_repository`, so a token with `api` or
`write_repository` cannot connect.

GitLab.com tokens expire within a year. When GitLab stops accepting the token,
create a new one and paste it on the GitLab connection page.

## Connect and read your first project

**Before you start**

* A GitLab.com account that can see the projects you want your AI to read. Self-managed GitLab is not supported yet.
* A personal access token with only the read\_api scope.

**1. Create a token on GitLab.com**

On GitLab.com open Edit profile, then Access, then Personal access tokens. Choose Generate token, then Legacy token. Name it, set an expiry date, pick only read\_api, and choose Generate token. Copy the token once. The connect form links to a pre-filled token page.

**2. Open GitLab in Connections**

Sign in to ApexGenius, open Connections, choose GitLab, and select Connect.

**3. Paste the token**

Paste the token into the connection form. ApexGenius supplies the gitlab.com address, checks the token’s scopes and your GitLab user, and stores it encrypted. A token that can make changes is refused. Never paste the token into a chat.

![The Connect GitLab dialog in ApexGenius with the empty GitLab personal access token field, the How to get it link and the Connect button.](https://www.apexgenius.ai/images/integration-guides/gitlab/20261026-credentials.webp)

![The Connect GitLab dialog in ApexGenius with the empty GitLab personal access token field, the How to get it link and the Connect button.](https://www.apexgenius.ai/images/integration-guides/gitlab/20261026-credentials-mobile.webp)

Paste a GitLab.com personal access token with only the read\_api scope and choose Connect. How to get it opens the token steps.

**4. Check the connected user**

Open Tools to see the GitLab reads, then ask your AI the question below. Compare the username with your GitLab.com account.

**Try a first question with your AI agent**

```text theme={"system"}
Using GitLab, tell me which GitLab user is connected, then list my five most recently updated open merge requests. Do not change anything.
```

Confirm the username matches your GitLab.com account and the merge requests match GitLab. The connection is read-only, so this check changes nothing.

## What your AI can do

* Confirm the connected GitLab user, and list groups and their projects.
* Find projects and read their labels and milestones.
* List and read issues and their comments.
* List and read merge requests, with their comments, diffs and commits.
* Read the repository tree, a file, branches, commits, tags and releases.
* List pipelines and read the jobs inside one.

Three ApexGenius tools reach these reads: `gitlab_search_operations` finds
them, `gitlab_read_operation` runs them, and `gitlab_write_operation` refuses
every call because GitLab has no write operations here. Reads use the read
route, so an AI agent set to Read only can use all of them.

Use the numeric project or group id that GitLab shows on the project page. A
path such as `group/project` is refused.

## Limits

* GitLab.com only. Self-managed GitLab and GitLab Dedicated are not supported
  yet.
* The token reads what your GitLab user can read. Private projects need a user
  who is a member.
* GitLab.com limits how many API calls each user can make each minute.
* Nothing to undo: reads change nothing. If a check shows GitLab is partially
  ready, check the connection health, the Tools tab, and the GitLab skill.
* Disconnecting removes the token from ApexGenius. Revoke it on GitLab.com to
  stop it everywhere.

[Official GitLab personal access token instructions](https://docs.gitlab.com/user/profile/personal_access_tokens/).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.