Skip to main content

Bitbucket MCP (Model Context Protocol) server built with FastMCP that provides programmatic access to Bitbucket API v2.0

Project description

Bitbucket MCP Server

PyPI version Python License: MIT Tests

A Model Context Protocol (MCP) server that provides programmatic access to Bitbucket API v2.0. Built with FastMCP, this server enables LLMs and other tools to interact with Bitbucket repositories, pull requests, pipelines, and workspaces.

Features

  • 26 Bitbucket API Tools: Complete coverage of essential Bitbucket operations
  • 3 Meta-Tools: High-level workflows for common patterns (pipeline analysis, PR reviews, workspace overview)
  • 7 MCP Resources: Quick access to repository info, branches, members, and more
  • Optimized for LLMs: Token-efficient design with structured outputs
  • Flexible Configuration: Works with any Bitbucket workspace and repository via environment variables

Installation

From PyPI

pip install bb-mcp-server

From Source

git clone https://github.com/yourusername/bb-mcp-server.git
cd bb-mcp-server
pip install -e .

Configuration

  1. Create a Bitbucket App Password:

  2. Set up environment variables:

    cp .env.example .env
    
  3. Edit .env with your credentials:

    BITBUCKET_USERNAME=your_username
    BITBUCKET_APP_PASSWORD=your_app_password
    BITBUCKET_WORKSPACE=your_workspace  # Optional, defaults to "busie"
    BITBUCKET_REPO=your_repo            # Optional, defaults to "fe-main"
    

Usage

Running the Server

# Using the installed package
bb-mcp-server

# Or directly with Python
python server.py

Integrating with MCP Clients

Add to your MCP client configuration:

{
  "servers": {
    "bitbucket": {
      "command": "bb-mcp-server",
      "env": {
        "BITBUCKET_USERNAME": "your_username",
        "BITBUCKET_APP_PASSWORD": "your_app_password"
      }
    }
  }
}

Available Tools

The lean surface ships ten focused tools with summary-first payloads:

  • pr.list – List PRs with compact metadata.
  • pr.overview – Return digest: meta, blockers, diffstat, recent comments.
  • pr.review – Generate a structured review summary based on the overview.
  • pr.comment.add – Post a PR comment (optional inline path/line).
  • pr.tasks.sync – Create and resolve PR tasks in one call.
  • pipe.run – Start a pipeline for the given repo/ref/spec.
  • pipe.fail.summary – Summarise the most recent failing pipelines.
  • workspace.list – List repos, members, or projects (summary by default).
  • repo.get – Repo basics plus a five-item PR sample.
  • me.whoami – Minimal identity plus accessible workspaces.

Legacy names (e.g. list_pull_requests, analyze_pipeline_failure) map automatically to the new surface for backward compatibility.

Resources

  • bitbucket://{workspace}/{repo}/info - Repository information
  • bitbucket://{workspace}/{repo}/recent-pipelines - Recent pipeline runs
  • bitbucket://{workspace}/{repo}/open-prs - Open pull requests
  • bitbucket://{workspace}/workspace-members - Team members for reviewers
  • bitbucket://{workspace}/{repo}/branches - Available branches
  • bitbucket://{workspace}/workspace-projects - Workspace projects

Development

Setting up Development Environment

# Clone the repository
git clone https://github.com/yourusername/bb-mcp-server.git
cd bb-mcp-server

# Create virtual environment
python -m venv .venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate

# Install in development mode
pip install -e .
pip install -r requirements.txt

Running Tests

# Install test dependencies
pip install pytest pytest-asyncio pytest-cov

# Run tests
pytest tests/

# Run with coverage
pytest tests/ --cov=. --cov-report=html

Code Quality

# Linting
ruff check .

# Formatting
black .

# Type checking
mypy server.py utils/ modules/

Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • Built with FastMCP framework
  • Uses Bitbucket API v2.0
  • Implements Model Context Protocol (MCP) specification

Support

For issues, questions, or contributions, please visit:

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

bb_mcp_server-1.0.1.tar.gz (28.7 kB view details)

Uploaded Source

Built Distribution

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

bb_mcp_server-1.0.1-py3-none-any.whl (36.9 kB view details)

Uploaded Python 3

File details

Details for the file bb_mcp_server-1.0.1.tar.gz.

File metadata

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

File hashes

Hashes for bb_mcp_server-1.0.1.tar.gz
Algorithm Hash digest
SHA256 00a93eff21ee33a610f8d1d56425ef13740aed8e8a150ac77b3104355621c1e5
MD5 b53421b942b9977854b2b226fa54f872
BLAKE2b-256 185cbfd1555e1df323ce3a579fd2c9ec6e7acd97d6f73012412706ac64e25f6f

See more details on using hashes here.

Provenance

The following attestation bundles were made for bb_mcp_server-1.0.1.tar.gz:

Publisher: publish.yml on jasonpaulso/bitbucket-openapi-generated

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

File details

Details for the file bb_mcp_server-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: bb_mcp_server-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 36.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for bb_mcp_server-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 4784aa5cec75ee7756119c426295a6311d6ee622e9d1a01fefb661a845c33f60
MD5 3e09988da849a5e8307c967411f6136f
BLAKE2b-256 c4a8fcec0b22320ce8a8cb3aaf8dd22c43275c6b9853014ff529dbaa7969443a

See more details on using hashes here.

Provenance

The following attestation bundles were made for bb_mcp_server-1.0.1-py3-none-any.whl:

Publisher: publish.yml on jasonpaulso/bitbucket-openapi-generated

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