Skip to content

SvitEM/bitbucket-mcp-server

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

4 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Bitbucket MCP Server - Enterprise Secure Edition

npm version License: MIT Security Audit Zero Runtime Dependencies

Secure, self-hosted Model Context Protocol (MCP) server for Bitbucket Server/Data Center β€” designed for enterprise, air-gapped, and private network environments. Built in Rust for maximum security, performance, and zero runtime dependencies.


🎯 Why This MCP Server?

Feature This Server Other MCP Servers
Deployment Single binary Node.js + npm dependencies
Security Rust memory safety JavaScript runtime vulnerabilities
Dependencies Zero at runtime 100+ npm packages
Air-gapped βœ… Fully supported ❌ Requires npm registry
SSL/TLS Custom CA support Limited
Permissions Granular READ/WRITE/DELETE All-or-nothing
Audit Trail Security-audited dependencies Supply chain risks

Perfect For:

  • πŸ”’ Enterprise environments with strict security policies
  • 🏒 Corporate networks behind firewalls
  • ✈️ Air-gapped systems without internet access
  • πŸ›‘οΈ Compliance requirements (SOC2, ISO27001, GDPR)
  • πŸ“¦ Minimal attack surface requirements

πŸš€ Quick Start

Install (30 seconds)

# Global install
npm install -g @bitbucket-mcp/server

# Or run without install
npx @bitbucket-mcp/server

Configure Claude Desktop

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": "npx",
      "args": ["-y", "@bitbucket-mcp/server"],
      "env": {
        "BITBUCKET_BASE_URL": "https://bitbucket.your-company.com",
        "BITBUCKET_USERNAME": "service-account",
        "BITBUCKET_PASSWORD": "your-personal-access-token",
        "BITBUCKET_SSL_VERIFY": "true",
        "BITBUCKET_ALLOW_READ": "true",
        "BITBUCKET_ALLOW_WRITE": "false",
        "BITBUCKET_ALLOW_DELETE": "false"
      }
    }
  }
}

πŸ” Security Features

Enterprise-Grade Security

Feature Description
Memory Safety Rust prevents buffer overflows, use-after-free, data races
Zero Supply Chain Risk No runtime npm dependencies to compromise
Audited Dependencies All Rust crates scanned with cargo-audit
Granular Permissions Separate READ/WRITE/DELETE controls
Self-Signed SSL Support for internal CA certificates
No Telemetry Zero data collection, fully offline-capable

Security Configuration

{
  "env": {
    // Require SSL verification (default: true)
    "BITBUCKET_SSL_VERIFY": "true",
    
    // Read-only mode for maximum security
    "BITBUCKET_ALLOW_READ": "true",
    "BITBUCKET_ALLOW_WRITE": "false",
    "BITBUCKET_ALLOW_DELETE": "false",
    
    // Use personal access token instead of password
    "BITBUCKET_PASSWORD": "your-pat-token"
  }
}

Compliance Ready

  • βœ… SOC2: Audit trails, access controls, encryption in transit
  • βœ… ISO27001: Secure development, dependency management
  • βœ… GDPR: No data retention, on-premise deployment
  • βœ… HIPAA: Private network deployment supported

πŸ› οΈ Available Tools (19 MCP Tools)

Projects

Tool Description Permission
list_projects List all projects with pagination READ
get_project Get project details by key READ

Repositories

Tool Description Permission
list_repos List repositories in a project READ
get_repo Get repository details READ

Pull Requests

Tool Description Permission
list_prs List pull requests with filters (state, author) READ
get_pr Get pull request details READ
create_pr Create a new pull request WRITE
update_pr Update pull request title/description WRITE
merge_pr Merge a pull request DELETE
decline_pr Decline a pull request DELETE
pr_diff Get pull request diff READ
pr_changes Get pull request file changes READ

Branches

Tool Description Permission
list_branches List repository branches READ
create_branch Create a new branch from ref WRITE
compare_branches Compare commits between branches READ

Commits

Tool Description Permission
list_commits List repository commits with filters READ
get_commit Get commit details READ

Files

Tool Description Permission
list_files Browse repository files READ
get_file_content Get file content at specific commit READ

πŸ“¦ Deployment Options

Option 1: NPM (Recommended)

npm install -g @bitbucket-mcp/server

Option 2: Direct Binary (Air-Gapped)

Download prebuilt binary for your platform:

Platform Binary Size
macOS Intel bitbucket-mcp-darwin-x64 ~15 MB
macOS ARM bitbucket-mcp-darwin-arm64 ~12 MB
Linux x64 bitbucket-mcp-linux-x64 ~18 MB
Linux ARM64 bitbucket-mcp-linux-arm64 ~16 MB
Windows x64 bitbucket-mcp-win32-x64.exe ~20 MB
# Download and run
chmod +x bitbucket-mcp-linux-x64
./bitbucket-mcp-linux-x64

Option 3: Docker (Coming Soon)

FROM scratch
COPY bitbucket-mcp-linux-x64 /bitbucket-mcp
ENTRYPOINT ["/bitbucket-mcp"]

🏒 Enterprise Deployment

Air-Gapped Installation

  1. Download on internet-connected machine:

    npm pack @bitbucket-mcp/server
  2. Transfer to air-gapped system via secure media

  3. Install offline:

    npm install -g bitbucket-mcp-server-0.1.0.tgz

Corporate Proxy Support

{
  "env": {
    "BITBUCKET_BASE_URL": "https://bitbucket.internal.company.com",
    "HTTP_PROXY": "http://proxy.company.com:8080",
    "HTTPS_PROXY": "http://proxy.company.com:8080",
    "NO_PROXY": "localhost,127.0.0.1,.internal.company.com"
  }
}

Service Account Setup

# 1. Create dedicated service account in Bitbucket
# 2. Grant minimal required permissions
# 3. Generate Personal Access Token (PAT)
# 4. Use in configuration (never commit to git!)

πŸ”§ Configuration Reference

Environment Variables

Variable Required Default Description
BITBUCKET_BASE_URL Yes - Bitbucket Server base URL
BITBUCKET_API_KEY No - API Key / PAT for Bearer token authentication (has priority over Basic Auth)
BITBUCKET_USERNAME Yes - Username for Basic Auth (ignored if BITBUCKET_API_KEY is set)
BITBUCKET_PASSWORD Yes - Password or PAT for Basic authentication (ignored if BITBUCKET_API_KEY is set)
BITBUCKET_SSL_VERIFY No true SSL certificate verification
BITBUCKET_ALLOW_READ No true Allow read operations
BITBUCKET_ALLOW_WRITE No true Allow write operations
BITBUCKET_ALLOW_DELETE No true Allow delete operations

Permission Modes

// Read-only (maximum security)
{ "BITBUCKET_ALLOW_READ": "true", "BITBUCKET_ALLOW_WRITE": "false", "BITBUCKET_ALLOW_DELETE": "false" }

// Developer mode (no delete)
{ "BITBUCKET_ALLOW_READ": "true", "BITBUCKET_ALLOW_WRITE": "true", "BITBUCKET_ALLOW_DELETE": "false" }

// Admin mode (full access)
{ "BITBUCKET_ALLOW_READ": "true", "BITBUCKET_ALLOW_WRITE": "true", "BITBUCKET_ALLOW_DELETE": "true" }

πŸ›‘οΈ Security Best Practices

1. Use Personal Access Tokens

# ❌ Don't use password
BITBUCKET_PASSWORD="my-actual-password"

# βœ… Use PAT with minimal scope
BITBUCKET_PASSWORD="pat:read-only-projects-repos"

2. Enable Read-Only Mode

