3.2 KiB
3.2 KiB
Bitbucket MCP Server
An MCP (Model Context Protocol) server that provides tools for interacting with the Bitbucket API.
Features
Currently implemented:
get_pull_request
- Retrieve detailed information about a pull request
Planned features:
create_pull_request
- Create new pull requestslist_pull_requests
- List pull requests with filtersupdate_pull_request
- Update PR detailsmerge_pull_request
- Merge pull requests- And more...
Installation
- Clone or download this repository
- Install dependencies:
npm install
- Build the TypeScript code:
npm run build
Authentication Setup
This server uses Bitbucket App Passwords for authentication.
Creating an App Password
- Log in to your Bitbucket account
- Navigate to: https://bitbucket.org/account/settings/app-passwords/
- Click "Create app password"
- Give it a descriptive label (e.g., "MCP Server")
- Select the following permissions:
- Account: Read
- Repositories: Read, Write
- Pull requests: Read, Write
- Click "Create"
- Important: Copy the generated password immediately (you won't be able to see it again!)
Running the Setup Script
node scripts/setup-auth.js
This will guide you through the authentication setup process.
Configuration
Add the server to your MCP settings file (usually located at ~/.vscode-server/data/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json
):
{
"mcpServers": {
"bitbucket": {
"command": "node",
"args": ["/absolute/path/to/bitbucket-mcp-server/build/index.js"],
"env": {
"BITBUCKET_USERNAME": "your-username",
"BITBUCKET_APP_PASSWORD": "your-app-password"
}
}
}
}
Replace:
/absolute/path/to/bitbucket-mcp-server
with the actual path to this directoryyour-username
with your Bitbucket username (not email)your-app-password
with the app password you created
For Bitbucket Server, use:
{
"mcpServers": {
"bitbucket": {
"command": "node",
"args": ["/absolute/path/to/bitbucket-mcp-server/build/index.js"],
"env": {
"BITBUCKET_USERNAME": "your-username",
"BITBUCKET_TOKEN": "your-http-access-token",
"BITBUCKET_BASE_URL": "https://bitbucket.yourcompany.com"
}
}
}
}
Usage
Once configured, you can use the available tools:
Get Pull Request
{
"tool": "get_pull_request",
"arguments": {
"workspace": "PROJ", // Required - your project key
"repository": "my-repo",
"pull_request_id": 123
}
}
Returns detailed information about the pull request including:
- Title and description
- Author and reviewers
- Source and destination branches
- Approval status
- Links to web UI and diff
- And more...
Development
npm run dev
- Watch mode for developmentnpm run build
- Build the TypeScript codenpm start
- Run the built server
Troubleshooting
- Authentication errors: Double-check your username and app password
- 404 errors: Verify the workspace, repository slug, and PR ID
- Permission errors: Ensure your app password has the required permissions
License
MIT