GitLab MCP Server
The provided schema exposes a GitLab MCP server that lets AI assistants inspect and operate self-hosted GitLab projects, merge requests, CI/CD pipelines/jobs, and repository data.
Check MCP server info and GitLab connectivity/health.
Browse projects and project members.
Manage merge requests: list/get/create/update/merge/approve, view diffs and commits, list/add notes.
Manage CI/CD: list/get/create/retry/cancel pipelines; list/get jobs, read job logs, and retry jobs.
Inspect repositories: list/get branches, list/get commits, compare branches/commits, and browse file trees.
README describes multi-target GitLab support with
list_targetsand optionaltarget_id, but the provided schema does not exposelist_targetsor anytarget_idparameter.
Provides comprehensive interaction with GitLab instances, allowing AI agents to manage projects, merge requests, CI/CD pipelines, jobs, and repository resources like branches and commits.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@GitLab MCP Server List the open merge requests for the frontend project"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
GitLab MCP Server
GitLab MCP Server — 透過 Model Context Protocol 讓 AI 助手(Claude Code、Cursor 等)直接操作自架 GitLab。
支援 GitLab 14.x+ REST API v4,使用 Personal Access Token 認證。
安裝與部署
前置需求
Docker
GitLab Personal Access Token(權限範圍:
api,read_user)取得方式:GitLab > User Settings > Access Tokens
Docker 部署(多 target,建議)
一個 container 同時服務多台 GitLab,各 tool 以 target_id 選台;token 從個人憑證檔讀,不放進 container 的環境變數(docker inspect 看不到)。
個人憑證檔
~/.larvata/credentials.json(權限600,key 隨意,以url的 origin 對應 target):{ "gitlab-larvata": { "url": "https://gitlab.example.com", "token": "glpat-..." }, "gitlab-larvata-new": { "url": "https://gitlab-new.example.com", "token": "glpat-..." } }非機密設定
~/.larvata/gitlab-mcp.env:GITLAB_MCP_TRANSPORT=sse GITLAB_MCP_HOST=0.0.0.0 GITLAB_MCP_PORT=8000 GITLAB_CREDENTIALS_FILE=/creds.json GITLAB_TARGETS_JSON=[{"id":"larvata","url":"https://gitlab.example.com","default":true},{"id":"larvata-new","url":"https://gitlab-new.example.com"}]建置與啟動:
docker build -t gitlab-mcp . docker run -d --name gitlab-mcp \ --user $(id -u):$(id -g) \ --env-file ~/.larvata/gitlab-mcp.env \ -v ~/.larvata/credentials.json:/creds.json:ro \ -p 127.0.0.1:8001:8000 \ --restart unless-stopped \ gitlab-mcp
--user 讓 container 能讀權限 600 的憑證檔。憑證檔每次呼叫都重讀,補好 token 不必重啟。用 list_targets 看各台的憑證狀態(present/missing/ambiguous/file_error)。
Docker 部署(單台相容模式)
沒設 GITLAB_TARGETS_JSON 時,照舊讀 GITLAB_URL/GITLAB_TOKEN,target id 為 default:
# 1. 建置 image
docker compose build
# 2. 建立 .env 檔案
cp .env.example .env
# 編輯 .env,填入 GITLAB_URL 和 GITLAB_TOKEN
# 3. 啟動服務
docker compose up -dMCP 客戶端設定
在 Claude Code 或其他 MCP 客戶端中加入:
{
"mcpServers": {
"gitlab": {
"type": "sse",
"url": "http://localhost:8001/sse"
}
}
}Related MCP server: GitLab MCP Server
環境變數
變數 | 必填 | 預設值 | 說明 |
| 多 target | — | target 清單: |
| 多 target | — | 憑證檔在 container 內的路徑(如 |
| 相容模式 | — | GitLab 位址(設了 |
| 相容模式 | — | Personal Access Token(多 target 模式下被忽略) |
| No |
| 傳輸模式( |
| No |
| SSE 監聽位址 |
| No |
| SSE 監聽端口 |
| No |
| 日誌等級 |
| No |
| API 請求逾時(秒) |
功能列表(31 tools)
除 list_targets 外,每個 tool 都有選填參數 target_id,省略時用預設台。
管理工具
Tool | 說明 |
| 列出各 GitLab 主機與憑證狀態(不含 token) |
| 取得伺服器資訊與 GitLab 版本 |
| 檢查連線狀態;不帶 |
Projects
Tool | 說明 |
| 列出可存取的專案(支援搜尋) |
| 取得專案詳情 |
| 列出專案成員 |
Merge Requests
Tool | 說明 |
| 列出 MR(可依狀態篩選) |
| 取得 MR 詳情 |
| 建立 MR |
| 更新 MR(標題、描述、指派、狀態) |
| 執行合併 |
| 核准 MR |
| 取得 MR 檔案變更(diff) |
| 取得 MR 包含的 commits |
| 列出 MR 留言 |
| 新增 MR 留言 |
CI/CD Pipelines & Jobs
Tool | 說明 |
| 列出 Pipelines(可依狀態、分支篩選) |
| 取得 Pipeline 詳情 |
| 觸發新 Pipeline |
| 重試 Pipeline |
| 取消 Pipeline |
| 列出 Pipeline 的 Jobs |
| 取得 Job 詳情 |
| 取得 Job 執行日誌 |
| 重試單一 Job |
Repository
Tool | 說明 |
| 列出分支 |
| 取得分支詳情 |
| 列出 Commits |
| 取得 Commit 詳情 |
| 比較兩個分支差異 |
| 瀏覽檔案結構 |
開發
# 安裝依賴(需要 uv)
uv sync
# 本地啟動(stdio 模式)
uv run gitlab-mcp
# 本地啟動(SSE 模式)
uv run gitlab-mcp --transport sse --port 8001License
MIT
Available Tools
30 toolsapprove_merge_requestC
核准 Merge Request
Args: project_id: 專案 ID 或路徑 mr_iid: MR 的 IID
Inputs: project_id (required), mr_iid (required). Returns: result
cancel_pipelineD
取消 Pipeline
Args: project_id: 專案 ID 或路徑 pipeline_id: Pipeline ID
Inputs: project_id (required), pipeline_id (required). Returns: result
compare_branchesC
比較兩個分支或 commit 的差異
Args: project_id: 專案 ID 或路徑 from_ref: 起始分支/commit to_ref: 目標分支/commit
Inputs: project_id (required), from_ref (required), to_ref (required). Returns: result
create_merge_requestB
建立新的 Merge Request
Args: project_id: 專案 ID 或路徑 source_branch: 來源分支 target_branch: 目標分支 title: MR 標題 description: MR 描述 assignee_id: 指派人 ID reviewer_ids: 審核者 ID 列表(逗號分隔,如 "1,2,3")
Inputs: project_id (required), source_branch (required), target_branch (required), title (required), +3 more. Returns: result
create_merge_request_noteC
新增 Merge Request 留言
Args: project_id: 專案 ID 或路徑 mr_iid: MR 的 IID body: 留言內容(支援 Markdown)
Inputs: project_id (required), mr_iid (required), body (required). Returns: result
create_pipelineC
觸發新的 CI/CD Pipeline
Args: project_id: 專案 ID 或路徑 ref: 分支名稱或標籤 variables: Pipeline 變數(JSON 格式,如 '[{"key":"VAR1","value":"val1"}]')
Inputs: project_id (required), ref (required), variables. Returns: result
get_branchC
取得分支詳細資訊
Args: project_id: 專案 ID 或路徑 branch_name: 分支名稱
Inputs: project_id (required), branch_name (required). Returns: result
get_commitC
取得 Commit 詳細資訊
Args: project_id: 專案 ID 或路徑 sha: Commit SHA(完整或縮短)
Inputs: project_id (required), sha (required). Returns: result
get_jobC
取得 Job 詳細資訊
Args: project_id: 專案 ID 或路徑 job_id: Job ID
Inputs: project_id (required), job_id (required). Returns: result
get_job_logB
取得 Job 的執行日誌
Args: project_id: 專案 ID 或路徑 job_id: Job ID last_lines: 只顯示最後 N 行(0 表示全部,預設 0)
Inputs: project_id (required), job_id (required), last_lines. Returns: result
get_merge_requestC
取得 Merge Request 詳細資訊
Args: project_id: 專案 ID 或路徑 mr_iid: MR 的 IID(專案內編號)
Inputs: project_id (required), mr_iid (required). Returns: result
get_merge_request_changesC
取得 Merge Request 的檔案變更(diff)
Args: project_id: 專案 ID 或路徑 mr_iid: MR 的 IID
Inputs: project_id (required), mr_iid (required). Returns: result
get_merge_request_commitsC
取得 Merge Request 包含的 commits
Args: project_id: 專案 ID 或路徑 mr_iid: MR 的 IID
Inputs: project_id (required), mr_iid (required). Returns: result
get_pipelineC
取得 Pipeline 詳細資訊
Args: project_id: 專案 ID 或路徑 pipeline_id: Pipeline ID
Inputs: project_id (required), pipeline_id (required). Returns: result
get_projectB
取得 GitLab 專案詳細資訊
Args: project_id: 專案 ID(數字)或路徑(如 group/project)
Inputs: project_id (required). Returns: result
health_checkB
健康檢查,確認與 GitLab 伺服器的連線狀態
Inputs: no named parameters. Returns: result
list_branchesC
列出專案的分支
Args: project_id: 專案 ID 或路徑 search: 搜尋關鍵字 page: 頁碼 per_page: 每頁筆數
Inputs: project_id (required), search, page, per_page. Returns: result
list_commitsC
列出 Commits
Args: project_id: 專案 ID 或路徑 ref_name: 分支或標籤名稱(預設為預設分支) path: 檔案路徑篩選 page: 頁碼 per_page: 每頁筆數
Inputs: project_id (required), ref_name, path, page, +1 more. Returns: result
list_merge_request_notesC
列出 Merge Request 的留言
Args: project_id: 專案 ID 或路徑 mr_iid: MR 的 IID page: 頁碼 per_page: 每頁筆數
Inputs: project_id (required), mr_iid (required), page, per_page. Returns: result
list_merge_requestsB
列出專案的 Merge Requests
Args: project_id: 專案 ID 或路徑 state: 狀態篩選(opened, closed, merged, all) page: 頁碼 per_page: 每頁筆數
Inputs: project_id (required), state, page, per_page. Returns: result
list_pipeline_jobsC
列出 Pipeline 的所有 Jobs
Args: project_id: 專案 ID 或路徑 pipeline_id: Pipeline ID page: 頁碼 per_page: 每頁筆數
Inputs: project_id (required), pipeline_id (required), page, per_page. Returns: result
list_pipelinesB
列出專案的 CI/CD Pipelines
Args: project_id: 專案 ID 或路徑 status: 狀態篩選(running, pending, success, failed, canceled, skipped) ref: 分支或標籤名稱篩選 page: 頁碼 per_page: 每頁筆數
Inputs: project_id (required), status, ref, page, +1 more. Returns: result
list_project_membersC
列出專案成員
Args: project_id: 專案 ID 或路徑 page: 頁碼 per_page: 每頁筆數
Inputs: project_id (required), page, per_page. Returns: result
list_projectsB
列出可存取的 GitLab 專案
Args: search: 搜尋關鍵字(專案名稱) membership: 僅列出已加入的專案(預設 True) page: 頁碼(預設 1) per_page: 每頁筆數(預設 20,最大 100)
Inputs: search, membership, page, per_page. Returns: result
list_repository_treeC
瀏覽 Repository 檔案結構
Args: project_id: 專案 ID 或路徑 path: 目錄路徑(預設為根目錄) ref: 分支或標籤(預設為預設分支) recursive: 是否遞迴列出子目錄
Inputs: project_id (required), path, ref, recursive. Returns: result
merge_merge_requestC
合併 Merge Request
Args: project_id: 專案 ID 或路徑 mr_iid: MR 的 IID merge_commit_message: 自訂合併 commit 訊息 should_remove_source_branch: 合併後是否刪除來源分支
Inputs: project_id (required), mr_iid (required), merge_commit_message, should_remove_source_branch. Returns: result
retry_jobC
重試單一 Job
Args: project_id: 專案 ID 或路徑 job_id: Job ID
Inputs: project_id (required), job_id (required). Returns: result
retry_pipelineC
重試 Pipeline
Args: project_id: 專案 ID 或路徑 pipeline_id: Pipeline ID
Inputs: project_id (required), pipeline_id (required). Returns: result
server_infoB
取得 GitLab MCP 服務器資訊和連線狀態
Inputs: no named parameters. Returns: result
update_merge_requestB
更新 Merge Request
Args: project_id: 專案 ID 或路徑 mr_iid: MR 的 IID title: 新標題 description: 新描述 state_event: 狀態變更(close 或 reopen) assignee_id: 新指派人 ID reviewer_ids: 審核者 ID 列表(逗號分隔) target_branch: 新目標分支
Inputs: project_id (required), mr_iid (required), title, description, +4 more. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 30 tools
Each tool has a clearly distinct purpose targeting specific GitLab resources and actions. For example, merge request operations (approve, create, get, update, merge), pipeline operations (create, cancel, retry), and branch/commit operations are all well-separated with no overlapping functionality.
All tools follow a consistent verb_noun pattern with snake_case throughout (e.g., create_merge_request, list_pipelines, get_branch). The naming convention is perfectly uniform across all 30 tools, making them easily predictable and readable.
With 30 tools, this is borderline heavy for an MCP server. While GitLab has extensive functionality, the tool count approaches the upper limit of what's typically manageable, potentially overwhelming agents despite good organization.
The tool surface provides comprehensive coverage of GitLab's core functionality including projects, branches, commits, merge requests, pipelines, and jobs. It offers complete CRUD/lifecycle operations for all major resources with no obvious gaps for agent workflows.
Maintenance
Related MCP Connectors
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
Go MCP server for GitLab: 2 dynamic tools reach 1000+ REST/GraphQL actions. Free/CE, no paid tier.
AI-native git hosting — repos, PRs, issues, CI gates, and AI code review over MCP (60 tools).
The Mercado Pago MCP Server implements the Model Context Protocol to provide AI agents and LLMs with access to Mercado Pago's APIs and tools within compatible development environments. It acts as an intermediary that translates Mercado Pago resources into executable functions (tools) that AI applications can invoke to perform actions and automate flows. The server simplifies integration, enables using documentation to implement or improve code, and optimizes operations through natural language interactions without manual implementations.
Related MCP Servers
- AlicenseBqualityDmaintenanceA Model Context Protocol server that enables interaction with GitLab accounts to manage repositories, merge requests, code reviews, and CI/CD pipelines through natural language.4121MIT
- -licenseNot gradedqualityNot gradedmaintenanceA Model Context Protocol server that enables AI assistants to interact with GitLab repositories, allowing tasks like managing merge requests, searching projects, and creating comments through RESTful API integration.21 npm2-
- AlicenseNot gradedqualityDmaintenanceEnables AI assistants to interact with GitLab by wrapping the REST API v4 into executable tools for repository and branch management. It supports operations like creating projects, managing branches, and retrieving user information through the Model Context Protocol.1ISC
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol server for GitLab integration, enabling AI assistants to manage projects, merge requests, pipelines, issues, releases, and more.MIT