Bitbucket MCPのロゴ

Bitbucket MCP

コミュニティ
MatanYemini

Bitbucket MCP - A Model Context Protocol (MCP) server for integrating with Bitbucket Cloud and Server APIs

公開者MatanYemini
リポジトリbitbucket-mcp
言語JavaScript
フォーク
108
スター
165
利用可能なツール
0
通信方式stdio
ライセンスMIT
リンク
  • ツールをAIワークフローに接続

    Bitbucket MCPは、対応するAIクライアントやAIエージェントから利用できるMCP機能を提供します。

  • 0個の利用可能なツール

    呼び出し可能なアクションを以下で確認できます。サーバーから提供されている場合は、名前や説明も表示されます。

  • コピーして使える設定

    セットアップ用の設定例を使って、お好みのMCPクライアントにこのサーバーを設定できます。

  • オープンソースの注目度

    リンク先のリポジトリには165件のスターと108件のフォークがあります。

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

-- 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:

bash
# Option A (recommended): API URL + explicit workspace
BITBUCKET_URL="https://api.bitbucket.org/2.0" \
BITBUCKET_WORKSPACE="your-workspace" \
BITBUCKET_USERNAME="your-username" \
BITBUCKET_PASSWORD="your-app-password" \
npx -y bitbucket-mcp@latest

# Option B (legacy-compatible): web URL only; workspace is auto-extracted
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:

bash
# Install globally
npm install -g bitbucket-mcp

# Or install in your project
npm install bitbucket-mcp

Then run it with:

bash
# If installed globally (Option A)
BITBUCKET_URL="https://api.bitbucket.org/2.0" \
BITBUCKET_WORKSPACE="your-workspace" \
BITBUCKET_USERNAME="your-username" \
BITBUCKET_PASSWORD="your-app-password" \
bitbucket-mcp

# If installed globally (Option B - legacy-compatible)
BITBUCKET_URL="https://bitbucket.org/your-workspace" \
BITBUCKET_USERNAME="your-username" \
BITBUCKET_PASSWORD="your-app-password" \
bitbucket-mcp

# If installed in your project (Option A)
BITBUCKET_URL="https://api.bitbucket.org/2.0" \
BITBUCKET_WORKSPACE="your-workspace" \
BITBUCKET_USERNAME="your-username" \
BITBUCKET_PASSWORD="your-app-password" \
npx bitbucket-mcp

# If installed in your project (Option B - legacy-compatible)
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 API base URL. Defaults to https://api.bitbucket.org/2.0No
BITBUCKET_USERNAMEYour Bitbucket usernameYes*
BITBUCKET_PASSWORDYour Bitbucket app passwordYes*
BITBUCKET_TOKENYour Bitbucket access token (alternative to username/password)No
BITBUCKET_WORKSPACEDefault workspace to use. If omitted and BITBUCKET_URL contains it, auto-setNo
BITBUCKET_ENABLE_DANGEROUSSet to true to enable dangerous tools (e.g., deletions). Default: disabledNo
BITBUCKET_LOG_DISABLEDisable file logging when set to true/1No
BITBUCKET_LOG_FILEAbsolute path to a specific log fileNo
BITBUCKET_LOG_DIRDirectory to store logs (defaults to OS-specific app log dir)No
BITBUCKET_LOG_PER_CWDWhen true, nest logs under a per-working-directory subfolderNo

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
    • Pipelines: Read (required for pipeline operations)
  4. Copy the generated password and use it as the BITBUCKET_PASSWORD environment variable

Troubleshooting

401 Authentication Errors

If you're getting 401 authentication errors, check the following:

  1. Verify your app password: Make sure you're using an App Password, not your regular Bitbucket password
  2. Verify app password permissions: Your app password needs at least "Repositories: Read" permission
  3. Try the API URL format: If you're still getting 401 errors, try using the direct API URL format:
bash
BITBUCKET_URL="https://api.bitbucket.org/2.0"
  1. Test API access: Verify your credentials work by testing the Bitbucket API directly:
bash
# Test with curl (replace with your actual values)
curl -u "your-username:your-app-password" \
  "https://api.bitbucket.org/2.0/repositories/your-workspace"

Atlassian API Key

  1. Put the Atlassian API Key in the BITBUCKET_PASSWORD variable, not BITBUCKET_TOKEN
  2. Use your Bitbucket email as BITBUCKET_USERNAME instead of your regular username

For reference you can check the API token documentation

Getting Help

