Prerequisites
- A GitLab account with access to the target projects or groups
- A personal access token, group access token, or project access token with scopes such as
apiandread_api - For self-managed GitLab: the REST base URL for your instance (e.g.
https://gitlab.example.com/api/v4) - project_contributor access in AgentRuntime
Connect in AgentRuntime
Create a GitLab access token
In GitLab, go to User Settings → Access Tokens (or create a group/project token). Grant at least
read_api; add api if you need to create issues. Copy the token immediately — GitLab shows it only once.Create a connection
Go to Connections and click New custom connection to create an API key connection with
APIToken. For self-managed instances, also set BaseURL to your REST v4 base (e.g. https://gitlab.example.com/api/v4).Add gitlab MCP instance
Go to MCP, click Add instance for gitlab, wire your connection on Instance config, set the profile active, and save.
What you can build
- Incident → issue — Workflow failure step captures error context → LLM formats a title and body →
create_issuein the on-call project. - Release notes triage —
list_issueswithstate=opened→ LLM summarizes blockers → post summary to Slack or Notion. - Project discovery —
list_projectswithsearch→ agent picks the correctproject_id_or_pathfor downstream API calls. - Custom automation —
gitlab_api_callfor merge requests, pipelines, or labels not covered by first-class tools.
Tools
| Tool | Description |
|---|---|
get_current_user | GitLab user for the configured API token |
list_projects | Projects visible to the token (optional name/path search) |
get_project | Project by numeric ID or namespace path (e.g. group/project) |
list_issues | Issues in a project with optional state filter |
create_issue | Create an issue with title, description, and labels |
gitlab_api_call | Raw GitLab REST v4 request (GET, POST, PUT, PATCH, DELETE) |
Example
Create an issue when a workflow step fails:Configuration
| Key | Required | Description |
|---|---|---|
APIToken | Yes | Personal, group, or project access token |
BaseURL | No | REST v4 base URL (default GitLab.com API) |
Troubleshooting
| Issue | Fix |
|---|---|
401 Unauthorized | Token expired or revoked; create a new token with correct scopes |
404 on project path | Use URL-encoded path (group%2Fproject) or numeric project ID |
| Self-managed SSL errors | Confirm BaseURL uses HTTPS and matches your instance hostname |
403 on create_issue | Token needs api scope, not just read_api |