← Back to directory
B

Bitbucket Server MCP

Community
MCP server for managing Bitbucket Server pull requests
GitHub source repository ↗
★ 66 Stars Category · Dev Tools Popular Source revision f57cb8624786
56FMRS · C
Reliability
7/20
Security and permissions
9/20
Maintenance
11/20
Documentation
16/20
Setup experience
13/20

This server offers a fairly comprehensive toolset for the Bitbucket Server pull-request workflow — project/repository discovery, PR creation through merge, comments and batch reviews, code search, and file browsing — with a read-only mode and custom headers for enterprise network setups; credentials must be protected and the irreversibility of write actions outside read-only mode should be kept in mind.

Read the FMRS scoring method →

Bitbucket Server MCP is a Node.js MCP server that exposes the Bitbucket Server REST API for project and repository discovery, full pull-request lifecycle management (create, update, approve, merge, decline), code search, file reading, branch and commit history browsing, comment management, and CI/CD code insights (e.g. SonarQube). It supports configuring a default project, a read-only mode, and custom HTTP headers (useful for Zero Trust tokens or proxies) via environment variables.

Tools

list_projects
Lists all accessible Bitbucket projects with their details, useful for project discovery and finding correct project keys.
list_repositories
Browses repositories within a specific project or across all accessible projects, returning clone URLs and metadata.
create_pull_request
Creates a new pull request with source/target branches and reviewers, supporting cross-repository PRs from forks.
update_pull_request
Safely updates a pull request's title, description, or reviewers using a read-modify-write pattern that preserves unspecified fields.
get_pull_request
Retrieves detailed pull request information including status, reviewers, commits, and metadata.
merge_pull_request
Merges an approved pull request using merge-commit, squash, or fast-forward strategy.
decline_pull_request
Declines a pull request that should not be merged, optionally with a reason message.
add_comment
Adds a comment to a pull request, supporting Markdown, threaded replies, and open or pending (draft) state.
add_comment_inline
Adds an inline comment on a specific line of a pull request's diff.
get_diff
Retrieves the code diff for a pull request, with configurable context lines and per-file line limits for large diffs.
get_reviews
Fetches review history, approval status, and reviewer feedback for a pull request.
get_activities
Gets the complete activity timeline for a pull request, including comments, reviews, and commits.
get_comments
Filters pull request activities to return only comments, focusing on discussion content.
search
Searches code and filenames across repositories with project/repository filtering; only works on default branches.
get_file_content
Reads the content of a specific file from a repository, with pagination for large files.
browse_repository
Browses files and directories in a repository to explore its structure.
list_pull_requests
Lists pull requests in a repository, filterable by state, author, and direction.
list_branches
Lists repository branches, identifying the default branch and latest commit info per branch.
list_commits
Lists commit history for a repository, filterable by branch and author.
delete_branch
Deletes a branch from a repository, with a safety check preventing deletion of the default branch.
approve_pull_request
Approves a pull request as the current authenticated user.
unapprove_pull_request
Removes the current user's approval from a pull request.
edit_comment
Edits an existing comment's text, requiring the comment version for optimistic locking.
delete_comment
Deletes a comment from a pull request, requiring the comment version for optimistic locking.
publish_review
Publishes all pending draft comments at once, optionally setting an approval status and overview comment.
get_code_insights
Fetches Code Insights reports (e.g. SonarQube, security scans) and their annotations for a pull request.
get_dashboard_pull_requests
Lists pull requests across all repositories for the authenticated user, filterable by role and status.

Setup

  1. Ensure Node.js >= 16 is installed.
  2. Optionally install via Smithery (npx -y @smithery/cli install @garc33/bitbucket-server-mcp-server --client claude), or install manually with npm install followed by npm run build.
  3. Add a server entry to your MCP client configuration, setting command to node and args to the path of the built build/index.js.
  4. Set required environment variables: BITBUCKET_URL, plus either BITBUCKET_TOKEN or BITBUCKET_USERNAME/BITBUCKET_PASSWORD for authentication; optionally set BITBUCKET_DEFAULT_PROJECT, BITBUCKET_READ_ONLY, BITBUCKET_CUSTOM_HEADERS, BITBUCKET_LOG_PATH, and BITBUCKET_DIFF_MAX_LINES_PER_FILE.
  5. Restart the client to load the new server.
claude_desktop_config.json
{"mcpServers":{"bitbucket":{"command":"node","args":["/path/to/bitbucket-server/build/index.js"],"env":{"BITBUCKET_URL":"https://your-bitbucket-server.com","BITBUCKET_TOKEN":"your-access-token","BITBUCKET_DEFAULT_PROJECT":"your-default-project"}}}}

Fit and risk

Best for

  • Teams running self-hosted Bitbucket Server / Data Center who want a conversational interface for PR workflows
  • CI/CD or proxy environments that need safe, read-only access to Bitbucket data
  • Organizations behind Zero Trust networks that need custom headers to reach Bitbucket

Not for

  • Users on Bitbucket Cloud (bitbucket.org) rather than Bitbucket Server/Data Center, since this server targets the Server API
  • Users unwilling to run a local Node.js MCP server process

Required permissions

  • Requires a Bitbucket Server personal access token, or username/password basic-auth credentials
  • The scope of allowed operations is bounded by the configured credential's repository permissions; write actions (create/merge/comment/delete branch, etc.) need corresponding write access
  • Optional custom HTTP headers are sent with every request and may carry sensitive tokens that must be managed carefully

Risks and side effects

  • Authentication tokens or passwords are configured as plaintext environment variables and must be stored/transmitted securely
  • Outside read-only mode, the model can directly merge, decline, delete branches, and delete comments — irreversible or collaboration-impacting actions with real misuse potential
  • The log file is written to local disk by default (`~/.bitbucket-server-mcp/bitbucket.log`) and may capture sensitive operation details

Troubleshooting

  1. Verify `BITBUCKET_URL` and authentication (token or username/password) are correct and the account has the needed repository permissions
  2. If write operations are rejected, check whether `BITBUCKET_READ_ONLY=true` was set unintentionally
  3. If a tool call complains about a missing project, set `BITBUCKET_DEFAULT_PROJECT` or pass the `project` parameter explicitly
  4. Check the log file (default `~/.bitbucket-server-mcp/bitbucket.log`, or the `BITBUCKET_LOG_PATH` override) for detailed error messages
  5. Confirm `npm install` and `npm run build` were run, and that the client config path points to the correct `build/index.js`

Use cases

Create, review, approve, and merge Bitbucket Server pull requests directly from an AI assistant
Search code across projects, browse repository structure, and read file contents
Inspect pull request diffs, comments, review status, and CI/CD code insight results
Manage branches (list, filter, delete merged ones) and browse commit history

Supported clients

Claude DesktopFull support
VS CodeFull support