mcp-bitbucket
Provides tools for interacting with Bitbucket Server/Data Center to browse repositories, manage pull requests and comments, review diffs, merge or decline pull requests, search code, and more.
Click on "Install 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., "@mcp-bitbucketshow me the diff of pull request #12"
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.
mcp-bitbucket
Bitbucket Server for AI agents and the humans next to them. Read pull requests and their diffs without a clone, draft a review and publish it with a verdict, post blocking tasks, browse code and commits, open, merge or decline pull requests — from an MCP client, from a shell, or from your own TypeScript.
Bitbucket Server / Data Center only. Bitbucket Cloud is not supported.
Packages
Package | What it is | Bin |
Bitbucket client, operations, formatters — everything else is a thin adapter over it | — | |
MCP server, 29 tools over stdio or Streamable HTTP |
| |
Shell client for the same operations, infers the repo from your git remote |
| |
Claude Code skill that teaches an agent the | — |
Claude Code / Claude Desktop tool use → mcp. Terminal, scripts, CI, agents that run commands → cli. Building something else → core. They read the same credentials and install side by side.
Related MCP server: Atlassian Bitbucket MCP Server
Prerequisites
Node.js 18+, pnpm 10+ (
corepack enable)A Bitbucket Server Personal Access Token — profile → Manage Account → HTTP Access Tokens, with repository read + pull request write
Only for
bb login(OS keyring):sudo apt install -y libsecret-1-0 gnome-keyring. Every command also works fromBITBUCKET_TOKEN.
Install
pnpm install
pnpm build # core first, then mcp and cliEntry points: packages/mcp/dist/index.js, packages/cli/dist/index.js.
Quick start
MCP server
claude mcp add mcp-bitbucket \
-e BITBUCKET_URL=https://bitbucket.example.com \
-e BITBUCKET_TOKEN=your-personal-access-token \
-- node /absolute/path/to/mcp-bitbucket/packages/mcp/dist/index.jsOr in .mcp.json (${VAR} is expanded by Claude Code, so no secret is committed):
{
"mcpServers": {
"mcp-bitbucket": {
"type": "stdio",
"command": "node",
"args": ["/absolute/path/to/mcp-bitbucket/packages/mcp/dist/index.js"],
"env": {
"BITBUCKET_URL": "${BITBUCKET_URL}",
"BITBUCKET_TOKEN": "${BITBUCKET_TOKEN}"
}
}
}
}HTTP transport instead of stdio: node packages/mcp/dist/index.js --http (port 3000) or MCP_HTTP_PORT=8080 node …. Routes: POST /mcp, GET /mcp (SSE), DELETE /mcp.
bb CLI
pnpm --filter @mcp-bitbucket/cli link --global
bb login # or export BITBUCKET_URL / BITBUCKET_TOKEN
bb whoami # proves authentication — `bb ping` only proves reachability
bb pr get 42 # repository comes from the git origin remoteCommand surface: packages/cli/README.md or bb --help.
Claude Code skill
bash packages/skill/scripts/install.sh # ~/.claude/skills/bitbucket-review
bash packages/skill/scripts/install.sh ./.claude # project scopeNeeds bb on PATH and a resolvable credential.
Configuration
Environment variables, .env at the repo root is loaded automatically (cp .env.example .env). The MCP server validates them at startup; the CLI also accepts --url / --token, which win over everything.
Variable | Default | Effect |
| — | Instance base URL. Required for the MCP server. |
| — | Personal Access Token. Required for the MCP server. |
|
| Which verbs the MCP server exposes — see Permissions. |
| unset (all) | Repository allowlist — see Permissions. |
| unset | Enables HTTP transport on this port instead of stdio. |
|
|
|
|
| REST module and version. |
| resolved | User slug the review tools act as, when a proxy strips |
| unset | CLI only: default for |
Limits
Every numeric cap lives in packages/core/src/operations/caps.ts and is env-overridable: BITBUCKET_DIFF_MAX_CHARS (60000), BITBUCKET_DIFF_HEAD_RATIO (0.6), BITBUCKET_DIFF_CONTEXT_LINES (3), BITBUCKET_DIFF_FETCH_MAX_CHARS (12000000), BITBUCKET_DIFF_CACHE_ENTRIES (4), BITBUCKET_CHANGED_FILES_MAX_ITEMS (1000), BITBUCKET_CHANGED_FILES_STATS_MAX_FILES (500). Truncation is never silent — the note names the parameter and the variable that lift the cap, and lists every elided hunk header.
Permissions
Two independent guards.
MCP_PERMISSION_MODE — MCP server only. Every tool is classified read, write or destructive in packages/mcp/src/permissions.ts; a forbidden tool is both hidden from ListTools and refused when called by name.
Mode | Tools |
unset / | 29 |
| 26 — no |
| 17 |
anything else | 0 — a typo fails closed, with a warning on stderr |
The CLI does not read it. A readonly deployment does not stop bb review merge.
Repository allowlist — both entry points. BITBUCKET_ALLOWED_PROJECTS / BITBUCKET_ALLOWED_REPOS take comma-, semicolon- or space-separated patterns: PROJ, PROJ/*, PROJ/repo-a. The check runs inside the shared client before any socket opens, so every tool and every bb command inherits it. Unset means every repository. Case-insensitive; personal repos are project ~username. A malformed pattern is dropped, never widened — a value made only of malformed patterns allows nothing.
Tools
29 MCP tools: 17 read, 9 write, 3 destructive. Full parameters in docs/tools.md.
Group | Tools |
Diagnostic |
|
Repository |
|
Pull request |
|
Comment |
|
Context |
|
Diff |
|
Commit |
|
Browse |
|
Search |
|
Review |
|
Notable defaults
Resolved discussion is hidden.
get_pull_request_comments/bb comment lsneedincludeResolved(--include-resolved) to show resolved threads and tasks; the reply says how many it hid. An explicitstatefilter overrides the default.Reviews are drafted, not posted.
add_pr_draft_comment/bb review draftstore an invisible comment;submit_pr_reviewpublishes every pending comment with a verdict as one notification.pending: false(--no-pending) posts immediately;discard_pr_draft_reviewthrows the draft away.bb ping≠ authentication./application-propertiesanswers 200 anonymously on many instances.bb whoamiis the authentication check.
Development
pnpm build | typecheck | test | lint | format | clean
pnpm dev:mcp # MCP server from source (tsx)
pnpm cli pr ls # bb from source
pnpm --filter @mcp-bitbucket/core testThe layering rule that keeps the adapters from drifting:
core knows nothing about MCP or the CLI — no MCP SDK, no yargs, no stdout. Operations take a client plus params and return structured data or throw.
Adapters own input validation and output shape — zod plus the MCP result shape in
mcp, yargs plus text/--jsonincli. Neither leaks into core.Error messages are written once, in core, with
{projects}/{login}style placeholders each adapter renders in its own vocabulary — the same failure says "uselist_projects" to a model and "usebb project ls" to you.A new capability is an operation plus a formatter in core, then a thin adapter in each of
mcpandcli.
Docker
The image carries the MCP server only.
docker build -t mcp-bitbucket .
docker run -i --rm -e BITBUCKET_URL=… -e BITBUCKET_TOKEN=… mcp-bitbucket
docker run --rm -p 3000:3000 -e BITBUCKET_URL=… -e BITBUCKET_TOKEN=… -e MCP_HTTP_PORT=3000 mcp-bitbucketTroubleshooting
docs/troubleshooting.md. The three most common: a tool missing from the client list means MCP_PERMISSION_MODE hid it (an unrecognised value hides all 29); Refused: … outside the configured repository allowlist means the allowlist does not cover that repo; fewer comments than the web UI means resolved threads are hidden.
Limitations
Bitbucket Server only; no Bitbucket Cloud, no OAuth/SSO/app passwords.
bb loginstores credentials in the OS keyring only — no plaintext store, no--password.No webhooks or event-driven mode; the server answers tool calls.
Diffs are server-rendered unified diff text; inline comments anchored into the diff are not exposed.
search_codeneeds the instance code index: default branch, whole words, no regex.MCP_PERMISSION_MODEgates the MCP server only; the allowlist gates both.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseAqualityBmaintenanceFacilitates interaction with Bitbucket Server for pull request management using the MCP protocol, supporting operations such as creating, merging, commenting, and reviewing pull requests.1566Apache 2.0
- AlicenseBqualityDmaintenanceEnables AI assistants to interact with Bitbucket Cloud and self-hosted instances for pull request reviews, code search, repository operations, and managing PR comments and approvals.19GPL 3.0
- AlicenseBqualityCmaintenanceEnables LLMs to interact with Bitbucket repositories to manage pull requests, branches, and commits through the Model Context Protocol. It supports repository operations such as searching code, accessing file contents, and comparing branches using natural language.165,033MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI systems to interact with Atlassian Bitbucket Server/Data Center for accessing projects, repositories, branches, files, and managing pull requests.MIT
Related MCP Connectors
A MCP server built for developers enabling Git based project management with project and personal…
MCP server for AI access to SmartBear tools, including BugSnag, Reflect, Swagger, PactFlow, QTM4J.
MCP server exposing the Backtest360 engine API as tools for AI agents.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/cuonghuunguyen/bitbucket-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server