Provides tools for repository management (creating, deleting, searching), branch operations, file handling (read, write, delete), issue tracking (creating, deleting issues), and pull request creation in Bitbucket repositories.
MCP Bitbucket Python π¦
A Python implementation of an MCP server for Bitbucket integration. MCP (Model Context Protocol) enables secure, local tool access for AI applications. The server runs locally on the same machine as your AI application.
Installation
Related MCP server: Bitbucket MCP Server
Tools Available
This MCP server provides the following Bitbucket integration tools:
bb_create_repository: Create a new Bitbucket repositoryRequired: name (repository name)
Optional: description, workspace (defaults to kallows), project_key, is_private (default: true), has_issues (default: true)
bb_create_branch: Create a new branch in a repositoryRequired: repo_slug, branch (name for the new branch)
Optional: workspace (defaults to kallows), start_point (defaults to main)
bb_delete_repository: Delete a Bitbucket repositoryRequired: repo_slug
Optional: workspace (defaults to kallows)
bb_read_file: Read a file from a repositoryRequired: repo_slug, path (file path in repository)
Optional: workspace (defaults to kallows), branch (defaults to main/master)
bb_write_file: Create or update a file in a repositoryRequired: repo_slug, path, content
Optional: workspace (defaults to kallows), branch (defaults to main), message (commit message)
bb_create_issue: Create an issue in a repositoryRequired: repo_slug, title, content
Optional: workspace (defaults to kallows), kind (bug/enhancement/proposal/task), priority (trivial/minor/major/critical/blocker)
bb_delete_issue: Delete an issue from a repositoryRequired: repo_slug, issue_id
Optional: workspace (defaults to kallows)
bb_search_repositories: Search Bitbucket repositories using query syntaxRequired: query (e.g., 'name ~ "test"' or 'project.key = "PROJ"')
Optional: workspace (defaults to kallows), page (default: 1), pagelen (default: 10, max: 100)
bb_delete_file: Delete a file from a repositoryRequired: repo_slug, path
Optional: workspace (defaults to kallows), branch (defaults to main), message (commit message)
bb_create_pull_request: Create a pull requestRequired: repo_slug, title, source_branch
Optional: workspace (defaults to kallows), destination_branch (defaults to main), description, close_source_branch (default: true)
Environment Setup
The server requires Bitbucket credentials to be set up as environment variables:
Creating Bitbucket App Password
Go to Bitbucket Settings β App passwords
Create a new app password with these permissions:
Repositories: Read, Write, Admin (for delete operations)
Pull requests: Read, Write
Issues: Read, Write
Account: Read (for workspace operations)
Claude Desktop Configuration
Add this configuration to your claude_desktop_config.json:
Windows
Mac and Linux
β οΈ Important: You must restart Claude Desktop after modifying the configuration file.
Usage
Once configured, the Bitbucket tools will be available in Claude Desktop. You can:
Ask Claude to create repositories and branches
Read and write files in your repositories
Create and manage issues
Search for repositories
Create pull requests
Manage repository files
Example queries:
"Create a new repository called 'my-project' in my personal workspace"
"Create a new branch called 'feature-xyz' in the my-project repository"
"Create a README.md file in my-project with some basic content"
"Search for repositories that contain 'python' in the name"
Workspace Configuration
The tools default to the "kallows" workspace, but you can:
Specify a different workspace using the
workspaceparameterUse
workspace='~'to work with your personal workspaceCreate repositories in team workspaces if you have permissions
Running Tests
The project includes unit and integration tests:
Development
Adding New Tools
Add the tool definition to
handle_list_tools()inserver.pyAdd the implementation to
handle_call_tool()inserver.pyAdd corresponding tests
Update this README
Error Handling
The server includes comprehensive error handling:
Permission errors with helpful guidance
Network connectivity issues
Invalid parameters and validation
Bitbucket API rate limiting
Project Structure
License
This project is licensed under the MIT License.
Contributing
Fork the repository
Create a feature branch
Add tests for your changes
Ensure all tests pass
Submit a pull request
Support
For issues and questions:
Check the Bitbucket API documentation
Verify your app password permissions
Review the test files for usage examples
Create an issue in this repository