gitlab-automation
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseGitLab Automation via Rube MCP
通过Rube MCP实现GitLab自动化
Automate GitLab operations including project management, issue tracking, merge request workflows, CI/CD pipeline monitoring, branch management, and user administration through Composio's GitLab toolkit.
借助Composio的GitLab工具包,自动化GitLab操作,包括项目管理、议题追踪、合并请求工作流、CI/CD流水线监控、分支管理和用户权限管理。
Prerequisites
前提条件
- Rube MCP must be connected (RUBE_SEARCH_TOOLS available)
- Active GitLab connection via with toolkit
RUBE_MANAGE_CONNECTIONSgitlab - Always call first to get current tool schemas
RUBE_SEARCH_TOOLS
- 必须已连接Rube MCP(需确保可用)
RUBE_SEARCH_TOOLS - 通过激活GitLab连接,工具包选择
RUBE_MANAGE_CONNECTIONSgitlab - 请始终先调用以获取最新的工具模式
RUBE_SEARCH_TOOLS
Setup
设置步骤
Get Rube MCP: Add as an MCP server in your client configuration. No API keys needed — just add the endpoint and it works.
https://rube.app/mcp- Verify Rube MCP is available by confirming responds
RUBE_SEARCH_TOOLS - Call with toolkit
RUBE_MANAGE_CONNECTIONSgitlab - If connection is not ACTIVE, follow the returned auth link to complete GitLab OAuth
- Confirm connection status shows ACTIVE before running any workflows
获取Rube MCP:在客户端配置中添加作为MCP服务器。无需API密钥,只需添加端点即可使用。
https://rube.app/mcp- 确认可正常响应,以此验证Rube MCP是否可用
RUBE_SEARCH_TOOLS - 调用并指定工具包为
RUBE_MANAGE_CONNECTIONSgitlab - 如果连接状态未激活,请按照返回的授权链接完成GitLab OAuth认证
- 在运行任何工作流之前,确认连接状态显示为ACTIVE
Core Workflows
核心工作流
1. Manage Issues
1. 议题管理
When to use: User wants to create, update, list, or search issues in a GitLab project
Tool sequence:
- - Find the target project and get its ID [Prerequisite]
GITLAB_GET_PROJECTS - - List and filter issues for a project [Required]
GITLAB_LIST_PROJECT_ISSUES - - Create a new issue [Required for create]
GITLAB_CREATE_PROJECT_ISSUE - - Update an existing issue (title, labels, state, assignees) [Required for update]
GITLAB_UPDATE_PROJECT_ISSUE - - Find user IDs for assignment [Optional]
GITLAB_LIST_PROJECT_USERS
Key parameters:
- : Project ID (integer) or URL-encoded path (e.g.,
id)"my-group/my-project" - : Issue title (required for creation)
title - : Issue body text (max 1,048,576 characters)
description - : Comma-separated label names (e.g.,
labels)"bug,critical" - /
add_labels: Add or remove labels without replacing allremove_labels - : Filter by
state,"all", or"opened""closed" - :
state_eventor"close"to change issue state"reopen" - : Array of user IDs; use
assignee_idsto unassign all[0] - : Internal issue ID within the project (required for updates)
issue_iid - : Filter by milestone title
milestone - : Search in title and description
search - :
scope,"created_by_me", or"assigned_to_me""all" - /
page: Pagination (default per_page: 20)per_page
Pitfalls:
- accepts either integer project ID or URL-encoded path; wrong IDs yield 4xx errors
id - is the project-internal ID (shown as #42), different from the global issue ID
issue_iid - Labels in field replace ALL existing labels; use
labels/add_labelsfor incremental changesremove_labels - Setting to empty array does NOT unassign; use
assignee_idsinstead[0] - field requires administrator or project/group owner rights
updated_at
适用场景:用户需要在GitLab项目中创建、更新、列出或搜索议题
工具执行顺序:
- - 找到目标项目并获取其ID [前提步骤]
GITLAB_GET_PROJECTS - - 列出并筛选项目中的议题 [必需步骤]
GITLAB_LIST_PROJECT_ISSUES - - 创建新议题 [创建操作必需]
GITLAB_CREATE_PROJECT_ISSUE - - 更新现有议题(标题、标签、状态、经办人) [更新操作必需]
GITLAB_UPDATE_PROJECT_ISSUE - - 查找用于分配的用户ID [可选步骤]
GITLAB_LIST_PROJECT_USERS
关键参数:
- : 项目ID(整数)或URL编码路径(例如:
id)"my-group/my-project" - : 议题标题(创建操作必填)
title - : 议题正文(最大1,048,576字符)
description - : 逗号分隔的标签名称(例如:
labels)"bug,critical" - /
add_labels: 添加或移除标签,无需替换所有现有标签remove_labels - : 筛选条件,可选
state、"all"或"opened""closed" - : 用于修改议题状态,可选
state_event或"close""reopen" - : 用户ID数组;使用
assignee_ids可移除所有经办人[0] - : 项目内的议题ID(显示为#42),与全局议题ID不同
issue_iid - : 按里程碑标题筛选
milestone - : 在标题和正文中搜索
search - : 可选
scope、"created_by_me"或"assigned_to_me""all" - /
page: 分页参数(默认每页20条)per_page
注意事项:
- 字段支持整数项目ID或URL编码路径;错误的ID会导致4xx错误
id - 是项目内部ID(显示为#42),与全局议题ID不同
issue_iid - 字段中的标签会替换所有现有标签;如需增量修改,请使用
labels/add_labelsremove_labels - 将设为空数组无法移除经办人;需使用
assignee_ids替代[0] - 修改字段需要管理员或项目/群组所有者权限
updated_at
2. Manage Merge Requests
2. 合并请求管理
When to use: User wants to list, filter, or review merge requests in a project
Tool sequence:
- - Get project details and verify access [Prerequisite]
GITLAB_GET_PROJECT - - List and filter merge requests [Required]
GITLAB_GET_PROJECT_MERGE_REQUESTS - - Verify source/target branches [Optional]
GITLAB_GET_REPOSITORY_BRANCHES - - Find reviewers/assignees [Optional]
GITLAB_LIST_ALL_PROJECT_MEMBERS
Key parameters:
- : Project ID or URL-encoded path
id - :
state,"opened","closed","locked", or"merged""all" - :
scope(default),"created_by_me", or"assigned_to_me""all" - /
source_branch: Filter by branch namestarget_branch - /
author_id: Filter by MR authorauthor_username - : Filter by assignee (use
assignee_idfor unassigned,Nonefor assigned)Any - /
reviewer_id: Filter by reviewerreviewer_username - : Comma-separated label filter
labels - : Search in title and description
search - :
wipfor draft MRs,"yes"for non-draft"no" - :
order_by(default),"created_at","title","merged_at""updated_at" - :
viewfor minimal fields"simple" - : Filter by specific MR internal IDs
iids[]
Pitfalls:
- Default is
scopewhich limits results; use"created_by_me"for complete listings"all" - and
author_idare mutually exclusiveauthor_username - and
reviewer_idare mutually exclusivereviewer_username - filter requires the
approvedfeature flag (disabled by default)mr_approved_filter - Large MR histories can be noisy; use filters and moderate values
per_page
适用场景:用户需要列出、筛选或审核项目中的合并请求
工具执行顺序:
- - 获取项目详情并验证访问权限 [前提步骤]
GITLAB_GET_PROJECT - - 列出并筛选合并请求 [必需步骤]
GITLAB_GET_PROJECT_MERGE_REQUESTS - - 验证源分支/目标分支 [可选步骤]
GITLAB_GET_REPOSITORY_BRANCHES - - 查找审核人/经办人 [可选步骤]
GITLAB_LIST_ALL_PROJECT_MEMBERS
关键参数:
- : 项目ID或URL编码路径
id - : 可选
state、"opened"、"closed"、"locked"或"merged""all" - : 可选
scope(默认)、"created_by_me"或"assigned_to_me""all" - /
source_branch: 按分支名称筛选target_branch - /
author_id: 按合并请求作者筛选author_username - : 按经办人筛选(
assignee_id表示未分配,None表示已分配)Any - /
reviewer_id: 按审核人筛选reviewer_username - : 逗号分隔的标签筛选条件
labels - : 在标题和正文中搜索
search - :
wip表示草稿合并请求,"yes"表示非草稿"no" - : 可选
order_by(默认)、"created_at"、"title"、"merged_at""updated_at" - :
view表示仅返回基础字段"simple" - : 按特定合并请求内部ID筛选
iids[]
注意事项:
- 默认为
scope,会限制结果范围;如需完整列表请使用"created_by_me""all" - 和
author_id不可同时使用author_username - 和
reviewer_id不可同时使用reviewer_username - 筛选条件需要启用
approved功能标志(默认禁用)mr_approved_filter - 大型合并请求历史记录可能包含冗余信息;请使用筛选条件并合理设置值
per_page
3. Manage Projects and Repositories
3. 项目与仓库管理
When to use: User wants to list projects, create new projects, or manage branches
Tool sequence:
- - List all accessible projects with filters [Required]
GITLAB_GET_PROJECTS - - Get detailed info for a specific project [Optional]
GITLAB_GET_PROJECT - - List projects owned by a specific user [Optional]
GITLAB_LIST_USER_PROJECTS - - Create a new project [Required for create]
GITLAB_CREATE_PROJECT - - List branches in a project [Required for branch ops]
GITLAB_GET_REPOSITORY_BRANCHES - - Create a new branch [Optional]
GITLAB_CREATE_REPOSITORY_BRANCH - - Get details of a specific branch [Optional]
GITLAB_GET_REPOSITORY_BRANCH - - View commit history [Optional]
GITLAB_LIST_REPOSITORY_COMMITS - - Get language breakdown [Optional]
GITLAB_GET_PROJECT_LANGUAGES
Key parameters:
- /
name: Project name and URL-friendly path (both required for creation)path - :
visibility,"private", or"internal""public" - : Group or user ID for project placement
namespace_id - : Case-insensitive substring search for projects
search - :
membershipto limit to projects user is a member oftrue - :
ownedto limit to user-owned projectstrue - : Project ID for branch operations
project_id - : Name for new branch
branch_name - : Source branch or commit SHA for new branch creation
ref - :
order_by,"id","name","path","created_at","updated_at","star_count""last_activity_at"
Pitfalls:
- pagination is required for complete coverage; stopping at first page misses projects
GITLAB_GET_PROJECTS - Some responses place items under ; parse the actual returned list structure
data.details - Most follow-up calls depend on correct ; verify with
project_idfirstGITLAB_GET_PROJECT - Invalid /
branch_name/refcauses client errors; verify branch existence viashafirstGITLAB_GET_REPOSITORY_BRANCHES - Both and
nameare required forpathGITLAB_CREATE_PROJECT
适用场景:用户需要列出项目、创建新项目或管理分支
工具执行顺序:
- - 列出所有可访问的项目并应用筛选条件 [必需步骤]
GITLAB_GET_PROJECTS - - 获取特定项目的详细信息 [可选步骤]
GITLAB_GET_PROJECT - - 列出特定用户拥有的项目 [可选步骤]
GITLAB_LIST_USER_PROJECTS - - 创建新项目 [创建操作必需]
GITLAB_CREATE_PROJECT - - 列出项目中的分支 [分支操作必需]
GITLAB_GET_REPOSITORY_BRANCHES - - 创建新分支 [可选步骤]
GITLAB_CREATE_REPOSITORY_BRANCH - - 获取特定分支的详细信息 [可选步骤]
GITLAB_GET_REPOSITORY_BRANCH - - 查看提交历史 [可选步骤]
GITLAB_LIST_REPOSITORY_COMMITS - - 获取项目语言占比 [可选步骤]
GITLAB_GET_PROJECT_LANGUAGES
关键参数:
- /
name: 项目名称和URL友好路径(创建操作必填)path - : 可选
visibility、"private"或"internal""public" - : 项目所属的群组或用户ID
namespace_id - : 对项目名称进行不区分大小写的子串搜索
search - :
membership表示仅显示用户为成员的项目true - :
owned表示仅显示用户拥有的项目true - : 分支操作对应的项目ID
project_id - : 新分支的名称
branch_name - : 创建新分支的源分支或提交SHA
ref - : 可选
order_by、"id"、"name"、"path"、"created_at"、"updated_at"、"star_count""last_activity_at"
注意事项:
- 需要分页才能获取完整项目列表;仅获取第一页会遗漏项目
GITLAB_GET_PROJECTS - 部分响应结果的项目列表位于下;请解析实际返回的列表结构
data.details - 大多数后续操作依赖正确的;请先通过
project_id验证GITLAB_GET_PROJECT - 无效的/
branch_name/ref会导致客户端错误;请先通过sha验证分支是否存在GITLAB_GET_REPOSITORY_BRANCHES - 操作同时需要
GITLAB_CREATE_PROJECT和name参数path
4. Monitor CI/CD Pipelines
4. CI/CD流水线监控
When to use: User wants to check pipeline status, list jobs, or monitor CI/CD runs
Tool sequence:
- - Verify project access [Prerequisite]
GITLAB_GET_PROJECT - - List pipelines with filters [Required]
GITLAB_LIST_PROJECT_PIPELINES - - Get detailed info for a specific pipeline [Optional]
GITLAB_GET_SINGLE_PIPELINE - - List jobs within a pipeline [Optional]
GITLAB_LIST_PIPELINE_JOBS
Key parameters:
- : Project ID or URL-encoded path
id - : Filter by
status,"created","waiting_for_resource","preparing","pending","running","success","failed","canceled","skipped","manual""scheduled" - :
scope,"running","pending","finished","branches""tags" - : Branch or tag name
ref - : Specific commit SHA
sha - : Pipeline source (use
sourcefor child pipelines)"parent_pipeline" - :
order_by(default),"id","status","ref","updated_at""user_id" - /
created_after: ISO 8601 date filterscreated_before - : Specific pipeline ID for job listing
pipeline_id - :
include_retriedto include retried jobs (defaulttrue)false
Pitfalls:
- Large pipeline histories can be noisy; use ,
status, and date filters to narrow resultsref - Use moderate values to keep output manageable
per_page - Pipeline job accepts single status string or array of statuses
scope - returns only pipelines with invalid configurations
yaml_errors: true
适用场景:用户需要检查流水线状态、列出作业或监控CI/CD运行情况
工具执行顺序:
- - 验证项目访问权限 [前提步骤]
GITLAB_GET_PROJECT - - 列出流水线并应用筛选条件 [必需步骤]
GITLAB_LIST_PROJECT_PIPELINES - - 获取特定流水线的详细信息 [可选步骤]
GITLAB_GET_SINGLE_PIPELINE - - 列出流水线中的作业 [可选步骤]
GITLAB_LIST_PIPELINE_JOBS
关键参数:
- : 项目ID或URL编码路径
id - : 按状态筛选,可选
status、"created"、"waiting_for_resource"、"preparing"、"pending"、"running"、"success"、"failed"、"canceled"、"skipped"、"manual""scheduled" - : 可选
scope、"running"、"pending"、"finished"、"branches""tags" - : 分支或标签名称
ref - : 特定提交SHA
sha - : 流水线来源(
source表示子流水线)"parent_pipeline" - : 可选
order_by(默认)、"id"、"status"、"ref"、"updated_at""user_id" - /
created_after: ISO 8601格式的日期筛选条件created_before - : 用于列出作业的特定流水线ID
pipeline_id - :
include_retried表示包含重试的作业(默认true)false
注意事项:
- 大型流水线历史记录可能包含冗余信息;请使用、
status和日期筛选条件缩小结果范围ref - 合理设置值以保持输出内容简洁
per_page - 流水线作业的参数支持单个状态字符串或状态数组
scope - 仅返回配置无效的流水线
yaml_errors: true
5. Manage Users and Members
5. 用户与成员管理
When to use: User wants to find users, list project members, or check user status
Tool sequence:
- - Search and list GitLab users [Required]
GITLAB_GET_USERS - - Get details for a specific user by ID [Optional]
GITLAB_GET_USER - - Get user status message and availability [Optional]
GITLAB_GET_USERS_ID_STATUS - - List all project members (direct + inherited) [Required for member listing]
GITLAB_LIST_ALL_PROJECT_MEMBERS - - List project users with search filter [Optional]
GITLAB_LIST_PROJECT_USERS
Key parameters:
- : Search by name, username, or public email
search - : Get specific user by username
username - /
active: Filter by user stateblocked - : Project ID for member listing
id - : Filter members by name, email, or username
query - : Filter members by
stateor"awaiting"(Premium/Ultimate)"active" - : Filter by specific user IDs
user_ids
Pitfalls:
- Many user filters (admins, auditors, extern_uid, two_factor) are admin-only
- includes direct, inherited, and invited members
GITLAB_LIST_ALL_PROJECT_MEMBERS - User search is case-insensitive but may not match partial email domains
- Premium/Ultimate features (state filter, seat info) are not available on free plans
适用场景:用户需要查找用户、列出项目成员或检查用户状态
工具执行顺序:
- - 搜索并列出GitLab用户 [必需步骤]
GITLAB_GET_USERS - - 通过ID获取特定用户的详细信息 [可选步骤]
GITLAB_GET_USER - - 获取用户状态消息和可用性 [可选步骤]
GITLAB_GET_USERS_ID_STATUS - - 列出所有项目成员(直接成员+继承成员) [成员列表操作必需]
GITLAB_LIST_ALL_PROJECT_MEMBERS - - 列出项目用户并应用搜索筛选 [可选步骤]
GITLAB_LIST_PROJECT_USERS
关键参数:
- : 按名称、用户名或公开邮箱搜索
search - : 按用户名获取特定用户
username - /
active: 按用户状态筛选blocked - : 成员列表对应的项目ID
id - : 按名称、邮箱或用户名筛选成员
query - : 按成员状态筛选(仅Premium/Ultimate版本支持,可选
state或"awaiting")"active" - : 按特定用户ID筛选
user_ids
注意事项:
- 许多用户筛选条件(管理员、审计员、extern_uid、双因素认证)仅管理员可用
- 包含直接成员、继承成员和受邀成员
GITLAB_LIST_ALL_PROJECT_MEMBERS - 用户搜索不区分大小写,但可能无法匹配部分邮箱域名
- Premium/Ultimate版本专属功能(状态筛选、席位信息)在免费版本中不可用
Common Patterns
通用模式
ID Resolution
ID解析
GitLab uses two identifier formats for projects:
- Numeric ID: Integer project ID (e.g., )
123 - URL-encoded path: Namespace/project format (e.g., or
"my-group%2Fmy-project")"my-group/my-project" - Issue IID vs ID: is the project-internal number (#42); the global
issue_iidis differentid - User ID: Numeric; resolve via with
GITLAB_GET_USERSorsearchusername
GitLab为项目提供两种标识符格式:
- 数字ID: 整数类型的项目ID(例如:)
123 - URL编码路径: 命名空间/项目格式(例如:或
"my-group%2Fmy-project")"my-group/my-project" - 议题IID与ID: 是项目内部编号(#42);全局
issue_iid与之不同id - 用户ID: 数字类型;可通过的
GITLAB_GET_USERS或search参数解析username
Pagination
分页
GitLab uses offset-based pagination:
- Set (starting at 1) and
page(1-100, default 20)per_page - Continue incrementing until response returns fewer items than
pageor is emptyper_page - Total count may be available in response headers (,
X-Total)X-Total-Pages - Always paginate to completion for accurate results
GitLab使用基于偏移量的分页方式:
- 设置(从1开始)和
page(1-100,默认20)per_page - 持续递增直到返回结果数量少于
page或返回空结果per_page - 总数量可能在响应头中提供(、
X-Total)X-Total-Pages - 为获取准确结果,请始终完成全部分页请求
URL-Encoded Paths
URL编码路径
When using project paths as identifiers:
- Forward slashes must be URL-encoded: becomes
my-group/my-projectmy-group%2Fmy-project - Some tools accept unencoded paths; check schema for each tool
- Prefer numeric IDs when available for reliability
当使用项目路径作为标识符时:
- 斜杠必须进行URL编码:需转换为
my-group/my-projectmy-group%2Fmy-project - 部分工具支持未编码路径;请查阅每个工具的模式确认
- 如有可用,优先使用数字ID以提高可靠性
Known Pitfalls
已知注意事项
ID Formats
ID格式
- Project field accepts both integer and string (URL-encoded path)
id - Issue is project-scoped; do not confuse with global issue ID
issue_iid - Pipeline IDs are project-scoped integers
- User IDs are global integers across the GitLab instance
- 项目字段支持整数和字符串(URL编码路径)两种类型
id - 议题是项目范围内的ID;请勿与全局议题ID混淆
issue_iid - 流水线ID是项目范围内的整数
- 用户ID是GitLab实例全局唯一的整数
Rate Limits
速率限制
- GitLab has per-user rate limits (typically 300-2000 requests/minute depending on plan)
- Large pipeline/issue histories should use date and status filters to reduce result sets
- Paginate responsibly with moderate values
per_page
- GitLab对每个用户设置了速率限制(根据版本不同,通常为300-2000请求/分钟)
- 对于大型流水线/议题历史记录,请使用日期和状态筛选条件缩小结果范围
- 合理设置值,负责任地进行分页请求
per_page
Parameter Quirks
参数特殊性
- field replaces ALL labels; use
labels/add_labelsfor incremental changesremove_labels - unassigns all; empty array does nothing
assignee_ids: [0] - defaults vary:
scopefor MRs,"created_by_me"for issues"all" - and
author_idare mutually exclusive in MR filtersauthor_username - Date parameters use ISO 8601 format:
"2024-01-15T10:30:00Z"
- 字段会替换所有现有标签;如需增量修改,请使用
labels/add_labelsremove_labels - 可移除所有经办人;空数组无效果
assignee_ids: [0] - 默认参数值因操作而异:合并请求默认
scope,议题默认"created_by_me""all" - 合并请求筛选条件中,和
author_id不可同时使用author_username - 日期参数需使用ISO 8601格式:
"2024-01-15T10:30:00Z"
Plan Restrictions
版本限制
- Some features require Premium/Ultimate: ,
epic_id,weight,iteration_id, memberapproved_by_idsfilterstate - Admin-only features: user management filters, override, custom attributes
updated_at - The feature flag is disabled by default
mr_approved_filter
- 部分功能需要Premium/Ultimate版本:、
epic_id、weight、iteration_id、成员approved_by_ids筛选state - 仅管理员可用功能:用户管理筛选条件、覆盖、自定义属性
updated_at - 功能标志默认禁用
mr_approved_filter
Quick Reference
快速参考
| Task | Tool Slug | Key Params |
|---|---|---|
| List projects | | |
| Get project details | | |
| User's projects | | |
| Create project | | |
| List issues | | |
| Create issue | | |
| Update issue | | |
| List merge requests | | |
| List branches | | |
| Get branch | | |
| Create branch | | |
| List commits | | project ID, branch ref |
| Project languages | | project ID |
| List pipelines | | |
| Get pipeline | | |
| List pipeline jobs | | |
| Search users | | |
| Get user | | user ID |
| User status | | user ID |
| List project members | | |
| List project users | | |
| 任务 | 工具标识 | 关键参数 |
|---|---|---|
| 列出项目 | | |
| 获取项目详情 | | |
| 用户的项目 | | |
| 创建项目 | | |
| 列出议题 | | |
| 创建议题 | | |
| 更新议题 | | |
| 列出合并请求 | | |
| 列出分支 | | |
| 获取分支详情 | | |
| 创建分支 | | |
| 列出提交 | | project ID, branch ref |
| 项目语言占比 | | project ID |
| 列出流水线 | | |
| 获取流水线详情 | | |
| 列出流水线作业 | | |
| 搜索用户 | | |
| 获取用户详情 | | user ID |
| 用户状态 | | user ID |
| 列出项目成员 | | |
| 列出项目用户 | | |