Skip to main content
Glama
bitbucket-mcp

bitbucket-mcp

by sanscdm

Bitbucket MCP

A FastMCP server for Bitbucket Cloud REST API.

Features

  • List repositories

  • Get repo details

  • List branches

  • List pull requests

  • Create/manage pull requests

  • And more...

Related MCP server: Bitbucket MCP

Setup

1. Create a Bitbucket API Token

  1. Go to https://id.atlassian.com/manage-profile/security/api-tokens

  2. Click "Create API token with scopes" (not the regular one)

  3. Name it (e.g., "MCP Tool")

  4. Under "Select app", choose Bitbucket

  5. Grant the needed permissions (repo read/write, PR read/write, etc.)

  6. Copy the token

2. Set Environment Variables

export BITBUCKET_EMAIL="your-email@domain.com"
export BITBUCKET_API_TOKEN="your-api-token-here"

Or create a .env file:

BITBUCKET_EMAIL=your-email@domain.com
BITBUCKET_API_TOKEN=your-api-token-here

3. Run the Server

# Using uv (recommended)
uv run --directory /path/to/bitbucket-mcp python server.py

# Or with pip
pip install -r requirements.txt
python server.py

4. Connect via mcporter

Add to your mcporter.json:

{
  "mcpServers": {
    "bitbucket": {
      "command": "/path/to/uv",
      "args": [
        "run",
        "--directory",
        "/path/to/bitbucket-mcp",
        "python",
        "server.py"
      ],
      "env": {
        "BITBUCKET_EMAIL": "your-email@domain.com",
        "BITBUCKET_API_TOKEN": "your-api-token"
      }
    }
  }
}

Requirements

  • Python 3.10+

  • uv (optional, but recommended)

License

MIT

Available Tools

32 tools
approve_pull_requestC

Approve a pull request.

Args: pr_id: PR ID number workspace: Workspace slug repo: Repository slug

Inputs: pr_id (required), repo, workspace. Returns: result

browse_sourceA

Browse repository source files at a specific ref (branch/tag/commit).

Args: path: File or directory path (empty for root) ref: Branch name, tag, or commit hash (default "main") workspace: Workspace slug repo: Repository slug

Inputs: ref, path, repo, workspace. Returns: result

comment_on_prA

Add a general comment to a pull request.

Args: pr_id: PR ID number body: Comment text (markdown supported) workspace: Workspace slug repo: Repository slug

Inputs: body (required), pr_id (required), repo, workspace. Returns: result

create_pull_requestA

Create a new pull request.

Args: title: PR title source_branch: Source branch name dest_branch: Destination branch (default "main") description: PR description (markdown supported) reviewers: Comma-separated reviewer UUIDs (optional) close_source: Close source branch on merge (default True) workspace: Workspace slug repo: Repository slug

Inputs: title (required), source_branch (required), repo, reviewers, +4 more. Returns: result

decline_pull_requestB

Decline (close without merging) a pull request.

Args: pr_id: PR ID number workspace: Workspace slug repo: Repository slug

Inputs: pr_id (required), repo, workspace. Returns: result

delete_pr_commentB

Delete a PR comment.

Args: pr_id: PR ID number comment_id: Comment ID to delete workspace: Workspace slug repo: Repository slug

Inputs: pr_id (required), comment_id (required), repo, workspace. Returns: result

edit_pr_commentB

Edit an existing PR comment.

Args: pr_id: PR ID number comment_id: Comment ID to edit body: New comment text workspace: Workspace slug repo: Repository slug

Inputs: body (required), pr_id (required), comment_id (required), repo, +1 more. Returns: result

get_pull_requestA

Get full details of a pull request.

Args: pr_id: Pull request ID number workspace: Workspace slug repo: Repository slug

Inputs: pr_id (required), repo, workspace. Returns: result

get_repoB

Get repository details.

Args: workspace: Workspace slug (uses default if not provided) repo: Repository slug (uses default if not provided)

Inputs: repo, workspace. Returns: result

inline_comment_on_prA

Add an inline code review comment on a specific file and line in a PR.

Args: pr_id: PR ID number body: Comment text (markdown supported) file_path: File path relative to repo root (e.g., "src/main.py") line: Line number (on the new/right side of the diff) workspace: Workspace slug repo: Repository slug

Inputs: body (required), line (required), pr_id (required), file_path (required), +2 more. Returns: result

list_branchesA

List branches in a repository.

Args: workspace: Workspace slug repo: Repository slug

Inputs: repo, workspace. Returns: result

list_commitsB

List recent commits, optionally filtered by branch.

Args: branch: Branch name (optional, defaults to all) workspace: Workspace slug repo: Repository slug

Inputs: repo, branch, workspace. Returns: result

list_pipelinesB

List recent pipelines (builds) for a repository.

Args: workspace: Workspace slug repo: Repository slug

Inputs: repo, workspace. Returns: result

list_pr_commentsB

List all comments on a pull request.

Args: pr_id: PR ID number workspace: Workspace slug repo: Repository slug

Inputs: pr_id (required), repo, workspace. Returns: result

list_pull_requestsA

List pull requests. Default shows open PRs.

Args: workspace: Workspace slug repo: Repository slug state: PR state - OPEN, MERGED, DECLINED, SUPERSEDED (default OPEN)

Inputs: repo, state, workspace. Returns: result

list_reposA

List repositories in a workspace.

Args: workspace: Workspace slug (uses default if not provided)

Inputs: workspace. Returns: result

list_workspacesA

