Bitbucket MCP (Model Context Protocol) server built with FastMCP that provides programmatic access to Bitbucket API v2.0
Project description
Bitbucket MCP Server
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
-
Create a Bitbucket App Password:
- Go to https://bitbucket.org/account/settings/app-passwords/
- Create a new app password with necessary permissions
- Save the password securely
-
Set up environment variables:
cp .env.example .env
-
Edit
.envwith 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 informationbitbucket://{workspace}/{repo}/recent-pipelines- Recent pipeline runsbitbucket://{workspace}/{repo}/open-prs- Open pull requestsbitbucket://{workspace}/workspace-members- Team members for reviewersbitbucket://{workspace}/{repo}/branches- Available branchesbitbucket://{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.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - 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:
- GitHub Issues: https://github.com/yourusername/bb-mcp-server/issues
- Documentation: https://github.com/yourusername/bb-mcp-server/wiki
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
00a93eff21ee33a610f8d1d56425ef13740aed8e8a150ac77b3104355621c1e5
|
|
| MD5 |
b53421b942b9977854b2b226fa54f872
|
|
| BLAKE2b-256 |
185cbfd1555e1df323ce3a579fd2c9ec6e7acd97d6f73012412706ac64e25f6f
|
Provenance
The following attestation bundles were made for bb_mcp_server-1.0.1.tar.gz:
Publisher:
publish.yml on jasonpaulso/bitbucket-openapi-generated
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bb_mcp_server-1.0.1.tar.gz -
Subject digest:
00a93eff21ee33a610f8d1d56425ef13740aed8e8a150ac77b3104355621c1e5 - Sigstore transparency entry: 564791841
- Sigstore integration time:
-
Permalink:
jasonpaulso/bitbucket-openapi-generated@6e544421b675efb791f0745e2e4c70dd90b794c5 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/jasonpaulso
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@6e544421b675efb791f0745e2e4c70dd90b794c5 -
Trigger Event:
workflow_dispatch
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4784aa5cec75ee7756119c426295a6311d6ee622e9d1a01fefb661a845c33f60
|
|
| MD5 |
3e09988da849a5e8307c967411f6136f
|
|
| BLAKE2b-256 |
c4a8fcec0b22320ce8a8cb3aaf8dd22c43275c6b9853014ff529dbaa7969443a
|
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
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bb_mcp_server-1.0.1-py3-none-any.whl -
Subject digest:
4784aa5cec75ee7756119c426295a6311d6ee622e9d1a01fefb661a845c33f60 - Sigstore transparency entry: 564791849
- Sigstore integration time:
-
Permalink:
jasonpaulso/bitbucket-openapi-generated@6e544421b675efb791f0745e2e4c70dd90b794c5 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/jasonpaulso
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@6e544421b675efb791f0745e2e4c70dd90b794c5 -
Trigger Event:
workflow_dispatch
-
Statement type: