GitLab connector

Read and create GitLab issues, merge requests, pipelines, and more on GitLab.com or a self-managed GitLab.

On this page

The gitlab connector connects workflows to the GitLab REST API v4. Use it to file issues from failed workflows, review merge requests and pipelines, search a project, or call any other GitLab API endpoint, on GitLab.com or your own GitLab server.

Prerequisites

  • A GitLab account with access to the projects you want to automate.
  • A personal, group, or project access token. Use the read_api scope for read-only workflows and api if workflows create or change things.
  • For a self-managed GitLab: its API base URL, for example https://gitlab.example.com/api/v4.
  • The project_contributor role or higher in your workspace, which lets you manage connections and MCP instances. See Roles and permissions.

Connect in AgentRuntime

  1. Create a GitLab access token

    In GitLab, open your avatar menu, go to Preferences (or Edit profile), then Access tokens, and add a new token with the scopes above. You can also create a group or project access token. Copy the token right away; GitLab shows it only once.

  2. Add the connector to your workspace

    Click MCP in the sidebar, then Add connectors. Find GitLab in the App catalog, select it, and click Add to workspace. The instance now appears on the MCP connectors page. See MCP instances.

  3. Add your credentials to a profile

    Open the new instance to reach Instance config. Under Profiles for this connector, click New profile, enter a Display name, and on the Type secrets on this screen tab fill in gitlab_api_token (your token) and, for a self-managed GitLab, gitlab_base_url. Set Status to Active — can be used in workflows and click Save. Then click Use this profile for workflows.

  4. Test it

    In Workflow Studio, add the gitlab_get_current_user tool from your GitLab instance (use Browse platform MCP if it is not listed), fill in its arguments, and run the workflow. A successful step means the connection works. This tool has no arguments and returns the user the token belongs to.

Note

To reuse the same credentials in more than one profile, save them first under Connections → New custom connection, using the exact key names from Configuration, then choose Use a saved connection on the profile instead.

What you can build

  • Incident to issue. When a workflow step fails, an LLM formats the error and gitlab_create_issue files it in your on-call project.
  • Merge request review. gitlab_get_merge_request and gitlab_get_merge_request_diffs feed an LLM step that posts feedback with gitlab_create_workitem_note.
  • Pipeline watcher. gitlab_list_pipelines and gitlab_get_job_log collect failures for a daily digest.
  • Anything else. gitlab_api_call sends a raw REST v4 request for endpoints without a dedicated tool.

Tools

The Required arguments column lists the fields the tool's input schema marks as required. Some of them are optional in practice; if you have nothing to set, pass an empty value such as "", [], {}, or false.

project_id_or_path accepts a numeric project ID or the project path, such as group/project.

ToolAccessWhat it doesRequired arguments
gitlab_api_callWriteCall any GitLab REST v4 endpoint with the configured token.method, path
gitlab_create_issueWriteCreate an issue in a GitLab project.project_id_or_path, title
gitlab_create_merge_requestWriteCreate a merge request in a GitLab project.project_id_or_path, title, source_branch, target_branch
gitlab_create_workitem_noteWriteAdd a note to an issue or merge request.project_id_or_path, work_item_type, work_item_iid, body
gitlab_get_current_userReadGet the GitLab user for the configured API token.—
gitlab_get_job_logReadGet the plain-text trace log for a CI job.project_id_or_path, job_id
gitlab_get_merge_requestReadGet a merge request by project and merge request IID.project_id_or_path, merge_request_iid
gitlab_get_merge_request_commitsReadList commits on a merge request.project_id_or_path, merge_request_iid
gitlab_get_merge_request_diffsReadGet file diffs for a merge request.project_id_or_path, merge_request_iid
gitlab_get_pipelineReadGet a pipeline by project and pipeline ID.project_id_or_path, pipeline_id
gitlab_get_projectReadGet a GitLab project by numeric ID or namespace path.id_or_path
gitlab_get_server_versionReadGet GitLab instance version and revision.—
gitlab_get_workitem_notesReadList notes on an issue or merge request.project_id_or_path, work_item_type, work_item_iid
gitlab_list_issuesReadList issues in a GitLab project.project_id_or_path
gitlab_list_labelsReadList labels in a GitLab project.project_id_or_path
gitlab_list_merge_requestsReadList merge requests in a GitLab project.project_id_or_path
gitlab_list_pipelinesReadList CI/CD pipelines for a GitLab project.project_id_or_path
gitlab_list_projectsReadList GitLab projects visible to the configured token.—
gitlab_searchReadSearch GitLab issues or merge requests.query, scope

Example

File an issue when a workflow step fails.

{
  "id": "gitlab-issue",
  "type": "mcp",
  "name": "File GitLab issue",
  "tool_name": "gitlab_create_issue",
  "tool_args": {
    "project_id_or_path": "my-group/my-service",
    "title": "Workflow run {{input.run_id}} failed",
    "description": "{{steps.summarize-error.result.text}}",
    "labels": "automation,incident"
  },
  "depends_on": [
    "summarize-error"
  ],
  "timeout_s": 30
}

Configuration

KeyRequiredDescription
gitlab_api_tokenYesPersonal, group, or project access token.
gitlab_base_urlNoGitLab REST API v4 base URL. Default https://gitlab.com/api/v4.

Troubleshooting

ProblemWhat to do
401 unauthorizedThe token is expired or revoked. Create a new token with the right scopes.
403 when creating an issueThe token needs the api scope, not only read_api.
404 for a projectUse the numeric project ID, or the full group/project path, and check that the token can see the project.
Self-managed GitLab does not connectgitlab_base_url must be the full API v4 URL of your server, for example https://gitlab.example.com/api/v4.
Edit this pageagentruntime-io/agentruntime-docs