Skip to main content
Glama
Bitbucket Server MCP

Bitbucket Server MCP

by garc33

Bitbucket Server MCP

Bitbucket Serverのプルリクエスト管理用MCP (Model Context Protocol) サーバーです。このサーバーは、MCPプロトコルを通じてBitbucket Server APIと対話するためのツールとリソースを提供します。

✨ 新機能

  • 🔧 カスタムHTTPヘッダー: BITBUCKET_CUSTOM_HEADERS 環境変数を使用して、すべてのリクエストにカスタムヘッダーを追加可能(ゼロトラストトークンやプロキシに便利)

  • 📋 PRの検索: list_pull_requests を使用して、状態、作成者、または方向でプルリクエストを一覧表示・フィルタリング可能(#14を修正)

  • 🌿 ブランチ管理: list_branches でデフォルトブランチ検出を含むブランチ一覧表示、delete_branch でマージ済みブランチの削除が可能

  • 📝 コミット履歴: list_commits を使用して、ブランチや作成者でフィルタリングしながらコミット履歴を閲覧可能

  • ✅ PRの承認: approve_pull_request および unapprove_pull_request でプルリクエストの承認・承認取り消しが可能

  • 🔍 高度な検索: search ツールを使用して、プロジェクト/リポジトリのフィルタリングを行いながらコードやファイルを検索可能

  • 📄 ファイル操作: get_file_content および browse_repository でファイル内容の読み取りやリポジトリディレクトリの閲覧が可能

  • 💬 コメント管理: get_comments ツールでPRコメントの抽出とフィルタリングが可能

  • 🔍 プロジェクトの探索: list_projects でアクセス可能なすべてのBitbucketプロジェクトを一覧表示可能

  • 📁 リポジトリの閲覧: list_repositories でプロジェクト全体のリポジトリを探索可能

  • 🔧 柔軟なプロジェクトサポート: デフォルトプロジェクトをオプション化 - コマンドごとに指定するか、BITBUCKET_DEFAULT_PROJECT を使用可能

  • 📖 ドキュメントの強化: 使用例や設定ガイドを改善したREADME

Related MCP server: Bitbucket MCP Server

要件

  • Node.js >= 16

インストール

Smithery経由でのインストール

Smithery を介してClaude DesktopにBitbucket Serverを自動的にインストールするには:

npx -y @smithery/cli install @garc33/bitbucket-server-mcp-server --client claude

手動インストール

npm install

ビルド

npm run build

機能

このサーバーは、包括的なBitbucket Server統合のために以下のツールを提供します:

list_projects

Bitbucketプロジェクトの発見と探索: アクセス可能なすべてのプロジェクトを詳細とともに一覧表示します。プロジェクトの発見や、他の操作で使用する正しいプロジェクトキーを見つけるために不可欠です。

使用例:

  • 正確なプロジェクトキーが不明な場合に利用可能なプロジェクトを探す

  • プロジェクトの構造と権限を調査する

  • アクセス権のある新しいプロジェクトを発見する

パラメータ:

  • limit: 返すプロジェクトの数(デフォルト: 25、最大: 1000)

  • start: ページネーションの開始インデックス(デフォルト: 0)

list_repositories

リポジトリの閲覧と発見: 特定のプロジェクト内、またはアクセス可能なすべてのプロジェクト全体のリポジトリを探索します。クローンURLやメタデータを含む包括的なリポジトリ情報を返します。

使用例:

  • 他の操作のためにリポジトリスラッグを見つける

  • プロジェクト全体のコードベース構造を調査する

  • アクセス権のあるリポジトリを発見する

  • 特定のプロジェクトのリポジトリを閲覧する

パラメータ:

  • project: Bitbucketプロジェクトキー(オプション、指定がない場合は BITBUCKET_DEFAULT_PROJECT を使用)

  • limit: 返すリポジトリの数(デフォルト: 25、最大: 1000)

  • start: ページネーションの開始インデックス(デフォルト: 0)

create_pull_request

レビューのためのコード変更の提案: コード変更の提出、レビューの依頼、またはフィーチャーブランチのマージを行うための新しいプルリクエストを作成します。ブランチ参照とレビュアーの割り当てを自動的に処理します。

使用例:

  • レビューのために機能開発を提出する

  • バグ修正を提案する

  • フィーチャーブランチからのコード統合を依頼する

  • コード変更について共同作業する

パラメータ:

  • project: Bitbucketプロジェクトキー(オプション、指定がない場合は BITBUCKET_DEFAULT_PROJECT を使用)

  • repository (必須): リポジトリスラッグ

  • title (必須): 明確で説明的なPRタイトル

  • description: コンテキストを含む詳細な説明(Markdownをサポート)

  • sourceBranch (必須): 変更を含むソースブランチ

  • targetBranch (必須): マージ先のターゲットブランチ

  • reviewers: レビュアーのユーザー名の配列

  • sourceProject: ソースリポジトリのプロジェクトキー(フォークからのクロスリポジトリPR用)

  • sourceRepository: ソースリポジトリのスラッグ(フォークからのクロスリポジトリPR用)

  • includeDefaultReviewers: ターゲットブランチに設定されたデフォルトレビュアーを自動的に取得して含める(デフォルト: true)

update_pull_request

プルリクエストの安全な更新: メタデータを失うことなく、既存のプルリクエストのタイトル、説明、またはレビュアーを変更します。明示的に変更されていないすべてのフィールドを保持するために、読み取り-変更-書き込みパターンを使用します。

使用例:

  • 作成後にPRのタイトルや説明を修正する

  • 既存のレビュアーを失わずにレビュアーを追加または置換する

  • 承認ステータスに影響を与えずにPRメタデータを更新する

パラメータ:

  • project: Bitbucketプロジェクトキー(オプション、指定がない場合は BITBUCKET_DEFAULT_PROJECT を使用)

  • repository (必須): リポジトリスラッグ

  • prId (必須): 更新するプルリクエストID

  • title: 新しいタイトル(省略時は現在のタイトルを保持)

  • description: 新しい説明(省略時は現在の説明を保持)

  • reviewers: ユーザー名の配列としての新しいレビュアーリスト(省略時は現在のレビュアーを保持)

get_pull_request

包括的なPR情報: ステータス、レビュアー、コミット、およびすべてのメタデータを含む詳細なプルリクエスト情報を取得します。アクションを実行する前にPRの状態を理解するために不可欠です。

使用例:

  • PRの承認ステータスを確認する

  • PRの詳細と進捗をレビューする

  • マージ前に変更内容を理解する

  • PRのステータスを監視する

パラメータ:

  • project: Bitbucketプロジェクトキー(オプション、指定がない場合は BITBUCKET_DEFAULT_PROJECT を使用)

  • repository (必須): リポジトリスラッグ

  • prId (必須): プルリクエストID

merge_pull_request

承認済み変更の統合: 承認されたプルリクエストをターゲットブランチにマージします。ワークフローの好みに基づいて、さまざまなマージ戦略をサポートします。

使用例:

  • コードレビュープロセスを完了する

  • 承認された機能を統合する

  • メインブランチにバグ修正を適用する

  • コード変更をリリースする

パラメータ:

  • project: Bitbucketプロジェクトキー(オプション、指定がない場合は BITBUCKET_DEFAULT_PROJECT を使用)

  • repository (必須): リポジトリスラッグ

  • prId (必須): プルリクエストID

  • message: カスタムマージコミットメッセージ

  • strategy: マージ戦略:

    • merge-commit (デフォルト): 履歴を保持するマージコミットを作成

    • squash: すべてのコミットを1つに結合

    • fast-forward: マージコミットなしでブランチポインタを移動

decline_pull_request

不適切な変更の拒否: マージすべきではないプルリクエストを拒否し、作成者にフィードバックを提供します。

使用例:

  • 基準を満たさない変更を拒否する

  • プロジェクトの方向性と矛盾するPRを閉じる

  • 大幅な修正を依頼する

  • 不要なコード統合を防ぐ

パラメータ:

  • project: Bitbucketプロジェクトキー(オプション、指定がない場合は BITBUCKET_DEFAULT_PROJECT を使用)

  • repository (必須): リポジトリスラッグ

  • prId (必須): プルリクエストID

  • message: 拒否の理由(作成者へのフィードバックに役立ちます)

add_comment

コードレビューへの参加: レビューのフィードバック、議論、共同作業のためにプルリクエストにコメントを追加します。スレッド形式の会話をサポートしています。

使用例:

  • コードレビューのフィードバックを提供する

  • 特定の変更について質問する

  • 改善を提案する

  • 技術的な議論に参加する

  • レビューの決定を文書化する

パラメータ:

  • project: Bitbucketプロジェクトキー(オプション、指定がない場合は BITBUCKET_DEFAULT_PROJECT を使用)

  • repository (必須): リポジトリスラッグ

  • prId (必須): プルリクエストID

  • text (必須): コメント内容(Markdownをサポート)

  • parentId: スレッド返信のための親コメントID

  • state: コメント状態: OPEN(デフォルト、即時公開)または PENDING(ドラフト、レビューが公開されるまで自分のみに表示)

get_diff

コード変更の分析: プルリクエストで何が追加、削除、または変更されたかを正確に示すコードの差分を取得します。大きな差分を効果的に管理するために、ファイルごとの切り捨てをサポートしています。

使用例:

  • 特定のコード変更をレビューする

  • 変更の範囲を理解する

  • マージ前に影響を分析する

  • 実装の詳細を検査する

  • コード品質評価

  • 出力を圧倒することなく大きなファイルを処理する

パラメータ:

  • project: Bitbucketプロジェクトキー(オプション、指定がない場合は BITBUCKET_DEFAULT_PROJECT を使用)

  • repository (必須): リポジトリスラッグ

  • prId (必須): プルリクエストID

  • contextLines: 変更前後のコンテキスト行数(デフォルト: 10)

  • maxLinesPerFile: ファイルごとに表示する最大行数(オプション、指定がない場合は BITBUCKET_DIFF_MAX_LINES_PER_FILE 環境変数を使用、制限なしの場合は0に設定)

大きなファイルの処理: ファイルが maxLinesPerFile 制限を超えると、以下が表示されます:

  • ファイルヘッダーとメタデータ(常に保持)

  • 先頭からの許可された行の最初の60%

  • ファイル統計を含む切り捨てメッセージ

  • 末尾からの許可された行の最後の40%

  • 完全な差分を表示する方法の明確な指示

get_reviews

レビュー進捗の追跡: レビュー履歴、承認ステータス、レビュアーのフィードバックを取得して、レビューの状態を把握します。

使用例:

  • PRがマージの準備ができているか確認する

  • 誰が変更をレビューしたかを確認する

  • レビューのフィードバックを理解する

  • 承認要件を監視する

  • レビューの進捗を追跡する

get_activities

プルリクエストアクティビティの取得: コメント、レビュー、コミット、その他のイベントを含む、プルリクエストの完全なアクティビティタイムラインを取得します。

使用例:

  • コメントの議論やフィードバックを読む

  • 完全なPRタイムラインをレビューする

  • PRに追加/削除されたコミットを追跡する

  • 承認およびレビュー履歴を確認する

  • 完全なPRライフサイクルを理解する

パラメータ:

  • project: Bitbucketプロジェクトキー(オプション、指定がない場合は BITBUCKET_DEFAULT_PROJECT を使用)

  • repository (必須): リポジトリスラッグ

  • prId (必須): プルリクエストID

get_comments

PRコメントのみの抽出: プルリクエストのアクティビティをフィルタリングしてコメントのみを返します。レビューや他のアクティビティに邪魔されず、議論の内容に集中しやすくなります。

使用例:

  • PRの議論スレッドを読む

  • フィードバックや質問を抽出する

  • ノイズなしでコメント内容に集中する

  • 会話の流れを分析する

パラメータ:

  • project: Bitbucketプロジェクトキー(オプション、指定がない場合は BITBUCKET_DEFAULT_PROJECT を使用)

  • repository (必須): リポジトリスラッグ

  • prId (必須): プルリクエストID

高度なコードおよびファイル検索: プロジェクト/リポジトリのフィルタリングとクエリ最適化をサポートするBitbucket検索APIを使用して、リポジトリ全体を検索します。ファイルの内容とファイル名の両方を検索します。注: 検索はリポジトリのデフォルトブランチでのみ機能します。

使用例:

  • プロジェクト全体で特定のコードパターンを見つける

  • 名前や内容でファイルを探す

  • 特定のプロジェクトやリポジトリ内で検索する

  • ファイル拡張子でフィルタリングする

パラメータ:

  • query (必須): 検索クエリ文字列

  • project: 検索範囲を制限するためのBitbucketプロジェクトキー

  • repository: リポジトリ固有の検索のためのリポジトリスラッグ

  • type: クエリ最適化 - "file"(正確なファイル名一致のためにクエリを引用符で囲む)または "code"(デフォルトの検索動作)

  • limit: 返す結果の数(デフォルト: 25、最大: 100)

  • start: ページネーションの開始インデックス(デフォルト: 0)

クエリ構文の例:

  • "README.md" - 正確なファイル名を見つける

  • config ext:yml - YAMLファイル内の設定を見つける

  • function project:MYPROJECT - 特定のプロジェクトで "function" を検索する

  • bug fix repo:PROJ/my-repo - 特定のリポジトリで検索する

get_file_content

ページネーションによるファイル内容の読み取り: ページネーションを通じて大きなファイルをサポートし、リポジトリから特定のファイルの内容を取得します。

使用例:

  • ソースコードファイルを読み取る

  • 設定ファイルを表示する

  • ドキュメントの内容を抽出する

  • 特定のファイルバージョンを検査する

パラメータ:

  • project: Bitbucketプロジェクトキー(オプション、指定がない場合は BITBUCKET_DEFAULT_PROJECT を使用)

  • repository (必須): リポジトリスラッグ

  • filePath (必須): リポジトリ内のファイルへのパス

  • branch: ブランチまたはコミットハッシュ(オプション、デフォルトは main/master)

  • limit: リクエストごとの最大行数(デフォルト: 100、最大: 1000)

  • start: ページネーションの開始行

Available Tools

28 tools
add_commentB

Add a comment to a pull request for code review, feedback, questions, or discussion. Use this to provide review feedback, ask questions about specific changes, suggest improvements, or participate in code review discussions. Supports threaded conversations.

Inputs: prId (required), text (required), repository (required), state, +3 more.

add_comment_inlineB

Add an inline comment (to specific lines) to the diff of a pull request for code review, feedback, questions, or discussion. Use this to provide review feedback, ask questions about specific changes, suggest improvements, or participate in code review discussions. Supports threaded conversations.

Inputs: line (required), prId (required), text (required), filePath (required), +6 more.

approve_pull_requestA

Approve a pull request as the current user. Use this to signal that you have reviewed the changes and they are ready to be merged. The approval is recorded with your user identity.

Inputs: prId (required), repository (required), project.

browse_repositoryA

Browse and list files and directories in a Bitbucket repository. Use this to explore repository structure, find files, or navigate directories.

Inputs: repository (required), path, limit, branch, +1 more.

create_pull_requestA

Create a new pull request to propose code changes, request reviews, or merge feature branches. Use this when you want to submit code for review, merge a feature branch, or contribute changes to a repository. Automatically sets up branch references and can assign reviewers.

Inputs: title (required), repository (required), sourceBranch (required), targetBranch (required), +6 more.

decline_pull_requestA

Decline or reject a pull request that should not be merged. Use this when changes are not acceptable, conflicts with project direction, or when the PR needs significant rework. This closes the PR without merging.

Inputs: prId (required), repository (required), message, project.

delete_branchA

Delete a branch from a Bitbucket repository. Cannot delete the default branch. Use this for cleanup after merging pull requests or removing stale feature branches.

Inputs: branch (required), repository (required), project.

delete_commentA

Delete a comment from a pull request. Requires the comment version for optimistic locking.

Inputs: prId (required), version (required), commentId (required), repository (required), +1 more.

edit_commentA

Edit an existing comment on a pull request. Use this to fix typos, update information, or reformat comments. Requires the comment version for optimistic locking.

Inputs: prId (required), text (required), version (required), commentId (required), +3 more.

get_activitiesB

Retrieve all activities for a pull request including comments, reviews, commits, and other timeline events. Use this to get the complete activity history and timeline of the pull request.

Inputs: prId (required), repository (required), limit, start, +2 more.

get_build_statusA

Get build states and CI build URLs (including Jenkins links) for a commit using the authenticated Bitbucket connection. Use the pull request fromRef.latestCommit as commitHash. Returns a paginated list; an empty list means no build statuses are recorded, not a successful build.

Inputs: commitHash (required), limit, start.

get_code_insightsA

Retrieve Code Insights reports (SonarQube, security scans, etc.) and their annotations for a pull request. Use this to check quality gates, code coverage, security findings, and other CI/CD analysis results.

Inputs: prId (required), repository (required), project.

get_commentsA

Retrieve only the comments from a pull request. Use this when you specifically want to read the discussion and feedback comments without other activities like reviews or commits.

Inputs: prId (required), repository (required), limit, start, +2 more.

get_dashboard_pull_requestsA

List pull requests across all repositories for the authenticated user. Use this to see PRs you need to review, PRs you authored, or PRs you are participating in. Returns PRs from all projects and repositories without needing to specify each one.

Inputs: role, limit, order, start, +3 more.

get_diffA

Retrieve the code differences (diff) for a pull request showing what lines were added, removed, or modified. Use this to understand the scope of changes, review specific code modifications, or analyze the impact of proposed changes before merging.

Inputs: prId (required), repository (required), project, contextLines, +1 more.

get_file_contentA

Retrieve the content of a specific file from a Bitbucket repository with pagination support. Use this to read source code, configuration files, documentation, or any text-based files. For large files, use start parameter to paginate through content.

Inputs: filePath (required), repository (required), limit, start, +2 more.

get_pull_requestA

Retrieve comprehensive details about a specific pull request including status, reviewers, commits, and metadata. Use this to check PR status, review progress, understand changes, or gather information before performing actions like merging or commenting.

Inputs: prId (required), repository (required), project.

get_reviewsA

Fetch the review history and approval status of a pull request. Use this to check who has reviewed the PR, see approval status, understand review feedback, or determine if the PR is ready for merging based on review requirements.

Inputs: prId (required), repository (required), limit, start, +2 more.

list_branchesA

List branches in a Bitbucket repository. Shows branch names, latest commits, and identifies the default branch. Use this to explore available branches, find branch names for checkout or PR creation, or verify branch existence before operations.

Inputs: repository (required), limit, start, project, +1 more.

list_commitsA

List commits in a Bitbucket repository, optionally filtered by branch and/or author. Use this to review commit history, find specific changes, track contributions, or understand the evolution of a branch.

Inputs: repository (required), limit, start, author, +2 more.

list_projectsA

Discover and list all Bitbucket projects you have access to. Use this first to explore available projects, find project keys, or when you need to work with a specific project but don't know its exact key. Returns project keys, names, descriptions and visibility settings.

Inputs: limit, start.

list_pull_requestsA

List pull requests in a Bitbucket repository filtered by state, author, or direction. Use this to find open PRs, see your pending reviews, discover PRs awaiting merge, or get an overview of PR activity in a repository.

Inputs: repository (required), limit, start, state, +3 more.

list_repositoriesB

Browse and discover repositories within a specific project or across all accessible projects. Use this to find repository slugs, explore codebases, or understand the repository structure. Returns repository names, slugs, clone URLs, and project associations.

Inputs: limit, start, project.

merge_pull_requestA

Merge an approved pull request into the target branch. Use this when a PR has been reviewed, approved, and is ready to be integrated. Choose the appropriate merge strategy based on your team's workflow and repository history preferences.

Inputs: prId (required), repository (required), message, project, +1 more.

publish_reviewA

Publish all pending (draft) review comments on a pull request at once. Optionally set your review status to APPROVED or NEEDS_WORK, and add an overview comment. This is the batch operation that transitions all PENDING comments to published.

Inputs: prId (required), repository (required), project, commentText, +1 more.

unapprove_pull_requestA

Remove your approval from a pull request. Use this to retract a previous approval if you discover issues after approving or if the PR has changed since your review.

Inputs: prId (required), repository (required), project.

update_pull_requestA

Update an existing pull request title, description, or reviewers. Safely preserves all fields not explicitly changed (uses read-modify-write to avoid losing reviewers or other metadata).

Inputs: prId (required), repository (required), title, project, +2 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.6/5.0

    Scored across 28 tools

    Disambiguation4/5

    Most tools target distinct resources and actions, and descriptions clearly separate near-neighbors like add_comment vs add_comment_inline and get_activities vs get_comments/get_reviews. The timeline tools still overlap somewhat since get_activities returns comments and reviews as well, but the distinctions are understandable.

    Naming Consistency4/5

    Almost all tools follow snake_case verb_noun naming (create_pull_request, get_diff, delete_branch, etc.). Minor deviations like the bare 'search' and 'browse_repository' versus 'list_repositories' are noticeable but do not undermine readability.

    Tool Count3/5

    At 28 tools this is heavy for a single MCP server, even one covering Bitbucket. Many operations are genuinely useful, but some could be consolidated or made more narrowly scoped, making the surface feel borderline oversized.

    Completeness4/5

    The PR lifecycle, commenting, reviews, repo browsing, search, branches, commits, builds, and Code Insights are well covered. Gaps remain around branch creation and broader repository/project administration, but core agent workflows have no dead ends.

    Maintenance

    ActivitySlowing
    ResponsivenessLimited data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      D
      maintenance
      An MCP server that provides tools for interacting with the Bitbucket API, supporting both Bitbucket Cloud and Bitbucket Server, enabling pull request, branch, file, code review, and search operations.
      19
      MIT
    • A
      license
      B
      quality
      B
      maintenance
      MCP server for Bitbucket Server integration, enabling project, repository, pull request, source code, branch, and code review operations via the Bitbucket Server APIs.
      27
      46 npm
      MIT