Kiro + GitLab MCP
The GitLab MCP server connects Kiro to your GitLab instance — self-hosted or GitLab.com. Kiro can read issues, merge requests, CI/CD pipeline results, and file contents directly.
What You Can Do
Section titled “What You Can Do”- “Implement the feature described in issue #34”
- “What failed in the last pipeline for this branch?”
- “Write the code to fix the bug in MR !12’s failing test”
- “Read the project’s
.gitlab-ci.ymland explain the stages” - “List all open issues in the project labelled ‘backend’”
- “Generate a merge request description for the current changes”
Prerequisites
Section titled “Prerequisites”- GitLab account (GitLab.com or self-hosted)
- Personal Access Token with the following scopes:
read_api— access to all read-only API endpointsread_repository— read repository files and commits
Creating a token (GitLab.com):
- GitLab → User Avatar → Edit Profile → Access Tokens
- Add a new token with
read_apiandread_repositoryscopes - Set an expiry date and copy the token immediately
Installation
Section titled “Installation”npm install -g @modelcontextprotocol/server-gitlabConfiguration
Section titled “Configuration”.kiro/mcp.json for GitLab.com:
{ "mcpServers": { "gitlab": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-gitlab"], "env": { "GITLAB_PERSONAL_ACCESS_TOKEN": "${GITLAB_TOKEN}", "GITLAB_API_URL": "https://gitlab.com/api/v4" } } }}Self-hosted GitLab:
{ "mcpServers": { "gitlab": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-gitlab"], "env": { "GITLAB_PERSONAL_ACCESS_TOKEN": "${GITLAB_TOKEN}", "GITLAB_API_URL": "https://gitlab.your-company.com/api/v4" } } }}Set the environment variable:
# Linux/macOSexport GITLAB_TOKEN="glpat-your_token_here"
# Windows PowerShell$env:GITLAB_TOKEN = "glpat-your_token_here"What Kiro Can Access
Section titled “What Kiro Can Access”| Capability | Description |
|---|---|
| Read issue | Title, description, labels, comments |
| List issues | Filter by state, label, assignee, milestone |
| Read merge request | Description, changed files, threads |
| List merge requests | Open/merged, by branch, by author |
| Read file | Contents of any file in any branch |
| Pipeline status | Latest pipeline result, job logs |
| Read commits | Commit history, diffs |
| List repositories | User/group projects |
Practical Examples
Section titled “Practical Examples”Debug a failing pipeline:
User: The pipeline for this branch is failing. What's wrong?
Kiro:1. Reads the latest pipeline for the current branch2. Finds the failing job (e.g., "test")3. Reads the job logs4. Identifies the error (e.g., missing env variable, test assertion failure)5. Suggests the fixImplement an issue:
User: Implement GitLab issue #56 in this project
Kiro:1. Fetches issue #562. Reads title, description, and discussion threads3. Creates a spec based on the requirements4. Implements the codeFix a flaky test referenced in an MR:
User: MR !23 has a review comment about a flaky test. Fix it.
Kiro:1. Fetches MR !232. Reads the review thread3. Finds the affected test file4. Rewrites the test to remove the race conditionGitLab CI/CD Context
Section titled “GitLab CI/CD Context”With the MCP server, Kiro can help with GitLab CI/CD:
User: Our .gitlab-ci.yml has a deploy stage that's failing on production but not staging. Read it and find the issue.
Kiro:1. Reads the current .gitlab-ci.yml2. Reads the failing pipeline job log3. Identifies the environment-specific difference4. Proposes the fixUsing with Self-Hosted GitLab
Section titled “Using with Self-Hosted GitLab”If your GitLab instance has a custom SSL certificate, you may need to configure the Node.js environment to trust it:
{ "mcpServers": { "gitlab": { "command": "npx", "args": ["-y", "@modelcontextprotocol/server-gitlab"], "env": { "GITLAB_PERSONAL_ACCESS_TOKEN": "${GITLAB_TOKEN}", "GITLAB_API_URL": "https://gitlab.internal.company.com/api/v4", "NODE_TLS_REJECT_UNAUTHORIZED": "0" } } }}NODE_TLS_REJECT_UNAUTHORIZED=0 disables certificate verification — only use this in a trusted internal network environment.
Troubleshooting
Section titled “Troubleshooting”401 Unauthorized — Check that the token is correct and has read_api scope.
404 Project not found — Verify the project namespace/path. GitLab uses group/project format. You may need to specify namespace/project-name in your prompt.
Cannot reach self-hosted instance — Check network connectivity and that the GITLAB_API_URL ends with /api/v4.