Skip to main content

MCP Server for Bitbucket API - Container optimized with configurable tools, structured output and slim responses

Project description

Bitbucket MCP Server (Python)

PyPI Python CI CodeQL License: MIT

Connect Claude Code, VS Code (GitHub Copilot), Cursor, and any MCP-compatible AI assistant to your Bitbucket Cloud repositories. Review pull requests, monitor pipelines, and manage your code — all through natural language.

Features

  • 32 MCP tools — repositories, pull requests, comments, diffs, pipelines, build statuses, reviewers
  • Slim responses — stripped API noise for lower LLM token usage
  • Configurable — enable/disable tools via configs/tools.json
  • Secure credentials — environment variables or system keychain

Quick Start

1. Install

The recommended way to run the server is via uvx (zero install, isolated environment):

# Always latest version
uvx --from bitbucket-mcp-py bitbucket-mcp

# Pin a specific version
uvx --from bitbucket-mcp-py==1.8.1 bitbucket-mcp

Why --from? The PyPI package is bitbucket-mcp-py but the command entry point is bitbucket-mcp. The --from flag tells uvx which package to install.

Alternative install methods
Mode Command Best for
pip global pip install bitbucket-mcp-py Simple, persistent install
Local dev pip install -e . in project dir Contributing to the project
Docker See Docker section Container-based workflows

2. Configure credentials

Set the following environment variables (or use a .env file — see Credentials):

Variable Description
BITBUCKET_USERNAME Your Bitbucket email
BITBUCKET_TOKEN Your Bitbucket API token
BITBUCKET_WORKSPACE Your workspace slug

Get your API token at: https://id.atlassian.com/manage-profile/security/api-tokens

3. Configure your AI assistant

Claude Code (recommended)

Option A — CLI (fastest):

claude mcp add bitbucket-mcp \
  -e BITBUCKET_USERNAME=your-email@example.com \
  -e BITBUCKET_TOKEN=your-api-token \
  -e BITBUCKET_WORKSPACE=your-workspace \
  -- uvx --from bitbucket-mcp-py bitbucket-mcp

Option B — JSON config (~/.claude.json or project .mcp.json):

{
  "mcpServers": {
    "bitbucket-mcp": {
      "type": "stdio",
      "command": "uvx",
      "args": ["--from", "bitbucket-mcp-py", "bitbucket-mcp"],
      "env": {
        "BITBUCKET_USERNAME": "your-email@example.com",
        "BITBUCKET_TOKEN": "your-api-token",
        "BITBUCKET_WORKSPACE": "your-workspace"
      }
    }
  }
}

VS Code (GitHub Copilot)

Add to .vscode/mcp.json (workspace) or ~/Library/Application Support/Code/User/mcp.json (global, macOS):

{
  "servers": {
    "bitbucket-mcp": {
      "type": "stdio",
      "command": "uvx",
      "args": ["--from", "bitbucket-mcp-py", "bitbucket-mcp"],
      "env": {
        "BITBUCKET_USERNAME": "your-email@example.com",
        "BITBUCKET_TOKEN": "your-api-token",
        "BITBUCKET_WORKSPACE": "your-workspace"
      }
    }
  }
}

Cursor

Add to ~/.cursor/mcp.json:

{
  "mcpServers": {
    "bitbucket-mcp": {
      "command": "uvx",
      "args": ["--from", "bitbucket-mcp-py", "bitbucket-mcp"],
      "env": {
        "BITBUCKET_USERNAME": "your-email@example.com",
        "BITBUCKET_TOKEN": "your-api-token",
        "BITBUCKET_WORKSPACE": "your-workspace"
      }
    }
  }
}

Available Tools

Category Tools
Repositories list_repositories, get_repository
Pull Requests get_pull_requests, get_pull_request, create_pull_request, update_pull_request, approve_pull_request, unapprove_pull_request, request_changes_pull_request, unrequest_changes_pull_request, decline_pull_request, merge_pull_request
Comments get_pull_request_comments, add_pull_request_comment, get_pull_request_comment, update_pull_request_comment, delete_pull_request_comment, resolve_pull_request_comment, reopen_pull_request_comment, get_pull_request_activity
Diff / Review get_pull_request_diff, get_pull_request_diffstat, get_pull_request_commits
Build / CI get_pull_request_statuses, get_commit_statuses
Pipelines list_pipeline_runs, get_pipeline_run, get_pipeline_steps, get_pipeline_step_logs, run_pipeline, stop_pipeline
Reviewers get_effective_default_reviewers

Disabled by default: merge_pull_request (safety), stop_pipeline (safety). Enable in configs/tools.json.

Credentials

Option 1: .env file (recommended)

cp .env.example .env
# Edit .env with your credentials

Option 2: System keychain (most secure)

pip install 'bitbucket-mcp-py[keyring]'
python3 -c "import keyring; keyring.set_password('bitbucket-mcp', 'bitbucket_token', 'YOUR_TOKEN')"

Docker (Alternative)

If you prefer running the server in a container:

docker build -t bitbucket-mcp-py .
docker run -d --name bitbucket-mcp --env-file .env bitbucket-mcp-py

Then configure your AI assistant to use docker exec:

{
  "mcpServers": {
    "bitbucket-mcp": {
      "command": "docker",
      "args": ["exec", "-i", "bitbucket-mcp", "python", "-m", "src.main", "--transport", "stdio"]
    }
  }
}

Development

# Install dev dependencies
uv sync --extra dev

# Run tests
uv run pytest tests/ -v

# Run specific test
uv run pytest tests/test_client.py -v

Requirements

  • Python 3.12+
  • Bitbucket API token

License

MIT

References

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bitbucket_mcp_py-1.9.0.tar.gz (95.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bitbucket_mcp_py-1.9.0-py3-none-any.whl (22.1 kB view details)

Uploaded Python 3

File details

Details for the file bitbucket_mcp_py-1.9.0.tar.gz.

File metadata

  • Download URL: bitbucket_mcp_py-1.9.0.tar.gz
  • Upload date:
  • Size: 95.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for bitbucket_mcp_py-1.9.0.tar.gz
Algorithm Hash digest
SHA256 c70753436853f7087ed2b99d3414bb506c60de7d7f5e72323fa9fad31c259ec9
MD5 ba8eed76fdb008751387188f7ddd72d5
BLAKE2b-256 b8c2785659ae6ff685f0360debf6ef6faccfd5b2fc7e14ca7381fa90814f14c4

See more details on using hashes here.

Provenance

The following attestation bundles were made for bitbucket_mcp_py-1.9.0.tar.gz:

Publisher: release.yml on lawp09/bitbucket-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file bitbucket_mcp_py-1.9.0-py3-none-any.whl.

File metadata

File hashes

Hashes for bitbucket_mcp_py-1.9.0-py3-none-any.whl
Algorithm Hash digest
SHA256 66aa8970572d2bbb22c20fde1898832f23fbbcdc83f8061fa1504e3f01401859
MD5 1593b60c79c9db069d7569e5209bb7cc
BLAKE2b-256 9ca6cfc88744ea6da742392846d2905530fb32f880f90a26acf7029a0ad16e6c

See more details on using hashes here.

Provenance

The following attestation bundles were made for bitbucket_mcp_py-1.9.0-py3-none-any.whl:

Publisher: release.yml on lawp09/bitbucket-mcp

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page