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_apiscope for read-only workflows andapiif 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
- 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.
- 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.
- 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. - Test it
In Workflow Studio, add the
gitlab_get_current_usertool 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.
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_issuefiles it in your on-call project. - Merge request review.
gitlab_get_merge_requestandgitlab_get_merge_request_diffsfeed an LLM step that posts feedback withgitlab_create_workitem_note. - Pipeline watcher.
gitlab_list_pipelinesandgitlab_get_job_logcollect failures for a daily digest. - Anything else.
gitlab_api_callsends 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.
| Tool | Access | What it does | Required arguments |
|---|---|---|---|
gitlab_api_call | Write | Call any GitLab REST v4 endpoint with the configured token. | method, path |
gitlab_create_issue | Write | Create an issue in a GitLab project. | project_id_or_path, title |
gitlab_create_merge_request | Write | Create a merge request in a GitLab project. | project_id_or_path, title, source_branch, target_branch |
gitlab_create_workitem_note | Write | Add a note to an issue or merge request. | project_id_or_path, work_item_type, work_item_iid, body |
gitlab_get_current_user | Read | Get the GitLab user for the configured API token. | — |
gitlab_get_job_log | Read | Get the plain-text trace log for a CI job. | project_id_or_path, job_id |
gitlab_get_merge_request | Read | Get a merge request by project and merge request IID. | project_id_or_path, merge_request_iid |
gitlab_get_merge_request_commits | Read | List commits on a merge request. | project_id_or_path, merge_request_iid |
gitlab_get_merge_request_diffs | Read | Get file diffs for a merge request. | project_id_or_path, merge_request_iid |
gitlab_get_pipeline | Read | Get a pipeline by project and pipeline ID. | project_id_or_path, pipeline_id |
gitlab_get_project | Read | Get a GitLab project by numeric ID or namespace path. | id_or_path |
gitlab_get_server_version | Read | Get GitLab instance version and revision. | — |
gitlab_get_workitem_notes | Read | List notes on an issue or merge request. | project_id_or_path, work_item_type, work_item_iid |
gitlab_list_issues | Read | List issues in a GitLab project. | project_id_or_path |
gitlab_list_labels | Read | List labels in a GitLab project. | project_id_or_path |
gitlab_list_merge_requests | Read | List merge requests in a GitLab project. | project_id_or_path |
gitlab_list_pipelines | Read | List CI/CD pipelines for a GitLab project. | project_id_or_path |
gitlab_list_projects | Read | List GitLab projects visible to the configured token. | — |
gitlab_search | Read | Search 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
| Key | Required | Description |
|---|---|---|
gitlab_api_token | Yes | Personal, group, or project access token. |
gitlab_base_url | No | GitLab REST API v4 base URL. Default https://gitlab.com/api/v4. |
Troubleshooting
| Problem | What to do |
|---|---|
401 unauthorized | The token is expired or revoked. Create a new token with the right scopes. |
403 when creating an issue | The token needs the api scope, not only read_api. |
404 for a project | Use the numeric project ID, or the full group/project path, and check that the token can see the project. |
| Self-managed GitLab does not connect | gitlab_base_url must be the full API v4 URL of your server, for example https://gitlab.example.com/api/v4. |