bbkt MCP Server

Local setup required. This server has to be cloned and prepared on your machine before you register it in Claude Code.
1

Set the server up locally

Run this once to clone and prepare the server before adding it to Claude Code.

Run in terminal
git clone https://github.com/zach-snell/bbkt.git
cd bbkt
./install.sh
2

Register it in Claude Code

After the local setup is done, run this command to point Claude Code at the built server.

Run in terminal
claude mcp add bbkt -- node "<FULL_PATH_TO_BBKT>/dist/index.js"

Replace <FULL_PATH_TO_BBKT>/dist/index.js with the actual folder you prepared in step 1.

README.md

A Bitbucket CLI and MCP server for managing workspaces and repositories.

bbkt (Bitbucket CLI & MCP Server)

A complete command-line interface and Model Context Protocol (MCP) server written in Go that provides programmatic integration with Bitbucket workspaces and repositories.

Features

  • Dual Mode: Run as a rich, interactive CLI tool for daily developer tasks, or as an MCP server for AI agents.
  • Git Awareness: Automatically detects your current Bitbucket repository from .git/config when run from the terminal.
  • Interactive UI: Sleek terminal UI wizards trigger automatically when required arguments are omitted.
  • Read/Write Operations: Seamlessly manage repositories, workspaces, pipelines, issues, and pull requests. Modify or delete repository source code directly from the API.
  • Authentication: Supports standard App Passwords or an interactive OAuth 2.0 web flow for desktop users.

Installation

From Source

# Clone the repository
git clone https://github.com/zach-snell/bbkt.git
cd bbkt

# Run the install script (builds and moves to ~/.local/bin)
./install.sh

Ensure ~/.local/bin is added to your system $PATH for the executable to be universally available.

From GitHub Releases

Download the appropriate binary for your system (Linux, macOS, Windows) from the Releases page.

CLI Usage

bbkt provides a robust command-line interface with the following core modules:

# Manage workspaces
bbkt workspaces [list, get]

# Manage repositories
bbkt repos [list, get, create, delete]

# Manage pull requests and comments
bbkt prs [list, get, create, merge, approve, decline]
bbkt prs comments [list, add, resolve]

# Trigger and view pipelines
bbkt pipelines [list, get, trigger, stop, logs]

# Issue tracking
bbkt issues [list, get, create, update]

# Read, search, and edit source code
bbkt source [read, tree, search, history, write, delete]

MCP Usage

The tool also serves as an MCP server. It supports two protocols: Stdio (default via bbkt mcp) and the official Streamable Transport API over HTTP.

Stdio Transport (Default)

If you intend to use this with an MCP client (such as Claude Desktop or Cursor), add it to your client's configuration file as a local command:

{
  "mcpServers": {
    "bitbucket": {
      "command": "/absolute/path/to/bbkt",
      "args": ["mcp"],
      "env": {
        "BITBUCKET_USERNAME": "your-username",
        "BITBUCKET_API_TOKEN": "your-api-token"
      }
    }
  }
}

Streamable Transport (HTTP)

You can run the server as a long-lived HTTP process serving the Streamable Transport API (which uses Server-Sent Events underneath). This is useful for remote network clients.

bbkt mcp --port 8080

Environment Variables

Variable Description Required
BITBUCKET_USERNAME Your Bitbucket username No (but recommended for API Tokens)
BITBUCKET_API_TOKEN An Atlassian API Token No (If omitted, triggers OAuth 2.0 browser flow)
BITBUCKET_CLIENT_ID OAuth 2.0 Client ID Only if using OAuth
BITBUCKET_CLIENT_SECRET OAuth 2.0 Client Secret Only if using OAuth

API Token Scopes & Security

read:workspace, read:account, read:user, read:repository:bitbucket, write:repository:bitbucket, read:pullrequest:bitbucket, write:pullrequest:bitbucket, read:pipeline:bitbucket, write:pipeline:bitbucket

Token Introspection: The bbkt mcp server dynamically evaluates your API token's granted scopes at startup. If you omit specific permissions (like write:pipeline:bitbucket), the server will completely hide the associated MCP tools (trigger_pipeline, stop_pipeline) from the AI agent to prevent hallucinated successes.

Explicit Tool Denial: Even if your token has full admin privileges, you can explicitly deny the AI agent access to any tool using the BITBUCKET_DISABLED_TOOLS environment variable.

export BITBUCKET_DISABLED_TOOLS="delete_repository,delete_branch,delete_file"

Tools Provided

  • manage_workspaces: Getting and listing Bitbucket workspaces
  • manage_repositories: Listing, getting, creating, and deleting repositories
  • manage_refs: Listing, creating, and deleting branches and tags
  • manage_commits: Listing and getting commits, diffs, and diffstats
  • manage_source: Source code operations (read, list_directory, get_history, search, write, delete)
  • manage_pull_requests: All pull request operations (list, get, create, update, merge, approve, unapprove, decline, diff, diffstat, commits)
  • `manage_pr_comments

Tools (7)

manage_workspacesGetting and listing Bitbucket workspaces
manage_repositoriesListing, getting, creating, and deleting repositories
manage_refsListing, creating, and deleting branches and tags
manage_commitsListing and getting commits, diffs, and diffstats
manage_sourceSource code operations (read, list_directory, get_history, search, write, delete)
manage_pull_requestsAll pull request operations (list, get, create, update, merge, approve, unapprove, decline, diff, diffstat, commits)
manage_pr_commentsOperations for managing pull request comments

Environment Variables

BITBUCKET_USERNAMEYour Bitbucket username
BITBUCKET_API_TOKENAn Atlassian API Token
BITBUCKET_CLIENT_IDOAuth 2.0 Client ID
BITBUCKET_CLIENT_SECRETOAuth 2.0 Client Secret

Configuration

claude_desktop_config.json
{"mcpServers": {"bitbucket": {"command": "/absolute/path/to/bbkt", "args": ["mcp"], "env": {"BITBUCKET_USERNAME": "your-username", "BITBUCKET_API_TOKEN": "your-api-token"}}}}

Try it

List all open pull requests in my current repository and summarize the changes.
Find the latest pipeline status for the main branch in my repository.
Search for the definition of the 'auth' function in the source code of my repository.
Create a new branch named 'feature/login-fix' and list the recent commits.
Add a comment to pull request #42 suggesting a code improvement.

Frequently Asked Questions

What are the key features of bbkt?

Dual mode operation as both a CLI tool and an MCP server. Automatic Git repository detection from .git/config. Comprehensive read/write operations for repositories, PRs, and pipelines. Dynamic API token scope evaluation to hide unauthorized tools from AI. Support for both Stdio and HTTP Streamable Transport protocols.

What can I use bbkt for?

Automating pull request reviews by having the AI analyze diffs and suggest comments.. Quickly searching through repository source code using natural language queries.. Monitoring and triggering CI/CD pipelines directly from the AI chat interface.. Managing repository branches and tags without leaving the development environment..

How do I install bbkt?

Install bbkt by running: git clone https://github.com/zach-snell/bbkt.git && cd bbkt && ./install.sh

What MCP clients work with bbkt?

bbkt works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Turn this server into reusable context

Keep bbkt docs, env vars, and workflow notes in Conare so your agent carries them across sessions.

Need the old visual installer? Open Conare IDE.
Open Conare