cli / mcp for bitbucket
1# bitbucket-tool-cli
2
3CLI for [Bitbucket Cloud](https://bitbucket.org) pull request management.
4
5## Installation
6
7```bash
8npx bitbucket-tool-cli pr:list --workspace my-ws --repo my-repo
9```
10
11Or install globally:
12
13```bash
14npm install -g bitbucket-tool-cli
15```
16
17## Commands
18
19| Command | Description |
20|---------|-------------|
21| `pr:list` | List pull requests (alias: `prs`) |
22| `pr:create <source> <title> [description]` | Create a pull request |
23| `pr:update <pr-id>` | Update or close a pull request |
24| `pr:comment <pr-id> <comment>` | Add a comment to a pull request |
25| `pr:comments <pr-id>` | Get all comments on a pull request |
26
27### pr:list
28
29```bash
30bitbucket-tool-cli pr:list --workspace my-ws --repo my-repo
31bitbucket-tool-cli pr:list --state MERGED
32```
33
34Options:
35- `-s, --state <state>` — Filter by state: `OPEN`, `MERGED`, `DECLINED`, `SUPERSEDED` (default: `OPEN`)
36
37### pr:create
38
39```bash
40bitbucket-tool-cli pr:create feature/login "Add login page" "Implements OAuth login" \
41 --workspace my-ws --repo my-repo
42```
43
44Options:
45- `-d, --destination <branch>` — Destination branch (default: `main`)
46
47### pr:update
48
49```bash
50bitbucket-tool-cli pr:update 42 --title "New title" --workspace my-ws --repo my-repo
51bitbucket-tool-cli pr:update 42 --close
52```
53
54Options:
55- `-t, --title <title>` — Update PR title
56- `-d, --description <desc>` — Update PR description
57- `--destination <branch>` — Update destination branch
58- `--close` — Close/decline the pull request
59
60### pr:comment
61
62```bash
63bitbucket-tool-cli pr:comment 42 "LGTM" --workspace my-ws --repo my-repo
64```
65
66### pr:comments
67
68```bash
69bitbucket-tool-cli pr:comments 42 --workspace my-ws --repo my-repo
70```
71
72## Authentication
73
74Set one of:
75
76- **API token**: `BITBUCKET_TOKEN` env var
77- **OAuth 2.0**: `BITBUCKET_OAUTH_CLIENT_ID` + `BITBUCKET_OAUTH_CLIENT_SECRET`
78
79Optionally set `BITBUCKET_WORKSPACE` as a default workspace.
80
81## License
82
83MIT