Sponsored by Deepsite.site

Bitbucket MCP

Created By
MatanYemini8 months ago
Bitbucket MCP - A Model Context Protocol (MCP) server for integrating with Bitbucket Cloud and Server APIs
Content

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.

CodeQL GitHub Repository License: MIT npm version

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

The easiest way to use this MCP server is via NPX, which allows you to run it without installing it globally:

# Run with environment variables
BITBUCKET_URL="https://bitbucket.org/your-workspace" \
BITBUCKET_USERNAME="your-username" \
BITBUCKET_PASSWORD="your-app-password" \
npx -y bitbucket-mcp@latest

Manual Installation

Alternatively, you can install it globally or as part of your project:

# Install globally
npm install -g bitbucket-mcp

# Or install in your project
npm install bitbucket-mcp

Then run it with:

# If installed globally
BITBUCKET_URL="https://bitbucket.org/your-workspace" \
BITBUCKET_USERNAME="your-username" \
BITBUCKET_PASSWORD="your-app-password" \
bitbucket-mcp

# If installed in your project
BITBUCKET_URL="https://bitbucket.org/your-workspace" \
BITBUCKET_USERNAME="your-username" \
BITBUCKET_PASSWORD="your-app-password" \
npx bitbucket-mcp

Configuration

Environment Variables

Configure the server using the following environment variables:

VariableDescriptionRequired
BITBUCKET_URLBitbucket base URL (e.g., "https://bitbucket.org/your-workspace")Yes
BITBUCKET_USERNAMEYour Bitbucket usernameYes*
BITBUCKET_PASSWORDYour Bitbucket app passwordYes*
BITBUCKET_TOKENYour Bitbucket access token (alternative to username/password)No
BITBUCKET_WORKSPACEDefault workspace to use when not specifiedNo

* Either BITBUCKET_TOKEN or both BITBUCKET_USERNAME and BITBUCKET_PASSWORD must be provided.

Creating a Bitbucket App Password

  1. Log in to your Bitbucket account
  2. Go to Personal Settings > App Passwords
  3. Create a new app password with the following permissions:
    • Repositories: Read
    • Pull requests: Read, Write
  4. Copy the generated password and use it as the BITBUCKET_PASSWORD environment variable

Integration with Cursor

To integrate this MCP server with Cursor:

  1. Open Cursor
  2. Go to Settings > Extensions
  3. Click on "Model Context Protocol"
  4. Add a new MCP configuration:
"bitbucket": {
  "command": "npx",
  "env": {
    "BITBUCKET_URL": "https://bitbucket.org/your-workspace",
    "BITBUCKET_USERNAME": "your-username",
    "BITBUCKET_PASSWORD": "your-app-password"
  },
  "args": ["-y", "bitbucket-mcp@latest"]
}
  1. Save the configuration
  2. 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:

"bitbucket-local": {
  "command": "node",
  "env": {
    "BITBUCKET_URL": "https://bitbucket.org/your-workspace",
    "BITBUCKET_USERNAME": "your-username",
    "BITBUCKET_PASSWORD": "your-app-password"
  },
  "args": ["/path/to/your/local/bitbucket-mcp/dist/index.js"]
}

Available Tools

This MCP server provides tools for interacting with Bitbucket repositories and pull requests. Below is a comprehensive list of the available operations:

Repository Operations

listRepositories

Lists repositories in a workspace.

Parameters:

  • workspace (optional): Bitbucket workspace name
  • limit (optional): Maximum number of repositories to return

getRepository

Gets details for a specific repository.

Parameters:

  • workspace: Bitbucket workspace name
  • repo_slug: Repository slug

Pull Request Operations

getPullRequests

Gets pull requests for a repository.

Parameters:

  • workspace: Bitbucket workspace name
  • repo_slug: Repository slug
  • state (optional): Pull request state (OPEN, MERGED, DECLINED, SUPERSEDED)
  • limit (optional): Maximum number of pull requests to return

createPullRequest

Creates a new pull request.

Parameters:

  • workspace: Bitbucket workspace name
  • repo_slug: Repository slug
  • title: Pull request title
  • description: Pull request description
  • sourceBranch: Source branch name
  • targetBranch: Target branch name
  • reviewers (optional): List of reviewer usernames

getPullRequest

Gets details for a specific pull request.

Parameters:

  • workspace: Bitbucket workspace name
  • repo_slug: Repository slug
  • pull_request_id: Pull request ID

updatePullRequest

Updates a pull request.

Parameters:

  • workspace: Bitbucket workspace name
  • repo_slug: Repository slug
  • pull_request_id: Pull request ID
  • Various optional update parameters (title, description, etc.)

getPullRequestActivity

Gets the activity log for a pull request.

Parameters:

  • workspace: Bitbucket workspace name
  • repo_slug: Repository slug
  • pull_request_id: Pull request ID

approvePullRequest

Approves a pull request.

Parameters:

  • workspace: Bitbucket workspace name
  • repo_slug: Repository slug
  • pull_request_id: Pull request ID

unapprovePullRequest

Removes an approval from a pull request.

Parameters:

  • workspace: Bitbucket workspace name
  • repo_slug: Repository slug
  • pull_request_id: Pull request ID

declinePullRequest

Declines a pull request.

Parameters:

  • workspace: Bitbucket workspace name
  • repo_slug: Repository slug
  • pull_request_id: Pull request ID
  • message (optional): Reason for declining

mergePullRequest

Merges a pull request.

