Atlassian Bitbucket MCP サーバー
Atlassian Bitbucket Cloud 用の Node.js/TypeScript Model Context Protocol (MCP) サーバー。AI システム (Claude や Cursor AI などの LLM など) がリポジトリ、プルリクエスト、ワークスペース、コードとリアルタイムかつ安全にやり取りできるようにします。
このサーバーを使用する理由
最小限の入力、最大限の出力: シンプルな識別子により、追加のフラグを必要とせずに包括的な詳細が提供されます。
豊富なコードの視覚化: ファイル統計、差分ビュー、スマート コンテキストを使用して、コードの変更に関する詳細な情報を取得します。
安全なローカル認証: 資格情報を使用してローカルで実行し、トークンをリモート サーバーに保存することはありません。
直感的な Markdown 応答: すべての出力に対して、適切に構造化された一貫した Markdown 形式が採用されています。
完全な Bitbucket 統合: ワークスペース、リポジトリ、プル リクエスト、コメント、コード検索などにアクセスできます。
Related MCP server: GitHub MCP Tools
MCPとは何ですか?
モデルコンテキストプロトコル(MCP)は、AIシステムを外部ツールやデータソースに安全に接続するためのオープンスタンダードです。このサーバーはBitbucket Cloud向けにMCPを実装しており、AIアシスタントがBitbucketデータをプログラムで操作できるようにします。
前提条件
Node.js (>=18.x):ダウンロード
Bitbucket クラウドアカウント
設定
ステップ1: 認証
次のいずれかの認証方法を選択します。
オプション A: Bitbucket アプリのパスワード (推奨)
Bitbucket App Passwordsから生成します。最小権限:
ワークスペース: 読み取り
リポジトリ: 読む
プルリクエスト: 読む
明示的に指定されていない場合にデフォルトのワークスペースを指定するには、 BITBUCKET_DEFAULT_WORKSPACEを設定することもできます。
オプションB: Atlassian APIトークン
Atlassian API トークンから生成します。
注: Bitbucket アプリ パスワードは、より詳細な Bitbucket 固有の権限を提供するため、強くお勧めします。
ステップ2: 資格情報を構成する
オプション A: MCP 構成ファイル (推奨)
~/.mcp/configs.jsonを編集または作成します。
Bitbucket アプリパスワードの使用:
{
"bitbucket": {
"environments": {
"ATLASSIAN_BITBUCKET_USERNAME": "<your_username>",
"ATLASSIAN_BITBUCKET_APP_PASSWORD": "<your_app_password>"
}
}
}Atlassian API トークンの使用:
{
"bitbucket": {
"environments": {
"ATLASSIAN_SITE_NAME": "bitbucket",
"ATLASSIAN_USER_EMAIL": "<your_email>",
"ATLASSIAN_API_TOKEN": "<your_api_token>"
}
}
}オプションB: 環境変数
export ATLASSIAN_BITBUCKET_USERNAME="<your_username>"
export ATLASSIAN_BITBUCKET_APP_PASSWORD="<your_app_password>"ステップ3: インストールと実行
npxのクイックスタート
npx -y @aashari/mcp-server-atlassian-bitbucket ls-workspacesグローバルインストール
npm install -g @aashari/mcp-server-atlassian-bitbucket
mcp-atlassian-bitbucket ls-workspacesステップ4:AIアシスタントに接続する
MCP 互換クライアント (例: Claude、Cursor AI) を構成します。
{
"mcpServers": {
"bitbucket": {
"command": "npx",
"args": ["-y", "@aashari/mcp-server-atlassian-bitbucket"]
}
}
}MCPツール
MCP ツールは、 snake_case名、 camelCaseパラメータを使用し、Markdown 形式の応答を返します。
bb_ls_workspaces : 利用可能なワークスペースを一覧表示します(
query:str opt)。使用方法:アクセス可能なワークスペースを表示します。bb_get_workspace : ワークスペースの詳細を取得します(
workspaceSlug: 文字列が必要です)。用途: ワークスペース情報を表示します。bb_ls_repos : リポジトリを一覧表示します (
workspaceSlug: str opt、projectKey: str opt、query: str opt、role: str opt)。用途: リポジトリを検索します。bb_get_repo : リポジトリの詳細を取得します(
workspaceSlug: 文字列必須、repoSlug: 文字列必須)。用途: リポジトリ情報にアクセスします。bb_search : Bitbucket コンテンツを検索します (
workspaceSlug: str req、query: str req、scope: str opt、language: str opt、extension: str opt)。用途: コードまたは PR を検索します。bb_ls_prs : プルリクエストを一覧表示します(
workspaceSlug: str req、repoSlug: str req、state: str opt)。用途: オープンまたはマージされたPRを表示します。bb_get_pr : PRの詳細を取得します(
workspaceSlug: 文字列必須、repoSlug: 文字列必須、prId: 文字列必須)。使用方法: 差分を含むPRの詳細を表示します。bb_ls_pr_comments : PRコメントを一覧表示します(
workspaceSlug: 文字列必須、repoSlug: 文字列必須、prId: 文字列必須)。用途: PRのディスカッションを表示します。bb_add_pr_comment : PR にコメントを追加します (
workspaceSlug: str req、repoSlug: str req、prId: str req、content: str req、inline: obj opt)。使用方法: PR にフィードバックを追加します。bb_add_pr : PR を作成します (
workspaceSlug: str req、repoSlug: str req、title: str req、sourceBranch: str req、targetBranch: str opt)。使用方法: 新しい PR を作成します。bb_add_branch : ブランチを作成します (
workspaceSlug: str req、repoSlug: str req、newBranchName: str req、sourceBranchOrCommit: str opt)。使用方法: 機能ブランチを作成します。bb_clone_repo : リポジトリを複製します(
workspaceSlug: 文字列必須、repoSlug: 文字列必須、targetPath: 文字列必須)。用途: ローカルでコードを複製します。bb_get_commit_history : コミット履歴を取得します(
workspaceSlug: str req、repoSlug: str req、revision: str opt、path: str opt)。用途: コード履歴を表示します。bb_get_file : ファイルの内容を取得します(
workspaceSlug: str req、repoSlug: str req、filePath: str req、revision: str opt)。使用方法: 特定のファイルを表示します。bb_diff_branches : ブランチ間の差分を表示します(
workspaceSlug: str req、repoSlug: str req、sourceBranch: str req、targetBranch: str req)。用途: ブランチを比較します。bb_diff_commits : コミット間の差分を表示します(
workspaceSlug: str req、repoSlug: str req、sourceCommit: str req、targetCommit: str req)。用途: コミットを比較します。bb_list_branches : ブランチを一覧表示します (
workspaceSlug: str req、repoSlug: str req、query: str opt、sort: str opt)。使用方法: すべてのブランチを表示します。
bb_ls_workspaces
すべてのワークスペースを一覧表示:
{}ワークスペースを検索:
{ "query": "devteam" }bb_get_workspace
ワークスペースの詳細を取得します:
{ "workspaceSlug": "acme-corp" }bb_ls_repos
ワークスペース内のリポジトリを一覧表示します:
{ "workspaceSlug": "acme-corp", "projectKey": "PROJ" }デフォルトのワークスペースを使用してリポジトリを一覧表示します。
{ "projectKey": "PROJ" }bb_get_repo
リポジトリの詳細を取得します:
{ "workspaceSlug": "acme-corp", "repoSlug": "backend-api" }bb_search
検索コード:
{
"workspaceSlug": "acme-corp",
"query": "Logger",
"scope": "code",
"language": "typescript"
}bb_ls_prs
オープン PR をリストします:
{ "workspaceSlug": "acme-corp", "repoSlug": "frontend-app", "state": "OPEN" }bb_get_pr
PRの詳細を取得:
{ "workspaceSlug": "acme-corp", "repoSlug": "frontend-app", "prId": "42" }bb_ls_pr_comments
PRコメントをリストする:
{ "workspaceSlug": "acme-corp", "repoSlug": "frontend-app", "prId": "42" }bb_add_pr_comment
一般的なコメントを追加:
{
"workspaceSlug": "acme-corp",
"repoSlug": "frontend-app",
"prId": "42",
"content": "Looks good."
}インラインコメントを追加:
{
"workspaceSlug": "acme-corp",
"repoSlug": "frontend-app",
"prId": "42",
"content": "Consider refactoring.",
"inline": { "path": "src/utils.js", "line": 42 }
}bb_add_pr
プルリクエストを作成:
{
"workspaceSlug": "acme-corp",
"repoSlug": "frontend-app",
"title": "Add login screen",
"sourceBranch": "feature/login"
}bb_add_branch
新しいブランチを作成:
{
"workspaceSlug": "acme-corp",
"repoSlug": "frontend-app",
"newBranchName": "feature/new-feature",
"sourceBranchOrCommit": "main"
}bb_clone_repo
クローンリポジトリ:
{
"workspaceSlug": "acme-corp",
"repoSlug": "backend-api",
"targetPath": "/Users/me/projects"
}bb_get_commit_history
コミット履歴を表示:
{
"workspaceSlug": "acme-corp",
"repoSlug": "backend-api"
}フィルタリングされたコミット履歴:
{
"workspaceSlug": "acme-corp",
"repoSlug": "backend-api",
"revision": "develop",
"path": "src/main/java/com/acme/service/UserService.java"
}bb_get_file
ファイルの内容を取得:
{
"workspaceSlug": "acme-corp",
"repoSlug": "backend-api",
"filePath": "src/main/java/com/acme/service/Application.java",
"revision": "main"
}bb_diff_branches
ブランチを比較:
{
"workspaceSlug": "acme-corp",
"repoSlug": "web-app",
"sourceBranch": "develop",
"targetBranch": "main"
}bb_diff_commits
コミットの比較:
{
"workspaceSlug": "acme-corp",
"repoSlug": "web-app",
"sourceCommit": "a1b2c3d",
"targetCommit": "e4f5g6h"
}bb_list_branches
すべてのブランチを一覧表示:
{
"workspaceSlug": "acme-corp",
"repoSlug": "frontend-app"
}フィルタリングされたブランチ:
{
"workspaceSlug": "acme-corp",
"repoSlug": "frontend-app",
"query": "feature/",
"sort": "name"
}CLIコマンド
CLIコマンドはkebab-caseを使用します。詳細については、 --helpを実行してください(例: mcp-atlassian-bitbucket ls-workspaces --help )。
ls-workspaces : ワークスペースを一覧表示します (
--query)。例:mcp-atlassian-bitbucket ls-workspaces。get-workspace : ワークスペースの詳細を取得します (
--workspace-slug)。例:mcp-atlassian-bitbucket get-workspace --workspace-slug acme-corp。ls-repos : リポジトリを一覧表示します (
--workspace-slug、--project-key、--query)。例:mcp-atlassian-bitbucket ls-repos --workspace-slug acme-corp。get-repo : リポジトリの詳細を取得します (
--workspace-slug、--repo-slug)。例:mcp-atlassian-bitbucket get-repo --workspace-slug acme-corp --repo-slug backend-api。search : コードを検索します (
--workspace-slug、--query、--scope、--language)。例:mcp-atlassian-bitbucket search --workspace-slug acme-corp --query "auth"。ls-prs : PR を一覧表示します (
--workspace-slug、--repo-slug、--state)。例:mcp-atlassian-bitbucket ls-prs --workspace-slug acme-corp --repo-slug backend-api。get-pr : PRの詳細を取得します(
--workspace-slug、--repo-slug、--pr-id)。例:mcp-atlassian-bitbucket get-pr --workspace-slug acme-corp --repo-slug backend-api --pr-id 42。ls-pr-comments : PRコメントを一覧表示します(
--workspace-slug、--repo-slug、--pr-id)。例:mcp-atlassian-bitbucket ls-pr-comments --workspace-slug acme-corp --repo-slug backend-api --pr-id 42。add-pr-comment : PRコメントを追加します(
--workspace-slug、--repo-slug、--pr-id、--content)。例:mcp-atlassian-bitbucket add-pr-comment --workspace-slug acme-corp --repo-slug backend-api --pr-id 42 --content "Looks good"。add-pr : PR を作成します (
--workspace-slug、--repo-slug、--title、--source-branch)。例:mcp-atlassian-bitbucket add-pr --workspace-slug acme-corp --repo-slug backend-api --title "New feature" --source-branch feature/login。get-file : ファイルの内容を取得します (
--workspace-slug、--repo-slug、--file-path)。例:mcp-atlassian-bitbucket get-file --workspace-slug acme-corp --repo-slug backend-api --file-path src/main.js。add-branch : ブランチを作成します (
--workspace-slug、--repo-slug、--new-branch-name)。例:mcp-atlassian-bitbucket add-branch --workspace-slug acme-corp --repo-slug backend-api --new-branch-name feature/new。
ワークスペース/リポジトリの一覧と表示
# List all workspaces
mcp-atlassian-bitbucket ls-workspaces
# Get details of a specific workspace
mcp-atlassian-bitbucket get-workspace --workspace-slug acme-corp
# List repositories in a workspace
mcp-atlassian-bitbucket ls-repos --workspace-slug acme-corp --project-key PROJ
# Get details of a specific repository
mcp-atlassian-bitbucket get-repo --workspace-slug acme-corp --repo-slug backend-apiプルリクエストの操作
# List open pull requests in a repository
mcp-atlassian-bitbucket ls-prs --workspace-slug acme-corp --repo-slug frontend-app --state OPEN
# Get details of a specific pull request with code changes
mcp-atlassian-bitbucket get-pr --workspace-slug acme-corp --repo-slug frontend-app --pr-id 42
# List comments on a pull request
mcp-atlassian-bitbucket ls-pr-comments --workspace-slug acme-corp --repo-slug frontend-app --pr-id 42
# Add a comment to a pull request
mcp-atlassian-bitbucket add-pr-comment --workspace-slug acme-corp --repo-slug frontend-app --pr-id 42 --content "Looks good to merge."
# Create a new pull request
mcp-atlassian-bitbucket add-pr --workspace-slug acme-corp --repo-slug frontend-app --title "Add login screen" --source-branch feature/loginコードとコミット
# Search for code
mcp-atlassian-bitbucket search --workspace-slug acme-corp --query "Logger" --scope code --language typescript
# View commit history
mcp-atlassian-bitbucket get-commit-history --workspace-slug acme-corp --repo-slug backend-api --revision develop
# Get file content
mcp-atlassian-bitbucket get-file --workspace-slug acme-corp --repo-slug backend-api --file-path "src/Application.java" --revision main
# Compare branches
mcp-atlassian-bitbucket diff-branches --workspace-slug acme-corp --repo-slug web-app --source-branch develop --target-branch main
# Compare commits
mcp-atlassian-bitbucket diff-commits --workspace-slug acme-corp --repo-slug web-app --source-commit a1b2c3d --target-commit e4f5g6h支店管理
# List branches
mcp-atlassian-bitbucket list-branches --workspace-slug acme-corp --repo-slug frontend-app --query "feature/" --sort name
# Create a new branch
mcp-atlassian-bitbucket add-branch --workspace-slug acme-corp --repo-slug frontend-app --new-branch-name feature/new-feature --source-branch-or-commit main
# Clone a repository
mcp-atlassian-bitbucket clone --workspace-slug acme-corp --repo-slug backend-api --target-path ./cloned-projects応答フォーマット
すべての回答は Markdown 形式です。これには以下が含まれます。
タイトル: 実行された操作または表示されたエンティティ。
コンテキスト: ワークスペース、リポジトリ、プル リクエスト、またはブランチ情報。
コンテンツ: ファイル コンテンツ、PR の詳細、検索結果などの主要データ。
メタデータ: タイムスタンプ、作成者、統計。
差分: ブランチ/コミット間の差分の構文強調表示によるコード変更。
リポジトリの詳細
# Repository: backend-api
**Workspace:** acme-corp
**Full Name:** acme-corp/backend-api
**Language:** Java
**Created:** 2024-01-15 by John Smith
**Updated:** 2025-05-10 (2 days ago)
## Overview
Spring Boot backend API for the ACME product suite.
## Statistics
- **Default Branch:** main
- **Size:** 24.5 MB
- **Commits:** 358
- **Open PRs:** 4
- **Forks:** 3
## Recent Activity
- PR #42: "Add OAuth2 support" by Jane Doe (Open)
- PR #41: "Fix pagination bug" by Alex Kim (Merged)
- PR #40: "Update dependencies" by John Smith (Merged)
*Repository URL: https://bitbucket.org/acme-corp/backend-api*プルリクエストのレビュー
# Pull Request #42: Add OAuth2 support
**Repository:** acme-corp/backend-api
**Author:** Jane Doe
**State:** OPEN
**Created:** 2025-05-15 (4 days ago)
**Updated:** 2025-05-18 (yesterday)
## Description
Implements OAuth2 authentication flow with support for:
- Authorization code grant
- Refresh tokens
- Token caching
## Changes
- **Files changed:** 7
- **Additions:** 245 lines
- **Deletions:** 32 lines
## Diff for src/auth/OAuthService.java
@@ -10,6 +10,25 @@ public class OAuthService {
private final TokenRepository tokenRepository;
private final HttpClient httpClient;
+ @Autowired
+ public OAuthService(
+ TokenRepository tokenRepository,
+ HttpClient httpClient) {
+ this.tokenRepository = tokenRepository;
+ this.httpClient = httpClient;
+ }
+
+ public TokenResponse refreshToken(String refreshToken) {
+ // Validate refresh token
+ if (StringUtils.isEmpty(refreshToken)) {
+ throw new InvalidTokenException("Refresh token cannot be empty");
+ }
+
+ // Call OAuth server for new access token
+ return httpClient.post("/oauth/token")
+ .body(Map.of("grant_type", "refresh_token", "refresh_token", refreshToken))
+ .execute()
+ .as(TokenResponse.class);
+ }
## Comments (3)
1. **John Smith** (2 days ago):
> Please add unit tests for the refresh token flow
2. **Jane Doe** (yesterday):
> Added tests in the latest commit
3. **Approval by:** Alex Kim (yesterday)
*Pull Request URL: https://bitbucket.org/acme-corp/backend-api/pull-requests/42*発達
# Clone repository
git clone https://github.com/aashari/mcp-server-atlassian-bitbucket.git
cd mcp-server-atlassian-bitbucket
# Install dependencies
npm install
# Run in development mode
npm run dev:server
# Run tests
npm test貢献
貢献を歓迎します!ご協力をお願いします:
リポジトリをフォークします。
機能ブランチを作成します (
git checkout -b feature/xyz)。変更をコミットします (
git commit -m "Add xyz feature")。ブランチにプッシュします (
git push origin feature/xyz)。プルリクエストを開きます。
詳細については、 CONTRIBUTING.md を参照してください。