Skip to content

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.

  • “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.yml and explain the stages”
  • “List all open issues in the project labelled ‘backend’”
  • “Generate a merge request description for the current changes”

  • GitLab account (GitLab.com or self-hosted)
  • Personal Access Token with the following scopes:
    • read_api — access to all read-only API endpoints
    • read_repository — read repository files and commits

Creating a token (GitLab.com):

  1. GitLab → User Avatar → Edit Profile → Access Tokens
  2. Add a new token with read_api and read_repository scopes
  3. Set an expiry date and copy the token immediately

Terminal window
npm install -g @modelcontextprotocol/server-gitlab

.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:

Terminal window
# Linux/macOS
export GITLAB_TOKEN="glpat-your_token_here"
# Windows PowerShell
$env:GITLAB_TOKEN = "glpat-your_token_here"

CapabilityDescription
Read issueTitle, description, labels, comments
List issuesFilter by state, label, assignee, milestone
Read merge requestDescription, changed files, threads
List merge requestsOpen/merged, by branch, by author
Read fileContents of any file in any branch
Pipeline statusLatest pipeline result, job logs
Read commitsCommit history, diffs
List repositoriesUser/group projects

Debug a failing pipeline:

User: The pipeline for this branch is failing. What's wrong?
Kiro:
1. Reads the latest pipeline for the current branch
2. Finds the failing job (e.g., "test")
3. Reads the job logs
4. Identifies the error (e.g., missing env variable, test assertion failure)
5. Suggests the fix

Implement an issue:

User: Implement GitLab issue #56 in this project
Kiro:
1. Fetches issue #56
2. Reads title, description, and discussion threads
3. Creates a spec based on the requirements
4. Implements the code

Fix a flaky test referenced in an MR:

User: MR !23 has a review comment about a flaky test. Fix it.
Kiro:
1. Fetches MR !23
2. Reads the review thread
3. Finds the affected test file
4. Rewrites the test to remove the race condition

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.yml
2. Reads the failing pipeline job log
3. Identifies the environment-specific difference
4. Proposes the fix

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.


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.