# mshegolev/gitlab-ci-mcp [Health: Active]

**Category:** 🔄 Version Control  
**Repository:** https://github.com/mshegolev/gitlab-ci-mcp  
**GitHub Stars:** 2  
**Views:** 3  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/mshegolev-gitlab-ci-mcp

## Description
GitLab CI/CD — pipelines, jobs, schedules, MRs, files. Works with any GitLab (SaaS or self-hosted); published on PyPI and in the MCP Registry.

## Tools
Capabilities this server exposes over MCP:

- **gitlab_list_branches** — List branches of a project, optionally filtered by substring.

    Includes ``default``, ``protected`` and ``merged`` flags, and the short id
    of the tip commit with its title and date.

    Examples:
        - "List all branches with 'release' in name" → ``search='release'``
        - "Next page of branches" → ``page=2``
        - Don't use when you want to check if a specific branch exists by exact name —
          use ``gitlab_get_file`` on that ref and look at the error instead.
    
- **gitlab_list_tags** — List tags of a project, newest first.

    Useful for release-note generation or checking the last shipped version.

    Examples:
        - "What was the last release tag" → default call, take the first item
        - "All v2.x releases" → ``search='v2.'``
    
- **gitlab_compare_branches** — Compare two branches — returns up to 30 commits and the list of changed files.

    Use for "what's in ``release/x.y`` vs ``master``?" or for release-note drafting.

    Examples:
        - "What's new in release/1.5 vs master" → ``source='release/1.5'``, ``target='master'``
        - Don't use to fetch full diffs of an MR — use ``gitlab_get_merge_request_changes``.
    
- **gitlab_list_merge_requests** — List merge requests of a project, optionally filtered by state.

    Examples:
        - "What MRs are open right now" → default (state='opened')
        - "What merged last week" → ``state='merged'`` then filter by ``updated_at`` client-side
        - "Everything regardless of state" → ``state='all'``
        - Don't use when you have an MR IID — use ``gitlab_get_merge_request`` for detail.
    
- **gitlab_get_merge_request** — Get full information about a merge request by internal ID (``iid``).

    Includes state, branches, author, assignees, reviewers, labels, conflict
    status, description and timestamps.

    Examples:
        - "Show me the description and state of !42" → ``mr_iid=42``
        - Don't use to see changed files — use ``gitlab_get_merge_request_changes``.
    
- **gitlab_get_merge_request_changes** — List changed files in a merge request with truncated diffs (2KB per file).

    Useful for code-review-style queries ("what changed in !42?"). Diffs beyond
    2KB are truncated — fetch the raw file via ``gitlab_get_file`` for full
    content.

    Examples:
        - "What did MR !42 change" → ``mr_iid=42``
        - If you need full content of a changed file, use ``gitlab_get_file``
          with the MR's source branch.
    
- **gitlab_create_merge_request** — Create a merge request from ``source_branch`` into ``target_branch``.

    **Not idempotent**: creates a new MR each call. Check existing MRs first
    via ``gitlab_list_merge_requests`` if you want to avoid duplicates.

    Examples:
        - "Open an MR from feature/login to master" → ``source_branch='feature/login'``
        - "Open a WIP MR with a label" → ``title='Draft: ...'``, ``labels=['wip']``
        - Don't use to merge an already-open MR — use ``gitlab_merge_mr``.
    
- **gitlab_merge_mr** — Perform the actual merge if GitLab reports the MR can be merged.

    **Destructive**: writes to the target branch. Checks ``merge_status`` first
    and returns ``status='cannot_merge'`` if conflicts exist or pipelines are
    required.

    Examples:
        - "Merge !42" → ``mr_iid=42``
        - Don't call without checking ``gitlab_get_merge_request`` first when you suspect conflicts.
    
- **gitlab_list_pipelines** — List recent pipelines of a project, newest first.

    Use for triage ("show failed pipelines on master"), release readiness checks,
    or feeding pipeline IDs into follow-up calls. Read-only and idempotent.

    Returns ``PipelinesListOutput``: ``project``, ``count``, ``pagination`` and
    ``pipelines[]`` (each ``PipelineSummary``). The tool result additionally
    carries a markdown table in its text content.

    Examples:
        - "Show failed pipelines on master" → ``status='failed'``, ``ref='master'``
        - "Last nightly schedule runs" → ``source='schedule'``
        - "Second page of pipelines" → ``page=2``
        - Don't use when you have a specific pipeline ID — use ``gitlab_get_pipeline`` instead.
    
- **gitlab_get_pipeline** — Get a single pipeline with full timing details.

    Useful right after ``gitlab_list_pipelines`` — lists only return summaries.
    Returns status, ref, source, durations (queued/total), and started/finished timestamps.

    Examples:
        - "Why was pipeline 123 slow" → check ``queued_duration`` and ``duration`` fields
        - "Is pipeline 456 still running" → look at ``status``
        - Don't use to see individual jobs — use ``gitlab_get_pipeline_jobs``.
    
- **gitlab_get_pipeline_jobs** — List jobs of a pipeline with stage, status, duration and web URL.

    Use after noticing a failed pipeline to drill down into which specific job
    broke and fetch its log via ``gitlab_get_job_log``.

    Examples:
        - "What jobs are in pipeline 123" → ``pipeline_id=123``
        - "Which job failed in pipeline 456" → filter result by ``status='failed'`` client-side
        - Don't use for overall pipeline status — use ``gitlab_get_pipeline`` instead.
    
- **gitlab_get_job_log** — Fetch the trace/log of a job, with optional regex filter.

    Two modes:

    * Default: return the last ``tail`` lines (token-efficient, good for
      "why did this just fail?").
    * With ``grep_pattern``: return only matching lines with
      ``grep_context`` surrounding lines on each side — ideal for finding
      "ERROR" / "Traceback" in megabyte-scale CI logs without pulling the
      whole trace into context.

    Examples:
        - "Why did job 789 fail" → default tail=100, look at the end of the log
        - "Show me the first stage output of job 789" → ``tail=5000`` and scan for stage separator
        - "Find every Traceback in job 789" → ``grep_pattern='Traceback'``, ``grep_context=5``
        - "All ERROR lines from job 789" → ``grep_pattern='ERROR|FAIL'``
    
- **gitlab_trigger_pipeline** — Create a new pipeline on the given ref, optionally with CI variables.

    **Not idempotent**: each call creates a new pipeline. Consumes minutes on
    your runners — avoid calling in loops.

    Examples:
        - "Run the pipeline on master" → default (``ref='master'``)
        - "Run the pipeline on feature/x with DEBUG=1" → ``ref='feature/x'``, ``variables={'DEBUG': '1'}``
        - Don't call to retry — use ``gitlab_retry_pipeline`` which keeps the same pipeline ID.
    
- **gitlab_retry_pipeline** — Retry all failed jobs of an existing pipeline.

    Creates new job runs (new history entries). Safe to call when the pipeline
    has at least one failed/canceled job; has no effect if everything already
    passed.

    Examples:
        - "Retry the failed jobs in pipeline 123" → ``pipeline_id=123``
        - Don't use to rerun a successful pipeline — use ``gitlab_trigger_pipeline`` instead.
    
- **gitlab_cancel_pipeline** — Cancel a running pipeline. In-flight jobs will be interrupted.

    Destructive for *in-progress* work. Cancelling an already-finished pipeline
    is a no-op.

    Examples:
        - "Pipeline 123 is stuck, cancel it" → ``pipeline_id=123``
        - Don't use on finished pipelines — no effect; use ``gitlab_retry_pipeline``
          if you want to rerun it.
    
- **gitlab_pipeline_health** — Aggregate success rate over 7 and 30 days with a trend indicator.

    Great for stand-ups and on-call hand-offs. Returns success rate %, totals,
    last-10 statuses and a trend (``up``/``down``/``flat``).

    Emits progress via the MCP Context (``info`` log + ``report_progress``) —
    useful in IDEs that show per-tool progress bars.

    Examples:
        - "How stable is master" → default (``ref='master'``, ``source='schedule'``)
        - "Push-driven pipeline health" → ``source='push'``
        - Don't use for a single pipeline — use ``gitlab_get_pipeline``.
    
