Labsco
pdogra1299 logo

Bitbucket

24

from pdogra1299

Manage Bitbucket repositories, pull requests, and pipelines via the Bitbucket API for both Cloud and Server.

🔥🔥🔥🔥✓ VerifiedAccount requiredNeeds API keys

Bitbucket MCP Server

An MCP (Model Context Protocol) server that provides tools for interacting with the Bitbucket API, supporting both Bitbucket Cloud and Bitbucket Server.

Features

Available Tools (29 total)

PR Core (pr_core)

  • get_pull_request - Full PR details including comments, file changes, and merge info

  • list_pull_requests - List PRs with filters (state, author, pagination)

  • create_pull_request - Create new pull requests

  • update_pull_request - Update PR details (title, description, reviewers, destination branch)

  • merge_pull_request - Merge pull requests with various strategies

  • decline_pull_request - Decline/reject a pull request

PR Comments (pr_comments)

  • add_comment - Add general, inline, threaded, or suggestion comments to a PR (supports attachments, Server only)

  • delete_comment - Delete a comment from a pull request

Attachments — Bitbucket Server only (attachments)

  • manage_attachments - Download (action: "download") or delete (action: "delete") an existing repository attachment by numeric id

  • To upload a file, pass the attachments parameter to add_comment, create_pull_request, or update_pull_request (see Attachments ). There is no list operation — Bitbucket exposes no attachment-listing API.

Code Review (pr_review)

  • get_pull_request_diff - Structured line-by-line diff with ADDED/REMOVED/CONTEXT types

  • set_pr_approval - Approve (approved: true) or unapprove (approved: false) a PR

  • set_review_status - Request changes (request_changes: true) or remove the request (false)

PR Tasks — Bitbucket Server only (pr_tasks)

  • list_pr_tasks - List all tasks on a pull request

  • create_pr_task - Create a new task on a pull request

  • update_pr_task - Update the text of an existing task

  • set_pr_task_status - Mark a task done (done: true) or reopen it (done: false)

  • delete_pr_task - Delete a task from a pull request

  • convert_pr_item - Convert a comment to a task (direction: "to_task") or back ("to_comment")

Commits (commits)

  • list_pr_commits - List all commits in a pull request

  • list_branch_commits - List commits in a branch with date/author/message filters

  • get_commit_detail - Get the structured diff for a specific commit by SHA

Branches (branches)

  • list_branches - List branches with filtering and pagination

  • get_branch - Detailed branch info including associated PRs and stats

  • delete_branch - Delete a branch

Files (files)

  • list_directory_content - List files and directories in a repository path

  • get_file_content - Get file content with smart truncation for large files

  • search_files - Search for files by glob pattern (case-insensitive, like VS Code Ctrl+P)

  • get_file_blame - Per-line blame: who last modified each line, commit hash, and author timestamp (Bitbucket Server only)

Search — Bitbucket Server only (search)

  • search_code - Index-backed code search with Bitbucket modifiers (lang:, ext:, path:, archived:, fork:, -term), client-side regex_filter post-filter, snake_case ↔ camelCase fanout, and an index-reach probe that surfaces INDEX_GAP_LIKELY when the index returns nothing despite matching files existing

  • find_in_files - Content search via file listing + raw-content fan-out. Full PCRE regex; works on languages or branches Bitbucket's index does not cover; with rate-limit detection and honest scan diagnostics

  • search_repositories - Search for repositories by name, slug, or description

Discovery (discovery)

  • list_projects - List all accessible Bitbucket projects/workspaces

  • list_repositories - List repositories in a project or across all accessible projects

Token Optimization

v2.0.0 introduces significant token savings on every LLM request:

Configuration Tools exposed Est. tokens Bitbucket Server (all groups) 29 ~5,100 Bitbucket Cloud (auto-filtered) 21 ~3,900 Custom group preset (e.g. pr_core,pr_review,files) 12 ~2,100

Bitbucket Cloud automatically hides the 10 server-only tools with no configuration needed.

BITBUCKET_TOOL_GROUPS lets you expose only the groups relevant to your workflow — see Tool Group Filtering below.

Tool Group Filtering

