Bitbucket MCP Server
The Bitbucket MCP Server provides comprehensive tools for interacting with Bitbucket API (both Cloud and Server), enabling efficient repository management through:
Pull Request Management: Create, retrieve, update, merge, and list pull requests with filtering and pagination options.
Branch Operations: List, delete, and get detailed information about branches, including associated pull requests and commits.
Code Review: Approve/unapprove pull requests, request/remove changes, add comments (inline, general, and replies), and view diffs.
File and Directory Access: List directory contents and retrieve file content with smart truncation for large files.
Collaboration Features: Add comments with code suggestions, configure merge strategies (merge-commit, squash, fast-forward), and customize commit messages.
These capabilities enable efficient workflow management for development teams using Bitbucket repositories.
Provides tools for interacting with the Bitbucket API, supporting both Bitbucket Cloud and Bitbucket Server. Enables management of pull requests (creating, updating, listing, approving, commenting), handling code reviews, working with branches, and viewing diffs.
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., "@Bitbucket MCP Serverlist my open pull requests in the web-app repository"
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 Server
MCP server for Bitbucket — built for AI coding agents that need to work with remote repositories as if they were local clones: grep-fast code search, windowed file reads, compact token-efficient responses, and a transport layer that never trips Bitbucket's rate limits.
Supports Bitbucket Server / Data Center (primary target) and Bitbucket Cloud.
Why v3
v2 | v3 | |
Content search in a repo | 1 listing + up to 3,000 file GETs | 1 archive call cold, 0–1 calls warm |
Search completeness | silently partial under server throttling | complete, with every cap reported |
PR diff tokens | per-line JSON (~4× larger) | raw unified diff |
Read a 100-line window | 2 calls, full file transferred | 1 call, window only |
Blame a window of a huge file | up to 100 calls | 1 call |
Rate-limit safety | none (burst → 429/403) | client-side pacing sized to DC's limiter |
Tools | 33 | 25 (~30% less definition context) |
Measured on a live Data Center instance: a repeated content search went from 519 API calls / ~7s (finding 1 of 8 real matches under burst throttling) to 0 API calls / 24ms finding all 8. Full design and verified API research: REVAMP_PLAN.md.
Related MCP server: Bitbucket MCP Server
Tools (25)
Search (search) — Server/DC only
grep— search file contents with full regex, any branch, like ripgrep on a local clone. Onearchivedownload per repo+commit, streamed in constant memory, cached in-process, freshness-checked every call (responses carryas_of <commit>). Omitqueryfor filename-only glob listing. Modes:content,files,count;glob,path,context,case_insensitive,max_results.search_code— index-backed exact-term search across a whole project in one call (default branch only, case-insensitive, no regex, files <512 KiB, ~1000-result window). Best for cross-repo identifier lookups; usegrepfor everything else.search_repositories— find repos by name/description.
Pull requests (pr_core)
get_pull_request— metadata + reviewer status + merge info in 1 call;include_comments/include_file_changes(default true),include_tasks,comment_limit. Returnsversionfor follow-up mutations.list_pull_requests— repo-scoped; omitrepository(Server) for your PRs across all repos in one call (rolefilter).create_pull_request,update_pull_request,merge_pull_request,decline_pull_request— all mutations acceptversionfrom a prior read (saves a fetch; auto-refetch + retry once on 409 conflicts).
Comments & tasks (pr_comments)
add_comment— general, threaded reply, inline (file_path+line_number, orcode_snippetauto-resolution), codesuggestion, or task (severity: "BLOCKER", Server). Attachments upload via theattachmentsparam (Server).manage_comment—edit/delete/resolve/reopen/to_task/to_commenton any comment or task, one call withversion.
Review (pr_review)
get_pull_request_diff— raw unified diff text; scope withfile_path(server-side),include_patterns/exclude_patterns,context_lines,ignore_whitespace.set_review_status—APPROVED/NEEDS_WORK/UNAPPROVED(mutually exclusive; one call).
Commits (commits)
list_pr_commits,list_branch_commits(server-sidesince-rev/mergesfilters; bounded page-walk for client-sideauthor/until/search),get_commit_detail(unified diff, ordetail: "files"for the changed-file list without bodies).
Branches (branches)
list_branches,get_branch(branch + its PRs),delete_branch(expected_headskips the lookup call).
Files (files)
get_file_content— windowed server-side:start_line/line_counttransfer only that window (≤5000 lines/call).full_content/ negativestart_linefor whole-file or tail reads.get_file_blame— commit-span blame for a line window in 1 call (Server).list_directory_content— paginated, compact.
Attachments (attachments, Server) / Discovery (discovery)
manage_attachments(downloadcapped,delete),list_projects,list_repositories.
Output conventions
Bulk content (diffs, files, grep results) is plain text, not JSON-escaped strings; lists are compact JSON without pretty-printing. Dates are ISO-8601.
Content-derived responses carry
as_of <commit>so the agent knows exactly which state it saw.Truncation is never silent — every cap produces an explicit warning with continuation guidance (
next_start, "narrow the glob", etc.).Mutable entities include
version, so mutations don't need a re-read.
Installation
Using npx (recommended)
{
"mcpServers": {
"bitbucket": {
"command": "npx",
"args": ["-y", "@nexus2520/bitbucket-mcp-server"],
"env": {
"BITBUCKET_USERNAME": "your.username",
"BITBUCKET_TOKEN": "your-http-access-token",
"BITBUCKET_BASE_URL": "https://bitbucket.yourcompany.com"
}
}
}
}For Bitbucket Cloud use BITBUCKET_APP_PASSWORD instead of BITBUCKET_TOKEN (and omit BITBUCKET_BASE_URL).
Credential walkthroughs: Cloud app password · Server/DC HTTP token.
From source
git clone https://github.com/pdogra1299/bitbucket-mcp-server.git
cd bitbucket-mcp-server
npm install && npm run build
# point your MCP config at: node <repo>/build/index.jsConfiguration
Every numeric policy is environment-tunable — nothing is hard-coded. The full table lives in src/config/index.ts (CONFIG_REFERENCE). The ones that matter most:
Variable | Default | Purpose |
|
| Client-side sustained request rate (DC's per-user refill is 5/s). |
|
| Burst capacity (DC's server bucket is 60) |
|
| Max in-flight requests across all tools |
|
| In-memory grep cache budget. |
|
| Files larger than this are scanned but not cached |
|
| Branch→SHA freshness memo; |
|
| Abort archive scans past this many extracted MB (falls back to bounded per-file scan) |
|
| Per-request timeout |
| all | Comma-separated groups to expose (validated, enforced at dispatch, fails closed) |
The grep engine's guarantees
Memory-bounded: the archive is streamed, never buffered whole; the cache is a hard byte budget with LRU eviction and content-hash dedup across branches. Worst case = budget + a few MB transient.
Fresh: every query re-resolves the branch head; a moved branch can never serve stale results. Merges/deletes made through this server invalidate immediately.
Complete: cache limits never reduce scan coverage — oversized files are still scanned; only true binaries are skipped, and they're counted in the output.
Rate limiting
All requests flow through a token bucket sized to Bitbucket DC's per-user limiter, so 429s are avoided rather than retried-after. If your instance throttles hard anyway, the error message says exactly what to do — the durable fix is asking a Bitbucket admin for a rate-limit exemption for the service account (Admin → Rate limiting → Exemptions), then setting BITBUCKET_RATE_LIMIT_RPS=0.
Migrating from v2
Removed tools and their v3 equivalents (same capabilities, fewer tools):
v2 | v3 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Update Claude Code permission allowlists (mcp__bitbucket__*) accordingly. Diff tools now return unified diff text instead of per-line JSON — line numbers come from @@ headers. Full details in CHANGELOG.md.
Development
npm run build # tsc → build/
npm test # build + node --test (unit + snapshot-engine tests)Architecture: src/config (all policy) · src/core (transport, snapshot engine, caches) · src/handlers (tool logic) · src/tools (definitions, guards, registry) · src/formatting (compact output) · src/types (single barrel).
License
MIT
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- 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/pdogra1299/bitbucket-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server