- **gitlab_get_file** — Read a text file from the repository, truncated to 500 lines.

    For binaries, gets decoded as UTF-8 with errors replaced — you will likely
    get garbage; use for text content only.

    Examples:
        - "Show me .gitlab-ci.yml on master" → ``file_path='.gitlab-ci.yml'``
        - "Read src/app.py from the release-1.2 tag" → ``file_path='src/app.py'``, ``ref='release-1.2'``
        - Don't use for listings — use ``gitlab_list_repository_tree``.
    
- **gitlab_list_repository_tree** — List files and directories at a given path in the repository.

    Examples:
        - "Show top-level files" → default call
        - "All .py files recursively" → ``recursive=True`` then filter on ``.py`` in path
        - Don't use for full-text content — use ``gitlab_get_file`` for that.
    
- **gitlab_project_info** — Return basic metadata about a project: ID, default branch, visibility, counts.

    Examples:
        - "What's the project ID and default branch" → default call
        - "Is this repo public or private" → look at ``visibility``
    
- **gitlab_list_schedules** — List all CI/CD schedules of a project.

    Variable keys whose name hints at a secret (``TOKEN``, ``PASSWORD``,
    ``SECRET``, ``CREDENTIAL``, ``PRIVATE_KEY``, ``API_KEY``) keep the key
    but have the value replaced by ``***`` so the agent still sees which
    variables exist.

    Examples:
        - "What schedules do we have and are they all active" → default call
        - Don't use to *run* a schedule now — use ``gitlab_trigger_pipeline``
          with the schedule's variables instead.
    
- **gitlab_create_schedule** — Create a new CI/CD schedule with the given cron and variables.

    **Not idempotent**: duplicate calls create duplicate schedules with
    auto-incrementing IDs.

    Examples:
        - "Schedule a nightly build on master at 02:00 Europe/Berlin" →
          ``description='Nightly build'``, ``cron='0 2 * * *'``, ``ref='master'``,
          ``timezone='Europe/Berlin'``, ``variables={'NIGHTLY': '1'}``
        - Don't use to update existing schedules — use ``gitlab_update_schedule``.
    
- **gitlab_update_schedule** — Update an existing schedule. Only provided fields change.

    Destructive when ``variables`` is set: the entire variable set is replaced,
    so ensure the caller sends a full list.

    Examples:
        - "Deactivate schedule 42" → ``schedule_id=42``, ``active=False``
        - "Change cron of schedule 42 to hourly" → ``schedule_id=42``, ``cron='0 * * * *'``
        - Don't pass ``variables`` unless you want to *replace* them entirely.
    
- **gitlab_delete_schedule** — Delete a schedule by ID. Cannot be undone.

    Examples:
        - "Delete schedule 42" → ``schedule_id=42``
        - If you only want to pause it temporarily, call ``gitlab_update_schedule``
          with ``active=False`` instead.
    

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `uvx` (confidence: high):

```json
"mcpServers": {
  "gitlab-ci-mcp": {
    "command": "uvx",
    "args": ["--from","gitlab-ci-mcp","gitlab-ci-mcp"],
    "env": {
      "GITLAB_URL": "",
      "GITLAB_TOKEN": "",
      "GITLAB_PROJECT_PATH": "",
      "GITLAB_SSL_VERIFY": "",
      "GITLAB_NO_PROXY_DOMAINS": ""
    }
  }
}
```

**Requires environment variables:** `GITLAB_URL`, `GITLAB_TOKEN`, `GITLAB_PROJECT_PATH`, `GITLAB_SSL_VERIFY`, `GITLAB_NO_PROXY_DOMAINS` — the values above are empty placeholders; fill in real credentials before running (see the repository for what each one is for).

## Documentation & README

# gitlab-ci-mcp

<!-- mcp-name: io.github.mshegolev/gitlab-ci-mcp -->

