← All integrations

GitLab

Let an agent triage issues and review merge requests on gitlab.com without a token in its prompt. It reads projects, issues, merge requests, pipelines and files, opens, edits and comments, and closing, approving, merging or retrying a pipeline can wait for a person.

GitLabsecret · GITLAB
host
gitlab.com
connect
API key, per user
  • Create issue

    gitlab-create-issue

  • Update issue

    gitlab-update-issue

  • Close issue

    gitlab-close-issue

  • Reopen issue

    gitlab-reopen-issue

writes are off until switched on

Reads and writes in GitLab. Writes are off until you switch them on.

Each one is a named operation from the pack. Reads change nothing.

Writes

  • Create issue

    read back

    gitlab-create-issue

    Open one issue in a project, with a title and optional description, labels, one assignee, milestone and due date. Returns the issue with its number (`iid`).

  • Update issue

    read back

    gitlab-update-issue

    Change one issue: any of title, description, the full label list, labels to add or remove, assignees, milestone and due date. Fields left out are not changed. It does not open or close the issue: use close-issue and reopen-issue.

  • Close issue

    read back

    gitlab-close-issue

    Close one issue.

  • Reopen issue

    read back

    gitlab-reopen-issue

    Reopen one closed issue.

  • Comment on issue

    read back

    gitlab-comment-on-issue

    Add one comment to an issue.

  • Create merge request

    read back

    gitlab-create-merge-request

    Open one merge request from a source branch into a target branch in the same project, with a title and optional description, labels, assignees, reviewers, and whether to squash and delete the source branch on merge. Start the title with `Draft:` to open it as a draft. Returns the merge request with its number (`iid`).

  • Update merge request

    read back

    gitlab-update-merge-request

    Change one merge request: any of title, description, the full label list, labels to add or remove, assignees, reviewers and target branch, or close or reopen it (`state_event`). Fields left out are not changed.

  • Comment on merge request

    read back

    gitlab-comment-on-merge-request

    Add one comment to a merge request's overview.

  • Approve merge request

    read back

    gitlab-approve-merge-request

    Approve one merge request as the token's user. Pass the head `sha` you reviewed (from get-merge-request); GitLab refuses the approval (409) if the branch has moved since.

  • Merge merge request

    read back

    gitlab-merge-merge-request

    Merge one merge request now. `sha` must be the head commit you reviewed (from get-merge-request); GitLab refuses the merge (409) if the branch has moved since. Optionally squash, delete the source branch, and set the merge or squash commit message.

  • Retry pipeline

    acknowledged

    gitlab-retry-pipeline

    Retry the failed and canceled jobs of one pipeline. A pipeline with none is left as it was. Returns the pipeline.

  • Cancel pipeline

    acknowledged

    gitlab-cancel-pipeline

    Cancel the running and pending jobs of one pipeline. Returns the pipeline.

Reads

  • List projects

    gitlab-list-projects

    List the projects the token's user is a member of, 20 per page, most recently active first, in GitLab's short form: id, name, full path, default branch, web URL and last activity. Archived projects are left out. Pass `search` to match names, and `page` for the next page.

  • Get project

    gitlab-get-project

    Get one project: id, name, full path, description, default branch, visibility, open issue count, web URL and the token user's access level in it.

  • Search issues

    gitlab-search-issues

    Search issues across every project the token's user can see, 10 per page, newest first, with descriptions. `scope` is created_by_me when left out; `assigned_to_me` and `all` widen it. GitLab.com may refuse `all` with 400. Filter by state, labels (all must match) and text. Pass `page` for the next page.

  • List issues

    gitlab-list-issues

    List the issues of one project, 10 per page, newest first by default, with descriptions, labels, assignees and milestone. Filters: state, labels (all must match), text, assignee and author usernames, milestone title, and updated_after. Pass `page` for the next page.

  • Get issue

    gitlab-get-issue

    Get one issue by its number in the project: title, description, state, labels, assignees, author, milestone, due date, timestamps and web URL.

  • List issue notes

    gitlab-list-issue-notes

    List the comments and system notes on one issue, 20 per page, oldest first by default. Pass activity_filter=only_comments to leave out system notes (label and state changes). Pass `page` for the next page.

  • List labels

    gitlab-list-labels

    List the labels of one project, 50 per page, with each one's name, color, description and open issue count. Use the names in labels, add_labels and remove_labels. Pass `page` for the next page.

  • List merge requests

    gitlab-list-merge-requests

    List the merge requests of one project, 5 per page, newest first by default, with descriptions, branches, state, draft flag, merge status and web URL. Filters: state, labels, text, author and reviewer usernames, target branch. Pass `page` for the next page.

  • Get merge request

    gitlab-get-merge-request

    Get one merge request by its number in the project: title, description, source and target branches, state, draft flag, detailed_merge_status, head commit `sha` (pass it to approve-merge-request and merge-merge-request), labels, assignees, reviewers, latest pipeline and web URL.

  • List merge request diffs

    gitlab-list-merge-request-diffs

    List the changed files of one merge request, 5 per page, each with old and new path, whether it was added, renamed or deleted, and its unified diff. GitLab collapses very large diffs (too_large, collapsed) and a page with big diffs can be cut at 64 KB. Pass `page` for the next page.

  • List merge request notes

    gitlab-list-merge-request-notes

    List the comments and system notes on one merge request, 20 per page, newest first by default. Pass `page` for the next page.

  • List pipelines

    gitlab-list-pipelines

    List the CI/CD pipelines of one project, 20 per page, newest first, with id, status, ref, sha, source and web URL. Filters: status, ref (branch or tag) and sha. Pass `page` for the next page.

  • Get pipeline

    gitlab-get-pipeline

    Get one pipeline: status, ref, sha, source, who started it, timestamps, duration and web URL.

  • Get file

    gitlab-get-file

    Get one file from a repository at a branch, tag or commit (`ref`). The file comes back with its `content` in base64, its size, blob id and last commit id. A file over about 45 KB is cut by the 64 KB response limit once encoded.

  • List branches

    gitlab-list-branches

    List the branches of one repository, 30 per page, with each one's name, protected and merged flags, default flag and latest commit. Pass `search` to match names, and `page` for the next page.

  • List commits

    gitlab-list-commits

    List commits on a branch or tag, 20 per page, newest first, with sha, title, message, author, dates and web URL. Filter by ref_name (the default branch when left out), a file path, and since and until times. Pass `page` for the next page.

How do users connect? Each one brings their own GitLab.

  1. 1.Call for the userYour server invokes the action for the signed-in user. Without a GitLab connection, the SDK throws EndUserNotConnectedError with a connect link.
  2. 2.The user pastes a keyThe link opens a form that shows where in GitLab's settings to create the key. The link lasts 10 minutes and works once.
  3. 3.Anlyon checks itThe key is checked with GitLab before it is kept, and bound to gitlab.com. It is never shown back.
  4. 4.Your server confirmsYour server confirms the connection for the user who is signed in, and the call goes through.

Guardrails. Suggested limits and approvals, for you to review.

Suggested limits

  • 50 issues opened a day
  • 100 issues updated a day
  • 50 issues closed a day
  • 50 issues reopened a day
  • 200 issue comments a day
  • 20 merge requests opened a day
  • 50 merge requests updated a day
  • 200 merge request comments a day
  • 50 merge requests approved a day
  • 20 merge requests merged a day
  • 20 pipelines retried a day
  • 20 pipelines canceled a day

Suggested approvals

  • A person approves closing an issue
  • A person approves closing a merge request
  • A person approves approving a merge request
  • A person approves merging a merge request
  • A person approves retrying a pipeline
  • A person approves canceling a pipeline

What the key must allow

  • A personal access token with the api scope
  • Or, narrower, a project access token with the api scope and the Developer role

Good to know

  • Projects on gitlab.com. A self-managed GitLab cannot be connected yet.
  • An approval or a merge names the commit that was reviewed, so a newer push is not merged unseen.

For your own account

  1. 1.In GitLab, open User settings, Access tokens, and create a token with the api scope, or create a project access token in the project's settings.
  2. 2.In Anlyon, open Actions, then Integrations, choose GitLab and paste the token.
  3. 3.Anlyon checks the token with GitLab before storing it. It becomes a secret named GITLAB, bound to gitlab.com.

GitLab in your code. For one of your users, or for your own account.

Act for one of your users from your server, or connect your company's own GitLab with the CLI.

gitlab.ts
import { Client, EndUserNotConnectedError } from "@anlyonhq/sdk";const anlyon = new Client({ apiKey: process.env.ANLYON_API_KEY! });try {  const { data } = await anlyon    .forUser(session.userId)    .actions.invoke("gitlab-create-issue", {      project: "acme/widgets",      title: "Checkout fails for saved cards"    });  return { status: "done", grade: data.grade };} catch (error) {  if (error instanceof EndUserNotConnectedError) {    // The user connects their own GitLab, then you call again.    return { status: "connect_required", url: error.connectUrl };  }  throw error;}

Let your agent act for your users, safely.

A few lines of server code, then send a user a connect link. Nothing to host.

$ claude mcp add --transport http anlyon https://api.anlyon.com/mcp