{
  "env": {
    "BITBUCKET_ALLOW_WRITE": "false",
    "BITBUCKET_ALLOW_DELETE": "false"
  }
}

3. Restrict Network Access

# Bind to localhost only (if supported)
# Or use firewall rules to restrict access
sudo ufw allow from 127.0.0.1 to any port 3000

4. Rotate Credentials

# Rotate PAT every 90 days
# Monitor Bitbucket audit logs for unusual activity

5. Enable SSL Verification

{
  "env": {
    "BITBUCKET_SSL_VERIFY": "true"  // Never disable in production
  }
}

πŸ› Troubleshooting

SSL Certificate Errors

For self-signed/internal CA certificates:

{
  "env": {
    // Option 1: Add to system trust store (recommended)
    // Option 2: Disable verification (NOT recommended for production)
    "BITBUCKET_SSL_VERIFY": "false"
  }
}

⚠️ Warning: Only disable SSL verification for trusted internal servers.

Authentication Failed

# Check credentials
curl -u username:password https://bitbucket.example.com/rest/api/1.0/projects

# Verify PAT has required permissions
# Check user is not locked/suspended

Connection Refused

# Verify URL includes protocol
BITBUCKET_BASE_URL="https://bitbucket.example.com"  # βœ…
BITBUCKET_BASE_URL="bitbucket.example.com"          # ❌

# Test connectivity
curl -I https://bitbucket.example.com

# Check firewall/proxy rules

Permission Denied

{
  "env": {
    // Enable only required permissions
    "BITBUCKET_ALLOW_READ": "true",
    "BITBUCKET_ALLOW_WRITE": "false",
    "BITBUCKET_ALLOW_DELETE": "false"
  }
}

πŸ—οΈ Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Claude Desktop │────▢│  MCP Server      │────▢│  Bitbucket      β”‚
β”‚  (AI Assistant) β”‚     β”‚  (Rust Binary)   β”‚     β”‚  Server/DC      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
        β”‚                       β”‚                        β”‚
        β”‚                       β”‚                        β”‚
   User Requests          Zero Dependencies        REST API 1.0
   Natural Language         Memory Safe              Basic Auth
                            Single Binary            SSL/TLS

Why Rust?

  • Memory Safety: No buffer overflows, use-after-free, or data races
  • Performance: Native code, no GC pauses
  • Security: Audited dependencies, minimal attack surface
  • Portability: Single static binary, no runtime dependencies

πŸ“š Resources


🀝 Contributing

We welcome contributions! Please see our Contributing Guide for details.

Development

git clone https://github.com/your-org/bitbucket-mcp-server.git
cd bitbucket-mcp-server

# Build
cargo build --release

# Test
cargo test

# Security audit
cargo audit

πŸ”„ CI/CD & Automated Releases

Automatic Versioning

ΠŸΡ€ΠΈ ΠΊΠ°ΠΆΠ΄ΠΎΠΌ ΠΊΠΎΠΌΠΌΠΈΡ‚Π΅ Π² Π²Π΅Ρ‚ΠΊΡƒ main автоматичСски:

  1. Dependabot обновляСт зависимости (СТСнСдСльно ΠΏΠΎ понСдСльникам)
  2. БоздаСтся Π½ΠΎΠ²Ρ‹ΠΉ Ρ‚Π΅Π³ с ΠΈΠ½ΠΊΡ€Π΅ΠΌΠ΅Π½Ρ‚ΠΎΠΌ patch-вСрсии (v0.1.0 β†’ v0.1.1)
  3. ГСнСрируСтся changelog Π½Π° основС Conventional Commits
  4. ΠŸΡƒΠ±Π»ΠΈΠΊΡƒΠ΅Ρ‚ΡΡ GitHub Release с Π±ΠΈΠ½Π°Ρ€Π½ΠΈΠΊΠ°ΠΌΠΈ для всСх ΠΏΠ»Π°Ρ‚Ρ„ΠΎΡ€ΠΌ
  5. ΠŸΡƒΠ±Π»ΠΈΠΊΠ°Ρ†ΠΈΡ Π² npm (ΠΏΡ€ΠΈ Π½Π°Π»ΠΈΡ‡ΠΈΠΈ Ρ‚ΠΎΠΊΠ΅Π½Π° NPM_TOKEN)

