Bitbucket MCP Server
Enables management of code repositories and development workflows within the Atlassian ecosystem via Bitbucket, including pull request handling and workspace management.
Provides a suite of tools for interacting with Bitbucket repositories, allowing for workspace exploration, code search, branch management, and full pull request lifecycle automation including creation, approval, and merging.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Bitbucket MCP Server show all open pull requests in the web-app repository"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Bitbucket MCP Server
A Model Context Protocol (MCP) server that enables Large Language Models (LLMs) to interact with Bitbucket repositories, manage pull requests, analyze code, and perform various repository operations.
π Features
Repository Management
List workspaces and repositories
Get detailed repository information
Search code across repositories
Access file contents
Branch Operations
List and get branch details
Compare branches
View branch history
Pull Request Management
List, create, and manage pull requests
Approve and merge pull requests
Add comments and reviews
Filter by status (OPEN, MERGED, DECLINED)
Commit Operations
List and analyze commits
Get commit details and diffs
Filter commits by branch
Related MCP server: Bitbucket MCP Server
π Quick Start
Prerequisites
Node.js 18 or higher
Bitbucket account with App Password
Installation
Clone the repository:
git clone https://github.com/jlromano/bitbucket-mcp.git
cd bitbucket-mcpInstall dependencies:
npm installConfigure environment:
cp .env.example .env
# Edit .env with your Bitbucket credentialsBuild the project:
npm run buildπ Authentication Setup
Creating a Bitbucket App Password
Log into your Bitbucket account
Navigate to Personal Settings β App passwords
Click Create app password
Select the following permissions:
Account: Read
Workspace membership: Read
Repositories: Read, Write
Pull requests: Read, Write
Copy the generated password
Environment Configuration
Create a .env file with your credentials:
BITBUCKET_USERNAME=your-username-or-email
BITBUCKET_APP_PASSWORD=your-app-password
BITBUCKET_WORKSPACE=default-workspace (optional)π Configuration
Claude Desktop
Add to your Claude configuration file:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
Linux: ~/.config/claude/claude_desktop_config.json
{
"mcpServers": {
"bitbucket": {
"command": "node",
"args": ["/absolute/path/to/bitbucket-mcp/dist/index.js"],
"env": {
"BITBUCKET_USERNAME": "your-username",
"BITBUCKET_APP_PASSWORD": "your-app-password",
"BITBUCKET_WORKSPACE": "your-workspace"
}
}
}
}Other MCP-Compatible Applications
Install globally and run:
npm install -g bitbucket-mcp
bitbucket-mcpπ οΈ Available Tools
The server provides the following tools for LLM interaction:
Tool | Description |
| List all available workspaces |
| List repositories in a workspace |
| Get repository details |
| List repository branches |
| Get branch details |
| Compare two branches |
| List pull requests with optional filters |
| Get pull request details |
| Create a new pull request |
| Approve a pull request |
| Merge a pull request |
| Add a comment to a pull request |
| List repository commits |
| Get commit details |
| Get file contents from repository |
| Search code in workspace |
π» Development
Project Structure
bitbucket-mcp/
βββ src/
β βββ index.ts # MCP server implementation
β βββ BitbucketClient.ts # Bitbucket API client
βββ dist/ # Compiled JavaScript
βββ .env.example # Environment variables template
βββ package.json
βββ tsconfig.json
βββ README.mdDevelopment Commands
# Run in development mode with hot reload
npm run dev
# Build for production
npm run build
# Run linting
npm run lint
# Format code
npm run format
# Start production server
npm startπ€ Usage Examples
Once configured, you can interact with your Bitbucket repositories through your LLM:
"List all repositories in my workspace"
"Show open pull requests in the main repository"
"Create a pull request from feature/new-feature to main"
"Get the content of README.md from the develop branch"
"Search for 'authentication' in the codebase"
"Compare develop and main branches"
"Show recent commits with 'fix' in the message"
π Troubleshooting
Common Issues
Authentication Failed
Verify your username (use email if that's your login)
Ensure App Password is valid and has correct permissions
Check that the App Password hasn't expired
Workspace Not Found
Confirm workspace slug matches URL format:
bitbucket.org/WORKSPACE/Verify you have access to the workspace
Build Errors
Ensure Node.js 18+ is installed:
node --versionClear node_modules and reinstall:
rm -rf node_modules && npm installRebuild the project:
npm run build
π License
This project is licensed under the MIT License - see the LICENSE file for details.
π€ 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
π Acknowledgments
Built with the Model Context Protocol SDK
Powered by Bitbucket API
Inspired by the MCP community
π§ Support
For issues, questions, or suggestions, please open an issue on GitHub.
Note: This is not an official Atlassian product. Bitbucket is a trademark of Atlassian.
Available Tools
16 toolsadd_pull_request_commentC
Add a comment to a pull request
Inputs: workspace (required), repo_slug (required), pr_id (required), content (required).
approve_pull_requestC
Approve a pull request
Inputs: workspace (required), repo_slug (required), pr_id (required).
compare_branchesC
Compare two branches
Inputs: workspace (required), repo_slug (required), source_branch (required), destination_branch (required).
create_pull_requestC
Create a new pull request
Inputs: workspace (required), repo_slug (required), title (required), source_branch (required), +2 more.
get_branchC
Get details of a specific branch
Inputs: workspace (required), repo_slug (required), branch_name (required).
get_commitC
Get details of a specific commit
Inputs: workspace (required), repo_slug (required), commit_hash (required).
get_file_contentC
Get the content of a file from a repository
Inputs: workspace (required), repo_slug (required), path (required), ref.
get_pull_requestC
Get details of a specific pull request
Inputs: workspace (required), repo_slug (required), pr_id (required).
get_repositoryC
Get details of a specific repository
Inputs: workspace (required), repo_slug (required).
list_branchesC
List all branches in a repository
Inputs: workspace (required), repo_slug (required).
list_commitsC
List commits in a repository
Inputs: workspace (required), repo_slug (required), branch.
list_pull_requestsC
List pull requests in a repository
Inputs: workspace (required), repo_slug (required), state.
list_repositoriesC
List all repositories in a workspace
Inputs: workspace.
list_workspacesB
List all available Bitbucket workspaces
Inputs: no named parameters.
merge_pull_requestC
Merge a pull request
Inputs: workspace (required), repo_slug (required), pr_id (required).
search_codeC
Search for code in a workspace
Inputs: workspace (required), query (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogβ¦
TDQS
Scored across 16 tools
Every tool has a clearly distinct purpose targeting specific resources and actions in the Bitbucket domain. There is no overlap or ambiguity between tools like 'get_branch', 'list_branches', 'compare_branches', or 'get_pull_request', 'list_pull_requests', 'merge_pull_request'.
All tools follow a consistent verb_noun pattern throughout (e.g., 'list_repositories', 'get_commit', 'create_pull_request'). The naming is uniform with clear action prefixes and descriptive resource names, making the set predictable and readable.
With 16 tools, the count is slightly on the higher side but reasonable for a comprehensive Bitbucket server covering repositories, branches, commits, pull requests, and workspaces. It's well-scoped, though it might feel heavy compared to simpler servers.
The tool surface provides complete CRUD/lifecycle coverage for the Bitbucket domain, including listing, getting, creating, merging, and commenting on pull requests, along with repository, branch, commit, and workspace operations. There are no obvious gaps, ensuring agents can handle full workflows without dead ends.
Maintenance
Related MCP Connectors
Code intelligence for LLMs. Analyze, search, and retrieve code from any public git repository.
A Model Context Protocol (MCP) application for automated GitHub PR analysis and issue management.β¦
Access the GitHub API, enabling file operations, repository management, search functionality, andβ¦
Read and write KukGit repositories, files, issues and pull requests from an AI assistant.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceEnables interaction with Bitbucket through the Model Context Protocol, allowing users to manage pull requests, add comments, review code, create tasks, and perform other repository operations using natural language.7MIT
- AlicenseNot gradedqualityDmaintenanceEnables LLMs to interact with Bitbucket repositories, primarily focusing on retrieving and reviewing pull request context. It provides a suite of tools for repository operations, allowing users to manage pull requests and explore Bitbucket resources through the Model Context Protocol.MIT
- AlicenseNot gradedqualityCmaintenanceEnables interaction with Bitbucket repositories through the Model Context Protocol, supporting code search, repository management, branch creation, pull requests, and more.1MIT
- AlicenseNot gradedqualityAmaintenanceEnables AI assistants to interact with Bitbucket Cloud and Server APIs, providing access to repositories, pull requests, and related operations through the Model Context Protocol.8,143 npmMIT