Reduce the number of tools sent to the LLM on every request by setting BITBUCKET_TOOL_GROUPS to a comma-separated list of group names. Only tools in the listed groups will be exposed.

Available groups

Group Tools Platform pr_core get_pull_request, list_pull_requests, create_pull_request, update_pull_request, merge_pull_request, decline_pull_request Both pr_comments add_comment, delete_comment Both attachments manage_attachments Server only pr_review get_pull_request_diff, set_pr_approval, set_review_status Both pr_tasks list_pr_tasks, create_pr_task, update_pr_task, set_pr_task_status, delete_pr_task, convert_pr_item Server only commits list_pr_commits, list_branch_commits, get_commit_detail Both branches list_branches, get_branch, delete_branch Both files list_directory_content, get_file_content, search_files, get_file_blame (Server only) Both search search_code, find_in_files, search_repositories Server only discovery list_projects, list_repositories Both

Example presets

PR review workflow (~2,100 tokens):

Copy & paste — that's it
"env": {
 "BITBUCKET_TOOL_GROUPS": "pr_core,pr_review,files"
}

Full PR management (~3,500 tokens):

Copy & paste — that's it
"env": {
 "BITBUCKET_TOOL_GROUPS": "pr_core,pr_comments,pr_review,pr_tasks"
}

Code exploration only (~1,400 tokens):

Copy & paste — that's it
"env": {
 "BITBUCKET_TOOL_GROUPS": "files,search,discovery"
}

When BITBUCKET_TOOL_GROUPS is not set, all applicable tools are exposed (default behaviour). Bitbucket Cloud users always have server-only tools automatically hidden regardless of this setting.

Attachments

Bitbucket Server / Data Center only. Bitbucket Cloud has no public REST API for attaching files to pull requests or comments, so any use of the attachments parameter or the manage_attachments tool on a Cloud connection returns a clear error.

Uploading & embedding

Pass an attachments array to add_comment, create_pull_request, or update_pull_request. Each file is uploaded to the repository, and a Markdown reference (attachment:N/M) is appended to the comment body / PR description automatically. Each item is either a local file path string or an object { file_path, alt_text?, render? }:

  • render: "image" → embeds inline as ![alt](attachment:N/M)

  • render: "link" → embeds as a download link [alt](attachment:N/M)

  • render: "auto" (default) → image for image file types, otherwise a link

Copy & paste — that's it
{
 "tool": "add_comment",
 "arguments": {
 "workspace": "PROJ",
 "repository": "my-repo",
 "pull_request_id": 42,
 "comment_text": "Here's the crash I'm seeing:",
 "attachments": ["/tmp/screenshot.png"]
 }
}
Copy & paste — that's it
{
 "tool": "update_pull_request",
 "arguments": {
 "workspace": "PROJ",
 "repository": "my-repo",
 "pull_request_id": 42,
 "attachments": [
 { "file_path": "/tmp/architecture.png", "alt_text": "Architecture", "render": "image" },
 { "file_path": "/tmp/report.csv", "render": "link" }
 ]
 }
}

When only attachments are supplied to update_pull_request (no description), the references are appended to the PR's existing description rather than replacing it.

Downloading & deleting

Use manage_attachments with the numeric attachment id (the trailing number of an attachment:N/M reference, e.g. 3 from attachment:1/3):

Copy & paste — that's it
{ "tool": "manage_attachments", "arguments": { "workspace": "PROJ", "repository": "my-repo", "action": "download", "attachment_id": "3" } }
{ "tool": "manage_attachments", "arguments": { "workspace": "PROJ", "repository": "my-repo", "action": "delete", "attachment_id": "3" } }

download returns text inline, images as an image block, and a metadata summary for other types. delete requires REPO_ADMIN. There is no list action — Bitbucket exposes no attachment-listing API.

Note: Bitbucket's attachment upload endpoint is private/undocumented (the download/delete endpoints are documented). It works on Bitbucket Server/Data Center 7.x+; the server tolerates the two known upload path variants and may change in future Bitbucket releases.

Development

  • npm run dev - Watch mode for development

  • npm run build - Build the TypeScript code

  • npm start - Run the built server

License

MIT