List all Bitbucket workspaces you have access to.

Inputs: no named parameters. Returns: result

merge_pull_requestA

Merge a pull request.

Args: pr_id: PR ID number strategy: Merge strategy - merge_commit, squash, or fast_forward (optional, uses repo default) close_source: Close/delete source branch after merge (default True) workspace: Workspace slug repo: Repository slug

Inputs: pr_id (required), repo, strategy, workspace, +1 more. Returns: result

pipeline_stepsA

Get steps/stages of a pipeline run.

Args: pipeline_uuid: Pipeline UUID workspace: Workspace slug repo: Repository slug

Inputs: pipeline_uuid (required), repo, workspace. Returns: result

pr_activityA

Get activity log for a pull request (approvals, comments, updates).

Args: pr_id: PR ID number workspace: Workspace slug repo: Repository slug

Inputs: pr_id (required), repo, workspace. Returns: result

pr_build_statusA

Get build/pipeline statuses for a pull request.

Args: pr_id: PR ID number workspace: Workspace slug repo: Repository slug

Inputs: pr_id (required), repo, workspace. Returns: result

pr_commitsA

List commits in a pull request.

Args: pr_id: PR ID number workspace: Workspace slug repo: Repository slug

Inputs: pr_id (required), repo, workspace. Returns: result

pr_diffB

Get the full diff of a pull request.

Args: pr_id: PR ID number workspace: Workspace slug repo: Repository slug

Inputs: pr_id (required), repo, workspace. Returns: result

pr_diffstatA

Get diffstat (files changed summary) for a pull request.

Args: pr_id: PR ID number workspace: Workspace slug repo: Repository slug

Inputs: pr_id (required), repo, workspace. Returns: result

remove_request_changesA

Remove your request-changes from a pull request.

Args: pr_id: PR ID number workspace: Workspace slug repo: Repository slug

Inputs: pr_id (required), repo, workspace. Returns: result

reply_to_pr_commentA

Reply to an existing PR comment.

Args: pr_id: PR ID number parent_comment_id: ID of the comment to reply to body: Reply text workspace: Workspace slug repo: Repository slug

Inputs: body (required), pr_id (required), parent_comment_id (required), repo, +1 more. Returns: result

request_changes_on_prC

Request changes on a pull request.

Args: pr_id: PR ID number workspace: Workspace slug repo: Repository slug

Inputs: pr_id (required), repo, workspace. Returns: result

stop_pipelineC

Stop a running pipeline.

Args: pipeline_uuid: Pipeline UUID (from list_pipelines) workspace: Workspace slug repo: Repository slug

Inputs: pipeline_uuid (required), repo, workspace. Returns: result

trigger_pipelineA

Trigger a pipeline run for a branch.

Args: branch: Branch name to run pipeline on custom_pattern: Custom pipeline name (optional, for custom pipelines in bitbucket-pipelines.yml) workspace: Workspace slug repo: Repository slug

Inputs: branch (required), repo, workspace, custom_pattern. Returns: result

unapprove_pull_requestB

Remove your approval from a pull request.

Args: pr_id: PR ID number workspace: Workspace slug repo: Repository slug

Inputs: pr_id (required), repo, workspace. Returns: result

update_pull_requestA

Update a pull request (title, description, reviewers, destination).

Args: pr_id: PR ID number title: New title (optional) description: New description (optional) reviewers: Comma-separated reviewer UUIDs to set (optional) dest_branch: New destination branch (optional) workspace: Workspace slug repo: Repository slug

Inputs: pr_id (required), repo, title, reviewers, +3 more. Returns: result

whoamiA

Check current Bitbucket auth. Returns the authenticated user info.

Inputs: no named parameters. Returns: result

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    B3.2/5.0

    Scored across 32 tools

    Disambiguation5/5

    Each tool targets a distinct resource and action. Comment tools are differentiated by operation (list/add/inline/reply/edit/delete), and PR views are clearly separated by data type (diff, diffstat, commits, activity, build status). No two tools appear to serve the same purpose.

    Naming Consistency3/5

    Most tools follow a verb_noun pattern (list_repos, create_pull_request), but there are notable deviations: data-view tools use a noun-first 'pr_' prefix (pr_diff, pr_commits, pr_activity, pr_build_status) and 'pipeline_steps' lacks a verb. The resource is inconsistently called 'pull_request' in some tools and 'pr' in others, and comment actions use varying prepositions (on, to). Still, the names remain readable and understandable.

    Tool Count2/5

    At 32 tools, the server exceeds the 'borderline' range of 16-25 and feels heavy. While many tools are justified for a Bitbucket API, there is some overlap (e.g., list_commits vs pr_commits) and the PR comment workflow alone accounts for six tools. The count would be more appropriate if consolidated or scoped tighter, such as focusing on core PR operations.

    Completeness3/5

    The pull request lifecycle is thoroughly covered (create, update, approve, merge, decline, comments, diff, commits, activity, build status). However, repository management is incomplete: there is no create/update/delete repo, and branch operations are limited to listing. These are notable gaps for a Bitbucket integration and could force agents to use external tools.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    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
      8,411 npm
      MIT
    • A
      license
      B
      quality
      D
      maintenance
      An MCP server for Bitbucket Cloud that enables managing pull requests, branches, and repositories in natural language from any MCP-capable client.
      23
      387 npm
      4
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      MCP server for Bitbucket Cloud that enables reviewing, managing, and merging pull requests, assigning reviewers by name, reading files at a ref, and inspecting pipeline status from any MCP client.
      14
      MIT