mcp-server-bitbucket

JaviMaligno/mcp-server-bitbucket

3.2

If you are the rightful owner of mcp-server-bitbucket and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.

The Bitbucket MCP Server facilitates seamless integration with Bitbucket API operations, supporting various MCP-compatible clients.

Tools
5
Resources
0
Prompts
0

Bitbucket MCP Server

CI/CD PyPI version npm version License: MIT

MCP server for Bitbucket API operations. Works with Claude Code, Claude Desktop, Cursor, and any MCP-compatible client.

Language Versions

This repository contains both TypeScript and Python implementations:

VersionDirectoryStatusInstallation
TypeScript/typescript✅ Recommended (Smithery)npm install -g mcp-server-bitbucket
Python/python✅ Stablepipx install mcp-server-bitbucket

Note: The TypeScript version is used for Smithery deployments. Both versions provide identical functionality.

Features

  • Repositories: get, create, delete, list, update (move to project, rename)
  • Pull Requests: create, get, list, merge, approve, decline, request changes, comments, diff
  • Pipelines: trigger, get status, list, view logs, stop
  • Branches: list, get
  • Projects: list, get
  • Commits: list, get details, compare/diff between branches
  • Commit Statuses: get build statuses, create status (CI/CD integration)
  • Deployments: list environments, get environment details, deployment history
  • Webhooks: list, create, get, delete
  • Tags: list, create, delete
  • Branch Restrictions: list, create, delete branch protection rules
  • Source Browsing: read files, list directories without cloning
  • Repository Permissions: manage user and group permissions
  • Pipeline Variables: manage CI/CD environment variables
  • MCP Prompts: reusable workflow templates (code review, release notes, etc.)
  • MCP Resources: browsable workspace data

Quick Start

TypeScript (Recommended for Smithery)

# Install globally
npm install -g mcp-server-bitbucket

# Or run directly with npx
npx mcp-server-bitbucket

Python

# Install with pipx
pipx install mcp-server-bitbucket

# Configure Claude Code
claude mcp add bitbucket -s user \
  -e BITBUCKET_WORKSPACE=your-workspace \
  -e BITBUCKET_EMAIL=your-email@example.com \
  -e BITBUCKET_API_TOKEN=your-api-token \
  -- mcp-server-bitbucket

Full Installation Guide - Includes API token creation, permissions setup, and troubleshooting.

Configuration

Environment Variables

VariableRequiredDescription
BITBUCKET_WORKSPACEBitbucket workspace slug
BITBUCKET_EMAILAccount email for Basic Auth
BITBUCKET_API_TOKENRepository access token
API_TIMEOUTRequest timeout in seconds (default: 30)
MAX_RETRIESMax retry attempts for rate limiting (default: 3)

Claude Code CLI

# TypeScript version
claude mcp add bitbucket -s user \
  -e BITBUCKET_WORKSPACE=your-workspace \
  -e BITBUCKET_EMAIL=your-email@example.com \
  -e BITBUCKET_API_TOKEN=your-api-token \
  -- npx mcp-server-bitbucket

# Python version
claude mcp add bitbucket -s user \
  -e BITBUCKET_WORKSPACE=your-workspace \
  -e BITBUCKET_EMAIL=your-email@example.com \
  -e BITBUCKET_API_TOKEN=your-api-token \
  -- mcp-server-bitbucket

Cursor IDE

Add to ~/.cursor/mcp.json:

{
  "mcpServers": {
    "bitbucket": {
      "command": "npx",
      "args": ["mcp-server-bitbucket"],
      "env": {
        "BITBUCKET_WORKSPACE": "your-workspace",
        "BITBUCKET_EMAIL": "your-email@example.com",
        "BITBUCKET_API_TOKEN": "your-api-token"
      }
    }
  }
}

Available Tools (58 total)

Repositories

ToolDescription
list_repositoriesList and search repositories
get_repositoryGet repository details
create_repositoryCreate a new repository
delete_repositoryDelete a repository
update_repositoryUpdate repo settings

Pull Requests

ToolDescription
list_pull_requestsList PRs
get_pull_requestGet PR details
create_pull_requestCreate a new PR
merge_pull_requestMerge a PR
approve_prApprove a PR
unapprove_prRemove approval
request_changes_prRequest changes
decline_prDecline a PR
list_pr_commentsList comments
add_pr_commentAdd comment
get_pr_diffGet the diff

Pipelines

ToolDescription
list_pipelinesList recent runs
get_pipelineGet status
get_pipeline_logsView logs
trigger_pipelineTrigger a run
stop_pipelineStop pipeline
list_pipeline_variablesList variables
get_pipeline_variableGet variable
create_pipeline_variableCreate variable
update_pipeline_variableUpdate variable
delete_pipeline_variableDelete variable

Branches, Commits, Tags

ToolDescription
list_branchesList branches
get_branchGet branch details
list_commitsList commits
get_commitGet commit details
compare_commitsCompare branches
get_commit_statusesGet build statuses
create_commit_statusReport CI status
list_tagsList tags
create_tagCreate a tag
delete_tagDelete a tag

And more...

  • Deployments: list_environments, get_environment, list_deployment_history
  • Webhooks: list_webhooks, create_webhook, get_webhook, delete_webhook
  • Branch Restrictions: list_branch_restrictions, create_branch_restriction, delete_branch_restriction
  • Source Browsing: get_file_content, list_directory
  • Permissions: User and group permission management (8 tools)
  • Projects: list_projects, get_project

MCP Prompts

Reusable workflow templates:

PromptDescription
code_reviewComprehensive PR code review
release_notesGenerate changelog between versions
pipeline_debugDebug failed CI/CD pipelines
repo_summaryComplete repository status overview

MCP Resources

Browsable workspace data:

Resource URIDescription
bitbucket://repositoriesList all repos
bitbucket://repositories/{repo}Repository details
bitbucket://repositories/{repo}/branchesBranch list
bitbucket://repositories/{repo}/pull-requestsOpen PRs
bitbucket://projectsList all projects

Development

TypeScript

cd typescript
npm install
npm run build
npm run dev  # Watch mode

Python

cd python
uv sync
uv run python -m src.server

Creating a Bitbucket API Token

  1. Go to your repository in Bitbucket
  2. Navigate to Repository settings > Access tokens
  3. Click Create Repository Access Token
  4. Select permissions:
    • Repository: Read, Write, Admin, Delete
    • Pull requests: Read, Write
    • Pipelines: Read, Write
  5. Copy the token immediately

License

MIT