Bitbucket MCP Server
Enables LLMs to interact with Bitbucket repositories to manage pull requests, branches, and commits through the Model Context Protocol. It supports repository operations such as searching code, accessing file contents, and comparing branches using natural language.
README
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
🚀 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-mcp
- Install dependencies:
npm install
- Configure environment:
cp .env.example .env
# Edit .env with your Bitbucket credentials
- Build 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_workspaces |
List all available workspaces |
list_repositories |
List repositories in a workspace |
get_repository |
Get repository details |
list_branches |
List repository branches |
get_branch |
Get branch details |
compare_branches |
Compare two branches |
list_pull_requests |
List pull requests with optional filters |
get_pull_request |
Get pull request details |
create_pull_request |
Create a new pull request |
approve_pull_request |
Approve a pull request |
merge_pull_request |
Merge a pull request |
add_pull_request_comment |
Add a comment to a pull request |
list_commits |
List repository commits |
get_commit |
Get commit details |
get_file_content |
Get file contents from repository |
search_code |
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.md
Development 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 --version - Clear node_modules and reinstall:
rm -rf node_modules && npm install - Rebuild 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.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。