Conventional Commits

Π˜ΡΠΏΠΎΠ»ΡŒΠ·ΡƒΠΉΡ‚Π΅ Ρ„ΠΎΡ€ΠΌΠ°Ρ‚ ΠΊΠΎΠΌΠΌΠΈΡ‚ΠΎΠ² для автоматичСского опрСдСлСния Ρ‚ΠΈΠΏΠ° ΠΈΠ·ΠΌΠ΅Π½Π΅Π½ΠΈΠΉ:

# НовыС Ρ„ΡƒΠ½ΠΊΡ†ΠΈΠΈ (minor version)
git commit -m "feat: add branch comparison tool"

# Π˜ΡΠΏΡ€Π°Π²Π»Π΅Π½ΠΈΡ (patch version)
git commit -m "fix: handle SSL certificate errors"

# ОбновлСния зависимостСй (patch version)
git commit -m "deps: update tokio to 1.42"

# ДокумСнтация (Π½Π΅ создаСт Ρ€Π΅Π»ΠΈΠ·)
git commit -m "docs: update README examples"

Workflow Overview

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  Push to main   │────▢│  auto-release.yml│────▢│  Create tag     β”‚
β”‚  (non-.md)      β”‚     β”‚                  β”‚     β”‚  (v0.1.0β†’0.1.1) β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                                          β”‚
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β–Όβ”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  npm Publish    │◀────│  release.yml     │◀────│  GitHub Release β”‚
β”‚                 β”‚     β”‚  Build & Test    β”‚     β”‚  + Changelog    β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Required Secrets

НастройтС secrets Π² GitHub Repository Settings β†’ Secrets β†’ Actions:

Secret Description Required
GITHUB_TOKEN АвтоматичСски создаСтся GitHub βœ… Yes
NPM_TOKEN Π’ΠΎΠΊΠ΅Π½ для ΠΏΡƒΠ±Π»ΠΈΠΊΠ°Ρ†ΠΈΠΈ Π² npm ❌ Optional

Dependabot Configuration

Dependabot автоматичСски обновляСт:

  • Rust зависимости (Cargo.toml) β€” СТСнСдСльно
  • npm зависимости (package.json) β€” СТСнСдСльно
  • GitHub Actions β€” СТСнСдСльно

ВсС обновлСния ΡΠΎΠ·Π΄Π°ΡŽΡ‚ΡΡ ΠΊΠ°ΠΊ Pull Request с Π»Π΅ΠΉΠ±Π»Π°ΠΌΠΈ:

  • dependencies + rust / javascript / ci/cd
  • Π“Ρ€ΡƒΠΏΠΏΠΈΡ€ΠΎΠ²Π°Π½Π½Ρ‹Π΅ обновлСния для minor/patch вСрсий

πŸ“„ License

MIT License - see LICENSE file for details.


πŸ” Keywords

MCP server, Model Context Protocol, Bitbucket Server, Bitbucket Data Center, enterprise MCP, secure MCP, self-hosted MCP, air-gapped MCP, on-premise MCP, single binary MCP, Rust MCP server, zero dependencies, private network MCP, corporate MCP, SOC2 compliant, ISO27001 compliant, Atlassian integration, Bitbucket REST API, Claude Desktop MCP, AI integration


Built for enterprise security β€’ Zero runtime dependencies β€’ Air-gapped ready

About

πŸ” Secure oriented enterprise MCP server for Bitbucket Server/Data Center. Single binary β€’ Zero dependencies β€’ Air-gapped ready β€’ Built in Rust

Topics

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors