# Fine-grained Tokens

Run GitLab MCP Server with a GitLab fine-grained personal access token: what to grant it, what the server shows such a token, and how to read the answer when an action is out of its reach.

Source: https://docs.jmrp.io/gitlab-mcp-server/operations/fine-grained-tokens/
Updated: 2026-11-24

---

A **fine-grained personal access token** carries no scopes. Its scope list is the
single value `granular`, and what it may do is a **grant** of named permissions
(Project: Read, Merge Request: Approve, Pipeline: Read), each held at a boundary: a
project, a group, the user or the instance. GitLab authenticates the token and then
judges every request against the grant.

Two facts about the grant decide most of this page:

- **A grant cannot be changed after the token is created.** Nothing at GitLab 19.6
  edits one: no route, GraphQL mutation or settings page. A missing permission
  therefore always means a new token.
- **A grant is judged per request.** A token can be refused one call and served the
  next, and a GraphQL query can come back partly empty, with no error, where the grant
  does not reach part of the answer.

GitLab MCP Server reads such a token as **unknown authority**, never as read-only: its
`granular` scope says nothing about writes, so it is not narrowed to the actions a
`read_api` token is served, and the five groups that need the `admin_mode` scope
stay in its catalog. The grant decides what each session is shown instead, as the rest
of this page describes
([ADR-0024](https://github.com/jmrplens/gitlab-mcp-server/blob/main/docs/development/adr/adr-0024-fine-grained-token-authority-per-action.md)
records why).

> **GitLab release**
>
> Fine-grained tokens are generally available from GitLab 19.2, and were a beta from
> GitLab 18.10. The permissions this server knows are the ones GitLab 19.6.1 declares,
> and the grant is judged on an instance that reports a 19.6 release
> ([GitLab.com and other releases](https://docs.jmrp.io/gitlab-mcp-server/operations/fine-grained-tokens/#gitlabcom-and-other-releases)).

## Classic and fine-grained tokens, action by action

Each action's entry in the [tool reference](https://docs.jmrp.io/gitlab-mcp-server/reference/tools/) carries
two token lines beside its tier. **Classic or OAuth token** names the scope GitLab
requires for the requests the action sends: `read_api`, which an `api` token carries too,
for an action that sends only REST `GET`s, GraphQL queries and the few routes GitLab opens
to `read_api` on every method, or whose requests GitLab authenticates by a trigger,
registration or runner token the caller passes; `api` for one that sends anything else.
The line also names `admin_mode` for the administration groups, which this server lists
only to a token carrying it, and any route the action sends that GitLab refuses to an
OAuth token whatever its scope; on an instance with Admin Mode turned on, GitLab asks
`admin_mode` of every action only an administrator may run as well. A classic token
carrying `read_api` and not `api` is served exactly the actions whose line names
`read_api`, provided it carries any other scope the line names. **Fine-grained token** is
the action's line of the [fine-grained permissions](https://docs.jmrp.io/gitlab-mcp-server/reference/fine-grained-permissions/)
table: the permissions a grant has to hold, at which boundary, and the parts of the answer
GitLab may leave empty. Both lines are generated from the one record of what each action
sends, so a change to an action moves both.

## What the server needs at startup

Grant these besides whatever your work needs. Each is optional, and the table says
what is lost without it.

| Permission | Boundary | What it is for | Without it |
| --- | --- | --- | --- |
| User: Read | user | `GET /api/v4/user`: the HTTP door's check of every new credential, and the identity on stdio | HTTP mode refuses the token at the door with `403` ([HTTP mode](https://docs.jmrp.io/gitlab-mcp-server/operations/fine-grained-tokens/#http-mode)); stdio starts without knowing the user |
| Metadata: Read | instance | `GET /api/v4/version`: the instance version the grant is judged at, the edition, and from GitLab 19.6 the instance plan the licensing tier is read from | The grant is not evaluated, and the tier is read from the steps below; stdio logs one warning naming the permission and starts anyway |
| Personal Access Token: Read | user | Reading the token's own grant | The grant is not evaluated, and the server withholds only what no fine-grained token can reach |
| Namespace: Read | user | The namespace plans the licensing tier is detected from (the subscription on GitLab.com) | From GitLab 19.6 the instance plan answers on self-managed, so nothing is lost there; before it, and on GitLab.com, the tier falls back to what the license says, or Free; set `GITLAB_MCP_TIER` (`--tier` in HTTP mode) to pin it |
| License: Read | instance | The license of a self-managed instance, which only an administrator may read | Nothing for a non-administrator, who cannot read it with any token |

On GitLab.com, and on an Enterprise Edition instance from 18.11 that reported no
recognized plan, the tier is also read from the groups the token is a member of,
and no grant lets a fine-grained token answer that step: GitLab declares no fine-grained
permission for whether a group's plan carries a licensed feature (the
`LicensedFeatureAvailability` type, at GitLab 19.6.1), so it refuses that answer to every
fine-grained token and the tier stays what the namespace plans said. A fine-grained token
on GitLab.com that administers no paid namespace is therefore served the Free catalog;
set `GITLAB_MCP_TIER` (`--tier` in HTTP mode) to the plan of the group you work in.

The server asks what kind of token it holds at `GET /api/v4/personal_access_tokens/self`,
and from GitLab 19.5 on that answer carries the grant too, so it is the one request
the server makes about the token. An older instance does not put the grant there, and
the server then reads it at `GET /api/v4/personal_access_tokens/:id`. Both need
Personal Access Token: Read; without it, GitLab's refusal of the first still tells the
server the token is a fine-grained one.

The first four are what a session needs to be served exactly what its grant reaches,
and they are the grant the end-to-end suite starts its fine-grained sessions on.
Without Metadata: Read or Personal Access Token: Read the server still starts and
serves the token, withholds only the actions no fine-grained token can reach, and lets
GitLab judge the rest, saying in each refusal why the grant was not evaluated.

## Create the token

**In the UI**: select your avatar, then **Edit profile**, **Access** > **Personal
access tokens**, and choose **Fine-grained token** from **Generate token**. Under **Add
resource permissions**, the **Group and project**, **User** and **Global** tabs hold
the project or group, user and instance boundaries the table above names. Add the
startup permissions above and what your work needs. GitLab's own page describes every
step:
[Fine-grained personal access tokens](https://docs.gitlab.com/auth/tokens/fine_grained_access_tokens/).

**Through the API**: `POST /api/v4/user/personal_access_tokens` creates a token for
the user whose credential sends the request (`$CREATING_TOKEN` below, one of your own),
with `granular_scopes` in place of `scopes`. Each scope names an access level, the
permissions it grants by GitLab's identifier for each (`read_project` is the one the UI
calls Project: Read), and, for `selected_memberships`, the projects or groups it
covers:

```bash
curl --request POST "$GITLAB_URL/api/v4/user/personal_access_tokens" \
  --header "PRIVATE-TOKEN: $CREATING_TOKEN" \
  --header "Content-Type: application/json" \
  --data '{
    "name": "gitlab-mcp-server",
    "expires_at": "2027-01-31",
    "granular_scopes": [
      {"access": "user", "permissions": ["read_user", "read_namespace", "read_personal_access_token"]},
      {"access": "instance", "permissions": ["read_metadata"]},
      {"access": "selected_memberships", "project_ids": [42],
       "permissions": ["read_project", "read_work_item", "create_work_item", "read_merge_request"]}
    ]
  }'
```

Send every scope in the one request: a grant cannot be added to afterwards. Every
project or group id becomes a scope of its own. The access levels are:

| Access level | What it reaches |
| --- | --- |
| `personal_projects` | The projects in your own namespace |
| `selected_memberships` | The projects and groups the scope lists, and everything under a listed group |
| `all_memberships` | Every project and group you are a member of |
| `user` | The user boundary: permissions on your own user, such as User: Read |
| `instance` | The instance boundary: Metadata: Read, and the administrator's permissions |

This server's actions for the route above, `user.create_current_user_pat`, for the
impersonation token route, `user.create_impersonation_token`, and for the administrator
route that creates a personal access token for another user,
`user.create_personal_access_token`, take `granular_scopes` in the shape above in place
of `scopes`, exactly one of the two, and each permission by its assignable name, the
one the [permissions reference](https://docs.jmrp.io/gitlab-mcp-server/reference/fine-grained-permissions/)
lists. The administrator route takes a grant from GitLab 19.6 on; an older instance
requires classic scopes there and refuses a call that sends only a grant. The route
above takes no classic scope but `k8s_proxy` and `self_rotate`, so a token for this
server created through it is a fine-grained one. GitLab answers a grant with 404 while
the `granular_personal_access_tokens` feature flag is off for the user. The server's
other token creation actions, for project, group and service account tokens, send
classic scopes only.

An administrator's token reaches the admin routes its `instance` scope grants, and on
an instance that enforces Admin Mode it needs nothing more: GitLab lets every
fine-grained token past the Admin Mode check of an API call, as it lets a classic token
that carries the `admin_mode` scope (`lib/api/api_guard.rb` at GitLab 19.4.1). The
end-to-end suite holds this on a running instance with Admin Mode turned on.

## Grants for common uses

Each row is what the actions it names need at the project boundary, beside the startup
permissions above.

| You want the assistant to | Grant at the project | Actions this covers, for example |
| --- | --- | --- |
| Read a project's issues and merge requests | Project: Read, Work Item: Read, Merge Request: Read | `project.get`, `issue.list`, `issue.get`, `merge_request.list` |
| Triage and comment on issues | the row above, plus Work Item: Create and Work Item: Update | `issue.create`, `issue.update`, `issue.note_create` |
| Review merge requests | Merge Request: Read, Merge Request: Create, Merge Request: Approve | `mr_review.changes_get`, `mr_review.discussion_create`, `merge_request.approve` |
| Follow CI | Pipeline: Read, Job: Read | `pipeline.list`, `pipeline.get`, `job.list`, `job.trace` |
| Edit files on a new branch | Repository: Read, Repository: Create, Repository: Update, Branch: Create | `repository.file_get`, `repository.file_create`, `repository.file_update`, `branch.create` |

Some pairings are GitLab's rather than this server's: a note on an issue or a merge
request (`issue.note_create`, `mr_review.note_create`) is created with Work Item:
Create, and a merge request discussion (`mr_review.discussion_create`) with Merge
Request: Create, because that is what the routes declare at GitLab 19.6.1.

The [fine-grained permissions reference](https://docs.jmrp.io/gitlab-mcp-server/reference/fine-grained-permissions/)
lists what every action needs, and `gitlab://tools/{id}` serves the same for one action
in its `fine_grained` block.

> **What a grant does not bound**
>
> A grant scoped to selected projects does not limit where every action writes. GitLab
> authorizes moving an issue (`issue.move`) only at the project the issue leaves, so the
> project it arrives in is judged by the token's user's own role there and not by the
> grant, and transferring a project or a group (`project.transfer`, `group.transfer`) is
> judged at the source the same way. Treat a fine-grained token as able to write wherever
> these actions can reach for its user, and remove them with `--exclude-tools` where that
> matters. This is GitLab's design rather than a defect: its
> [authorization principles](https://docs.gitlab.com/development/permissions/granular_access/authorization_principles/)
> check a fine-grained token against the resource the request path names and nothing
> else the operation touches, so this warning stands for as long as GitLab keeps that
> rule.

## What a session is shown

### The grant decides

When the token may read its own grant and the instance runs GitLab 19.6, the release
the server's permission table records, the server reads the grant with the token
itself and judges every action against it. A session is then **listed** the actions
its grant reaches, on every surface (`tools/list`, the dynamic surface's
`gitlab_find_action`, and `gitlab://tools`), and a call to any other is answered with
the permission it needs, in the words the token creation page uses, without a request
to GitLab. Two kinds of call are let through even though the listing leaves them out,
so GitLab judges them: a read GitLab would serve on a public project or group whatever
the grant, and, on the prerelease instance [below](https://docs.jmrp.io/gitlab-mcp-server/operations/fine-grained-tokens/#gitlabcom-and-other-releases),
every call that is not withheld from all fine-grained tokens. From GitLab 19.6 GitLab
serves such a public read as an anonymous request, so a route that requires a signed-in
user, such as an issue's links, refuses it with the permission the grant lacks, and the
answer quotes that refusal.

The grant is read once when the session starts and again on every revalidation: every
15 minutes by default in HTTP mode (`--revalidate-interval`), and on a timer of the
same interval on stdio (`GITLAB_MCP_SESSION_REVALIDATE_INTERVAL`, where `0` stops the
re-reads). An upgraded instance therefore moves the session to what its
new release decides. A re-read that fails keeps what the session was shown rather than
narrowing it, so what an assistant sees never changes with a GitLab outage. The server
reads at most 1 MiB and 1000 scopes of a grant; a larger grant is not evaluated.

When a session starts with its grant read, the server writes one line at `INFO` saying
so and what the grant decides, on stdio and when the HTTP pool builds the session's
entry. The line carries `phase=B`, the major.minor the instance reported (`bucket`),
the one the permission table was recorded from (`recorded_bucket`) and `listing_only`,
which is `true` only on the prerelease [below](https://docs.jmrp.io/gitlab-mcp-server/operations/fine-grained-tokens/#gitlabcom-and-other-releases), where the
grant decides the listing alone. Like the line of the fallback below, it never names the
token, its id or its projects and groups. A re-read that finds the verdict the session
already has writes nothing, and one that moves it to another writes a line with the
same pairs.

### When the grant is not evaluated

The session falls back to withholding only what no fine-grained token can reach
([below](https://docs.jmrp.io/gitlab-mcp-server/operations/fine-grained-tokens/#what-no-fine-grained-token-can-reach)) and lets GitLab judge the rest, and
every refusal says why the grant was not evaluated:

| What the refusal says | Cause | What to do |
| --- | --- | --- |
| `The token cannot read its own grant` | The token lacks Personal Access Token: Read | Create a token that also grants it |
| `The instance did not report a version this server can read` | The token lacks Metadata: Read, or the instance answered with no release number this server can read | Without Metadata: Read, create a token that also grants it. With it, check what `GET /api/v4/version` answers: only a GitLab release number of at most 64 bytes is read, so report a genuine release that is refused as an issue of this project |
| `The instance reports GitLab x.y and the permissions are recorded for 19.6 only` | The instance runs a release the table does not record | Nothing on your side; the table moves with the server's releases |
| `The token's grant names a permission GitLab 19.6.1 does not define` | A permission GitLab renamed or added after 19.6.1 | As above |
| `The token's grant is larger than this server reads` | More than 1 MiB or 1000 scopes | Grant at a group rather than project by project |
| `The token's grant holds a scope this server cannot read without guessing` | An access level GitLab 19.6.1 does not define, a scope naming both a project and a group, or a `selected_memberships` scope naming neither | Report it as an issue of this project, quoting the reason the log line names |
| `The instance did not answer the request for the token's grant`, or `... for its version` | GitLab was unreachable at that moment | Nothing; the next re-read asks again |

The server writes one line at `INFO` when a session starts in this state, naming the
reason (`grant-unreadable`, `version-unreadable`, `version-outside-record` and so on)
and never the token, its id or its projects and groups. For a grant naming permissions
the record lacks, it names how many and at most three of their names, each cut to 64
bytes.

### When the server cannot tell what kind of token it holds

Everything above starts from one request, `GET /api/v4/personal_access_tokens/self`,
whose answer says the token is a fine-grained one. When that request fails for any
reason other than GitLab refusing the token Personal Access Token: Read (a `5xx`, a
`429`, a timeout, or an instance that did not answer at all), the server knows no more
about the token than about a classic one whose scopes it could not detect, and serves
it the same way for as long as that lasts: the whole catalog, nothing withheld, no
refusal or note about a grant, and GitLab judging every call. That includes the actions
no fine-grained token can reach, so a write in the second row of
[their table](https://docs.jmrp.io/gitlab-mcp-server/operations/fine-grained-tokens/#what-no-fine-grained-token-can-reach) commits and is answered null
there too. The server logs it at `WARN`
(`failed to detect PAT scopes, all tools will be registered`).

The server asks again until GitLab answers:

- In HTTP mode, on every accepted revalidation of the pool entry, at
  `--revalidate-interval` (15 minutes by default). With `0` nothing revalidates, and
  the question is asked again by the build of the entry the first request makes once
  its credential has gone an hour unchecked.
- On stdio, on the timer that re-reads a grant, at
  `GITLAB_MCP_SESSION_REVALIDATE_INTERVAL` (15 minutes by default, and never with
  `0`), and as soon as a start that could not reach GitLab at all recovers, which is
  the first call GitLab answers.

A round GitLab still does not answer changes nothing and is logged at `DEBUG`
(`the token's kind is still unknown`). The round that learns the token is a
fine-grained one gives the session what its grant reaches, or the fallback above with
its reason, and says so at `INFO` with the phase (`B` when the grant was evaluated,
`A` when it was not). From then on the session is the fine-grained one this page
describes: a client that kept a listing from before is answered withheld on the calls
it may not make. A token learned to be a classic one keeps the scope narrowing the
start or the entry's build decided, until the process restarts or the entry is
rebuilt, unless the answer names scopes below the `read_api` minimum: then the HTTP
pool entry ends, as admission would have refused it, and a stdio process answers every
catalog method with JSON-RPC `-40300`.

With `--auth-mode=oauth` the verifier asks the same question while it admits the
token, and the pool entry takes the kind from that answer. When neither introspection
endpoint answered, the verifier admits the token on an assumed `api` scope, which says
nothing of its kind, so the pool entry asks the self endpoint itself, when it is built
and on each accepted revalidation, as legacy mode does.

### What no fine-grained token can reach

Some of what this server offers goes through GitLab GraphQL types or mutations that
declare no fine-grained permission at GitLab 19.6.1, and GitLab refuses or empties
those for every fine-grained token, whatever its grant. At 19.6.1 that is 14 actions of
1115, all through GraphQL, each in one of three ways:

| How GitLab answers | Actions | Examples |
| --- | ---: | --- |
| A type on the answer's path declares nothing: null, or a list emptied or nulled | 7 | `branch.rule_list`, `ci_catalog.list`, `security_finding.list`, `vulnerability.severity_count` |
| The write commits, and the answer is null | 4 | `security_attribute.create`, `security_attribute.update`, `security_category.create`, `security_category.update` |
| The mutation declares nothing and is refused | 3 | `security_attribute.bulk_update`, `security_scan_profile.attach`, `security_scan_profile.detach` |

These are withheld from every fine-grained session, with the reason, the GitLab release
the verdict comes from and the way out, which is a classic token. The second row is
withheld for a reason beyond the empty answer: an assistant that reads a null as "not
done" and tries again repeats a write GitLab already committed. The custom emoji
actions left this set with GitLab 19.5, which declares Custom Emoji: Read, and so did
the case of an epic GitLab declared at the project boundary only, which 19.5 also
declares at the group boundary. 41 more left it with GitLab 19.6, which declares the
namespace, achievement and target branch rule types among others: the epic, work item,
saved view and achievement actions and the target branch rules.

The [fine-grained permissions reference](https://docs.jmrp.io/gitlab-mcp-server/reference/fine-grained-permissions/)
names the reason for each. An action leaves this set once a GitLab release declares
the permission it lacks and this server records its table from that release, as the
custom emoji actions did with 19.5 and the epic and work item actions with 19.6; until then the way out is a classic token, and serving
over REST what GraphQL cannot reach is
[issue 1054](https://github.com/jmrplens/gitlab-mcp-server/issues/1054).

### GitLab.com and other releases

The permission table is recorded from GitLab 19.6.1, and the grant is judged only on an
instance that reports a 19.6 release. An instance on another release, 19.5 included,
falls back as [above](https://docs.jmrp.io/gitlab-mcp-server/operations/fine-grained-tokens/#when-the-grant-is-not-evaluated), naming the version it reported
and the one recorded. Such a session is withheld only what no fine-grained token reaches
at 19.6.1, so on 19.5 the epic, work item, saved view and achievement actions are listed
and passed to GitLab, which answers them empty or null for every fine-grained token as it
did before 19.6. A read emptied that way comes without the
[note](https://docs.jmrp.io/gitlab-mcp-server/operations/fine-grained-tokens/#what-an-empty-answer-can-mean) that says empty may not mean there is nothing,
since the note reads the 19.6.1 table, where those types declare a permission; a write
GitLab answers there without its object is still answered as
[probably committed](https://docs.jmrp.io/gitlab-mcp-server/operations/fine-grained-tokens/#a-write-answered-without-its-object). One exception is made for
the prerelease of the minor right after the recorded one (`19.7.0-pre`), which is what
GitLab.com reports: a session on an instance that reports it is **listed** what its
grant reaches at 19.6.1, and every call
the fallback would allow is passed to GitLab, so a permission GitLab changed in that one
milestone surfaces as GitLab's own refusal rather than as a refusal here with a stale
name. Once GitLab.com moves past that prerelease, it falls back like any other release
until the table is recorded again, which the server's own test against GitLab.com
reports.

## Reading a withheld answer

A call to an action the session may not run is answered as a tool error, before
anything reaches GitLab and before a confirmation or a safe-mode preview is offered.
It names the action by its canonical ID and opens with one of two stable texts. When
the grant does not reach the action:

```text
action "branch.create" exists but this fine-grained personal access token was not granted what it needs: the project permission [Branch: Create], as GitLab 19.6.1 declares it. Create a fine-grained token that grants it, or use a classic token with the api scope (an existing one, on an instance that no longer lets you create them), where the group does not refuse classic tokens. Do not report the capability as missing.
```

The permissions are the ones the token creation page offers, grouped by the boundary
they are held at. When no fine-grained token reaches the action at that GitLab
release:

```text
action "ci_catalog.list" exists but is not available to a fine-grained personal access token: GitLab 19.6.1 declares no fine-grained permission on the GraphQL type CiCatalogResource this action reads, and removes the items from such a list. Use a classic personal access token with read_api for reads or api for writes (an existing one, on an instance that no longer lets you create them), where the group does not refuse classic tokens. Do not report the capability as missing.
```

When the grant was not evaluated, this second form also says why, in the words of the
[table above](https://docs.jmrp.io/gitlab-mcp-server/operations/fine-grained-tokens/#when-the-grant-is-not-evaluated). Both end with
`Do not report the capability as missing.`, since the action exists and only the
credential cannot run it. On the default dynamic surface the text is prefixed with
`gitlab_execute_action:` and a space. The way out to a classic token reads "(an
existing one, on an instance that no longer lets you create them), where the group does
not refuse classic tokens", because GitLab can enforce fine-grained tokens in two ways
([below](https://docs.jmrp.io/gitlab-mcp-server/operations/fine-grained-tokens/#when-an-organization-enforces-fine-grained-tokens)).

Where to look next:

- `gitlab://tools/{id}` serves the detail of a withheld action with a `withheld` block
  carrying the cause and the same words, rather than answering not found, and every
  session, classic ones included, finds what the action needs in its `fine_grained`
  block
  ([Resources](https://docs.jmrp.io/gitlab-mcp-server/tools/resources-prompts/#tool-manifest-resource-template-1)).
- `gitlab_find_action`, on the dynamic surface, leaves out of a fine-grained session's
  results what it may not run, so the next best match takes its place, while
  `gitlab_execute_action` still answers a withheld action with the reason.
- Each refusal is logged at `INFO` with the reason class `fine_grained`, which
  [Telemetry](https://docs.jmrp.io/gitlab-mcp-server/operations/telemetry/#metrics) lists, and never with
  the token or its grant.

## What an empty answer can mean

Over REST, a call outside the grant is GitLab's own `403`, which names the missing
permission. It names it in the same words whether the grant lacks the permission,
holds it only for other projects or groups, or the token's user is not a member of the
project or group the call targets, so the description this server gives names all
three; when the session's own grant does hold the permission for other projects or
groups, the answer adds a sentence saying so, and what is missing is the project or
group in the grant, or the user's membership there. Over GraphQL it is not: a position the grant does not reach comes back
`null`, and a connection drops the items it does not reach, with no error either way.
So a fine-grained session is given a next step beside three kinds of answer:

- An answer GitLab always leaves partly empty for a fine-grained token, or leaves empty
  unless the grant holds more: the note names each part as the GraphQL selection that
  reaches it (`vulnerability { issueLinks { nodes } }`) and says "Empty there does not
  mean there is nothing." `vulnerability.list` and `vulnerability.get` are served this
  way.
- A not-found answer of an action that reads GraphQL: GitLab answers null for an object
  the token is not granted or that sits outside its grant, so not found may mean the
  token cannot see it.
- An empty list from an action whose answer is a GraphQL list: GitLab leaves out the
  items the token is not granted, so empty may mean the token cannot see them.

A list can also answer an item as `null` where it sits rather than leave it out, when
the item's type declares neither a permission check of its own nor a fine-grained
permission. Those items are left out of the answer rather than shown as rows with
nothing in them. The CI/CD catalog listing counts them in its heading and says why in
its next steps. At GitLab 19.6.1 that listing is itself withheld from a fine-grained
session ([above](https://docs.jmrp.io/gitlab-mcp-server/operations/fine-grained-tokens/#what-no-fine-grained-token-can-reach)), so the count is for a session
it is served to anyway, such as one whose token kind the server could not learn
([above](https://docs.jmrp.io/gitlab-mcp-server/operations/fine-grained-tokens/#when-the-server-cannot-tell-what-kind-of-token-it-holds)).

One REST route answers this way too. GitLab checks inside the route of `orbit.context`
what the token may read, answers an object it may not as `not_found` and leaves out the
parts of a summary it may not, so neither means there is nothing. The
[Orbit page](https://docs.jmrp.io/gitlab-mcp-server/tools/orbit/#context-resolve-one-reference) lists the
permissions, and a `not_found` there ends on a next step that says so to every session.

### A write answered without its object

GitLab checks a write's own permission before the write runs, and the object the write
answers with only after it ran. So a write the grant allows, whose object the grant does
not let the token read, is made, and answered without the object: `null` with no error,
or the error GitLab writes when that null sits below a field that cannot be null. An
assistant that reads that as "not done" repeats a write GitLab already made.

Where a fine-grained session can reach such a write, the answer is an error that says
the write was **probably committed**, and to check in GitLab, or with a classic token,
whether it took effect before repeating it, since repeating a create makes a second one.
Two kinds of write are answered this way:

- Writes the server serves whose object needs a permission the write's own does not
  include: the four vulnerability state changes (`vulnerability.dismiss`,
  `vulnerability.confirm`, `vulnerability.resolve` and `vulnerability.revert`), since
  Vulnerability: Update does not grant Vulnerability: Read, the epic note edits
  (`group.epic_note_update` and `group.epic_discussion_update_note`), since Work Item:
  Update does not grant Work Item: Read, from GitLab 19.5 the custom emoji creation
  (`custom_emoji.create`), since Custom Emoji: Create does not grant Custom Emoji: Read,
  and from GitLab 19.6 the epic note creations (`group.epic_note_create`,
  `group.epic_discussion_create` and `group.epic_discussion_add_note`), whose note is read
  with a permission Work Item: Create does not grant. An epic note created this way may
  also be a body of quick actions alone, which GitLab runs without keeping a note, and the
  answer says so. A session reaches one with a grant that holds the write without the
  read, when the grant was not evaluated, or when it holds the read on another project
  or group than the one written to. An edited note answered
  this way may also be a note GitLab deleted because its new body held only quick
  actions, and the answer says so, since a fine-grained token is not shown what told the
  two apart.
- The writes of the second row of the
  [table above](https://docs.jmrp.io/gitlab-mcp-server/operations/fine-grained-tokens/#what-no-fine-grained-token-can-reach). With the table this server
  records from GitLab 19.6.1 they are withheld from every session the server knows to be
  fine-grained, whatever its grant and whatever release the instance runs. The answer
  is there for a table recorded from a later release that stops withholding one while a
  grant can still leave its object out, as the custom emoji creation did when GitLab
  19.5 declared Custom Emoji: Read, and the epic and work item creations did with
  GitLab 19.6.

A token whose kind the server could not learn
([above](https://docs.jmrp.io/gitlab-mcp-server/operations/fine-grained-tokens/#when-the-server-cannot-tell-what-kind-of-token-it-holds)) is served as a
classic one, and gets the answer a classic token gets, which does not say the write was
probably committed. A classic token is never given this answer.

## GitLab's own refusals

A call the server lets through can still be refused by GitLab, and the server passes
on what GitLab said with what to do. GitLab has four such refusals, listed in
[Troubleshooting](https://docs.jmrp.io/gitlab-mcp-server/operations/troubleshooting/#fine-grained-tokens);
the one you will meet most is "Access denied: This operation requires a fine-grained
personal access token with the following project permissions: [...]", whose answer is
a new token whose grant names that project, or a group above it, with what it lists,
for a user who is a member there.

## When an organization enforces fine-grained tokens

GitLab can require fine-grained tokens after a date, in two forms:

- **On GitLab.com**, the Owner of a top-level group enforces them for the group, its
  subgroups and projects. A classic token is then refused there with the same text a
  fine-grained token gets ("Access denied: This operation requires a fine-grained
  personal access token with the following ... permissions"), so a classic token can
  meet that refusal too. Two Orbit actions answer it in their own way, since GitLab
  checks the token inside their route: `orbit.context` answers an object there as
  `not_found`, and `orbit.grep` lists the `branches` scope of a project there as
  unavailable. Classic tokens keep working outside the group.
- **On a self-managed instance**, an administrator enforces them for the whole
  instance: users can no longer create or rotate classic tokens, and existing ones keep
  working until they expire.

That is why every way out the server offers reads "a classic token (an existing one, on
an instance that no longer lets you create them), where the group does not refuse
classic tokens".

## HTTP mode

In HTTP mode every new credential is checked with `GET /api/v4/user` before it is
served, and a fine-grained token reaches that route only when it grants User: Read. A
token without it is answered `403` (not `401`), is **not charged** to the address's
failure budget, since GitLab accepted it, and is remembered for five minutes, so the
same token is answered from memory rather than checked again. The body opens with
`GitLab accepted this token and refused it the permission to read its own user.`,
quotes GitLab's own sentence, and names the way out: a fine-grained token that grants
User: Read, or a classic token.

In OAuth mode a fine-grained token sent as a Bearer token meets the `read_api` minimum
the door asks for. A deployment that admits only its own OAuth applications
(`--oauth-client-uid`) refuses every personal access token, fine-grained ones
included: see
[Admitting only your own application](https://docs.jmrp.io/gitlab-mcp-server/operations/oauth-app/#admitting-only-your-own-application).
The rest of the door is in [HTTP Server](https://docs.jmrp.io/gitlab-mcp-server/operations/http-server/).

## `--ignore-scopes` and a fine-grained token

`--ignore-scopes` (`GITLAB_MCP_IGNORE_SCOPES=true`) skips the scope filter and the
`read_api` narrowing. It does not skip reading what kind of token the server holds, and
it does not turn off anything this page describes: the grant is a different question
from the scopes, and skipping it would serve a fine-grained session the whole catalog
with no word of what its grant leaves out. Nor does it skip the admission minimum, so
a classic token carrying neither `read_api` nor `api` is refused under it too. The one
start that reads nothing under it is a stdio start that could not reach GitLab, since
an instance that did not answer cannot say what kind the token is; that session is the
one [described above](https://docs.jmrp.io/gitlab-mcp-server/operations/fine-grained-tokens/#when-the-server-cannot-tell-what-kind-of-token-it-holds),
exactly as it would be without the flag.

## Further reading

- [Fine-grained permissions reference](https://docs.jmrp.io/gitlab-mcp-server/reference/fine-grained-permissions/):
  what every action needs, generated from the handlers and from GitLab 19.6.1
- [Troubleshooting](https://docs.jmrp.io/gitlab-mcp-server/operations/troubleshooting/#fine-grained-tokens):
  GitLab's four refusal texts and what each means
- [HTTP Server](https://docs.jmrp.io/gitlab-mcp-server/operations/http-server/) and
  [OAuth application](https://docs.jmrp.io/gitlab-mcp-server/operations/oauth-app/): the door and the pool
- [Security](https://docs.jmrp.io/gitlab-mcp-server/operations/security/#fine-grained-personal-access-tokens):
  how a fine-grained token fits the server's security model
- [ADR-0024](https://github.com/jmrplens/gitlab-mcp-server/blob/main/docs/development/adr/adr-0024-fine-grained-token-authority-per-action.md):
  why the server decides this way
- [GitLab: Fine-grained personal access tokens](https://docs.gitlab.com/auth/tokens/fine_grained_access_tokens/):
  GitLab's own documentation of the token and its enforcement

## Frequently asked questions

### Does GitLab MCP Server work with a fine-grained personal access token?

Yes, in every mode. The server reads a fine-grained token as unknown authority rather than read-only, reads its grant with the token itself, and shows each session the actions the grant reaches, judged against the permissions GitLab 19.6.1 declares. A call to any other action is answered with the permission it needs, in the words GitLab's token creation page uses.

### Which permissions does a fine-grained token need for the server to start?

User: Read and Namespace: Read and Personal Access Token: Read at the user boundary, and Metadata: Read at the instance. Without Personal Access Token: Read or Metadata: Read the server still starts, but it cannot judge the grant, so it withholds only what no fine-grained token can reach and leaves the rest to GitLab. In HTTP mode a token without User: Read is refused at the door with 403.

### Why does an action say it is not available to a fine-grained token?

At GitLab 19.6.1, 14 actions of 1115 are refused or emptied for every fine-grained token whatever its grant, all of them over GraphQL, because they go through types or mutations that declare no fine-grained permission. Among them are the CI/CD catalog, branch rule, security attribute and security scan profile actions. The answer names the type and the release, and the way out is a classic token.

### I am missing a permission. Can I add it to my token?

No. GitLab fixes a fine-grained token's grant when the token is created, and rotating a token gives the new token the same grant, as GitLab's [rotation API](https://docs.gitlab.com/api/personal_access_tokens/#rotate-a-personal-access-token) documents. Create a new token that grants what the answer names.
