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 集成