Parameters:

  • workspace: Bitbucket workspace name
  • repo_slug: Repository slug
  • pull_request_id: Pull request ID
  • message (optional): Merge commit message
  • strategy (optional): Merge strategy (merge-commit, squash, fast-forward)

requestChanges

Requests changes on a pull request.

Parameters:

  • workspace: Bitbucket workspace name
  • repo_slug: Repository slug
  • pull_request_id: Pull request ID

removeChangeRequest

Removes a change request from a pull request.

Parameters:

  • workspace: Bitbucket workspace name
  • repo_slug: Repository slug
  • pull_request_id: Pull request ID

Pull Request Comment Operations

getPullRequestComments

Lists comments on a pull request.

Parameters:

  • workspace: Bitbucket workspace name
  • repo_slug: Repository slug
  • pull_request_id: Pull request ID

createPullRequestComment

Creates a comment on a pull request.

Parameters:

  • workspace: Bitbucket workspace name
  • repo_slug: Repository slug
  • pull_request_id: Pull request ID
  • content: Comment content
  • inline (optional): Inline comment information

getPullRequestComment

Gets a specific comment on a pull request.

Parameters:

  • workspace: Bitbucket workspace name
  • repo_slug: Repository slug
  • pull_request_id: Pull request ID
  • comment_id: Comment ID

updatePullRequestComment

Updates a comment on a pull request.

Parameters:

  • workspace: Bitbucket workspace name
  • repo_slug: Repository slug
  • pull_request_id: Pull request ID
  • comment_id: Comment ID
  • content: Updated comment content

deletePullRequestComment

Deletes a comment on a pull request.

Parameters:

  • workspace: Bitbucket workspace name
  • repo_slug: Repository slug
  • pull_request_id: Pull request ID
  • comment_id: Comment ID

resolveComment

Resolves a comment thread on a pull request.

Parameters:

  • workspace: Bitbucket workspace name
  • repo_slug: Repository slug
  • pull_request_id: Pull request ID
  • comment_id: Comment ID

reopenComment

Reopens a resolved comment thread on a pull request.

Parameters:

  • workspace: Bitbucket workspace name
  • repo_slug: Repository slug
  • pull_request_id: Pull request ID
  • comment_id: Comment ID

Pull Request Diff Operations

getPullRequestDiff

Gets the diff for a pull request.

Parameters:

  • workspace: Bitbucket workspace name
  • repo_slug: Repository slug
  • pull_request_id: Pull request ID

getPullRequestDiffStat

Gets the diff statistics for a pull request.

Parameters:

  • workspace: Bitbucket workspace name
  • repo_slug: Repository slug
  • pull_request_id: Pull request ID

getPullRequestPatch

Gets the patch for a pull request.

Parameters:

  • workspace: Bitbucket workspace name
  • repo_slug: Repository slug
  • pull_request_id: Pull request ID

Pull Request Task Operations

getPullRequestTasks

Lists tasks on a pull request.

Parameters:

  • workspace: Bitbucket workspace name
  • repo_slug: Repository slug
  • pull_request_id: Pull request ID

createPullRequestTask

Creates a task on a pull request.

Parameters:

  • workspace: Bitbucket workspace name
  • repo_slug: Repository slug
  • pull_request_id: Pull request ID
  • content: Task content
  • comment (optional): Comment ID to associate with the task
  • pending (optional): Whether the task is pending

getPullRequestTask

Gets a specific task on a pull request.

Parameters:

  • workspace: Bitbucket workspace name
  • repo_slug: Repository slug
  • pull_request_id: Pull request ID
  • task_id: Task ID

updatePullRequestTask

Updates a task on a pull request.

Parameters:

  • workspace: Bitbucket workspace name
  • repo_slug: Repository slug
  • pull_request_id: Pull request ID
  • task_id: Task ID
  • content (optional): Updated task content
  • state (optional): Updated task state

deletePullRequestTask

Deletes a task on a pull request.

Parameters:

  • workspace: Bitbucket workspace name
  • repo_slug: Repository slug
  • pull_request_id: Pull request ID
  • task_id: Task ID

Other Pull Request Operations

getPullRequestCommits

Lists commits on a pull request.

Parameters:

  • workspace: Bitbucket workspace name
  • repo_slug: Repository slug
  • pull_request_id: Pull request ID

getPullRequestStatuses

Lists commit statuses for a pull request.

Parameters:

  • workspace: Bitbucket workspace name
  • repo_slug: Repository slug
  • pull_request_id: Pull request ID

Development

Prerequisites

  • Node.js 18 or higher
  • npm or yarn

Setup

# Clone the repository
git clone https://github.com/MatanYemini/bitbucket-mcp.git
cd bitbucket-mcp

# Install dependencies
npm install

# Build the project
npm run build

# Run in development mode
npm run dev

License

This project is licensed under the MIT License - see the LICENSE file for details.

Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
Context7Context7 MCP Server -- Up-to-date code documentation for LLMs and AI code editors
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
Serper MCP ServerA Serper MCP Server
Amap Maps高德地图官方 MCP Server
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
TimeA Model Context Protocol server that provides time and timezone conversion capabilities. This server enables LLMs to get current time information and perform timezone conversions using IANA timezone names, with automatic system timezone detection.
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
CursorThe AI Code Editor
WindsurfThe new purpose-built IDE to harness magic
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
Tavily Mcp
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
DeepChatYour AI Partner on Desktop
ChatWiseThe second fastest AI chatbot™
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright McpPlaywright MCP server