If you encounter issues:

  1. Check the Bitbucket REST API documentation for API details
  2. Review the Bitbucket Cloud documentation for general help

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:
json
"bitbucket": {
  "command": "npx",
  "env": {
    "BITBUCKET_URL": "https://api.bitbucket.org/2.0",
    "BITBUCKET_WORKSPACE": "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:

json
"bitbucket-local": {
  "command": "node",
  "env": {
    "BITBUCKET_URL": "https://api.bitbucket.org/2.0",
    "BITBUCKET_WORKSPACE": "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:

Pagination

Unless noted otherwise, listing tools accept the following optional parameters:

  • pagelen: Number of items per page (Bitbucket pagelen). Defaults to 10 and is capped at 100.
  • page: 1-based Bitbucket page number to fetch. When omitted, the first page is returned.
  • all: When true (and page is not provided), the server automatically follows Bitbucket next links until all items are fetched or a safety cap of 1,000 entries is reached.
  • limit: Deprecated alias for pagelen kept 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 name
  • name (optional): Filter repositories by partial name match
  • Pagination controls described in Pagination

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)
  • Pagination controls described in Pagination

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
  • draft (optional): Whether to create the pull request as a draft

getPullRequest

Gets details for a specific pull request.

Parameters:

  • workspace: Bitbucket workspace name
  • repo_slug: Repository slug
  • pull_request_id: Pull request ID
  • Pagination 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 name
  • repo_slug: Repository slug
  • pull_request_id: Pull request ID
  • Pagination 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 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

createDraftPullRequest

Creates a new draft 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

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 name
  • repo_slug: Repository slug
  • pull_request_id: Pull request ID

convertTodraft

Converts a regular pull request to draft status.

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

addPullRequestComment

Creates a comment on a pull request (general or inline).

Parameters:

  • workspace: Bitbucket workspace name
  • repo_slug: Repository slug
  • pull_request_id: Pull request ID
  • content: Comment content in markdown format
  • inline (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:

json
{
  "path": "src/file.ts",
  "to": 15, // Line number in NEW version (for added/modified lines)
  "from": 10 // Line number in OLD version (for deleted/modified lines)
}

Examples:

  • General comment: Omit the inline parameter for a general pull request comment
  • Comment on new line: Use only to parameter
  • Comment on deleted line: Use only from parameter
  • Comment on modified line: Use both from and to parameters

Usage:

javascript
// General comment
addPullRequestComment(workspace, repo, pr_id, "Great work!");

// Inline comment on new line 25
addPullRequestComment(workspace, repo, pr_id, "Consider error handling here", {
  path: "src/service.ts",
  to: 25,
});

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

Pipeline Operations

listPipelineRuns

Lists pipeline runs for a repository.

Parameters:

  • workspace: Bitbucket workspace name
  • repo_slug: Repository slug
  • Pagination controls described in Pagination
  • status (optional): Filter pipelines by status (PENDING, IN_PROGRESS, SUCCESSFUL, FAILED, ERROR, STOPPED)
  • target_branch (optional): Filter pipelines by target branch
  • trigger_type (optional): Filter pipelines by trigger type (manual, push, pullrequest, schedule)

getPipelineRun

Gets details for a specific pipeline run.

Parameters:

  • workspace: Bitbucket workspace name
  • repo_slug: Repository slug
  • pipeline_uuid: Pipeline UUID
  • Pagination controls described in Pagination

runPipeline

Triggers a new pipeline run.

Parameters:

  • workspace: Bitbucket workspace name
  • repo_slug: Repository slug
  • target: Pipeline target configuration (object with ref_type, ref_name, and optional commit_hash, selector_type, selector_pattern)
  • variables (optional): Array of pipeline variables (objects with key, value, and optional secured fields)

stopPipeline

Stops a running pipeline.

Parameters:

  • workspace: Bitbucket workspace name
  • repo_slug: Repository slug
  • pipeline_uuid: Pipeline UUID

getPipelineSteps

Lists steps for a pipeline run.

Parameters:

  • workspace: Bitbucket workspace name
  • repo_slug: Repository slug
  • pipeline_uuid: Pipeline UUID

getPipelineStep

Gets details for a specific pipeline step.

Parameters:

  • workspace: Bitbucket workspace name
  • repo_slug: Repository slug
  • pipeline_uuid: Pipeline UUID
  • step_uuid: Step UUID

getPipelineStepLogs

Gets logs for a specific pipeline step.

Parameters:

  • workspace: Bitbucket workspace name
  • repo_slug: Repository slug
  • pipeline_uuid: Pipeline UUID
  • step_uuid: Step UUID

Development

Prerequisites

  • Node.js 18 or higher
  • npm or yarn

Setup

bash
# 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

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:

  1. Build the project so dist/index.js is up to date:
    bash
    npm run build
  2. Generate the registry manifest (this reads package.json and emits registry/bitbucket-mcp.manifest.json):
    bash
    npm run registry:manifest
  3. Follow the publish-server guide to push the manifest with smithery publish or 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.

Links

Bitbucket MCPのMCPを複数のAIモデルで活用

TypingMindはワークスペース単位でMCPツールに接続します。そのため、一度Bitbucket MCPに接続すれば、モデルごとに個別に設定することなく、TypingMind内のさまざまなAIモデルで利用できます。 このMCPは、デバイス上のTypingMind MCPコネクタを通じてローカルで動作します。

ローカルコネクタのセットアップガイド

MCPサーバーが、お使いのコンピューター上のローカルファイル、アプリ、非公開リソースにアクセスする必要がある場合は、この方法を使います。

1

MCP設定を開く

TypingMindで「設定」、「詳細設定」、「MCP」の順に進み、「コネクタを設定」を選択してください。

  1. ブラウザでTypingMindを開いてください。
  2. 設定アイコンをクリックしてください。
  3. 「詳細設定」に移動してください。
  4. 「MCP」セクションを開いてください。
  5. 「コネクタを設定」をクリックし、「このデバイス」を選択してください。
「このデバイス」が選択されたTypingMindのMCPコネクタ設定画面
2

コネクタのコマンドを実行

「このデバイス」を選択し、TypingMindからコマンドをコピーしてターミナルで実行してください。MCPの使用中は、プロセスを実行したままにしてください。

  1. TypingMindに表示されるセットアップコマンドをコピーしてください。
  2. macOSではターミナルを、WindowsではWindows Terminalを開いてください。
  3. コマンドを貼り付けて実行してください。
  4. ターミナルで続行の確認を求められた場合は、パッケージのインストールを承認してください。
  5. MCPツールの使用中は、ターミナルウィンドウを開いたまま、プロセスの実行を継続してください。
3

Bitbucket MCPをサーバーとして追加

コネクタのステータスが「準備完了」になったら、「サーバーを編集」をクリックし、MCPサーバーの設定を貼り付けてください。

  1. コネクタのステータスが「準備完了」になるまでお待ちください。
  2. 「サーバーを編集」をクリックしてください。
  3. Bitbucket MCPのMCPサーバー設定を貼り付けてください。
  4. サーバー一覧を保存してください。
  5. コネクタが引き続き使用可能か確認するには、更新してください。
稼働中のサーバーと「サーバーを編集」ボタンが表示されたTypingMindのMCP設定画面
{
  "mcpServers": {
    "bitbucket-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "<mcp-server-package>"
      ]
    }
  }
}
4

複数のモデルで同じ接続を使用

サーバー一覧を保存し、「プラグイン」を開いてBitbucket MCPのMCPツールを有効にしてください。その後、TypingMindで対応するAIモデルを選択し、チャットでツールを使うか、AIエージェントに割り当ててください。

  1. TypingMindの「プラグイン」ページを開いてください。
  2. Bitbucket MCPのMCPツールを有効にしてください。
  3. チャットを開始し、使用するAIモデルを選択してください。
  4. MCPツールをチャットで使うか、AIエージェントに割り当ててください。
  5. MCPに再接続することなく、必要に応じて別のAIモデルに切り替えられます。
選択したAIモデルと有効なMCPツールを使用したTypingMindのチャット
Bitbucket MCPを使ってこのタスクを手伝ってもらえますか?
Bitbucket MCP
はい、読みました。
Bitbucket MCPで調べた結果をお伝えします。

よくある質問

Bitbucket MCP MCPサーバーは何に使いますか?

Bitbucket MCPは、対応するAIクライアントを外部ツールやコンテキストに接続するためのMCPサーバーです。TypingMindでは、このMCPサーバーを一度追加するだけで、AIワークスペース内でそのツールを利用できるようになります。

TypingMindでBitbucket MCP MCPを複数のAIモデルと併用できますか?

はい。TypingMindはワークスペース単位でMCPツールに接続するため、モデルごとにMCPサーバーを設定する必要はありません。Claude、ChatGPT、Geminiや、TypingMindで設定したその他のAIモデルでBitbucket MCPを利用できます。

TypingMindでBitbucket MCP MCPを使うメリットは何ですか?

TypingMindは、複数のAIモデル、プロンプト、プラグイン、AIエージェント、APIキー、MCPツールを1つのワークスペースにまとめられる、LLMチャット向けの優れたフロントエンドです。Bitbucket MCPを接続すると、TypingMindでチャットのワークフローを整理しながら、お好みのモデルでそのMCPツールを利用できます。

Bitbucket MCP MCPをTypingMindに接続するにはどうすればよいですか?

Bitbucket MCPはTypingMindのローカルMCPコネクタ経由で動作します。MCPサーバーがコンピューター上のローカルファイル、デスクトップアプリ、コマンドラインツール、プライベートリソースにアクセスする必要がある場合に最適です。

TypingMindでBitbucket MCP MCPのどのようなツールを利用できますか?

Bitbucket MCPはMCP機能を提供しています。TypingMindのプラグインページで有効にすると、チャットで使用したり、AIエージェントに割り当てたりできます。

Bitbucket MCP MCPを使うには、APIキーをTypingMindと共有する必要がありますか?

いいえ。TypingMindはローカルファーストの設計で、モデルプロバイダー、APIキー、プロンプト、MCP設定をご自身で管理できます。Bitbucket MCPで認証が必要な場合は、接続の作成時に、そのMCPサーバーに必要なヘッダー、OAuth設定、またはローカル設定を追加してください。

関連するMCPサーバー

すべて見る

今すぐ自分専用のAIワークスペースを作成

ニュースレターに登録すると、新機能や今後のプレゼント企画のお知らせが届きます👇