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
Pipeline Operations
list_pipelines- List and filter pipeline runsget_pipeline- Get pipeline detailslist_pipeline_steps- Get pipeline step informationget_pipeline_step_logs- Retrieve step logscreate_pipeline- Trigger new pipeline
Pull Request Operations
list_pull_requests- List PRs with filteringcreate_pull_request- Create new PRget_pull_request- Get PR detailsupdate_pull_request- Update existing PRlist_pr_comments- Get PR commentscreate_pr_comment- Add PR commentget_pr_changes- View file changesget_pr_diffstat- Get diff statisticslist_pr_tasks- List PR tasks
Meta-Tools (Workflows)
analyze_pipeline_failure- Complete pipeline failure analysis with logs and recommendationsreview_pull_request- Comprehensive PR review with changes, comments, and approval statusworkspace_overview- Full workspace summary with repos, projects, and team info
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.0.tar.gz.
File metadata
- Download URL: bb_mcp_server-1.0.0.tar.gz
- Upload date:
- Size: 19.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
29b3c9842126b2c29e3d80d18b2b735c3479783131353943bd0d2fed00587597
|
|
| MD5 |
61a0b08f18de6720856ffd5f08d0f3d5
|
|
| BLAKE2b-256 |
b319938f916c6482731eea2fcfdfb4eb48ca1e11bd0095bbcd982692e28289bf
|
Provenance
The following attestation bundles were made for bb_mcp_server-1.0.0.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.0.tar.gz -
Subject digest:
29b3c9842126b2c29e3d80d18b2b735c3479783131353943bd0d2fed00587597 - Sigstore transparency entry: 524924161
- Sigstore integration time:
-
Permalink:
jasonpaulso/bitbucket-openapi-generated@239aed88c410bb4a8715810f71dd66b2997e1a5c -
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@239aed88c410bb4a8715810f71dd66b2997e1a5c -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file bb_mcp_server-1.0.0-py3-none-any.whl.
File metadata
- Download URL: bb_mcp_server-1.0.0-py3-none-any.whl
- Upload date:
- Size: 23.5 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 |
6e5552d401c2a9e10774cbec1aa7cec1dc9bfd58b73f8a5205dbc1f426efaca3
|
|
| MD5 |
2d9f3d52e76930b652ca7e71d39548af
|
|
| BLAKE2b-256 |
958dbe7d2f8edeee2a2eb52446829a72572294c325d181d3ee415b9976c1342a
|
Provenance
The following attestation bundles were made for bb_mcp_server-1.0.0-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.0-py3-none-any.whl -
Subject digest:
6e5552d401c2a9e10774cbec1aa7cec1dc9bfd58b73f8a5205dbc1f426efaca3 - Sigstore transparency entry: 524924193
- Sigstore integration time:
-
Permalink:
jasonpaulso/bitbucket-openapi-generated@239aed88c410bb4a8715810f71dd66b2997e1a5c -
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@239aed88c410bb4a8715810f71dd66b2997e1a5c -
Trigger Event:
workflow_dispatch
-
Statement type: