All integrations

Bitbucket

Hosted Bitbucket Cloud MCP for Claude, ChatGPT and Cursor. Pull request diffs, branch comparisons, pipeline status and review comments via MCP.

OAuth 17 tools

Overview

Give AI access to Bitbucket Cloud repositories, pull requests, branch diffs, file contents, and review comments. This Bitbucket MCP integration helps code review agents answer questions about PRs, branches, and pipelines without cloning repositories locally.

Common use cases

  • Bitbucket pull request MCP tools — summarize diffs, list reviewers, and compare branches.
  • Connect Bitbucket to Cursor or Claude — inspect src/App.php on develop or check pipeline status from chat.
  • Private gateway — combine Bitbucket with GitHub, Forge, and other dev tools in one MCP session.

Prerequisites

  • A Bitbucket Cloud account (bitbucket.org)
  • A stackgate.ai account

Getting credentials

For hub operators (OAuth app)

  1. In Bitbucket, open Workspace settings → Apps and features → OAuth consumers.
  2. Click Add consumer and set the Callback URL to your hub URL plus /oauth/bitbucket/callback (for example https://stackgate.ai/oauth/bitbucket/callback).
  3. Grant Read access to Repositories, Pull requests, and Pipelines.
  4. Copy the Key and Secret into hub environment variables:
    • BITBUCKET_CLIENT_ID
    • BITBUCKET_CLIENT_SECRET
    • BITBUCKET_INTEGRATION_REDIRECT_URI (must match the callback URL exactly)

For end users

  1. Open My Integrations → Bitbucket.
  2. Click Activate, then Connect Bitbucket.
  3. Authorize stackgate.ai via Bitbucket OAuth.

Using with AI clients

  • Dedicated endpoint: POST /mcp/bitbucket
  • Private gateway: bitbucket__* tools

Typical questions you can ask:

  • What changed in pull request 42 in repo my-repo?
  • How does src/App.php look on branch develop?
  • When was the latest commit on main?
  • What are the diffs between main and feature/login?
  • Who approved pull request 42?
  • Is the pipeline done on branch develop?
  • What failed in the latest pipeline on feature/login?

Pipelines

Pipeline tools require the Pipelines OAuth permission. If you connected before this was added, disconnect and reconnect Bitbucket in My Integrations.

For Atlassian Developer Console OAuth apps, enable the read:pipeline:bitbucket scope in your app settings, then reconnect.

Troubleshooting

  • 403 from Bitbucket — the token may lack access to a private repository; reconnect and confirm workspace membership.
  • 403 on pipeline tools — reconnect after granting Pipelines read access (classic OAuth) or read:pipeline:bitbucket (Atlassian OAuth app).
  • 401 / expired token — reconnect Bitbucket in My Integrations (access tokens expire after about an hour; refresh tokens are stored automatically when available).
  • Empty PR diff — Bitbucket redirects diff requests; ensure workspace is the workspace slug, not the display name.
  • Rate limits — Bitbucket OAuth app rate limits apply per connected account.

Available tools

  • add_pull_request_comment

    Add a comment or reply on a Bitbucket pull request. Pass parent_id to reply to an existing comment.

  • compare_branches_diffstat

    Get file-level diff stats between two branches or commits (e.g. main..feature).

  • compare_branches_diff

    Get the raw unified diff between two branches or commits (e.g. main..feature).

  • get_branch_pipeline_failure_logs

    Fetch failure logs from the latest failed Bitbucket Pipelines run on a branch to diagnose build errors.

  • get_branch_pipeline_status

    Get the latest Bitbucket Pipelines run status for a branch — running, successful, failed, or not found.

  • get_file_contents

    Get file contents from a Bitbucket repository at a path and optional ref (branch or commit).

  • get_me

    Get the connected Bitbucket account profile.

  • get_pull_request_diff

    Get the raw unified diff for a Bitbucket pull request. Large diffs are truncated.

  • get_pull_request

    Get a Bitbucket pull request including state, reviewers, and approval status.

  • list_branches

    List branches in a Bitbucket repository.

  • list_commits

    List commits on a Bitbucket branch or revision. Use pagelen=1 for the latest commit.

  • list_pull_request_activity

    List activity on a Bitbucket pull request including approvals, reviews, and comments.

  • list_pull_request_comments

    List comments on a Bitbucket pull request, including reply thread IDs.

  • list_pull_request_diffstat

    List file-level changes in a Bitbucket pull request (diffstat).

  • list_pull_requests

    List pull requests in a Bitbucket repository.

  • list_repos

    List repositories in a Bitbucket workspace.

  • list_workspaces

    List Bitbucket workspaces accessible to the connected account.

MCP endpoint: https://stackgate.ai/mcp/bitbucket (HTTP) or via the private gateway.