[![PyPI](https://img.shields.io/pypi/v/gitlab-ci-mcp.svg?logo=pypi&logoColor=white)](https://pypi.org/project/gitlab-ci-mcp/)
[![Python](https://img.shields.io/pypi/pyversions/gitlab-ci-mcp.svg?logo=python&logoColor=white)](https://pypi.org/project/gitlab-ci-mcp/)
[![License: MIT](https://img.shields.io/pypi/l/gitlab-ci-mcp.svg)](LICENSE)
[![Downloads](https://static.pepy.tech/badge/gitlab-ci-mcp/month)](https://pepy.tech/project/gitlab-ci-mcp)

MCP server for GitLab CI/CD. Lets an LLM agent (Claude Code, Cursor, OpenCode, DevX Agent, etc.) work with pipelines, jobs, schedules, branches, tags, merge requests and repository files.

Python and [FastMCP](https://github.com/modelcontextprotocol/python-sdk). Local stdio remains the default; opt-in Streamable HTTP supports shared deployments with one GitLab PAT per caller.

Supports GitLab.com and self-managed GitLab; see the compatibility policy below. Designed with corporate networks in mind: configurable `NO_PROXY` handling, optional SSL-verify toggle, per-project scoping via env vars.

### GitLab compatibility

The project supports GitLab.com and self-managed releases that GitLab currently
maintains. As of 2026-11-26, GitLab's maintained release lines are **19.4,
19.5, and 19.6** ([GitLab maintenance policy](https://docs.gitlab.com/policy/maintenance/)).
This list changes with GitLab's monthly release cycle; check the linked policy
for the current list before planning upgrades.

This is the project's support policy, not a claim that each server version has
been tested by this repository. CI currently tests Python 3.10, 3.11, and 3.12;
it does not run a GitLab server-version matrix.

For `gitlab_list_schedules`, GitLab may omit schedule `variables` and `inputs`
from API responses unless the caller is a Maintainer or Owner, or owns the
schedule ([Pipeline schedules API](https://docs.gitlab.com/api/pipeline_schedules/)).

## Design highlights

- **Tool annotations** — every tool carries `readOnlyHint` / `destructiveHint` / `idempotentHint` / `openWorldHint` so MCP clients can classify operations (e.g. ask for confirmation only on destructive ones like `gitlab_merge_mr`, `gitlab_delete_schedule`).
- **Structured output on every tool** — each tool declares a TypedDict return type, so FastMCP auto-generates an `outputSchema` and every result carries `structuredContent` alongside a pre-rendered markdown text block. Clients that can render structured data use it; agents that prefer compact text get the markdown. No `response_format` parameter needed.
- **Structured errors** — authentication, 404, 403, 429 (rate-limit), 5xx, missing-env errors are converted to actionable `ToolError` messages (e.g. _"GitLab authentication failed… verify GITLAB_TOKEN has `api` scope"_) and surfaced as `isError=True` results.
- **Pydantic input validation** — every argument has typed constraints (ranges, lengths, literals) auto-exposed as JSON Schema.
- **Explicit project scoping** — every GitLab tool requires `project_path` by default. Set `GITLAB_ALLOW_DEFAULT_PROJECT=true` to opt into the legacy environment fallback.
- **Pagination** — list tools return a `pagination` block with `page`, `total`, `has_more`, `next_page` and a next-page hint in the markdown footer.
- **Per-user HTTP credentials** — in Streamable HTTP mode every request must carry `X-GitLab-Token`; GitLab API calls and cached clients are isolated by PAT. Stdio remains single-user with `GITLAB_TOKEN`.
- **MCP Resources** — `gitlab://project/info` and `gitlab://project/ci-config` mirror common lookups for clients that prefer the Resource model over tools.
- **Lifespan management** — `python-gitlab` HTTP sessions are closed cleanly on server shutdown via an `asynccontextmanager` lifespan hook.
- **Log grep** — `gitlab_get_job_log` accepts `grep_pattern` + `grep_context` (surrounding lines) for regex-filtering megabyte-scale CI logs without pulling the whole trace into agent context.

### Threading model

FastMCP automatically runs synchronous tools in a worker thread
(`anyio.to_thread.run_sync`), so they do not block the asyncio event loop —
`python-gitlab` is a synchronous library and wrapping every call in
`asyncio.to_thread` ourselves would be ceremony. Tools that benefit from the
MCP Context (progress, info logs) are written as `async def` and explicitly
wrap `python-gitlab` calls with `asyncio.to_thread`.

## Features

26 tools covering the everyday CI/CD surface:

**Pipelines**
`gitlab_list_pipelines` · `gitlab_get_pipeline` · `gitlab_get_pipeline_jobs` · `gitlab_get_job_log` · `gitlab_list_job_artifacts` · `gitlab_get_job_artifact` · `gitlab_trigger_pipeline` · `gitlab_retry_pipeline` · `gitlab_cancel_pipeline` · `gitlab_pipeline_health`

**Schedules**
`gitlab_list_schedules` · `gitlab_create_schedule` · `gitlab_update_schedule` · `gitlab_delete_schedule`

**Branches & tags**
`gitlab_list_branches` · `gitlab_list_tags` · `gitlab_compare_branches`

**Merge requests**
`gitlab_list_merge_requests` · `gitlab_get_merge_request` · `gitlab_get_merge_request_changes` · `gitlab_create_merge_request` · `gitlab_merge_mr`

**Repository & project**
`gitlab_get_file` · `gitlab_list_repository_tree` · `gitlab_project_info`

**Package**
`gitlab_ci_mcp_check_updates`

### Inspecting job artifacts

Use `gitlab_list_job_artifacts` to discover files for a job, then
`gitlab_get_job_artifact` to read a selected UTF-8 text file. Responses are
bounded (1 MB by default, 2 MB maximum); binary and invalid UTF-8 files return
metadata without file contents. Older GitLab instances without the artifacts
tree endpoint use a ZIP listing fallback capped at 128 MB.

### Pipeline health report

`gitlab_pipeline_health` returns a ready-to-read summary over 7/30 days:

```
Last 7d:  96.4%  up   | 27/28 success
Last 30d: 92.1%       | 105/114 success
Last 10:  success success success failed success ...
```

Handy for on-call / triage: `покажи health master за последние 7 дней`.

## Installation

Requires Python 3.10+.

```bash
# via uvx (recommended)
uvx --from gitlab-ci-mcp gitlab-ci-mcp

# or via pip/pipx
pipx install gitlab-ci-mcp
```

## Configuration

All config is via environment variables:

| Variable | Required | Description |
| --- | --- | --- |
| `GITLAB_URL` | **yes** | Base URL, e.g. `https://gitlab.example.com` |
| `GITLAB_TOKEN` | stdio only | Personal Access Token with `api` scope. In HTTP mode, each client sends its own `X-GitLab-Token` header. |
| `MCP_TRANSPORT` | no | `stdio` (default) or `streamable-http` |
| `MCP_HTTP_HOST` | no | HTTP bind host; defaults to `127.0.0.1` |
| `MCP_HTTP_PORT` | no | HTTP bind port; defaults to `8000` |
| `GITLAB_PROJECT_PATH` | no | Legacy fallback project; used only with `GITLAB_ALLOW_DEFAULT_PROJECT=true` |
| `GITLAB_ALLOW_DEFAULT_PROJECT` | no | Set to `true` to opt into the legacy `GITLAB_PROJECT_PATH` fallback |
| `MCP_GITLAB_UPDATE_CHECK_ENABLED` | no | `false` by default; set to `true` to allow the explicit update-check tool to query PyPI |
| `GITLAB_SSL_VERIFY` | no | `true` (default) / `false` |
| `GITLAB_NO_PROXY_DOMAINS` | no | Comma-separated domains to add to `NO_PROXY` (useful in corp networks behind a local HTTP proxy — e.g. `.corp.example.com,gitlab.internal`) |
| `GITLAB_DISABLED_TOOL_GROUPS` | no | Comma-separated groups to omit from the advertised tool list; unset or blank keeps all groups |

`GITLAB_DISABLED_TOOL_GROUPS` accepts these stable group IDs and tool memberships:

| Group ID | Tools |
| --- | --- |
| `pipelines` | `gitlab_list_pipelines`, `gitlab_get_pipeline`, `gitlab_get_pipeline_jobs`, `gitlab_get_job_log`, `gitlab_list_job_artifacts`, `gitlab_get_job_artifact`, `gitlab_trigger_pipeline`, `gitlab_retry_pipeline`, `gitlab_cancel_pipeline`, `gitlab_pipeline_health` |
| `schedules` | `gitlab_list_schedules`, `gitlab_create_schedule`, `gitlab_update_schedule`, `gitlab_delete_schedule` |
| `branches_tags` | `gitlab_list_branches`, `gitlab_list_tags`, `gitlab_compare_branches` |
| `merge_requests` | `gitlab_list_merge_requests`, `gitlab_get_merge_request`, `gitlab_get_merge_request_changes`, `gitlab_create_merge_request`, `gitlab_merge_mr` |
| `repository` | `gitlab_get_file`, `gitlab_list_repository_tree`, `gitlab_project_info` |
| `package` | `gitlab_ci_mcp_check_updates` |

Group names are trimmed around commas; empty elements and duplicates are
ignored. Unknown IDs fail startup with a configuration error. All six groups
may be disabled, which starts the server with zero advertised tools. For
example, to omit pipeline and repository operations:

```bash
GITLAB_DISABLED_TOOL_GROUPS="pipelines, repository" gitlab-ci-mcp
```

Every tool accepts a `project_path` arg. It is required by default so a call
cannot silently target an environment-wide project. For legacy deployments,
set `GITLAB_ALLOW_DEFAULT_PROJECT=true` together with `GITLAB_PROJECT_PATH` to
opt into the old fallback behavior.

Update checking is disabled by default. Set `MCP_GITLAB_UPDATE_CHECK_ENABLED=true`
to enable the explicit `gitlab_ci_mcp_check_updates` tool. When enabled, it
makes one bounded request to fixed PyPI JSON, caches a result for five minutes,
reports failures and unsupported versions, and never installs anything. No
startup or other tool call performs this request. If called while disabled,
the tool reports `disabled` without making a network request.

Pipeline health success rate uses completed pipelines only: `success` and
`failed` are in the denominator; `running`, `pending`, `manual`, `canceled`,
`skipped`, and other non-completed statuses are excluded. A missing comparison
period or a sample without completed pipelines is reported as insufficient
data, not as a zero rate or a flat trend.

## Shared Streamable HTTP deployment

For a shared server, run with `MCP_TRANSPORT=streamable-http`. Each caller
must send their own GitLab PAT in `X-GitLab-Token`; the server never falls back
to the process `GITLAB_TOKEN` in this mode. GitLab applies that PAT's identity
and permissions to each API operation. The header is a custom credential
mechanism, not MCP OAuth; clients need support for configured custom headers.

The server binds to loopback (`127.0.0.1:8000`) by default. Expose it through
an HTTPS reverse proxy, restrict network access, and redact the PAT header from
proxy, tracing, and error logs. Initialize and tool discovery only check that
the header is non-empty; GitLab validates the PAT when an API call is made.

Example for Claude Code (provide `GITLAB_PAT` through a secret manager; do not
put a literal token in shell history):

```bash
claude mcp add --transport http \
  --header "X-GitLab-Token: ${GITLAB_PAT}" \
  gitlab https://mcp.example.com/mcp
```

The client must attach the header to every request. Each GitLab tool still
requires an explicit `project_path`. Fixed resources
`gitlab://project/info` and `gitlab://project/ci-config` have no project
argument; they require the explicit compatibility setting
`GITLAB_ALLOW_DEFAULT_PROJECT=true` and `GITLAB_PROJECT_PATH`.

Full credential details and limitations: [docs/per-user-auth.md](https://github.com/mshegolev/gitlab-ci-mcp/blob/HEAD/docs/per-user-auth.md).

## Claude Code

**Full walkthrough:** [docs/claude-code.md](https://github.com/mshegolev/gitlab-ci-mcp/blob/HEAD/docs/claude-code.md) — prerequisites, two install paths, multi-project setup, self-hosted GitLab behind a corp proxy, troubleshooting, uninstall.

Short version:

```bash
claude mcp add --transport stdio \
  --env GITLAB_URL=https://gitlab.example.com \
  --env GITLAB_TOKEN="$GITLAB_PAT" \
  gitlab -- uvx --from gitlab-ci-mcp gitlab-ci-mcp
```

Each GitLab tool call must include `project_path`, for example
`project_path="my-org/my-repo"`. For legacy default-project behavior, also set
`GITLAB_PROJECT_PATH` and `GITLAB_ALLOW_DEFAULT_PROJECT=true`.

Or in `~/.claude.json` / project `.mcp.json`:

```json
{
  "mcpServers": {
    "gitlab": {
      "type": "stdio",
      "command": "uvx",
      "args": ["--from", "gitlab-ci-mcp", "gitlab-ci-mcp"],
      "env": {
        "GITLAB_URL": "https://gitlab.example.com",
        "GITLAB_TOKEN": "${GITLAB_PAT}",
        "GITLAB_PROJECT_PATH": "my-org/my-repo",
        "GITLAB_ALLOW_DEFAULT_PROJECT": "true",
        "GITLAB_SSL_VERIFY": "true"
      }
    }
  }
}
```

Check:

```bash
claude mcp list
# gitlab: uvx --from gitlab-ci-mcp gitlab-ci-mcp - ✓ Connected
```

## Cursor / OpenCode / DevX Agent

Same idea — point the MCP config to `uvx --from gitlab-ci-mcp gitlab-ci-mcp` with the env vars above. See each tool's own MCP config syntax.

## Example prompts

```
что сломалось в последнем pipeline master
```

```
покажи health master за 7 дней для проекта my-org/other-repo
```

```
создай MR из feature/foo в master с title "feat: foo"
```

```
покажи содержимое .gitlab-ci.yml из master
```

## Rate limits & connection reuse

GitLab enforces a per-user rate limit (typically 2000 req/h for the REST API,
configurable by the admin — see your instance's `/admin/application_settings/network`).

- The server caches a bounded `python-gitlab` HTTP session per GitLab URL, project, and PAT fingerprint. Different users never reuse one another's cached client.
- List tools default to `per_page=20` to keep a single call within a small
  number of API requests.
- If you hit a `429 Too Many Requests`, the error handler returns an actionable
  message — wait and try again with larger `per_page` or fewer calls.

## Self-hosted GitLab behind a corporate proxy

When your laptop has a local HTTP proxy (e.g. `http://127.0.0.1:3128` for corp web access) but GitLab is on the intranet, the proxy intercepts and kills internal requests. Two options:

1. Set `GITLAB_NO_PROXY_DOMAINS` — the server will add them to `NO_PROXY` at startup **and clear `HTTP_PROXY`/`HTTPS_PROXY` from its own process** so they don't affect GitLab traffic.
2. Pass explicitly empty `HTTP_PROXY=""` etc. in the MCP `env` section.

## Development

```bash
git clone https://github.com/mshegolev/gitlab-ci-mcp
cd gitlab-ci-mcp
python -m venv .venv && . .venv/bin/activate
pip install -e '.[dev]'
pytest
```

Run the server directly (stdio transport is the default and waits on stdin for MCP messages):

```bash
GITLAB_URL=... GITLAB_TOKEN=... gitlab-ci-mcp
```

## License

MIT — see [LICENSE](https://github.com/mshegolev/gitlab-ci-mcp/blob/HEAD/LICENSE).

## Acknowledgements

Built on [python-gitlab](https://github.com/python-gitlab/python-gitlab) and the [MCP Python SDK](https://github.com/modelcontextprotocol/python-sdk).

