bitbucket-mcp
bitbucket-mcp
Bitbucket Cloud 用 MCP サーバー。 プルリクエスト、コードレビュー、ブランチ、ソース、 パイプライン、Webhook、変数を、生の REST 呼び出しではなく制御されたツールサーフェスとして 公開します。
存在理由
公式の Atlassian MCP は Jira と Confluence のみを対象としています。Bitbucket は対象外のため、 リポジトリ操作はすべて手書きの REST 呼び出しに頼ることになります。冗長なペイロード、ガードレールなし、 そしてスコープが許すすべてにアクセスできるトークンという状態です。
このサーバーは、次の 3 つの面でそのギャップを埋めます。
トリミングされたペイロード。 レスポンスは実際に使用するフィールドにまで正規化されるため、 PR レビューで消費するコンテキストは生の REST レスポンスの数分の一で済みます。
プロンプトではなくサーバー側のガードレール。 保護ブランチ、破壊的操作に対する
confirm、 読み取り専用モードは、HTTP 呼び出しが送出される前に強制されます。意図ごとに 1 つのツール。 汎用的な HTTP エスケープハッチの代わりに、レビュー、ブランチ、 パイプライン、Webhook のワークフローをカバーする 55 のツールを提供します。
flowchart LR
A["MCP client<br/>(Claude Code, Inspector)"] -->|stdio| B["bitbucket-mcp"]
B --> C{"Guards"}
C -->|"read only, confirm,<br/>protected branch,<br/>workspace lock"| D["Bitbucket Cloud<br/>REST API"]
C -.->|refused before<br/>the HTTP call| A
B --> E["git over SSH<br/>or HTTPS"]
E --> F["Repository"]
D -->|normalized,<br/>trimmed response| ARelated MCP server: Bitbucket MCP
インストール
このパッケージは npm に @marcusyoda/bitbucket-mcp として公開されています。
要件
Node >= 20
スコープ付き Atlassian API トークン(認証 を参照)
SSH 経由の
git_*ツール用に Bitbucket に登録された SSH キー。代わりに HTTPS 版を使用する場合はオプションです。
オプション 1: npx(インストール不要)
最も速い方法です。MCP クライアントをパッケージに向けて、npx に解決させます。
npx -y @marcusyoda/bitbucket-mcpオプション 2: グローバルインストール
npm install -g @marcusyoda/bitbucket-mcp
# or: pnpm add -g @marcusyoda/bitbucket-mcp
bitbucket-mcpオプション 3: ソースから
git clone https://github.com/marcusyoda/bitbucket-mcp.git
cd bitbucket-mcp
pnpm install
pnpm build # dist/index.jsMCP クライアントに登録する
Claude Code(CLI 経由)
claude mcp add bitbucket \
--env BITBUCKET_EMAIL=you@example.com \
--env BITBUCKET_API_TOKEN=your-token \
--env BITBUCKET_WORKSPACE=your-workspace \
-- npx -y @marcusyoda/bitbucket-mcp任意のクライアント(.mcp.json 経由)
{
"mcpServers": {
"bitbucket": {
"command": "npx",
"args": ["-y", "@marcusyoda/bitbucket-mcp"],
"env": {
"BITBUCKET_EMAIL": "you@example.com",
"BITBUCKET_API_TOKEN": "your-token",
"BITBUCKET_WORKSPACE": "your-workspace",
"BITBUCKET_DEFAULT_REPO": "your-repo-optional"
}
}
}
}代わりにソースから実行しますか? コマンドをビルド済みエントリポイントに置き換えてください。
{ "command": "node", "args": ["/abs/path/to/bitbucket-mcp/dist/index.js"] }get_current_user を呼び出して接続を確認します。トークンのラウンドトリップが行われ、Bitbucket の ID が返されます。
認証
認証は email:api_token を使用した HTTP Basic です。スコープ付き API トークンは id.atlassian.com > Manage account > Security > API tokens で作成します。
トークンスコープ(詳細なピッカー。使用するものだけを作成):
機能 | スコープ |
認証と ID の確認 |
|
ソース、ブランチ、リポジトリの読み取り |
|
API 経由でのブランチとリポジトリの作成 |
|
PR とコメントのレビュー、承認、却下、マージ |
|
パイプライン(読み取り、トリガー、停止) |
|
Webhook |
|
オプション: パイプライン変数とデプロイ変数の読み取り |
|
変数ツール(*_variable*、list_deployment_*)には admin:repository:bitbucket が必要です。このスコープを省略しても問題ありません。該当ツールは 403 を返し、それ以外はすべて正常に動作し続けます。
根拠と完全な権限決定記録は PERMISSIONS.md にあります。
環境変数
ローカル実行用に .env.example を .env にコピーしてください。これをコミットしてはいけません。
環境変数 | 目的 |
| REST API で使用する Atlassian アカウントのメールアドレス |
| スコープ付き API トークン |
| ワークスペーススラッグ(必須) |
| Bitbucket アカウントのユーザー名(メールアドレスではありません)。HTTPS の git ツールのみで使用 |
| オプション。未設定の場合、すべての呼び出しで |
|
|
| カンマ区切り。デフォルトは |
|
|
パッケージの .env は、環境に BITBUCKET_API_TOKEN が存在しない場合にのみ読み込まれます。これにより、プロジェクトごとの認証情報を注入するランチャーが常に優先され、別のワークスペースの迷子の .env が注入されたトークンを上書きすることは決してありません。
セーフティモデル
BITBUCKET_READ_ONLY=trueは、API に到達する前にすべての書き込みツールと破壊的ツールをブロックします。破壊的ツール(
merge、decline、delete_*、stop_pipeline、git_commit、git_push、インライン PR コメント)にはconfirm: trueが必要です。secured変数の作成にもconfirm: trueが必要です。セキュア変数の値は API 上書き込み専用で、返されたりログに記録されたりすることはありません。
保護ブランチ(
BITBUCKET_PROTECTED_BRANCHES、デフォルトはmain,dev)は直接変更がハードブロックされます。git_push、git_rebase(チェックアウト時)、delete_branch、create_branchは、confirmがあっても保護ブランチをターゲットにしません。変更は PR 経由で取り込みます。保護ブランチへのmerge_pull_requestはconfirm: trueで許可されます。ワークスペースロック。
BITBUCKET_LOCK_WORKSPACE=trueの場合、別のワークスペースを指定する呼び出しは拒否されます。1 つのインストールから複数のクライアントにサービスを提供するマシン向けに作られています。
ツール
すべてのツールは、環境変数のデフォルトを上書きするオプションの workspace と repo を受け付けます。
リポジトリとメタ: get_current_user、list_repositories、get_repository、create_repository
プルリクエスト: list_pull_requests、get_pull_request、get_pull_request_diff、get_pull_request_activity、create_pull_request、update_pull_request、approve_pull_request、unapprove_pull_request、request_changes_pull_request、decline_pull_request (confirm)、merge_pull_request (confirm)、list_pr_commits、get_diff
コメント: list_pr_comments、add_pr_comment (inline は confirm が必要)、reply_pr_comment、update_pr_comment、delete_pr_comment (confirm)、resolve_comment、react_pr_comment (実験的)
ブランチ、ソース、git: list_branches、get_branch、create_branch、delete_branch (confirm)、get_file_source、list_directory、clone_repo、clone_repo_https、git_commit (confirm)、git_rebase、git_push (confirm)、git_push_https (confirm)。すべてのプッシュツールとブランチツールは保護ブランチを拒否します。
パイプライン: list_pipelines、get_pipeline、get_pipeline_steps、get_pipeline_step_log、trigger_pipeline、stop_pipeline (confirm)
変数: list_repo_pipeline_variables、upsert_repo_pipeline_variable、delete_repo_pipeline_variable (confirm)、list_workspace_variables、list_deployment_environments、list_deployment_variables、upsert_deployment_variable、delete_deployment_variable (confirm)
Webhook: list_webhooks、get_webhook、create_webhook、update_webhook、delete_webhook (confirm)
git 用の SSH または HTTPS
clone_repo、git_commit、git_rebase、git_push はトークンではなくSSH キーを使用します。SSH が利用できない場合、clone_repo_https と git_push_https は username:token で認証し、BITBUCKET_USERNAME が必要です。保護ブランチのガードは両方のトランスポートに適用されます。
既知の制限
react_pr_commentは実験的です。 PR コメントへの絵文字リアクションは、Cloud ではなく Bitbucket Data Center 向けにドキュメント化されています。このツールはベストエフォートのエンドポイントをターゲットにしており、ワークスペースがサポートしていない場合はエラーを返す可能性があります。resolve_commentは、リポジトリでコメントスレッドの解決が利用可能であることに依存します。カスタムパイプラインが期待する変数を一覧表示するエンドポイントはありません。その情報は
bitbucket-pipelines.ymlに含まれており、get_file_sourceで読み取ってください。保存された変数の値を読み戻すには管理者スコープが必要です。
開発
pnpm install
pnpm dev # tsx watch
pnpm typecheck
pnpm build # tsup, ESM
pnpm inspect # build and open the MCP Inspectorプロジェクトのルールと規約は CLAUDE.md にあります。コントリビューションは issue ファーストのワークフローに従います。すべてのコミットはヘッダーに type(scope): subject [#N] の形式で issue をリンクします。
利用する
MIT ライセンスです。文字通り、仕事で使う、商用で使う、フォークする、独自のツールにベンダリングする、名前を変更する、すべて自由です。許可を求める必要も、ライセンス表示を維持する以外の帰属の儀式もありません。手書きの REST 呼び出しを書く午後を 1 回節約できれば、それだけで元が取れています。
ツールが足りない、またはこれがカバーしていない Bitbucket エンドポイントに遭遇しましたか? issue を開いてください。プルリクエストも歓迎します。唯一のルールは、すべてのコミットがヘッダーに type(scope): subject [#N] の形式で issue をリンクすることです。
LICENSE を参照してください。
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
AI-native git hosting — repos, PRs, issues, CI gates, and AI code review over MCP (60 tools).
Governed app access for AI agents: 1,000+ apps & 12,000+ tools via Code Mode MCP.
Connect AI assistants to GitHub - manage repos, issues, PRs, and workflows through natural language.
The Buildkite MCP server exposes Buildkite product data (pipelines, builds, jobs, and test data) to AI tools, editors, and agents through the Model Context Protocol. It provides capabilities including pipeline creation and management, build monitoring with specialized tools like 'wait_for_build', efficient log querying using Apache Parquet conversion and caching, and OAuth-based authentication for both read-write and read-only access to Buildkite's REST API.
Related MCP Servers
- AlicenseNot gradedqualityAmaintenanceEnables AI assistants to interact with Bitbucket Cloud repositories, allowing users to manage pull requests, comments, tasks, and branches through natural language commands.5,0331MIT
- AlicenseAqualityCmaintenanceEnables AI assistants to manage Bitbucket Cloud repositories, pull requests, branches, commits, pipelines, issues, and webhooks through the Model Context Protocol.81,058MIT
- AlicenseBqualityDmaintenanceEnables AI assistants to interact with Bitbucket Cloud and self-hosted instances for pull request reviews, code search, repository operations, and managing PR comments and approvals.19GPL 3.0
- AlicenseNot gradedqualityCmaintenanceEnables AI assistants to programmatically manage Bitbucket Cloud resources, including pull requests, repositories, and branches, automating code review workflows.189MIT
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/marcusyoda/bitbucket-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server