bitbucket-mcp
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., "@bitbucket-mcp show the diff for pull request #42"
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.
bitbucket-mcp
A Model Context Protocol server for Bitbucket Cloud. Review, manage, and merge pull requests, assign reviewers by name, read files at a ref, and inspect pipeline status — from any MCP client (Claude Desktop, Cursor, Claude Code) or a hosted HTTP endpoint.
It talks to the Bitbucket Cloud REST API v2.0 with a single access token. All read paths are paginated and capped; write tools (create/merge PR, comments, reviewers) are explicit.
Tools
All tools are prefixed bb_.
Tool | What it does |
| List PRs in a repo, filtered by state |
| Full detail for one PR |
| Unified diff for a PR |
| All comments on a PR (inline + general) |
| Aggregated build/status checks for a PR |
| Commit statuses for an arbitrary ref |
| Open a PR (optionally with reviewers) |
| Merge a PR (merge_commit / squash / fast_forward) |
| Add a comment (optionally inline on a file/line) |
| Edit one of your comments |
| Delete one of your comments |
| Assign reviewers by name or UUID |
| Inspect the local known-members directory |
| Read a file's contents at a branch/commit |
Assigning reviewers by name
Bitbucket's /workspaces/{workspace}/members endpoint requires the account
scope (which PR tokens don't carry), so you can't resolve a person's name to
their account UUID over the API. This server keeps a small local directory
of known members so bb_add_pull_request_reviewers accepts a plain name (e.g.
"Jane Doe") and resolves it offline. Raw account UUIDs always work too.
Seed people in either place (both use the same JSON shape; the env var merges on top of the file):
tools/bitbucket/directory.json— copydirectory.example.jsonand fill it in. This file is git-ignored so real account UUIDs never get committed.BITBUCKET_KNOWN_MEMBERSenv var — handy for hosted deploys.
{
"your-workspace-slug": [
{ "uuid": "{00000000-0000-0000-0000-000000000000}", "display_name": "Jane Doe", "nickname": "Jane" }
]
}Related MCP server: Bitbucket MCP
Configuration
Set via environment variables (see .env.example). Prefix BITBUCKET_.
Variable | Required | Description |
| ✅ | Access token (Bearer) or app password |
| — | Set only when using an app password (switches to Basic auth) |
| — | Default workspace slug, so tools don't need it each call |
| — | Default repo slug |
| — | JSON of extra known members (merged over |
| — | Pagination cap (default |
| — | HTTP timeout in seconds (default |
Tools are always listed but return a clear "not configured" error if
BITBUCKET_API_KEY is missing, so the server starts cleanly without secrets.
Quick start (local, stdio)
Requires Python 3.11+.
git clone https://github.com/matt-nann/bitbucket-mcp.git
cd bitbucket-mcp
python -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
export BITBUCKET_API_KEY=your-token
python server.py # stdio (default)Wire it into an MCP client
Claude Desktop (claude_desktop_config.json) / Cursor (~/.cursor/mcp.json):
{
"mcpServers": {
"bitbucket": {
"command": "python",
"args": ["/absolute/path/to/bitbucket-mcp/server.py"],
"env": {
"BITBUCKET_API_KEY": "your-token",
"BITBUCKET_WORKSPACE": "your-workspace-slug"
}
}
}
}Claude Code:
claude mcp add bitbucket \
--env BITBUCKET_API_KEY=your-token \
--env BITBUCKET_WORKSPACE=your-workspace-slug \
-- python /absolute/path/to/bitbucket-mcp/server.pyHosting (HTTP)
The same server runs over streamable HTTP for a shared/hosted deployment. It
binds dual-stack IPv6 and honors $PORT, so it works on Railway (and
Fly/Heroku/Docker) out of the box:
MCP_TRANSPORT=http PORT=8000 python server.py --http
# MCP endpoint: http://localhost:8000/mcp health: /health⚠️ HTTP mode has no built-in authentication and every request uses the one
BITBUCKET_API_KEY identity. Don't expose it publicly without an auth proxy in
front. See HOSTING.md for the full Railway walkthrough,
Docker instructions, and the security model.
Provenance
Extracted from a larger internal multi-tool MCP server into a standalone, self-contained package. No internal identifiers or shared auth layers are included; the member directory ships only as a placeholder example.
License
Available Tools
9 toolsbb_create_pull_requestB
Create a new Bitbucket pull request.
Args: title: PR title. source_branch: Source branch name. destination_branch: Destination branch name (default "main"). description: PR description (Markdown). reviewers: List of Bitbucket account UUIDs. close_source_branch: Delete source branch after merge. workspace: Bitbucket workspace slug. repo: Repository slug.
Inputs: title (required), source_branch (required), repo, reviewers, +4 more. Returns: object
bb_create_pull_request_commentA
Add a comment to a Bitbucket pull request — general or inline on a specific file/line.
Args: pull_request_id: The PR id (number). content: Comment body (Markdown). inline_path: File path for inline comment. inline_to: Line number in new version. inline_from: Line number in old version. workspace: Bitbucket workspace slug. repo: Repository slug.
Inputs: content (required), pull_request_id (required), repo, inline_to, +3 more. Returns: object
bb_delete_pull_request_commentA
Delete a comment from a Bitbucket pull request.
Permanently removes the comment. Only the comment's author may delete it — deleting someone else's comment fails with an authorization error. Get comment ids from bb_get_pull_request_comments. Returns a confirmation with the deleted comment id.
Args: pull_request_id: The PR id (number). comment_id: The id of the comment to delete. workspace: Bitbucket workspace slug. repo: Repository slug.
Inputs: comment_id (required), pull_request_id (required), repo, workspace. Returns: object
bb_edit_pull_request_commentA
Edit the body of an existing Bitbucket pull request comment.
Replaces the comment's content with content and returns the updated
comment. Only the comment's author may edit it — editing someone else's
comment fails with an authorization error. Get comment ids from
bb_get_pull_request_comments.
Args: pull_request_id: The PR id (number). comment_id: The id of the comment to edit. content: New comment body (Markdown), replaces the old one. workspace: Bitbucket workspace slug. repo: Repository slug.
Inputs: content (required), comment_id (required), pull_request_id (required), repo, +1 more. Returns: object
bb_get_pull_requestA
Get a Bitbucket PR's metadata: title, description, author, branches, reviewers, state.
Args: pull_request_id: The PR id (number). workspace: Bitbucket workspace slug. repo: Repository slug.
Inputs: pull_request_id (required), repo, workspace. Returns: object
bb_get_pull_request_commentsA
Get the review discussion on a Bitbucket PR (general and inline comments).
Args: pull_request_id: The PR id (number). workspace: Bitbucket workspace slug. repo: Repository slug.
Inputs: pull_request_id (required), repo, workspace. Returns: object
bb_get_pull_request_diffB
Get the unified diff for a Bitbucket PR. Returns raw diff text.
Args: pull_request_id: The PR id (number). file_path: Optional file path filter. workspace: Bitbucket workspace slug. repo: Repository slug.
Inputs: pull_request_id (required), repo, file_path, workspace. Returns: result
bb_get_pull_request_statusA
Get CI/build status for a Bitbucket PR's latest commit.
Args: pull_request_id: The PR id (number). workspace: Bitbucket workspace slug. repo: Repository slug.
Inputs: pull_request_id (required), repo, workspace. Returns: object
bb_list_workspace_membersA
List known workspace members to resolve a person's name to their UUID.
Members come from the local known-members directory (see directory.py).
Bitbucket's live members API is not used: it requires the account
scope the MCP token doesn't carry, so it only ever returned 403. The
directory is the single source of truth — seed people into
directory.json or the BITBUCKET_KNOWN_MEMBERS env var.
You usually don't need to call this before bb_add_pull_request_reviewers — that tool resolves names against the same directory itself. Use this to inspect who is known, or when a name is ambiguous. If more than one member matches, present the candidates rather than guessing.
Args: query: Optional case-insensitive name filter (display name or nickname). workspace: Bitbucket workspace slug.
Inputs: query, workspace. Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 9 tools
Each tool targets a distinct action on pull requests or workspace members. No two tools overlap in purpose; create, get, diff, status, and comment operations are clearly separated.
All tools follow a consistent 'bb_verb_noun' pattern (e.g., bb_create_pull_request, bb_get_pull_request_comments). The naming is uniform and predictable across the entire set.
With 9 tools, the server is well-scoped for Bitbucket pull request management. It covers core operations without being overly broad or too sparse.
While comment CRUD is fully covered, missing operations like listing, updating, merging, or declining pull requests create gaps for a complete PR workflow. The workspace members list is a helpful auxiliary tool.
Maintenance
Related MCP Connectors
A MCP server built for developers enabling Git based project management with project and personal…
MCP Server for JFrog, providing tools for development and artifact management.
The MCP server for Azure DevOps, bringing the power of Azure DevOps directly to your agents.
MCP server for Appcircle mobile CI/CD platform.
Related MCP Servers
- AlicenseBqualityCmaintenanceAn MCP server that enables interaction with Bitbucket repositories through the Model Context Protocol, supporting both Bitbucket Cloud and Server with features for PR lifecycle management and code review.208,411 npm30MIT
- AlicenseBqualityDmaintenanceAn MCP server for Bitbucket Cloud that enables managing pull requests, branches, and repositories in natural language from any MCP-capable client.23387 npm4MIT
- AlicenseBqualityBmaintenanceMCP server for Bitbucket Server integration, enabling project, repository, pull request, source code, branch, and code review operations via the Bitbucket Server APIs.2789 npmMIT
- FlicenseCqualityDmaintenanceAn MCP server for Bitbucket Cloud, covering pull requests, pull request comments, and pipelines.26-