| name | bkt-cli |
| description | Manage Bitbucket pull requests, issues, and repositories from the command line using the bkt CLI. Use when the user asks about Bitbucket PRs, issues, repos, pipelines, or needs to manage project work items via the command line. |
Bitbucket CLI (bkt)
Interact with Bitbucket Cloud & Data Center from the command line using bkt.
When to Use
- User asks to create, view, edit, or search Bitbucket pull requests
- User needs to manage Bitbucket issues (Cloud only)
- User wants to manage repositories, branches, or permissions
- User needs to trigger or view pipelines
- User needs to manage webhooks or extensions
- MCP tools (
mcp_bitbucket_*) are unavailable or failing
- User needs scripted/batch PR or issue operations
Prerequisites
- Install bkt:
brew install avivsinai/tap/bitbucket-cli (macOS) or see install instructions
- Authenticate:
bkt auth login
- Create and activate a context:
bkt context create
Authentication
Bitbucket Data Center
bkt auth login https://bitbucket.mycorp.example --web-token
bkt auth login https://bitbucket.mycorp.example --username alice --token <PAT>
Bitbucket Cloud
bkt auth login https://bitbucket.org --kind cloud --web
bkt auth login https://bitbucket.org --kind cloud --username <email> --token <api-token>
Context Management
bkt context create dc-prod --host bitbucket.mycorp.example --project ABC --set-active
bkt context create cloud-prod --host api.bitbucket.org --workspace myteam --set-active
bkt context list
bkt auth status
Pull Request Commands
List PRs
bkt pr list --state OPEN
bkt pr list --state OPEN --limit 10
bkt pr list --state MERGED
bkt pr list --state DECLINED
bkt pr list --json id,title,state --limit 20
Create PRs
bkt pr create --title "feat: cache" --source feature/cache --target main
bkt pr create --title "Fix auth" --source fix/auth --target main --reviewer alice
bkt pr create \
--title "feat: add caching" \
--source feature/cache \
--target main \
--description "Implements Redis caching for API responses"
bkt pr create --project DATA --repo platform-api \
--title "Fix bug" --source fix/bug --target main
View PRs
bkt pr view 42
bkt pr comments 42 --details
bkt pr view 42 --json id,title,state,author
Merge & Decline PRs
bkt pr merge 42 --message "merge: feature/cache"
bkt pr decline 42 --reason "Superseded by PR 99"
PR Checks & CI Status
bkt pr checks 42
bkt pr checks 42 --wait
bkt pr checks 42 --wait --timeout 5m
PR Comments & Review Threads
bkt pr comments 42 --details
bkt pr comments resolve 42 <thread-id>
bkt pr comments reopen 42 <thread-id>
bkt pr comments delete 42 <thread-id>
Issue Commands (Bitbucket Cloud Only)
List Issues
bkt issue list --state open
bkt issue list --state open --kind bug
bkt issue list --state open --priority major
Create Issues
bkt issue create -t "Login broken" -k bug -p major
bkt issue create \
--title "API timeout" \
--kind bug \
--priority critical \
--description "Endpoints timeout after 30s"
View Issues
bkt issue view 42
bkt issue view 42 --comments
Edit Issues
bkt issue edit 42 --assignee "{abc-123}" --priority critical
bkt issue edit 42 --kind improvement
Close & Reopen Issues
bkt issue close 42
bkt issue reopen 42
Issue Comments
bkt issue comment 42 -b "Fixed in v1.2.0"
Issue Status
bkt issue status
Attachments
bkt issue attachment list 42
bkt issue attachment upload 42 screenshot.png
bkt issue attachment download 42 --all
bkt issue attachment delete 42 old-file.txt
Repository Commands
bkt repo list --limit 20
bkt repo list --workspace myteam --limit 10
bkt repo view platform-api
bkt repo create data-pipeline --description "Data ingestion" --project DATA
bkt repo create frontend-app --workspace myteam --cloud-project WEB
bkt repo clone platform-api --project DATA --ssh
bkt repo browse --project DATA --repo platform-api
Branch Commands
bkt branch list --workspace myteam
bkt branch create release/1.9 --from main
Permission Commands
bkt perms repo list --project DATA --repo platform-api
Webhook Commands
bkt webhook create \
--name "CI" \
--url https://ci.example.com/hook \
--event repo:refs_changed
Pipeline Commands
bkt pipeline run --workspace myteam --repo api --ref main --var ENV=staging
bkt status pipeline {pipeline-uuid}
bkt status rate-limit
Extension Commands
bkt extension install https://github.com/example/bkt-hello.git
bkt extension exec hello -- --flag=1
Raw API Access
bkt api /rest/api/1.0/projects --param limit=100 --json
bkt api /repositories --param workspace=myteam --field pagelen=50
Environment Variables
| Variable | Description |
|---|
BKT_TOKEN | Authentication token (bypasses keyring) |
BKT_HOST | Bitbucket server base URL |
BKT_USERNAME | Username for basic auth in headless mode |
BKT_PROJECT | Default Data Center project key |
BKT_WORKSPACE | Default Bitbucket Cloud workspace |
BKT_REPO | Default repository slug |
BKT_CONFIG_DIR | Override config file directory |
BKT_HTTP_DEBUG | Set to 1 to log HTTP request URLs and status |
Common Workflows
PR Review Workflow
bkt pr list --state OPEN --limit 10
bkt pr checks 42
bkt pr comments 42 --details
Batch Operations
for id in 10 11 12; do bkt issue close "$id"; done
for pr in 40 41 42; do bkt pr checks "$pr"; done
Limitations
- Issue tracking is only available for Bitbucket Cloud (Data Center uses Jira)
- Requires
bkt auth login and context creation before first use
- Rate limits apply based on Bitbucket instance configuration
- Some commands may differ between Cloud and Data Center
- PR comment thread operations use top-level comment IDs