MCP Server for Bitbucket API - Container optimized with configurable tools, structured output and slim responses
Project description
Bitbucket MCP Server (Python)
Connect Claude Code, Cursor, VS Code (GitHub Copilot), 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
- 21 MCP tools — repositories, pull requests, comments, diffs, pipelines
- 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
# Avec uv (recommandé)
uvx bitbucket-mcp-py
# Avec pip
pip install bitbucket-mcp-py
Installation modes
| Mode | Command | Pour qui |
|---|---|---|
| uvx (recommended) | uvx bitbucket-mcp-py |
Zero install, works anywhere with uv |
| pip global | pip install bitbucket-mcp-py |
Simple, global dependencies |
| Local dev | pip install -e . in project dir |
Contributing to the project |
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
{
"mcpServers": {
"bitbucket": {
"command": "uvx",
"args": ["bitbucket-mcp-py"],
"env": {
"BITBUCKET_USERNAME": "your-email@example.com",
"BITBUCKET_TOKEN": "your-api-token",
"BITBUCKET_WORKSPACE": "your-workspace"
}
}
}
}
Cursor
Add to ~/.cursor/mcp.json:
{
"mcpServers": {
"bitbucket": {
"command": "uvx",
"args": ["bitbucket-mcp-py"],
"env": {
"BITBUCKET_USERNAME": "your-email@example.com",
"BITBUCKET_TOKEN": "your-api-token",
"BITBUCKET_WORKSPACE": "your-workspace"
}
}
}
}
VS Code (GitHub Copilot)
Add to ~/Library/Application Support/Code/User/mcp.json:
{
"mcpServers": {
"bitbucket": {
"command": "uvx",
"args": ["bitbucket-mcp-py"],
"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, decline_pull_request, merge_pull_request |
| Comments | get_pull_request_comments, add_pull_request_comment, get_pull_request_activity, get_pull_request_diff, get_pull_request_commits |
| Build Status | get_pull_request_statuses, get_pull_request_diffstat |
| Pipelines | list_pipeline_runs, get_pipeline_run, get_pipeline_steps, get_pipeline_step_logs |
merge_pull_requestis disabled by default. Enable it inconfigs/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": {
"command": "docker",
"args": ["exec", "-i", "bitbucket-mcp", "python", "-m", "src.main", "--transport", "stdio"]
}
}
}
Development
# Install dev dependencies
pip install -e '.[dev]'
# Run tests
pytest tests/ -v
# Run specific test
pytest tests/test_client.py -v
Requirements
- Python 3.12+
- Bitbucket API token
License
MIT
References
- MCP Registry - Official MCP server registry
- PyPI Package - Python package
- MCP Python SDK
- Bitbucket API 2.0
- FastMCP Framework
Project details
Release history Release notifications | RSS feed
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 bitbucket_mcp_py-1.7.0.tar.gz.
File metadata
- Download URL: bitbucket_mcp_py-1.7.0.tar.gz
- Upload date:
- Size: 91.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 |
a5d0baadc5ec372eb8b4fb78e4847858c8e48b95d6794fc37cfbff60cc0b60f2
|
|
| MD5 |
8b197138e612c1caf120ddc8ccf9d1ee
|
|
| BLAKE2b-256 |
b1e9bdd34cd55a15b6ddbdbaf677362b437f68172003c42a329fcf57a78523ea
|
Provenance
The following attestation bundles were made for bitbucket_mcp_py-1.7.0.tar.gz:
Publisher:
release.yml on lawp09/bitbucket-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bitbucket_mcp_py-1.7.0.tar.gz -
Subject digest:
a5d0baadc5ec372eb8b4fb78e4847858c8e48b95d6794fc37cfbff60cc0b60f2 - Sigstore transparency entry: 983740306
- Sigstore integration time:
-
Permalink:
lawp09/bitbucket-mcp@9076afcde4a25c44b8c8b6b56ae50944dc8f8e1b -
Branch / Tag:
refs/tags/v1.7.0 - Owner: https://github.com/lawp09
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@9076afcde4a25c44b8c8b6b56ae50944dc8f8e1b -
Trigger Event:
push
-
Statement type:
File details
Details for the file bitbucket_mcp_py-1.7.0-py3-none-any.whl.
File metadata
- Download URL: bitbucket_mcp_py-1.7.0-py3-none-any.whl
- Upload date:
- Size: 20.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 |
aec88545f969d3337e47a2557767bfff9e1cbbad5937565d23a43577f496292b
|
|
| MD5 |
c85b54f08e23a70229a0fea53e87c2dd
|
|
| BLAKE2b-256 |
63ccb7376618470d5d8b227fb87aae881edbd574fe2a40e25821027bfc250542
|
Provenance
The following attestation bundles were made for bitbucket_mcp_py-1.7.0-py3-none-any.whl:
Publisher:
release.yml on lawp09/bitbucket-mcp
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bitbucket_mcp_py-1.7.0-py3-none-any.whl -
Subject digest:
aec88545f969d3337e47a2557767bfff9e1cbbad5937565d23a43577f496292b - Sigstore transparency entry: 983740309
- Sigstore integration time:
-
Permalink:
lawp09/bitbucket-mcp@9076afcde4a25c44b8c8b6b56ae50944dc8f8e1b -
Branch / Tag:
refs/tags/v1.7.0 - Owner: https://github.com/lawp09
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@9076afcde4a25c44b8c8b6b56ae50944dc8f8e1b -
Trigger Event:
push
-
Statement type: