Skip to main content
GitLab The GitLab app provides read/write access to the GitLab DevOps platform via its REST v4 API. It can be used either as a Builder app (automations call GitLab instructions directly) or as a remote MCP server consumed by an Knowledges agent — covering projects, issues, merge requests, pipelines, branches, commits, releases, CI/CD variables, deploy keys, webhooks, wikis, groups and users. Supports two authentication modes:
  • Central OAuth2 (recommended) — one OAuth Application is registered once by the Prisme.ai workspace admin; every end user signs in with their own GitLab account. Nothing to install per tenant. Requires the platform admin to grant the GitLab capability in Prisme.ai Governance (see below).
  • Tenant PAT — install the GitLab app in your workspace and paste a Personal Access Token. Shared across the workspace’s users; no per-user sign-in.

Project Management

Projects, issues, merge requests, labels, milestones and wikis

CI/CD & DevOps

Pipelines, jobs, environments, CI variables, deploy keys and webhooks

Central OAuth or PAT

One shared OAuth Application with per-user sign-in, or a tenant-level static PAT — both modes coexist on the same MCP endpoint

Prerequisites

  • A GitLab account (gitlab.com or self-hosted)
  • For the central OAuth mode — the platform admin has registered ONE OAuth Application at User Settings > Applications (https://gitlab.com/-/user_settings/applications) with api scope and the callback URL <api-url>/workspaces/slug:gitlab/webhooks/oauthCallback, and has stored its Client ID + Client Secret in the Secrets of the central gitlab workspace. The end user only needs to click Connect once.
  • For the tenant PAT mode — a Personal Access Token with api scope (Preferences > Access Tokens), pasted into the installed app instance.
  • Base URL (default: https://gitlab.com/api/v4 — override for self-hosted instances)
The two modes are mutually exclusive per MCP call: callers identify themselves either by being authenticated to Prisme.ai (central) or by sending the mcp-api-key header (tenant). The same workspace can serve both at the same time.

Setup (one-time, platform admin)

The central OAuth flow is set up once per environment by the Prisme.ai workspace admin. End users never touch any of this.
1

Register the OAuth Application at GitLab

Open https://gitlab.com/-/user_settings/applications and click Add new application. Use these values:
  • NamePrisme.ai GitLab connector (or whatever fits your branding)
  • Redirect URI<api-url>/workspaces/slug:gitlab/webhooks/oauthCallback (e.g. https://api.studio.prisme.ai/v2/workspaces/slug:gitlab/webhooks/oauthCallback on production)
  • Scopesapi
Save and copy the Application ID + Secret (the Secret is shown only once).
2

Store the credentials in the gitlab workspace secrets

Open the central gitlab workspace in the Prisme.ai Builder (Studio), go to Workspace settings > Secrets and set:
  • gitlabOauthClientId — the Application ID from GitLab
  • gitlabOauthClientSecret — the Secret from GitLab
These secrets are scoped to the gitlab workspace itself — they are NOT exposed to the end users or to any tenant who installs the app.
3

Declare the OAuth authentication in Governance

Open Prisme.ai Governance > Capabilities > GitLab (or whichever capability your agents will use to consume the connector) and attach an authentication configuration that points at the three central webhooks of the gitlab workspace:
{
  "type": "oauth2",
  "status_url": "<api-url>/workspaces/slug:gitlab/webhooks/checkAuthStatus",
  "connect_url": "<api-url>/workspaces/slug:gitlab/webhooks/initiateOAuth",
  "disconnect_url": "<api-url>/workspaces/slug:gitlab/webhooks/disconnectOAuth"
}
Replace <api-url> with your environment’s API URL (https://api.studio.prisme.ai/v2 on production). Governance uses these URLs to (1) probe whether the calling user is already connected (status_url), (2) trigger the OAuth handshake when they are not (connect_url), and (3) revoke the session on demand (disconnect_url).
4

Grant the capability to the right roles

Still in Governance, grant the GitLab capability to the roles or users who should be allowed to sign in with their own GitLab account through the central MCP. Without this grant, callers without an mcp-api-key header are rejected with 401 Authentication required.
5

Test the flow

From an Agent Creator agent with the GitLab capability enabled, call any tool (e.g. getCurrentUser). The agent receives a connect_url on the first call; opening it in a new window redirects the user to GitLab, then back to a callback page that closes itself after 5 seconds. Subsequent calls reuse the stored access token transparently.

Installation

  1. Go to Apps in your workspace
  2. Search for GitLab and install it
  3. Open the app instance configuration and fill in the required fields

Configuration

FieldDescription
GitLab API Base URLBase URL of the GitLab API (default https://gitlab.com/api/v4). Override for self-hosted instances.
Personal Access TokenGitLab PAT with api scope, stored as a workspace secret. Required when calling the MCP endpoint with the mcp-api-key header (tenant mode). Leave empty to use the central OAuth shared by the platform admin.
MCP EndpointAuto-populated on install — URL of the MCP endpoint for this instance.
MCP API KeyAuto-populated on install — signed key used in the mcp-api-key header for tenant PAT mode. Do not modify.
OAuth credentials (Client ID / Client Secret / authorization URL / token URL / scopes) are NOT part of the app instance config anymore — they live in the Secrets of the central gitlab workspace and are shared by all callers in central mode. See the Setup section above.

Available Instructions

Every instruction resolves credentials from the workspace configuration.

Projects

InstructionArguments
listProjectssearch, visibility, owned, membership, order_by, sort, per_page, page
createProjectname*, path, namespace_id, description, visibility, default_branch, initialize_with_readme
getProjectid*
updateProjectid*, name, path, description, visibility, default_branch
deleteProjectid*
archiveProjectid*
unarchiveProjectid*
forkProjectid*, namespace, namespace_id, name, path

Issues

InstructionArguments
listIssuesid*, state, labels, milestone, search, assignee_username, per_page, page
createIssueid, title, description, labels, assignee_ids, milestone_id, confidential, due_date
getIssueid, iid
updateIssueid, iid, title, description, labels, assignee_ids, milestone_id, state_event
deleteIssueid, iid
closeIssueid, iid
reopenIssueid, iid
listIssueNotesid, iid, sort, order_by, per_page
createIssueNoteid, iid, body*, confidential
getIssueNoteid, iid, note_id*
updateIssueNoteid, iid, note_id, body
deleteIssueNoteid, iid, note_id*

Merge Requests

InstructionArguments
listMergeRequestsid*, state, source_branch, target_branch, labels, search, per_page
createMergeRequestid, source_branch, target_branch, title, description, assignee_ids, reviewer_ids, labels, milestone_id, remove_source_branch, squash
getMergeRequestid, iid
updateMergeRequestid, iid, title, description, target_branch, assignee_ids, labels, milestone_id, state_event
deleteMergeRequestid, iid
mergeMergeRequestid, iid, merge_commit_message, squash_commit_message, squash, should_remove_source_branch, merge_when_pipeline_succeeds, sha
approveMergeRequestid, iid, sha
unapproveMergeRequestid, iid
listMergeRequestNotesid, iid, sort, order_by, per_page
createMergeRequestNoteid, iid, body*
getMergeRequestNoteid, iid, note_id*
updateMergeRequestNoteid, iid, note_id, body
deleteMergeRequestNoteid, iid, note_id*

Branches

InstructionArguments
listBranchesid*, search, per_page
createBranchid, branch, ref*
getBranchid, branch
deleteBranchid, branch

Commits

InstructionArguments
listCommitsid*, ref_name, since, until, path, author, per_page
createCommitid, branch, commit_message, start_branch, start_sha, author_email, author_name, actions
getCommitid, sha
cherryPickCommitid, sha, branch*, dry_run, message
revertCommitid, sha, branch*, dry_run

Tags

InstructionArguments
listTagsid*, search, order_by, sort, per_page
createTagid, tag_name, ref*, message
getTagid, tag_name

Releases

InstructionArguments
listReleasesid*, order_by, sort, per_page
createReleaseid, name, tag_name, description, ref, released_at
getReleaseid, tag_name
deleteReleaseid, tag_name

Pipelines & Jobs

InstructionArguments
listPipelinesid*, status, ref, sha, username, order_by, sort, per_page
createPipelineid, ref, variables
getPipelineid, pipeline_id
retryPipelineid, pipeline_id
cancelPipelineid, pipeline_id
listPipelineJobsid, pipeline_id, scope, per_page
getJobid, job_id
retryJobid, job_id

Environments

InstructionArguments
listEnvironmentsid*, name, search, states, per_page
getEnvironmentid, environment_id
stopEnvironmentid, environment_id

Labels

InstructionArguments
listLabelsid*, with_counts, search, per_page
createLabelid, name, color*, description, priority
updateLabelid*, name, label_id, new_name, color, description, priority
deleteLabelid*, name, label_id

Milestones

InstructionArguments
listMilestonesid*, state, search, per_page
createMilestoneid, title, description, due_date, start_date
getMilestoneid, milestone_id
updateMilestoneid, milestone_id, title, description, due_date, start_date, state_event

Wiki

InstructionArguments
listWikiPagesid*, with_content
createWikiPageid, title, content*, format
getWikiPageid, slug, render_html, version

Webhooks

InstructionArguments
listProjectHooksid*, per_page
createProjectHookid, url, token, push_events, issues_events, merge_requests_events, tag_push_events, note_events, job_events, pipeline_events, wiki_page_events, enable_ssl_verification
deleteProjectHookid, hook_id

CI/CD Variables

InstructionArguments
listProjectVariablesid*, per_page
createProjectVariableid, key, value*, variable_type, protected, masked, raw, environment_scope, description
updateProjectVariableid, key, filter[environment_scope], value, variable_type, protected, masked, raw, environment_scope, description
deleteProjectVariableid, key, filter[environment_scope]

Deploy Keys

InstructionArguments
listDeployKeysid*, per_page
createDeployKeyid, title, key*, can_push
deleteDeployKeyid, key_id

Project Members

InstructionArguments
listProjectMembersid*, query, per_page
addProjectMemberid, user_id, access_level*, expires_at
removeProjectMemberid, user_id

Users

InstructionArguments
getCurrentUser
getUseruser_id*
listUsersactive, blocked, username, per_page, page
searchUserssearch*, per_page

Groups

InstructionArguments
listGroupssearch, owned, min_access_level, top_level_only, per_page
createGroupname, path, description, visibility, parent_id
getGroupid*
updateGroupid*, name, path, description, visibility
Arguments flagged with * are required.

DSUL Examples

List the user’s own projects

- GitLab.listProjects:
    membership: true
    order_by: last_activity_at
    sort: desc
    per_page: 20
    output: myProjects

Create an issue with labels and an assignee

- GitLab.createIssue:
    id: '{{projectId}}'
    title: Investigate 500s on /api/v1/search
    description: |
      Spike of 500s since 14:00 UTC. Logs in Kibana (link).
    labels: BUG,Incident
    assignee_ids:
      - '{{oncallUserId}}'
    output: issue

Open a merge request from a feature branch

- GitLab.createBranch:
    id: '{{projectId}}'
    branch: feature/auto-deploy
    ref: main
    output: branch
- GitLab.createMergeRequest:
    id: '{{projectId}}'
    source_branch: feature/auto-deploy
    target_branch: main
    title: Automate staging deploy
    description: Closes #{{issue.iid}}
    remove_source_branch: true
    output: mr

Trigger a pipeline on a specific ref

- GitLab.createPipeline:
    id: '{{projectId}}'
    ref: main
    variables:
      - key: DEPLOY_ENV
        value: staging
    output: pipeline

Error Handling

HTTP StatusErrorSolution
400Bad requestCheck argument shapes (IDs, dates, enum values)
401UnauthorizedVerify the PAT has api scope, or re-authorize OAuth
403ForbiddenThe token lacks permission on this project/group — check access level
404Not FoundVerify the project ID (numeric or URL-encoded path) and resource IID
409ConflictCommon on merge conflicts or concurrent updates
429Rate LimitedGitLab.com enforces 2000 req/min per-token; back off and retry
500Server ErrorTransient GitLab issue; retry after a few seconds

Common Issues

“Authentication required: please sign in to Prisme.ai before calling the GitLab MCP without an mcp-api-key header” — A caller hit the central endpoint without a valid Prisme.ai session AND without an mcp-api-key. Either sign in to Prisme.ai (central mode) or pass the tenant mcp-api-key (tenant mode). “Central OAuth config missing” — The gitlabOauthClientId / gitlabOauthClientSecret secrets of the central gitlab workspace are empty. Ask the platform admin to complete the Setup section above. “GitLab capability not granted” — The current user is signed in to Prisme.ai but has not been granted the GitLab capability in Governance. Ask the platform admin. “Invalid mcp-api-key” (tenant mode) — The mcp-api-key header does not match the central app secret. Reinstall the app instance to regenerate a signed key. “This GitLab tenant has no Personal Access Token configured” — Tenant mode was used (mcp-api-key header present) but the app instance’s token field is empty. Either fill the token or drop the header to fall back to central OAuth. “Can’t approve own MR” — A GitLab project access token’s bot user counts as the MR author and cannot approve its own merge requests. Use a different token (PAT for a human user) for the approval step. “pipeline creation 404” — The target ref has no .gitlab-ci.yml at its root. Either commit a CI config first or pick a ref that has one. Central OAuth — disconnecting a user — In central mode, the agent calls the disconnect tool (or the user opens <api-url>/workspaces/slug:gitlab/webhooks/disconnectOAuth) to revoke the access token at GitLab (RFC 7009) and delete the stored secrets. The next data tool call returns a fresh connect_url.

External Resources

GitLab REST API

Official GitLab REST v4 API reference

Tool Agents

Plug MCP servers into Knowledges agents