Bitbucket Cloud MCP
Integrates with Bitbucket Cloud's pull-request API to list and inspect pull requests, retrieve PR diffs and changed-file patches, list and create comments, create same-repository pull requests, and approve or withdraw approvals as the configured token owner.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
Bitbucket Cloud MCP
A Rust MCP server for Bitbucket Cloud repositories, pull requests, and snippets over stdio. The optional Pi extension asks for fresh consent before approving a pull request or withdrawing an approval.
Requirements
Rust 1.88 or later with Rust edition 2024 support.
A Bitbucket Cloud account, an API token, and a workspace. Bitbucket Server and Data Center are not supported.
Node.js and npm only if you use or test the Pi consent extension.
Grant the API token only the scopes you need:
Scope | Use |
| Discover repositories and read diffs. |
| Read pull requests and review activity. |
| Create pull requests, post comments, and manage your approvals. |
| List and read snippets. Also required for snippet writes. |
| Create and update snippets. Does not grant read access. |
Related MCP server: Juror Cloud MCP
Setup
1. Build the server
cargo build --locked --release2. Set the server environment
Use your secret manager or MCP host to supply credentials. See .env.example for reference. The server does not load dotenv files. Never commit credentials or put a real token in a shell command.
Variable | Required | Value |
| Yes | Email address for the token owner. |
| Yes | Bitbucket Cloud API token. |
| Yes | Workspace slug. All tools use this workspace; no tool accepts a workspace override. |
| No | Defaults to |
| No | Defaults to |
The server accepts HTTPS and allows HTTP only on loopback for local tests. The base URL cannot contain credentials, a query string, or a fragment. Disabling TLS verification applies to every request and prints a warning to stderr. Do not use it to bypass certificate errors against Bitbucket Cloud.
3. Configure your MCP client
Point the client at the built target/release/mcp-bitbucket binary and use stdio. Adapt the environment variable syntax to your client:
{
"mcpServers": {
"bitbucket": {
"command": "/absolute/path/to/mcp-bitbucket",
"env": {
"BITBUCKET_EMAIL": "${BITBUCKET_EMAIL}",
"BITBUCKET_API_TOKEN": "${BITBUCKET_API_TOKEN}",
"BITBUCKET_WORKSPACE": "${BITBUCKET_WORKSPACE}"
}
}
}
}Tools
Repositories
Tool | Description |
| Find repositories whose name or slug contains a literal, case-insensitive substring. |
Pull requests
Tool | Description |
| List pull requests in a repository. |
| Read a pull request, including its description. |
| Read the bounded pull-request diff. |
| List changed paths, statuses, and available line counts. Returns up to 50 files per page. |
| Read Bitbucket's patch for one repository-relative path. Returns up to 500 KB and reports truncation. |
| Create a non-draft pull request between two explicit branches in the same repository. Optional reviewers use Bitbucket UUIDs. |
Review
Tool | Description |
| List comments on a pull request. |
| Post a general comment, reply to a comment, or comment on one line of the current diff. |
| Approve a pull request as the token owner. |
| Withdraw the token owner's approval. |
| List current approvers and count their approvals. Does not check whether the pull request can merge. |
Snippets
Tool | Description |
| List visible snippets. Optionally filter by |
| Read a snippet's title, privacy, and filenames. Returns the current revision when the file links agree on it. |
| Read a UTF-8 file by exact relative path, including nested directories. Reads the current revision by default or accepts a full commit SHA. |
| Create a private snippet with a title and one or more text files. Returns only |
| Change the title or add or replace files in a private snippet. File changes require the current revision. |
Use the opaque snippet ID, not the numeric API ID or a URL. Reads reject partial, oversized, and non-text file responses. A file response can be at most 1,000,000 bytes. Snippet requests do not follow redirects.
Titles must be nonblank and at most 500 bytes. Uploads accept up to 10 files with unique basenames, up to 256,000 bytes each and 500,000 bytes total. Omitted files stay unchanged. The tools do not delete snippets, remove or rename files, or change visibility.
The server checks privacy before every update, but Bitbucket does not offer a way to make that check atomic with the write. Public snippets and snippets whose privacy cannot be confirmed are not editable. Title-only updates do not require a revision.
Pagination
List tools return values, next_page, and truncated. Pass next_page back as page on the same tool. Keep the original filters and page size when the tool accepts them. Stop when there is no next page, not when values is empty.
Repository search accepts query, page, and pagelen. It reads one upstream page per call. Reuse its cursor with the same query and page size.
Omit role on the first snippet page to list all snippets visible to the token owner. See Bitbucket's snippet role definitions for filtered listings. To continue, omit role or repeat the original value.
Repository and snippet cursors belong to the running server. Restart the listing if the server restarted or evicted the cursor.
Diffs and inline comments
For a large pull request, list changed files first with {"repo_slug":"demo","pull_request_id":42,"pagelen":25}. Then read one patch with {"repo_slug":"demo","pull_request_id":42,"path":"src/lib.rs"}. Bitbucket controls filtering for renamed files and may not match both names. Fetch the patch again if the pull request changes between requests.
Inline comments require a path and a line on the selected side of the current diff. The server rejects placement when the whole diff is truncated, the format does not support placement, or the selected line is absent. Renames and binary diffs can still be read as bounded raw diffs. Bitbucket can change the diff between validation and posting, so validation does not guarantee atomic placement.
Write errors
The server never redirects or automatically retries writes. outcome_unknown means Bitbucket might have applied the write. Check Bitbucket before retrying. upstream_rejected reports a known upstream rejection.
The server bounds response bodies as it reads them, omits upstream error bodies, and redacts known token and Basic-auth echoes in successful string fields. Where the server follows GET redirects, it accepts at most three hops on the same origin and within the configured API path prefix.
Pi consent extension
Run
npm cito install the pinned dependencies. Configure Pi1.5.0to usepi-mcp-adapter7.0.1. Pi's built-in MCP integration does not use this broker.Trust
.pi/extensions/bitbucket-consent.ts. Add the MCP configuration to.pi/mcp.jsonand run/reloadin Pi. If you copy the extension to another project, makepi-mcp-adapteravailable to its module resolver.
The extension prompts for Allow once on every approve_pull_request and withdraw_pull_request_approval, even when the adapter has a session grant. It shows the action, server, repository, and pull-request ID. The broker does not supply the server workspace. Invalid requests, cancellation, UI errors, headless sessions, and session changes deny the request.
The extra prompt applies only to approval and withdrawal through the Pi adapter. It does not cover direct MCP calls, shell commands, or other code with access to the token. The Rust server acts as the token owner and cannot infer human consent.
Verification
Rust server
cargo fmt --check
cargo clippy --locked --all-targets -- -D warnings
cargo test --lockedLocal stdio and HTTP contracts
Use Python 3 in a POSIX environment. The repository contract check also requires OpenSSL for its self-signed TLS fixture.
cargo build --locked
python3 scripts/test_smoke_regressions.py
python3 scripts/smoke_stdio.py target/debug/mcp-bitbucket
python3 scripts/check_file_diff_contract.py target/debug/mcp-bitbucket
python3 scripts/check_repository_search_contract.py target/debug/mcp-bitbucketThe stdio smoke calls every tool on the built server against a local Bitbucket mock. The other checks cover file filters, pagination, streaming limits, repository queries, and TLS verification. None require a Bitbucket account. The snippet tools have not been tested against a live Cloud workspace. The per-file tools also passed a read-only Bitbucket Cloud check for changed-file listing, a selected patch, and an empty result for a nonexistent path.
Pi extension
npm ci --ignore-scripts
npm run typecheck
npm test
PATH="$PWD/node_modules/.bin:$PATH" python3 scripts/smoke_pi_consent.pyThe Node tests exercise the real adapter broker and permission caches. The Pi smoke drives the consent dialog offline without model requests or account credentials.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
A Model Context Protocol (MCP) application for automated GitHub PR analysis and issue management.…
AI-native git hosting — repos, PRs, issues, CI gates, and AI code review over MCP (60 tools).
GitCore MCP: stacked PRs, speculative merge queues, SARIF reviews & agent attestation.
81MCP server for the GitCore API, enabling AI agents to interact with GitCore repositories, issues, pull requests, and more.
Related MCP Servers
- FlicenseNot gradedqualityAmaintenanceEnables an MCP client to sign in and inspect workspace-scoped review findings and hosted runs, and to prepare, then start or rerun after explicit confirmation, an existing hosted code review for a pull request. It exposes only concise summaries, never raw diffs, full reports, artifacts, credentials, or prompt text.2 npm-
- FlicenseNot gradedqualityAmaintenanceEnables MCP clients to sign in, list workspaces, and inspect workspace-scoped review findings and hosted runs. It can also prepare and, after explicit user confirmation, start or rerun an existing hosted pull-request review without exposing raw diffs, full reports, artifacts, credentials, or prompt text.2 npm-
- AlicenseNot gradedqualityAmaintenanceEnables MCP-compatible clients to list workspaces, inspect concise workspace-scoped review findings and hosted run summaries, and prepare—or, after explicit user confirmation, start or rerun—a hosted pull-request review without exposing raw diffs, artifacts, or credentials.2 npmMIT
- AlicenseNot gradedqualityCmaintenanceEnables MCP clients to create and inspect repositories, push and clone code, and manage issues and pull requests, including merging, through JSON-RPC tools with defined input schemas and modern/legacy handshakes.MIT