bitbucket-server-mcp
This MCP server integrates with Bitbucket Server/Data Center, enabling AI assistants to manage repositories, pull requests, code reviews, branches, commits, and more.
Repository Management: List projects and repositories, browse file structures, read file contents, edit files, create/delete repositories, upload attachments, get file blame, list/create forks, and get server info.
Pull Requests: Create (including cross-repo/fork PRs and drafts), get details, update, merge (multiple strategies), decline, list, and get activity, diffs, commits, and commits-to-PR mapping. Also list dashboard PRs across all repos.
Code Review: Manage PR comments (create, edit, delete, react; supports inline anchoring, draft state, tasks, threaded replies, resolve/unresolve) and reviews (approve, unapprove, publish).
Branches & Commits: List branches, create/delete branches (with default branch safety check), list commits, get commit details, compare refs, and list/create/delete/get tags.
Search & Insights: Search code and files across repos, get Code Insights reports and annotations (e.g., SonarQube), and get CI build statuses.
Users: Get user profiles and search users.
Labels: List, add, and remove repository labels.
Webhooks: List, create, update, and delete repository webhooks.
Commit Comments: List, create, edit, and delete comments on specific commits.
Repository Settings: Manage default reviewer conditions, branch restrictions, repository hooks (list/enable/disable/configure), merge checks, reviewer groups, and secret scanning allowlist rules.
SSH & GPG Keys: List, add, and delete SSH and GPG keys for the authenticated user.
Deployments: Get, create, and delete deployment records for commits.
Prompts & Resources: Built-in
review-prprompt for guided PR reviews;bitbucket://projectsresource providing a cached list of accessible projects as ambient context.
Provides tools for interacting with Bitbucket Server (or Data Center) including repository management, pull request operations, code review, and branch/commit management.
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-server-mcplist my open pull requests"
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.
Quickstart
Or via Claude Code:
claude mcp add bitbucket \
-e BITBUCKET_URL=https://your-bitbucket-server.com \
-e BITBUCKET_TOKEN=your-token \
-- npx -y @upendra_sengar/bitbucket-server-mcpRelated MCP server: Atlassian Bitbucket MCP Server
Requirements
Bitbucket Server / Data Center 7.21+ (the E2E suite covers 7.21, 8.5, 8.9, 8.19, 9.4 and 10.2).
One of:
Installation
Add to your workspace .vscode/mcp.json:
{
"servers": {
"bitbucket": {
"command": "npx",
"args": ["-y", "@upendra_sengar/bitbucket-server-mcp"],
"env": {
"BITBUCKET_URL": "https://your-bitbucket-server.com",
"BITBUCKET_TOKEN": "your-access-token"
}
}
}
}These clients all use the same mcpServers format. Add the JSON below to the config file for your client:
Client | Config file |
Claude Desktop |
|
Cursor |
|
Windsurf |
|
JetBrains | Settings > Tools > AI Assistant > MCP, or |
Neovim | mcphub.nvim |
{
"mcpServers": {
"bitbucket": {
"command": "npx",
"args": ["-y", "@upendra_sengar/bitbucket-server-mcp"],
"env": {
"BITBUCKET_URL": "https://your-bitbucket-server.com",
"BITBUCKET_TOKEN": "your-access-token"
}
}
}
}Add to your Zed settings (~/.config/zed/settings.json on Linux, ~/Library/Application Support/Zed/settings.json on macOS):
{
"context_servers": {
"bitbucket": {
"source": "custom",
"command": "npx",
"args": ["-y", "@upendra_sengar/bitbucket-server-mcp"],
"env": {
"BITBUCKET_URL": "https://your-bitbucket-server.com",
"BITBUCKET_TOKEN": "your-access-token"
}
}
}
}For environments without Node.js:
{
"mcpServers": {
"bitbucket": {
"command": "docker",
"args": [
"run", "-i", "--rm",
"-e", "BITBUCKET_URL=https://your-bitbucket-server.com",
"-e", "BITBUCKET_TOKEN=your-access-token",
"ghcr.io/upendrasengar/bitbucket-server-mcp"
]
}
}
}Or build locally: docker build -t bitbucket-mcp .
Bun users can replace npx -y with bunx in any of the configs above.
Tools
Repositories
Tool | Description |
| List all accessible Bitbucket projects |
| List repositories in a project |
| Browse files and directories |
| Read file contents with pagination |
| Upload a local file and get a markdown reference for PR comments |
| Edit a file by committing a new version via the REST API |
| Get Bitbucket Server version and properties |
| Get line-by-line blame/history for a file |
| Create a new repository |
| Delete a repository (irreversible) |
Pull Requests
Tool | Description |
| Create a PR, including cross-repo from forks ( |
| Get PR details |
| Safely update title, description, or reviewers (read-modify-write, preserves fields not explicitly changed) |
| Merge a PR with optional strategy ( |
| Decline a PR |
| List PRs with filtering by state, author, direction |
| List PRs across all repos for the authenticated user, filtered by role ( |
| Get PR activity timeline, filtered by type ( |
| Get PR diff with per-file truncation support. Use |
| List commits in a pull request |
| List pull requests containing a specific commit |
Code Review
Tool | Description |
| Unified create/edit/delete for PR comments. Supports inline anchoring ( |
| Unified approve/unapprove/publish. Publish transitions all |
Branches & Commits
Tool | Description |
| List branches with default branch detection |
| Browse commit history with branch and author filtering |
| Create or delete branches (safety check prevents deleting default branch) |
| Get details of a specific commit by its ID |
| List commits reachable from one ref but not another |
| List tags in a repository |
| Create or delete tags |
| Get details of a specific tag by its name |
Search & Insights
Tool | Description |
| Search code and files across repositories |
| Fetch Code Insights reports (SonarQube, security scans) and annotations |
| Get CI build status (state, name, URL) by commit ID or PR. When using prId, resolves the latest commit automatically. |
Forks
Tool | Description |
| List forks of a repository |
| Fork a repository into a target project |
Users
Tool | Description |
| Get a user profile by slug |
| Search users by filter query |
Labels
Tool | Description |
| List labels for a repository |
| Add or remove repository labels |
Webhooks
Tool | Description |
| List webhooks for a repository |
| Create, update, or delete webhooks |
Commit Comments
Tool | Description |
| List comments on a specific commit |
| Create, edit, or delete comments on a commit |
Repository Settings
Tool | Description |
| List default reviewer conditions |
| List branch permission restrictions |
| List repository hooks and their status |
| Enable, disable, or configure repository hooks |
| List merge check configurations |
| Configure merge check settings |
| List reviewer groups |
| Create or delete reviewer groups |
| List secret scanning allowlist rules (8.5+) |
Keys
Tool | Description |
| List SSH keys for the authenticated user |
| Add or delete SSH keys |
| List GPG keys for the authenticated user |
| Add or delete GPG keys |
Prompts
Prompt | Description |
| Step-by-step workflow for reviewing a PR: fetch details, read diff, check CI, create draft comments, and publish the review. Invoke via |
Resources
Resource | URI | Description |
|
| Cached list of all accessible projects (5 min TTL). Useful as ambient context without explicit tool calls. |
Configuration
Environment Variables
Variable | Required | Description |
| Yes | Base URL of your Bitbucket Server instance |
| Yes* | Personal access token |
| Yes* | Username for basic auth |
| Yes* | Password for basic auth |
| No | Default project key when not specified in tool calls |
| No | Set to |
| No | Extra headers for all requests ( |
| No | Max lines per file in diffs. Set to |
| No | Cache duration in seconds (default: 300). Set to |
| No | Comma-separated list of tool names to enable. If not set, all tools are available. |
| No | Set to |
*Either BITBUCKET_TOKEN or both BITBUCKET_USERNAME and BITBUCKET_PASSWORD are required.
Read-Only Mode
Set BITBUCKET_READ_ONLY=true to restrict the server to read-only operations. All create_*, update_*, delete_*, manage_*, merge_*, decline_*, fork_*, upload_*, and edit_* tools are disabled.
Tool Filtering
Set BITBUCKET_ENABLED_TOOLS to load only specific tools, reducing context window usage:
BITBUCKET_ENABLED_TOOLS=get_pull_request,get_diff,manage_comment,manage_reviewStartup Healthcheck
When BITBUCKET_STARTUP_HEALTHCHECK=true, the server probes
/rest/api/1.0/application-properties on startup and logs whether Bitbucket is
reachable. If not, it logs a diagnostic line referencing the relevant env vars
(BITBUCKET_URL, BITBUCKET_TOKEN, HTTPS_PROXY, NODE_EXTRA_CA_CERTS)
without blocking the server. Useful for debugging connectivity issues before
the first tool call fails with a generic error.
BITBUCKET_STARTUP_HEALTHCHECK=trueResponse Curation
Read tools return compact responses by default, keeping only the fields an AI assistant typically needs. Every read tool accepts a fields parameter to customize:
Omit
fields: returns a curated summary (e.g. PR id, title, state, author, branches, reviewers, task count)fields: "*all": returns the complete raw Bitbucket API responsefields: "id,title,author.user.name": returns exactly those fields (dot notation for nested paths)
Caching
The server caches frequently accessed data in memory (project lists, repository metadata, default reviewers) to reduce API calls. The cache uses LRU eviction (max 500 entries) so memory stays bounded, and write operations automatically invalidate related entries.
By default, cached entries expire after 5 minutes. Configure with BITBUCKET_CACHE_TTL (in seconds), or set to 0 to disable caching entirely.
Contributing
See CONTRIBUTING.md for development setup, architecture overview, and how to add new tools.
License
Apache 2.0
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/Upendrasengar/bitbucket-server-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server