
Mcp Gitlab
io.github.vish288由 GitHub 帳號 vish288 發布v0.22.0更新於 Nov 7, 2026
GitLab MCP server (MCP 2026-07-28): projects, MRs, pipelines, CI/CD, issues; writes or read-only
發布方自己的服務:Gitlab
概覽
面向 GitLab REST API 的 MCP 伺服器,讓助理讀取與管理專案、合併請求、程式碼審查、流水線與議題,並可鎖定為唯讀。
- 可以做什麼
- 讀取與管理專案、群組、分支、提交、儲存庫檔案、標籤與發行版本
- 審查合併請求:變更內容、核准、留言、行內討論、草稿留言、合併、rebase
- 檢視與操作 CI/CD:流水線、作業與日誌、重試或取消、專案與群組變數
- 追蹤議題:列出、檢視、建立、更新與留言
- 使用內建工作流程指南資源與提示詞完成 MR 審查、流水線診斷、發行準備與議題分類
- 適用情境
- 適合讓助理直接在 GitLab 執行個體中工作:審查合併請求、排查失敗的流水線、草擬發行版本或整理議題;支援 gitlab.com 與自架 CE/EE 執行個體,不需要 GitLab Duo 或 Premium。
- 執行需求
- 以本機 Python 套件執行(uvx mcp-gitlab,需先安裝 uv)。需要 GITLAB_URL 與 GitLab 權杖(GITLAB_TOKEN,或 GITLAB_PAT、GITLAB_PERSONAL_ACCESS_TOKEN、GITLAB_API_TOKEN),也可用 mcp-gitlab auth login 在本機登入。OAuth 模式需 GITLAB_OAUTH_CLIENT_ID 與 GITLAB_OAUTH_CLIENT_SECRET;HTTP 綁定非回送位址需 GITLAB_HTTP_BEARER_TOKEN。需能連線至 GitLab 執行個體的網路。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Mcp Gitlab,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
mcp-gitlab
[PyPI version] [PyPI downloads] [Python] [License: MIT] [CI] [MCP Registry]
mcp-gitlab is a Model Context Protocol (MCP) server for the GitLab REST API. It gives AI assistants 91 tools, 7 resources, and 6 prompts to manage projects, merge requests, pipelines, CI/CD variables, approvals, issues, and code reviews. Works with Claude Desktop, Claude Code, Cursor, Windsurf, VS Code Copilot, and any MCP-compatible client. Runs in one of two modes: with writes, or locked read-only (MCP_READ_ONLY=true) so the 57 write tools are never offered to the model.
Supports GitLab.com and self-hosted GitLab instances (CE/EE). No GitLab Duo or Premium required.
Supports the MCP 2026-07-28 specification, often called MCP 2.0, and stays compatible with 2025-11-25 clients.
Built with FastMCP 4.x, httpx, and Pydantic.
Install: uvx mcp-gitlab | PyPI | MCP Registry | Changelog
1-Click Installation
[Install in VS Code] [Install in VS Code Insiders]
💡 Tip: For other AI assistants (Claude Code, Windsurf, IntelliJ, Gemini CLI), visit the GitLab MCP Installation Gateway.
Manual Setup Guides (Click to expand)
Prerequisite: Install
uvfirst (required for alluvxinstall flows). Install uv.
Claude Code
Windsurf & IntelliJ
Windsurf: Add to ~/.codeium/windsurf/mcp_config.json
IntelliJ: Add to Settings | Tools | MCP Servers
Note: The actual server config starts at
gitlabinside themcpServersobject. RemoveMCP_READ_ONLYto allow writes.
Gemini CLI
VS Code
Add to .vscode/mcp.json. Remove MCP_READ_ONLY to allow writes.
Codex
pip / uv
Drop MCP_READ_ONLY to allow writes. On a shared or hosted server put it in the deployer's env, not the client config.
Configuration
Supported Token Types
The server checks these environment variables in order — first match wins:
GITLAB_TOKENGITLAB_PATGITLAB_PERSONAL_ACCESS_TOKENGITLAB_API_TOKEN
These accept any of the following token types:
Sign in without a token
Use this when you run the server for yourself over stdio and have no personal
access token. mcp-gitlab auth login signs you in to GitLab as a public OAuth
client and stores the tokens locally. The server then reads them at startup and
refreshes them on its own. This is not OAuth mode; the server stays in token
mode and nothing on the MCP wire changes.
Three commands:
auth login prints a code and a URL. Open the URL, enter the code, and approve.
The server then works with GITLAB_URL set and no token.
Client ID
Each sign-in needs an OAuth application ID. Resolution order: --client-id,
then GITLAB_OAUTH_CLIENT_ID, then a built-in default for https://gitlab.com.
The gitlab.com default is not registered yet. Until it is, set
GITLAB_OAUTH_CLIENT_ID or pass --client-id for gitlab.com too.
Register an app (self-managed, or gitlab.com until the default ships)
Create an application under User Settings → Applications → Add new application with these settings:
Use 127.0.0.1, not localhost. The device flow needs GitLab 17.9 or later; on
older instances use mcp-gitlab auth login --web.
Storage and precedence
Credentials live in ~/.config/mcp-gitlab/credentials.json, one entry per
GitLab URL, mode 0600. An environment token always wins: if GITLAB_TOKEN is
set, the server uses it and ignores the stored credentials.
Pass --scopes read_api for a read-only session; the server then blocks write
tools before any API call.
OAuth 2.1 (remote deployments)
For a server shared by several people, --auth oauth turns mcp-gitlab into an
MCP 2026-07-28 resource server with GitLab as the upstream OAuth provider: each
user signs in with their own GitLab account, every request runs with that
user's token, and no personal access token is configured on the server. Use it
when you host the server once and multiple users connect to it; keep the
default --auth token for a single-user local setup.
OAuth mode requires --transport streamable-http (OAuth applies to HTTP only;
stdio keeps using the environment token).
1. Register a GitLab OAuth application (User Settings → Applications, or a
group/instance application). Set the redirect URI to <base>/auth/callback
(e.g. https://mcp.example.com/auth/callback), mark it confidential, and grant
the api scope (or read_api for a read-only deployment). Copy the
Application ID and Secret.
2. Configure the server:
Point an MCP client (or the MCP Inspector, pnpm dlx @modelcontextprotocol/inspector)
at <base>/mcp; it discovers the authorization server, runs the OAuth flow, and
each tool call then uses that user's GitLab token. A read_api-only token can
read but is refused writes with an actionable hint.
Full guide, client setup and troubleshooting: docs/oauth.md.
Compatibility
Protocol support
mcp-gitlab implements the Model Context Protocol. It supports the 2026-07-28 specification, often called MCP 2.0. It stays compatible with 2025-11-25 clients.
- Specification: MCP 2026-07-28 (MCP 2.0). Verified over
stdioandstreamable-http. - Legacy clients: 2025-11-25 clients still work.
- Built on: FastMCP 4.x and the MCP Python SDK 2.x.
- Transports:
stdio(default) andstreamable-http(recommended for remote). Thesse(HTTP+SSE) transport still works, but the 2026-07-28 specification deprecates it. The server prints a warning when you use it. - Capabilities: tools, resources, and prompts. The server uses no roots, sampling, logging, elicitation, or resource subscriptions, so the 2026-07-28 deprecations do not affect it.
Error results
An expected failure (a 404, a 401, a validation error, or a write that reaches the read-only guard) comes back as a tool result with the protocol-level isError flag set, so a client can detect and self-correct instead of parsing an "error" key out of an otherwise successful result. In locked read-only mode the write tools are hidden, so calling one returns an Unknown tool error; the read-only envelope is the guard's own response, returned only when a client reaches a write tool anyway (a cached listing, or a future untagged tool). The body is a JSON object with error and, where it helps, status_code, body, and an actionable hint. That object is the result's text content; the error sets no structuredContent, because a strict client (the TypeScript MCP SDK) validates structuredContent against the tool's output schema even on an isError result and the schema would reject the error body. An unexpected bug is also an isError result but carries only TypeName: message text, likewise with no structuredContent.
A successful result carries the response as a JSON object in both the pretty text content and structuredContent (the object itself, not the old {"result": "<json string>"} wrapper a strict client would otherwise reject). Tools advertise no outputSchema: upstream GitLab fields pass through untyped, so a new API field never breaks a schema; a typed schema is opt-in per tool via output_schema= when a client needs one.
Tools (91)
Full tool reference (click to expand)
Projects
Project Approvals
Groups
Branches
Commits
Repository Files
Merge Requests
MR Notes
MR Discussions
Draft Notes
Pipelines
Jobs
Tags
Releases
CI/CD Variables
Issues
Resources (7)
The server exposes curated workflow guides as MCP resources that clients can read on demand.
Prompts (6)
The server provides MCP prompts — reusable multi-tool workflow templates that clients can surface as slash commands.
Usage Examples
Projects & Branches
Merge Requests & Code Review
Pipelines & CI/CD
Issues
Security Considerations
- Token scope: Use the minimum required scope.
apiscope grants full access; preferread_apifor read-only deployments. - Read-only mode: Set
MCP_READ_ONLY=true(orGITLAB_READ_ONLY=true) in the launch you control and the server starts locked: the 57 write tools and the write-workflow prompts are not listed, a call to one returns "Unknown tool", and the guard refuses any write that still reaches it. Nothing lifts the lock at runtime — not afalsefrom another source, not a.envfile, not tool arguments; any value other thanfalse/0/no/off/empty locks, and--read-onlycan only raise it. The lock is only as strong as the launch: set it where users cannot edit it (a managed MCP config such as Claude Codemanaged-mcp.json, a container, k8s or systemd env, or a hosted HTTP deployment). A user who starts the server themselves controls its environment. In OAuth mode also setGITLAB_OAUTH_SCOPES=read_apiso each user's GitLab token lacks write scope. - SSL verification:
GITLAB_SSL_VERIFY=trueby default. Only disable for self-signed certificates in trusted networks. - CI/CD variable masking:
gitlab_list_variablesandgitlab_list_group_variablesautomatically mask values of variables marked as masked in GitLab, returning***MASKED***instead of the actual value. - MCP tool annotations: Each tool declares
readOnlyHint,destructiveHint, andidempotentHintfor client-side permission prompts. - Credential storage: The server reads
GITLAB_TOKENfrom the environment and never writes it.mcp-gitlab auth loginstores OAuth tokens in~/.config/mcp-gitlab/credentials.json(mode 0600) and refreshes them in place.
Rate Limits & Permissions
Rate Limits
GitLab enforces per-user rate limits (default: 2000 requests/minute for authenticated users). When rate-limited, tools return a 429 error with a hint to wait before retrying. Paginated endpoints default to 20 results per page; use per_page (max 100) to reduce the number of API calls.
Required Permissions
CLI & Transport Options
--gitlab-token still works but is deprecated and hidden from --help: it exposes the token to
ps and shell history. Use GITLAB_TOKEN.
--auth {token,oauth} selects the authentication mode (token by default);
oauth requires --transport streamable-http.
In token mode an HTTP transport serves every tool with the single GITLAB_TOKEN to
anyone who reaches the port, so binding to a non-loopback --host is refused unless
you set GITLAB_HTTP_BEARER_TOKEN (≥ 16 chars; clients send it as
Authorization: Bearer <token>) or switch to --auth oauth for per-user sign-in.
The default 127.0.0.1 bind needs neither.
The server loads .env files from the working directory automatically via python-dotenv.
Docker
A minimal non-root image builds straight from this repo (uv, the committed uv.lock). The image
defaults to locked read-only (MCP_READ_ONLY=true); override it to allow writes.
For an HTTP transport, append --transport streamable-http --host 0.0.0.0; a non-loopback bind in
token mode needs GITLAB_HTTP_BEARER_TOKEN (≥ 16 chars) or GITLAB_AUTH=oauth (see above).
FAQ
Does mcp-gitlab support MCP 2.0?
Yes. It supports the MCP 2026-07-28 specification, often called MCP 2.0. It also stays compatible with 2025-11-25 clients.
Does it work with self-hosted GitLab?
Yes. It works with GitLab.com and self-hosted GitLab (CE and EE). It needs no GitLab Duo or Premium.
Which transports does it support?
It supports stdio (the default) and streamable-http. The sse transport still works, but the 2026-07-28 specification deprecates it. OAuth 2.1 mode (--auth oauth) is available on streamable-http only.
Can I run mcp-gitlab read-only so the assistant cannot merge, push or comment?
Yes. Start it with MCP_READ_ONLY=true (or GITLAB_READ_ONLY=true). The 57 write tools and the write-workflow prompts are then not listed at all, so the model never sees them; a call to one returns "Unknown tool", and nothing can turn writes back on while the process runs. Set it in a launch you control — a managed MCP config, a container or systemd env, or a hosted deployment — because a user who starts the server themselves can start it without the variable.
What token scopes does it need?
Use a token with the api scope for full access. Use the read_api scope for read-only deployments. The server reads a GITLAB_TOKEN from the environment and never writes it; tokens from mcp-gitlab auth login are stored in ~/.config/mcp-gitlab/credentials.json.
Which AI assistants work with it?
It works with Claude Desktop, Claude Code, Cursor, Windsurf, VS Code Copilot, and any MCP-compatible client.
How do I install mcp-gitlab?
Run uvx mcp-gitlab, or add it to your MCP client configuration. See the installation section above.
Related MCP Servers
- mcp-atlassian-extended — Jira + Confluence integration (22 tools, 15 resources, 5 prompts)
- mcp-coda — Coda integration (53 tools, 12 resources, 5 prompts)
- mcp-argocd — Argo CD integration (37 tools, 7 resources, 7 prompts)
Development
License
MIT
來源:README.md,提交 dddae53
工具
0版本歷史
23- v0.22.0最新Nov 7, 2026
- v0.21.3Nov 4, 2026
- v0.21.2Oct 22, 2026
- v0.21.1Oct 21, 2026
- v0.21.0Oct 18, 2026
- v0.20.2Oct 14, 2026
- v0.20.1Oct 14, 2026
- v0.20.0Oct 13, 2026
- v0.19.0Oct 13, 2026
- v0.18.0Oct 12, 2026
- v0.17.0Oct 12, 2026
- v0.16.0Oct 10, 2026
- v0.15.0Oct 6, 2026
- v0.14.0Oct 6, 2026
- v0.12.2Oct 3, 2026
- v0.12.1Sep 28, 2026
- v0.12.0Sep 27, 2026
- v0.11.0Sep 27, 2026
- v0.10.3Sep 25, 2026
- v0.10.2Sep 21, 2026
- v0.10.0Sep 20, 2026
- v0.9.7Sep 20, 2026
- v0.9.3Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分
其他 Gitlab 整合
Gitlab
com.gitlab官方發布者
Gitlab 的託管 MCP 服務,由 gitlab.com 發布;需要憑證;Streamable HTTP。

GitLab MCP Server
由 GitHub 帳號 sumirati 發布
在本機執行的 GitLab MCP 伺服器,讓助理在 GitLab.com 或自架執行個體上讀取與管理專案、分支、提交、合併請求、議題與 CI/CD 流水線。

Gitlab Mcp
由 GitHub 帳號 mmedum 發布
本機 stdio MCP 伺服器,讓助理以你的身分在 gitlab.com 專案中工作:議題、合併請求、審查、儲存庫與 CI。

Gitlab Ci Break Lint
由 GitHub 帳號 jmshinhwa 發布
一個本機 MCP 伺服器,用來標出 .gitlab-ci.yml 中在下一次 GitLab 主要版本升級後會被 runner 拒絕的行。

Gitlab Mcp
由 GitHub 帳號 mrfentmen 發布
讓助理不需 API 金鑰就能查詢 GitLab 上的公開專案與使用者資訊。