Bitbucket Automation via Rube MCP
Automate Bitbucket operations including repository management, pull request workflows, branch operations, issue tracking, and workspace administration through Composio's Bitbucket toolkit.
Prerequisites
- - Rube MCP must be connected (RUBESEARCHTOOLS available)
- Active Bitbucket connection via
RUBE_MANAGE_CONNECTIONS with toolkit INLINECODE1 - Always call
RUBE_SEARCH_TOOLS first to get current tool schemas
Setup
Get Rube MCP: Add https://rube.app/mcp as an MCP server in your client configuration. No API keys needed — just add the endpoint and it works.
- 1. Verify Rube MCP is available by confirming
RUBE_SEARCH_TOOLS responds - Call
RUBE_MANAGE_CONNECTIONS with toolkit INLINECODE6 - If connection is not ACTIVE, follow the returned auth link to complete Bitbucket OAuth
- Confirm connection status shows ACTIVE before running any workflows
Core Workflows
1. Manage Pull Requests
When to use: User wants to create, review, or inspect pull requests
Tool sequence:
- 1.
BITBUCKET_LIST_WORKSPACES - Discover accessible workspaces [Prerequisite] - INLINECODE8 - Find the target repository [Prerequisite]
- INLINECODE9 - Verify source and destination branches exist [Prerequisite]
- INLINECODE10 - Create a new PR with title, source branch, and optional reviewers [Required]
- INLINECODE11 - List PRs filtered by state (OPEN, MERGED, DECLINED) [Optional]
- INLINECODE12 - Get full details of a specific PR by ID [Optional]
- INLINECODE13 - Fetch unified diff for code review [Optional]
- INLINECODE14 - Get changed files with lines added/removed [Optional]
Key parameters:
- -
workspace: Workspace slug or UUID (required for all operations) - INLINECODE16 : URL-friendly repository name
- INLINECODE17 : Branch with changes to merge
- INLINECODE18 : Target branch (defaults to repo main branch if omitted)
- INLINECODE19 : List of objects with
uuid field for reviewer assignment - INLINECODE21 : Filter for LISTPULLREQUESTS -
OPEN, MERGED, or INLINECODE24 - INLINECODE25 : Truncation limit for GETPULLREQUEST_DIFF to handle large diffs
Pitfalls:
- -
reviewers expects an array of objects with uuid key, NOT usernames: INLINECODE28 - UUID format must include curly braces: INLINECODE29
- INLINECODE30 defaults to the repo's main branch if omitted, which may not be INLINECODE31
- INLINECODE32 is an integer for GET/DIFF operations but comes back as part of PR listing
- Large diffs can overwhelm context; always set
max_chars (e.g., 50000) on GETPULLREQUEST_DIFF
2. Manage Repositories and Workspaces
When to use: User wants to list, create, or delete repositories or explore workspaces
Tool sequence:
- 1.
BITBUCKET_LIST_WORKSPACES - List all accessible workspaces [Required] - INLINECODE35 - List repos with optional BBQL filtering [Required]
- INLINECODE36 - Create a new repo with language, privacy, and project settings [Optional]
- INLINECODE37 - Permanently delete a repository (irreversible) [Optional]
- INLINECODE38 - List members for reviewer assignment or access checks [Optional]
Key parameters:
- -
workspace: Workspace slug (find via LIST_WORKSPACES) - INLINECODE40 : URL-friendly name for create/delete
- INLINECODE41 : BBQL query filter (e.g.,
name~"api", project.key="PROJ", is_private=true) - INLINECODE45 : Filter repos by user role:
member, contributor, admin, INLINECODE49 - INLINECODE50 : Sort field with optional
- prefix for descending (e.g., -updated_on) - INLINECODE53 : Boolean for repository visibility (defaults to
true) - INLINECODE55 : Bitbucket project key; omit to use workspace's oldest project
Pitfalls:
- -
BITBUCKET_DELETE_REPOSITORY is irreversible and does not affect forks - BBQL string values MUST be enclosed in double quotes:
name~"my-repo" not INLINECODE58 - INLINECODE59 is NOT a valid BBQL field; use
name instead - Default pagination is 10 results; set
pagelen explicitly for complete listings - INLINECODE62 defaults to private; set
is_private: false for public repos
3. Manage Issues
When to use: User wants to create, update, list, or comment on repository issues
Tool sequence:
- 1.
BITBUCKET_LIST_ISSUES - List issues with optional filters for state, priority, kind, assignee [Required] - INLINECODE65 - Create a new issue with title, content, priority, and kind [Required]
- INLINECODE66 - Modify issue attributes (state, priority, assignee, etc.) [Optional]
- INLINECODE67 - Add a markdown comment to an existing issue [Optional]
- INLINECODE68 - Permanently delete an issue [Optional]
Key parameters:
- -
issue_id: String identifier for the issue - INLINECODE70 ,
content: Required for creation - INLINECODE72 :
bug, enhancement, proposal, or INLINECODE76 - INLINECODE77 :
trivial, minor, major, critical, or INLINECODE82 - INLINECODE83 :
new, open, resolved, on hold, invalid, duplicate, wontfix, INLINECODE91 - INLINECODE92 : Bitbucket username for CREATE;
assignee_account_id (UUID) for UPDATE - INLINECODE94 : ISO 8601 format date string
Pitfalls:
- - Issue tracker must be enabled on the repository (
has_issues: true) or API calls will fail - INLINECODE96 uses
assignee (username string), but UPDATE_ISSUE uses assignee_account_id (UUID) -- they are different fields - INLINECODE100 is permanent with no undo
- INLINECODE101 values include spaces:
"on hold" not INLINECODE103 - Filtering by
assignee in LIST_ISSUES uses account ID, not username; use "null" string for unassigned
4. Manage Branches
When to use: User wants to create branches or explore branch structure
Tool sequence:
- 1.
BITBUCKET_LIST_BRANCHES - List branches with optional BBQL filter and sorting [Required] - INLINECODE107 - Create a new branch from a specific commit hash [Required]
Key parameters:
- -
name: Branch name without refs/heads/ prefix (e.g., feature/new-login) - INLINECODE111 : Full SHA1 commit hash to branch from (must exist in repo)
- INLINECODE112 : BBQL filter (e.g.,
name~"feature/", name="main") - INLINECODE115 : Sort by
name or -target.date (descending commit date) - INLINECODE118 : 1-100 results per page (default is 10)
Pitfalls:
- -
CREATE_BRANCH requires a full commit hash, NOT a branch name as INLINECODE120 - Do NOT include
refs/heads/ prefix in branch names - Branch names must follow Bitbucket naming conventions (alphanumeric,
/, ., _, -) - BBQL string values need double quotes:
name~"feature/" not INLINECODE127
5. Review Pull Requests with Comments
When to use: User wants to add review comments to pull requests, including inline code comments
Tool sequence:
- 1.
BITBUCKET_GET_PULL_REQUEST - Get PR details and verify it exists [Prerequisite] - INLINECODE129 - Review the actual code changes [Prerequisite]
- INLINECODE130 - Get list of changed files [Optional]
- INLINECODE131 - Post review comments [Required]
Key parameters:
- -
pull_request_id: String ID of the PR - INLINECODE133 : Markdown-formatted comment text
- INLINECODE134 : Defaults to
markdown; also supports INLINECODE136 - INLINECODE137 : Object with
path, from, to for inline code comments - INLINECODE141 : Integer ID for threaded replies to existing comments
Pitfalls:
- -
pull_request_id is a string in CREATEPULLREQUESTCOMMENT but an integer in GETPULL_REQUEST - Inline comments require
inline.path at minimum; from/to are optional line numbers - INLINECODE146 creates a threaded reply; omit for top-level comments
- Line numbers in inline comments reference the diff, not the source file
Common Patterns
ID Resolution
Always resolve human-readable names to IDs before operations:
- - Workspace:
BITBUCKET_LIST_WORKSPACES to get workspace slugs - Repository:
BITBUCKET_LIST_REPOSITORIES_IN_WORKSPACE with q filter to find repo slugs - Branch:
BITBUCKET_LIST_BRANCHES to verify branch existence before PR creation - Members:
BITBUCKET_LIST_WORKSPACE_MEMBERS to get UUIDs for reviewer assignment
Pagination
Bitbucket uses page-based pagination (not cursor-based):
- - Use
page (starts at 1) and pagelen (items per page) parameters - Default page size is typically 10; set
pagelen explicitly (max 50 for PRs, 100 for others) - Check response for
next URL or total count to determine if more pages exist - Always iterate through all pages for complete results
BBQL Filtering
Bitbucket Query Language is available on list endpoints:
- - String values MUST use double quotes: INLINECODE156
- Operators:
= (exact), ~ (contains), != (not equal), >, >=, <, INLINECODE163 - Combine with
AND / OR: INLINECODE166
Known Pitfalls
ID Formats
- - Workspace: slug string (e.g.,
my-workspace) or UUID in braces ({uuid}) - Reviewer UUIDs must include curly braces: INLINECODE169
- Issue IDs are strings; PR IDs are integers in some tools, strings in others
- Commit hashes must be full SHA1 (40 characters)
Parameter Quirks
- -
assignee vs assignee_account_id: CREATEISSUE uses username, UPDATEISSUE uses UUID - INLINECODE172 values for issues include spaces:
"on hold", not INLINECODE174 - INLINECODE175 omission defaults to repo main branch, not
main literally - BBQL
repository is not a valid field -- use INLINECODE178
Rate Limits
- - Bitbucket Cloud API has rate limits; large batch operations should include delays
- Paginated requests count against rate limits; minimize unnecessary page fetches
Destructive Operations
- -
BITBUCKET_DELETE_REPOSITORY is irreversible and does not remove forks - INLINECODE180 is permanent with no recovery option
- Always confirm with the user before executing delete operations
Quick Reference
| Task | Tool Slug | Key Params |
|---|
| List workspaces | INLINECODE181 | INLINECODE182 , INLINECODE183 |
| List repos |
BITBUCKET_LIST_REPOSITORIES_IN_WORKSPACE |
workspace,
q,
role |
| Create repo |
BITBUCKET_CREATE_REPOSITORY |
workspace,
repo_slug,
is_private |
| Delete repo |
BITBUCKET_DELETE_REPOSITORY |
workspace,
repo_slug |
| List branches |
BITBUCKET_LIST_BRANCHES |
workspace,
repo_slug,
q |
| Create branch |
BITBUCKET_CREATE_BRANCH |
workspace,
repo_slug,
name,
target_hash |
| List PRs |
BITBUCKET_LIST_PULL_REQUESTS |
workspace,
repo_slug,
state |
| Create PR |
BITBUCKET_CREATE_PULL_REQUEST |
workspace,
repo_slug,
title,
source_branch |
| Get PR details |
BITBUCKET_GET_PULL_REQUEST |
workspace,
repo_slug,
pull_request_id |
| Get PR diff |
BITBUCKET_GET_PULL_REQUEST_DIFF |
workspace,
repo_slug,
pull_request_id,
max_chars |
| Get PR diffstat |
BITBUCKET_GET_PULL_REQUEST_DIFFSTAT |
workspace,
repo_slug,
pull_request_id |
| Comment on PR |
BITBUCKET_CREATE_PULL_REQUEST_COMMENT |
workspace,
repo_slug,
pull_request_id,
content_raw |
| List issues |
BITBUCKET_LIST_ISSUES |
workspace,
repo_slug,
state,
priority |
| Create issue |
BITBUCKET_CREATE_ISSUE |
workspace,
repo_slug,
title,
content |
| Update issue |
BITBUCKET_UPDATE_ISSUE |
workspace,
repo_slug,
issue_id |
| Comment on issue |
BITBUCKET_CREATE_ISSUE_COMMENT |
workspace,
repo_slug,
issue_id,
content |
| Delete issue |
BITBUCKET_DELETE_ISSUE |
workspace,
repo_slug,
issue_id |
| List members |
BITBUCKET_LIST_WORKSPACE_MEMBERS |
workspace |
通过 Rube MCP 实现 Bitbucket 自动化
通过 Composio 的 Bitbucket 工具包自动化 Bitbucket 操作,包括仓库管理、拉取请求工作流、分支操作、问题跟踪和工作区管理。
前提条件
- - 必须连接 Rube MCP(RUBESEARCHTOOLS 可用)
- 通过 RUBEMANAGECONNECTIONS 使用 bitbucket 工具包建立活跃的 Bitbucket 连接
- 始终先调用 RUBESEARCHTOOLS 获取当前工具架构
设置
获取 Rube MCP:在客户端配置中将 https://rube.app/mcp 添加为 MCP 服务器。无需 API 密钥——只需添加端点即可使用。
- 1. 通过确认 RUBESEARCHTOOLS 有响应来验证 Rube MCP 可用
- 使用 bitbucket 工具包调用 RUBEMANAGECONNECTIONS
- 如果连接状态不是 ACTIVE,按照返回的认证链接完成 Bitbucket OAuth
- 在运行任何工作流之前确认连接状态显示为 ACTIVE
核心工作流
1. 管理拉取请求
使用场景:用户想要创建、审查或检查拉取请求
工具序列:
- 1. BITBUCKETLISTWORKSPACES - 发现可访问的工作区 [前提条件]
- BITBUCKETLISTREPOSITORIESINWORKSPACE - 查找目标仓库 [前提条件]
- BITBUCKETLISTBRANCHES - 验证源分支和目标分支存在 [前提条件]
- BITBUCKETCREATEPULLREQUEST - 创建带有标题、源分支和可选审查者的新 PR [必需]
- BITBUCKETLISTPULLREQUESTS - 按状态(OPEN、MERGED、DECLINED)筛选列出 PR [可选]
- BITBUCKETGETPULLREQUEST - 获取特定 PR 的完整详情 [可选]
- BITBUCKETGETPULLREQUESTDIFF - 获取统一差异以进行代码审查 [可选]
- BITBUCKETGETPULLREQUEST_DIFFSTAT - 获取更改文件及其增删行数 [可选]
关键参数:
- - workspace:工作区标识符或 UUID(所有操作必需)
- reposlug:URL 友好的仓库名称
- sourcebranch:包含要合并更改的分支
- destinationbranch:目标分支(如果省略,默认为仓库主分支)
- reviewers:包含 uuid 字段的审查者分配对象列表
- state:LISTPULLREQUESTS 的筛选条件 - OPEN、MERGED 或 DECLINED
- maxchars:GETPULLREQUEST_DIFF 的截断限制,用于处理大型差异
注意事项:
- - reviewers 期望包含 uuid 键的对象数组,而不是用户名:[{uuid: {...}}]
- UUID 格式必须包含花括号:{123e4567-e89b-12d3-a456-426614174000}
- 如果省略 destinationbranch,默认为仓库的主分支,可能不是 main
- pullrequestid 在 GET/DIFF 操作中是整数,但作为 PR 列表的一部分返回
- 大型差异可能超出上下文限制;始终在 GETPULLREQUESTDIFF 上设置 max_chars(例如 50000)
2. 管理仓库和工作区
使用场景:用户想要列出、创建或删除仓库,或探索工作区
工具序列:
- 1. BITBUCKETLISTWORKSPACES - 列出所有可访问的工作区 [必需]
- BITBUCKETLISTREPOSITORIESINWORKSPACE - 使用可选的 BBQL 筛选列出仓库 [必需]
- BITBUCKETCREATEREPOSITORY - 使用语言、隐私和项目设置创建新仓库 [可选]
- BITBUCKETDELETEREPOSITORY - 永久删除仓库(不可逆) [可选]
- BITBUCKETLISTWORKSPACE_MEMBERS - 列出成员以分配审查者或检查访问权限 [可选]
关键参数:
- - workspace:工作区标识符(通过 LISTWORKSPACES 查找)
- reposlug:创建/删除的 URL 友好名称
- q:BBQL 查询筛选(例如 name~api、project.key=PROJ、isprivate=true)
- role:按用户角色筛选仓库:member、contributor、admin、owner
- sort:排序字段,可选 - 前缀表示降序(例如 -updatedon)
- isprivate:仓库可见性的布尔值(默认为 true)
- projectkey:Bitbucket 项目键;省略则使用工作区最旧的项目
注意事项:
- - BITBUCKETDELETEREPOSITORY 是不可逆的,且不影响分支
- BBQL 字符串值必须用双引号括起来:name~my-repo 而不是 name~my-repo
- repository 不是有效的 BBQL 字段;请使用 name
- 默认分页为 10 条结果;设置 pagelen 以获取完整列表
- CREATEREPOSITORY 默认为私有;设置 isprivate: false 以创建公开仓库
3. 管理问题
使用场景:用户想要创建、更新、列出或评论仓库问题
工具序列:
- 1. BITBUCKETLISTISSUES - 使用可选的状态、优先级、类型、分配者筛选列出问题 [必需]
- BITBUCKETCREATEISSUE - 使用标题、内容、优先级和类型创建新问题 [必需]
- BITBUCKETUPDATEISSUE - 修改问题属性(状态、优先级、分配者等) [可选]
- BITBUCKETCREATEISSUECOMMENT - 向现有问题添加 Markdown 评论 [可选]
- BITBUCKETDELETE_ISSUE - 永久删除问题 [可选]
关键参数:
- - issueid:问题的字符串标识符
- title、content:创建时必需
- kind:bug、enhancement、proposal 或 task
- priority:trivial、minor、major、critical 或 blocker
- state:new、open、resolved、on hold、invalid、duplicate、wontfix、closed
- assignee:CREATE 时的 Bitbucket 用户名;UPDATE 时的 assigneeaccountid(UUID)
- dueon:ISO 8601 格式的日期字符串
注意事项:
- - 必须在仓库上启用问题跟踪器(hasissues: true),否则 API 调用将失败
- CREATEISSUE 使用 assignee(用户名字符串),但 UPDATEISSUE 使用 assigneeaccountid(UUID)——它们是不同的字段
- DELETEISSUE 是永久性的,无法撤销
- state 值包含空格:on hold 而不是 onhold
- 在 LISTISSUES 中按 assignee 筛选使用账户 ID,而不是用户名;未分配的使用 null 字符串
4. 管理分支
使用场景:用户想要创建分支或探索分支结构
工具序列:
- 1. BITBUCKETLISTBRANCHES - 使用可选的 BBQL 筛选和排序列出分支 [必需]
- BITBUCKETCREATEBRANCH - 从特定提交哈希创建新分支 [必需]
关键参数:
- - name:不带 refs/heads/ 前缀的分支名称(例如 feature/new-login)
- target_hash:要分支的完整 SHA1 提交哈希(必须在仓库中存在)
- q:BBQL 筛选(例如 name~feature/、name=main)
- sort:按 name 或 -target.date(降序提交日期)排序
- pagelen:每页 1-100 条结果(默认为 10)
注意事项:
- - CREATE_BRANCH 需要完整的提交哈希,而不是分支