The Bitbucket MCP server enables AI assistants to interact with Bitbucket repositories and pull requests.
Repository Operations:
List repositories in a workspace
Get repository details
Pull Request Operations:
Fetch, create, update pull requests
Approve, unapprove, decline, or merge pull requests
Request or remove changes
Get activity logs
Manage comments and tasks (list, create, update, resolve)
Access diffs, patches, and commit statuses
List commits
All operations maintain data integrity, with filtering options available for pull request states (OPEN, MERGED, DECLINED, SUPERSEDED).
Enables interaction with Bitbucket Cloud and Server APIs, providing tools for listing and retrieving repositories, managing pull requests, and working with repository content.
Supports working with Git repositories stored in Bitbucket, allowing access to repository content and version control operations.
Bitbucket MCP
A Model Context Protocol (MCP) server for integrating with Bitbucket Cloud and Server APIs. This MCP server enables AI assistants like Cursor to interact with your Bitbucket repositories, pull requests, and other resources.
Safety First
This is a safe and responsible package — no DELETE operations are used, so there's no risk of data loss. Every pull request is analyzed with CodeQL to ensure the code remains secure.
Related MCP server: GitHub MCP Server
Overview
Checkout out the official npm package This server implements the Model Context Protocol standard to provide AI assistants with access to Bitbucket data and operations. It includes tools for:
Listing and retrieving repositories
Getting repository details
Fetching pull requests
And more...
Installation
-- Since it has been asked, in many cases we have seen - "BITBUCKET_USERNAME" is usually your email
Using NPX (Recommended)
The easiest way to use this MCP server is via NPX, which allows you to run it without installing it globally:
Manual Installation
Alternatively, you can install it globally or as part of your project:
Then run it with:
Configuration
Environment Variables
Configure the server using the following environment variables:
Variable | Description | Required |
| Bitbucket API base URL. Defaults to
| No |
| Your Bitbucket username | Yes* |
| Your Bitbucket app password | Yes* |
| Your Bitbucket access token (alternative to username/password) | No |
| Default workspace to use. If omitted and
contains it, auto-set | No |
| Set to
to enable dangerous tools (e.g., deletions). Default: disabled | No |
| Disable file logging when set to
/
| No |
| Absolute path to a specific log file | No |
| Directory to store logs (defaults to OS-specific app log dir) | No |
| When
, nest logs under a per-working-directory subfolder | No |
Either BITBUCKET_TOKEN or both BITBUCKET_USERNAME and BITBUCKET_PASSWORD must be provided.
Creating a Bitbucket App Password
Log in to your Bitbucket account
Go to Personal Settings > App Passwords
Create a new app password with the following permissions:
Repositories: Read
Pull requests: Read, Write
Pipelines: Read (required for pipeline operations)
Copy the generated password and use it as the
BITBUCKET_PASSWORDenvironment variable
Troubleshooting
401 Authentication Errors
If you're getting 401 authentication errors, check the following:
Verify your app password: Make sure you're using an App Password, not your regular Bitbucket password
Verify app password permissions: Your app password needs at least "Repositories: Read" permission
Try the API URL format: If you're still getting 401 errors, try using the direct API URL format:
Test API access: Verify your credentials work by testing the Bitbucket API directly:
Atlassian API Key
Put the Atlassian API Key in the
BITBUCKET_PASSWORDvariable, notBITBUCKET_TOKENUse your Bitbucket email as
BITBUCKET_USERNAMEinstead of your regular username
For reference you can check the API token documentation
Getting Help
If you encounter issues:
Check the Bitbucket REST API documentation for API details
Review the Bitbucket Cloud documentation for general help
Integration with Cursor
To integrate this MCP server with Cursor:
Open Cursor
Go to Settings > Extensions
Click on "Model Context Protocol"
Add a new MCP configuration:
Save the configuration
Use the "/bitbucket" command in Cursor to access Bitbucket repositories and pull requests
Using a Local Build with Cursor
If you're developing locally and want to test your changes:
Available Tools
This MCP server provides tools for interacting with Bitbucket repositories and pull requests. Below is a comprehensive list of the available operations:
Pagination
Unless noted otherwise, listing tools accept the following optional parameters:
pagelen: Number of items per page (Bitbucketpagelen). Defaults to 10 and is capped at 100.page: 1-based Bitbucket page number to fetch. When omitted, the first page is returned.all: Whentrue(andpageis not provided), the server automatically follows Bitbucketnextlinks until all items are fetched or a safety cap of 1,000 entries is reached.limit: Deprecated alias forpagelenkept for backward compatibility.
Use these knobs to page through large collections without hitting CLI truncation.
Repository Operations
listRepositories
Lists repositories in a workspace.
Parameters:
workspace(optional): Bitbucket workspace namename(optional): Filter repositories by partial name matchPagination controls described in Pagination
getRepository
Gets details for a specific repository.
Parameters:
workspace: Bitbucket workspace namerepo_slug: Repository slug
Pull Request Operations
getPullRequests
Gets pull requests for a repository.
Parameters:
workspace: Bitbucket workspace namerepo_slug: Repository slugstate(optional): Pull request state (OPEN,MERGED,DECLINED,SUPERSEDED)Pagination controls described in Pagination
createPullRequest
Creates a new pull request.
Parameters:
workspace: Bitbucket workspace namerepo_slug: Repository slugtitle: Pull request titledescription: Pull request descriptionsourceBranch: Source branch nametargetBranch: Target branch namereviewers(optional): List of reviewer usernamesdraft(optional): Whether to create the pull request as a draft
getPullRequest
Gets details for a specific pull request.
Parameters:
workspace: Bitbucket workspace namerepo_slug: Repository slugpull_request_id: Pull request IDPagination controls described in Pagination
Pagination controls described in Pagination
Pagination controls described in Pagination
Pagination controls described in Pagination
updatePullRequest
Updates a pull request.
Parameters:
workspace: Bitbucket workspace namerepo_slug: Repository slugpull_request_id: Pull request IDPagination controls described in Pagination
Pagination controls described in Pagination
Various optional update parameters (title, description, etc.)
getPullRequestActivity
Gets the activity log for a pull request.
Parameters:
workspace: Bitbucket workspace namerepo_slug: Repository slugpull_request_id: Pull request ID
approvePullRequest
Approves a pull request.
Parameters:
workspace: Bitbucket workspace namerepo_slug: Repository slugpull_request_id: Pull request ID
unapprovePullRequest
Removes an approval from a pull request.
Parameters:
workspace: Bitbucket workspace namerepo_slug: Repository slugpull_request_id: Pull request ID
declinePullRequest
Declines a pull request.
Parameters:
workspace: Bitbucket workspace namerepo_slug: Repository slugpull_request_id: Pull request IDmessage(optional): Reason for declining
mergePullRequest
Merges a pull request.
Parameters:
workspace: Bitbucket workspace namerepo_slug: Repository slugpull_request_id: Pull request IDmessage(optional): Merge commit messagestrategy(optional): Merge strategy (merge-commit,squash,fast-forward)
requestChanges
Requests changes on a pull request.
Parameters:
workspace: Bitbucket workspace namerepo_slug: Repository slugpull_request_id: Pull request ID
removeChangeRequest
Removes a change request from a pull request.
Parameters:
workspace: Bitbucket workspace namerepo_slug: Repository slugpull_request_id: Pull request ID
createDraftPullRequest
Creates a new draft pull request.
Parameters:
workspace: Bitbucket workspace namerepo_slug: Repository slugtitle: Pull request titledescription: Pull request descriptionsourceBranch: Source branch nametargetBranch: Target branch namereviewers(optional): List of reviewer usernames
Note: This is equivalent to calling createPullRequest with draft: true.
publishDraftPullRequest
Publishes a draft pull request to make it ready for review.
Parameters:
workspace: Bitbucket workspace namerepo_slug: Repository slugpull_request_id: Pull request ID
convertTodraft
Converts a regular pull request to draft status.
Parameters:
workspace: Bitbucket workspace namerepo_slug: Repository slugpull_request_id: Pull request ID
Pull Request Comment Operations
getPullRequestComments
Lists comments on a pull request.
Parameters:
workspace: Bitbucket workspace namerepo_slug: Repository slugpull_request_id: Pull request ID
addPullRequestComment
Creates a comment on a pull request (general or inline).
Parameters:
workspace: Bitbucket workspace namerepo_slug: Repository slugpull_request_id: Pull request IDcontent: Comment content in markdown formatinline(optional): Inline comment information for commenting on specific lines
Inline Comment Format:
The inline parameter allows you to create comments on specific lines of code in the pull request diff:
Examples:
General comment: Omit the
inlineparameter for a general pull request commentComment on new line: Use only
toparameterComment on deleted line: Use only
fromparameterComment on modified line: Use both
fromandtoparameters
Usage:
getPullRequestComment
Gets a specific comment on a pull request.
Parameters:
workspace: Bitbucket workspace namerepo_slug: Repository slugpull_request_id: Pull request IDcomment_id: Comment ID
updatePullRequestComment
Updates a comment on a pull request.
Parameters:
workspace: Bitbucket workspace namerepo_slug: Repository slugpull_request_id: Pull request IDcomment_id: Comment IDcontent: Updated comment content
deletePullRequestComment
Deletes a comment on a pull request.
Parameters:
workspace: Bitbucket workspace namerepo_slug: Repository slugpull_request_id: Pull request IDcomment_id: Comment ID
resolveComment
Resolves a comment thread on a pull request.
Parameters:
workspace: Bitbucket workspace namerepo_slug: Repository slugpull_request_id: Pull request IDcomment_id: Comment ID
reopenComment
Reopens a resolved comment thread on a pull request.
Parameters:
workspace: Bitbucket workspace namerepo_slug: Repository slugpull_request_id: Pull request IDcomment_id: Comment ID
Pull Request Diff Operations
getPullRequestDiff
Gets the diff for a pull request.
Parameters:
workspace: Bitbucket workspace namerepo_slug: Repository slugpull_request_id: Pull request ID
getPullRequestDiffStat
Gets the diff statistics for a pull request.
Parameters:
workspace: Bitbucket workspace namerepo_slug: Repository slugpull_request_id: Pull request ID
getPullRequestPatch
Gets the patch for a pull request.
Parameters:
workspace: Bitbucket workspace namerepo_slug: Repository slugpull_request_id: Pull request ID
Pull Request Task Operations
getPullRequestTasks
Lists tasks on a pull request.
Parameters:
workspace: Bitbucket workspace namerepo_slug: Repository slugpull_request_id: Pull request ID
createPullRequestTask
Creates a task on a pull request.
Parameters:
workspace: Bitbucket workspace namerepo_slug: Repository slugpull_request_id: Pull request IDcontent: Task contentcomment(optional): Comment ID to associate with the taskpending(optional): Whether the task is pending
getPullRequestTask
Gets a specific task on a pull request.
Parameters:
workspace: Bitbucket workspace namerepo_slug: Repository slugpull_request_id: Pull request IDtask_id: Task ID
updatePullRequestTask
Updates a task on a pull request.
Parameters:
workspace: Bitbucket workspace namerepo_slug: Repository slugpull_request_id: Pull request IDtask_id: Task IDcontent(optional): Updated task contentstate(optional): Updated task state
deletePullRequestTask
Deletes a task on a pull request.
Parameters:
workspace: Bitbucket workspace namerepo_slug: Repository slugpull_request_id: Pull request IDtask_id: Task ID
Other Pull Request Operations
getPullRequestCommits
Lists commits on a pull request.
Parameters:
workspace: Bitbucket workspace namerepo_slug: Repository slugpull_request_id: Pull request ID
getPullRequestStatuses
Lists commit statuses for a pull request.
Parameters:
workspace: Bitbucket workspace namerepo_slug: Repository slugpull_request_id: Pull request ID
Pipeline Operations
listPipelineRuns
Lists pipeline runs for a repository.
Parameters:
workspace: Bitbucket workspace namerepo_slug: Repository slugPagination controls described in Pagination
status(optional): Filter pipelines by status (PENDING,IN_PROGRESS,SUCCESSFUL,FAILED,ERROR,STOPPED)target_branch(optional): Filter pipelines by target branchtrigger_type(optional): Filter pipelines by trigger type (manual,push,pullrequest,schedule)
getPipelineRun
Gets details for a specific pipeline run.
Parameters:
workspace: Bitbucket workspace namerepo_slug: Repository slugpipeline_uuid: Pipeline UUIDPagination controls described in Pagination
runPipeline
Triggers a new pipeline run.
Parameters:
workspace: Bitbucket workspace namerepo_slug: Repository slugtarget: Pipeline target configuration (object withref_type,ref_name, and optionalcommit_hash,selector_type,selector_pattern)variables(optional): Array of pipeline variables (objects withkey,value, and optionalsecuredfields)
stopPipeline
Stops a running pipeline.
Parameters:
workspace: Bitbucket workspace namerepo_slug: Repository slugpipeline_uuid: Pipeline UUID
getPipelineSteps
Lists steps for a pipeline run.
Parameters:
workspace: Bitbucket workspace namerepo_slug: Repository slugpipeline_uuid: Pipeline UUID
getPipelineStep
Gets details for a specific pipeline step.
Parameters:
workspace: Bitbucket workspace namerepo_slug: Repository slugpipeline_uuid: Pipeline UUIDstep_uuid: Step UUID
getPipelineStepLogs
Gets logs for a specific pipeline step.
Parameters:
workspace: Bitbucket workspace namerepo_slug: Repository slugpipeline_uuid: Pipeline UUIDstep_uuid: Step UUID
Development
Prerequisites
Node.js 18 or higher
npm or yarn
Setup
Publishing to the MCP Registry
Use the official Model Context Protocol publishing guide when you are ready to make a new server release. The repository includes everything that guide expects:
Build the project so
dist/index.jsis up to date:npm run buildGenerate the registry manifest (this reads
package.jsonand emitsregistry/bitbucket-mcp.manifest.json):npm run registry:manifestFollow the publish-server guide to push the manifest with
smithery publishor the recommended workflow from the guide.
The generated manifest captures the CLI command (node dist/index.js), all documented configuration options, and pointers back to
this README for setup instructions, so it can be submitted directly to the MCP registry.
License
This project is licensed under the MIT License - see the LICENSE file for details.