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.
Bitbucket MCP Server
An MCP (Model Context Protocol) server that provides tools for interacting with the Bitbucket API, supporting both Bitbucket Cloud and Bitbucket Server.
Features
Currently Implemented Tools
Core PR Lifecycle Tools
get_pull_request
- Retrieve detailed information about a pull requestlist_pull_requests
- List pull requests with filters (state, author, pagination)create_pull_request
- Create new pull requestsupdate_pull_request
- Update PR details (title, description, reviewers, destination branch)add_comment
- Add comments to pull requests (supports replies)merge_pull_request
- Merge pull requests with various strategiesdelete_branch
- Delete branches after merge
Code Review Tools
get_pull_request_diff
- Get the diff/changes for a pull requestapprove_pull_request
- Approve a pull requestunapprove_pull_request
- Remove approval from a pull requestrequest_changes
- Request changes on a pull requestremove_requested_changes
- Remove change request from a pull request
Installation
Using npx (Recommended)
The easiest way to use this MCP server is directly with npx:
For Bitbucket Server:
From Source
- Clone or download this repository
- Install dependencies:
- Build the TypeScript code:
Authentication Setup
This server uses Bitbucket App Passwords for authentication.
Creating an App Password
- Log in to your Bitbucket account
- Navigate to: https://bitbucket.org/account/settings/app-passwords/
- Click "Create app password"
- Give it a descriptive label (e.g., "MCP Server")
- Select the following permissions:
- Account: Read
- Repositories: Read, Write
- Pull requests: Read, Write
- Click "Create"
- Important: Copy the generated password immediately (you won't be able to see it again!)
Running the Setup Script
This will guide you through the authentication setup process.
Configuration
Add the server to your MCP settings file (usually located at ~/.vscode-server/data/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json
):
Replace:
/absolute/path/to/bitbucket-mcp-server
with the actual path to this directoryyour-username
with your Bitbucket username (not email)your-app-password
with the app password you created
For Bitbucket Server, use:
Important for Bitbucket Server users:
- Use your full email address as the username (e.g., "john.doe@company.com")
- This is required for approval/review actions to work correctly
Usage
Once configured, you can use the available tools:
Get Pull Request
Returns detailed information about the pull request including:
- Title and description
- Author and reviewers
- Source and destination branches
- Approval status
- Links to web UI and diff
- Merge commit details (when PR is merged):
merge_commit_hash
: The hash of the merge commitmerged_by
: Who performed the mergemerged_at
: When the merge occurredmerge_commit_message
: The merge commit message
- And more...
List Pull Requests
Returns a paginated list of pull requests with:
- Array of pull requests with same details as get_pull_request
- Total count of matching PRs
- Pagination info (has_more, next_start)
Note on Author Filter:
- For Bitbucket Cloud: Use the username (e.g., "johndoe")
- For Bitbucket Server: Use the full email address (e.g., "john.doe@company.com")
Create Pull Request
Update Pull Request
Add Comment
Add general comments or inline comments on specific lines of code:
Note on inline comments:
file_path
: The path to the file as shown in the diffline_number
: The line number as shown in the diffline_type
:ADDED
- For newly added lines (green in diff)REMOVED
- For deleted lines (red in diff)CONTEXT
- For unchanged context lines
Merge Pull Request
List Branches
Returns a paginated list of branches with:
- Branch name and ID
- Latest commit hash
- Default branch indicator
- Pagination info
Delete Branch
Note: Branch deletion requires appropriate permissions. The branch will be permanently deleted.
Get Pull Request Diff
Approve Pull Request
Request Changes
Development
npm run dev
- Watch mode for developmentnpm run build
- Build the TypeScript codenpm start
- Run the built server
Troubleshooting
- Authentication errors: Double-check your username and app password
- 404 errors: Verify the workspace, repository slug, and PR ID
- Permission errors: Ensure your app password has the required permissions
License
MIT
This server cannot be installed
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
An MCP server that enables interaction with Bitbucket repositories through the Model Context Protocol, supporting both Bitbucket Cloud and Server with features for PR lifecycle management and code review.
Related MCP Servers
- -securityAlicense-qualityMCP Server simplifies the implementation of the Model Context Protocol by providing a user-friendly API to create custom tools and manage server workflows efficiently.Last updated -43TypeScriptMIT License
- -securityAlicense-qualityMCP Server provides a simpler API to interact with the Model Context Protocol by allowing users to define custom tools and services to streamline workflows and processes.Last updated -132TypeScriptMIT License
- AsecurityAlicenseAqualityFacilitates interaction with Bitbucket Server for pull request management using the MCP protocol, supporting operations such as creating, merging, commenting, and reviewing pull requests.Last updated -71JavaScriptApache 2.0
- AsecurityAlicenseAqualityA Model Context Protocol server that enables AI assistants to interact with Bitbucket repositories, pull requests, and other resources through Bitbucket Cloud and Server APIs.Last updated -3734JavaScriptMIT License