Gitlab Ci Mcp

io.github.mshegolev由 GitHub 帳號 mshegolev 發布v0.5.1更新於 Oct 24, 2026

GitLab CI/CD MCP — pipelines, jobs, schedules, MRs, files. Any GitLab (SaaS or self-hosted).

發布方自己的服務:Gitlab

概覽

AI 產生的概覽

本機 MCP 伺服器,讓助理檢視與操作 GitLab CI/CD:流水線、作業與日誌、排程、分支、標籤、合併請求及儲存庫檔案。

可以做什麼
列出、檢視、觸發、重試與取消流水線;讀取作業日誌並支援正規表達式過濾與上下文行;產生 7 天或 30 天的流水線健康摘要。列出、建立、更新與刪除流水線排程。列出分支與標籤,並比較分支差異。列出與檢視合併請求、查看其變更、建立合併請求並執行合併。讀取儲存庫檔案、列出儲存庫目錄樹並取得專案資訊。以 MCP 資源形式提供專案資訊與 CI 設定。
適用情境
適合讓助理排查失敗的流水線、讀取體積很大的 CI 日誌、查看流水線健康度、管理排程,或在 GitLab(包含企業代理後的自架實例)上建立與合併合併請求。
執行需求
以 Python 套件形式在本機執行(Python 3.10 以上),透過 uvx 或 pipx 啟動,使用 stdio 傳輸。需要 GITLAB_URL、GITLAB_TOKEN(具備 api 權限範圍的個人存取權杖)與 GITLAB_PROJECT_PATH。可選 GITLAB_SSL_VERIFY 與 GITLAB_NO_PROXY_DOMAINS。需要能連線至 GitLab 實例的網路,並受 GitLab API 速率限制約束。
安裝前請注意
GITLAB_TOKEN 是具備 api 權限範圍的個人存取權杖,對 GitLab 實例有相當廣泛的讀寫權限;應透過環境變數提供,不要寫入共用設定。多個工具會改變狀態:觸發、重試與取消流水線,建立、更新與刪除排程,建立與合併合併請求。將 GITLAB_SSL_VERIFY 設為 false 會關閉憑證驗證。設定 no-proxy 網域時,伺服器會清除自身行程中的 HTTP_PROXY/HTTPS_PROXY。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Gitlab Ci Mcp,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

gitlab-ci-mcp

[PyPI] [Python] [License: MIT] [Downloads]

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, FastMCP, stdio transport.

Works with any GitLab — SaaS gitlab.com or self-hosted / on-prem. Designed with corporate networks in mind: configurable NO_PROXY handling, optional SSL-verify toggle, per-project scoping via env vars.

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.
  • Project scoping per call — every tool accepts an optional project_path that overrides GITLAB_PROJECT_PATH for cross-project queries.
  • Pagination — list tools return a pagination block with page, total, has_more, next_page and a next-page hint in the markdown footer.
  • MCP Context integration — gitlab_pipeline_health and gitlab_get_job_log are async and emit info logs / report_progress events through the MCP Context so clients can show progress bars.
  • 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

23 tools covering the everyday CI/CD surface:

Pipelines gitlab_list_pipelines · gitlab_get_pipeline · gitlab_get_pipeline_jobs · gitlab_get_job_log · 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

Pipeline health report

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

Last 7d:  96.4%  up   | 27/28 successLast 30d: 92.1%       | 105/114 successLast 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/pipxpipx install gitlab-ci-mcp

Configuration

All config is via environment variables:

VariableRequiredDescription
GITLAB_URLyesBase URL, e.g. https://gitlab.example.com
GITLAB_TOKENyesPersonal Access Token with api scope
GITLAB_PROJECT_PATHyesDefault project, e.g. my-org/my-repo
GITLAB_SSL_VERIFYnotrue (default) / false
GITLAB_NO_PROXY_DOMAINSnoComma-separated domains to add to NO_PROXY (useful in corp networks behind a local HTTP proxy — e.g. .corp.example.com,gitlab.internal)

Every tool accepts an optional project_path arg that overrides GITLAB_PROJECT_PATH per call — useful for cross-project queries.

Claude Code

Full walkthrough: 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 gitlab uvx --from gitlab-ci-mcp gitlab-ci-mcp \  --env GITLAB_URL=https://gitlab.example.com \  --env GITLAB_TOKEN=glpat-xxxxxx \  --env GITLAB_PROJECT_PATH=my-org/my-repo

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_TOKEN}",        "GITLAB_PROJECT_PATH": "my-org/my-repo",        "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 one python-gitlab HTTP session per project_path, so repeated tool calls against the same project reuse the connection and do not re-authenticate each time.
  • 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-mcpcd gitlab-ci-mcppython -m venv .venv && . .venv/bin/activatepip install -e '.[dev]'pytest

Run the server directly (stdio transport, waits on stdin for MCP messages):

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

License

MIT — see LICENSE.

Acknowledgements

Built on python-gitlab and the MCP Python SDK.

來源:README.md,提交 d97277f

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v0.5.1最新Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分

其他 Gitlab 整合