@shibainu16/bitbucket-dc-mcp 1.0.2 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +249 -289
- package/build/index.js +0 -0
- package/build/lib/client.js +5 -0
- package/build/lib/client.js.map +1 -1
- package/build/lib/review-state.js +41 -0
- package/build/lib/review-state.js.map +1 -0
- package/build/server/boot.js +6 -6
- package/build/server/boot.js.map +1 -1
- package/build/tools/branches.js +8 -8
- package/build/tools/branches.js.map +1 -1
- package/build/tools/build-status.js +71 -0
- package/build/tools/build-status.js.map +1 -0
- package/build/tools/commits.js +8 -8
- package/build/tools/commits.js.map +1 -1
- package/build/tools/files.js +7 -7
- package/build/tools/files.js.map +1 -1
- package/build/tools/pr-activity.js +10 -10
- package/build/tools/pr-activity.js.map +1 -1
- package/build/tools/pr-comments.js +32 -25
- package/build/tools/pr-comments.js.map +1 -1
- package/build/tools/pr-diff.js +10 -10
- package/build/tools/pr-diff.js.map +1 -1
- package/build/tools/pr-review.js +175 -0
- package/build/tools/pr-review.js.map +1 -0
- package/build/tools/pr-tasks.js +14 -14
- package/build/tools/pr-tasks.js.map +1 -1
- package/build/tools/projects.js +5 -5
- package/build/tools/projects.js.map +1 -1
- package/build/tools/pull-requests.js +61 -14
- package/build/tools/pull-requests.js.map +1 -1
- package/build/tools/repositories.js +5 -5
- package/build/tools/repositories.js.map +1 -1
- package/package.json +84 -78
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 lvluu
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 lvluu
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,289 +1,249 @@
|
|
|
1
|
-
# Bitbucket DC MCP Server
|
|
2
|
-
|
|
3
|
-
[](https://www.npmjs.com/package/@shibainu16/bitbucket-dc-mcp)
|
|
4
|
-
[](https://github.com/lvluu/bitbucket-dc-mcp/actions/workflows/ci.yml)
|
|
5
|
-
[](https://opensource.org/licenses/MIT)
|
|
6
|
-
|
|
7
|
-
A [Model Context Protocol (MCP)](https://modelcontextprotocol.io) server that exposes **Bitbucket Data Center REST API v1.0** as tools for AI assistants.
|
|
8
|
-
|
|
9
|
-
## Overview
|
|
10
|
-
|
|
11
|
-
This server lets MCP-compatible clients (Claude Desktop, VS Code, IDEs, custom apps) interact with a Bitbucket Data Center instance
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
-
|
|
39
|
-
-
|
|
40
|
-
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
MCP_TRANSPORT
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
```
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
```
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
|
234
|
-
|
|
235
|
-
| `
|
|
236
|
-
| `
|
|
237
|
-
| `
|
|
238
|
-
| `
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
The MCP Inspector provides an interactive UI to browse and test all registered tools.
|
|
251
|
-
|
|
252
|
-
### Adding a New Tool
|
|
253
|
-
|
|
254
|
-
1. Create `src/tools/my-domain.ts` (or add to an existing domain file)
|
|
255
|
-
2. Export a default `RegisterableModule` that registers tools in its `register()` function
|
|
256
|
-
3. The auto-loader discovers it automatically on next build
|
|
257
|
-
4. Or use the generator: `npm run gen:tool`
|
|
258
|
-
|
|
259
|
-
See existing files in `src/tools/` for examples.
|
|
260
|
-
|
|
261
|
-
## Publishing
|
|
262
|
-
|
|
263
|
-
Releases are fully automated via [release-please](https://github.com/googleapis/release-please) and GitHub Actions:
|
|
264
|
-
|
|
265
|
-
1. Use [Conventional Commits](https://www.conventionalcommits.org/) (`feat:`, `fix:`, `chore:`, etc.)
|
|
266
|
-
2. On push to `main`, release-please automatically creates/updates a release PR with version bump and changelog
|
|
267
|
-
3. When the release PR is merged, the workflow publishes to npm automatically
|
|
268
|
-
|
|
269
|
-
Requires an `NPM_TOKEN` secret configured in the GitHub repository settings.
|
|
270
|
-
|
|
271
|
-
## Troubleshooting
|
|
272
|
-
|
|
273
|
-
| Issue | Solution |
|
|
274
|
-
|-------|----------|
|
|
275
|
-
| `BITBUCKET_URL is required` | Set the `BITBUCKET_URL` environment variable or add it to `.env` |
|
|
276
|
-
| `Cannot find module` errors | Run `npm run build` before starting the server |
|
|
277
|
-
| `401 Unauthorized` | Check your token or username/password credentials |
|
|
278
|
-
| `deleteBranch is disabled` | Set `BITBUCKET_ENABLE_DANGEROUS=true` to enable destructive operations |
|
|
279
|
-
| Tools not loading | Verify module has a valid default export matching `RegisterableModule` |
|
|
280
|
-
|
|
281
|
-
## License
|
|
282
|
-
|
|
283
|
-
MIT — see [LICENSE](LICENSE).
|
|
284
|
-
|
|
285
|
-
## Resources
|
|
286
|
-
|
|
287
|
-
- [Model Context Protocol Documentation](https://modelcontextprotocol.io)
|
|
288
|
-
- [Bitbucket Data Center REST API](https://developer.atlassian.com/server/bitbucket/rest/)
|
|
289
|
-
- [MCP Inspector](https://github.com/modelcontextprotocol/inspector)
|
|
1
|
+
# Bitbucket DC MCP Server
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@shibainu16/bitbucket-dc-mcp)
|
|
4
|
+
[](https://github.com/lvluu/bitbucket-dc-mcp/actions/workflows/ci.yml)
|
|
5
|
+
[](https://opensource.org/licenses/MIT)
|
|
6
|
+
|
|
7
|
+
A [Model Context Protocol (MCP)](https://modelcontextprotocol.io) server that exposes **Bitbucket Data Center REST API v1.0** as tools for AI assistants.
|
|
8
|
+
|
|
9
|
+
## Overview
|
|
10
|
+
|
|
11
|
+
This server lets MCP-compatible clients (Claude Desktop, VS Code, IDEs, custom apps) interact with a Bitbucket Data Center instance through 55 tools covering:
|
|
12
|
+
|
|
13
|
+
- **Projects** — list, get, create, update
|
|
14
|
+
- **Repositories** — list, get, create, fork, default branch
|
|
15
|
+
- **Pull Requests** — CRUD, merge, decline, reopen, approve, reviewers, can-merge
|
|
16
|
+
- **PR Comments** — list, add, get, update, delete (inline + general)
|
|
17
|
+
- **PR Diff & Changes** — diffs, file changes, conflict markers
|
|
18
|
+
- **PR Activity** — activity feed, participants, watchers
|
|
19
|
+
- **PR Tasks** — blocker comment tasks
|
|
20
|
+
- **Branches & Tags** — list, create, delete
|
|
21
|
+
- **Commits** — list, get, changes, diff
|
|
22
|
+
- **Files** — browse, read, edit, recursive listing
|
|
23
|
+
- **Build Status** — build statuses per commit, build statistics
|
|
24
|
+
|
|
25
|
+
```mermaid
|
|
26
|
+
graph LR
|
|
27
|
+
A[AI Client] <-->|MCP| B[bitbucket-dc-mcp]
|
|
28
|
+
B <-->|REST API v1.0| C[Bitbucket Data Center]
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Example Prompts
|
|
32
|
+
|
|
33
|
+
Once connected, try asking your AI assistant:
|
|
34
|
+
|
|
35
|
+
- "List all repositories in the PROJ project"
|
|
36
|
+
- "Show me open pull requests in repo X"
|
|
37
|
+
- "What changed in PR #42? Summarize the diff"
|
|
38
|
+
- "Create a branch called feature/login from main in PROJ/my-repo"
|
|
39
|
+
- "Add a comment on PR #15 suggesting a fix for the null check on line 23"
|
|
40
|
+
- "What's the build status for the latest commit on main?"
|
|
41
|
+
- "Show me the last 10 commits on the develop branch"
|
|
42
|
+
- "Read the contents of src/index.ts from the main branch"
|
|
43
|
+
- "Are there any unresolved tasks blocking PR #8 from merging?"
|
|
44
|
+
- "Who approved PR #21 and what comments were left?"
|
|
45
|
+
|
|
46
|
+
## Installation
|
|
47
|
+
|
|
48
|
+
### Global install
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
npm install -g @shibainu16/bitbucket-dc-mcp
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Using npx (no install required)
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
BITBUCKET_URL=https://bitbucket.example.com \
|
|
58
|
+
BITBUCKET_TOKEN=your-token \
|
|
59
|
+
MCP_TRANSPORT=stdio \
|
|
60
|
+
npx @shibainu16/bitbucket-dc-mcp
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Prerequisites
|
|
64
|
+
|
|
65
|
+
- Node.js >= 22
|
|
66
|
+
- A Bitbucket Data Center instance with API access
|
|
67
|
+
- A personal access token or username/password credentials
|
|
68
|
+
|
|
69
|
+
## Quick Start
|
|
70
|
+
|
|
71
|
+
### 1. Configure environment
|
|
72
|
+
|
|
73
|
+
Create a `.env` file (or export variables in your shell):
|
|
74
|
+
|
|
75
|
+
```env
|
|
76
|
+
# Required — your Bitbucket DC base URL
|
|
77
|
+
BITBUCKET_URL=https://bitbucket.example.com
|
|
78
|
+
|
|
79
|
+
# Authentication (choose one)
|
|
80
|
+
BITBUCKET_TOKEN=your-personal-access-token
|
|
81
|
+
# OR
|
|
82
|
+
BITBUCKET_USERNAME=your-username
|
|
83
|
+
BITBUCKET_PASSWORD=your-password
|
|
84
|
+
|
|
85
|
+
# Optional
|
|
86
|
+
BITBUCKET_DEFAULT_PROJECT=MYPROJ
|
|
87
|
+
BITBUCKET_ENABLE_DANGEROUS=false
|
|
88
|
+
MCP_TRANSPORT=http
|
|
89
|
+
PORT=3000
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### 2. Run
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
# If installed globally
|
|
96
|
+
bitbucket-dc-mcp
|
|
97
|
+
|
|
98
|
+
# Or via npx
|
|
99
|
+
npx @shibainu16/bitbucket-dc-mcp
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
The server starts in HTTP mode by default at `http://localhost:3000/mcp`.
|
|
103
|
+
|
|
104
|
+
## Configuration
|
|
105
|
+
|
|
106
|
+
### Environment Variables
|
|
107
|
+
|
|
108
|
+
| Variable | Required | Description | Default |
|
|
109
|
+
|----------|----------|-------------|---------|
|
|
110
|
+
| `BITBUCKET_URL` | Yes | Bitbucket DC base URL (auto-appends `/rest/api/1.0`) | — |
|
|
111
|
+
| `BITBUCKET_TOKEN` | Yes* | Personal access token (Bearer auth) | — |
|
|
112
|
+
| `BITBUCKET_USERNAME` | Yes* | Username for basic auth | — |
|
|
113
|
+
| `BITBUCKET_PASSWORD` | Yes* | Password for basic auth | — |
|
|
114
|
+
| `BITBUCKET_DEFAULT_PROJECT` | No | Default project key for tools that accept `projectKey` | — |
|
|
115
|
+
| `BITBUCKET_ENABLE_DANGEROUS` | No | Enable destructive operations (`deletePRComment`, `deleteBranch`) | `false` |
|
|
116
|
+
| `MCP_TRANSPORT` | No | Transport mode: `stdio` or `http` | `http` |
|
|
117
|
+
| `PORT` | No | HTTP server port | `3000` |
|
|
118
|
+
| `CORS_ORIGIN` | No | CORS allowed origins | `*` |
|
|
119
|
+
|
|
120
|
+
\* Either `BITBUCKET_TOKEN` or both `BITBUCKET_USERNAME` + `BITBUCKET_PASSWORD` are required.
|
|
121
|
+
|
|
122
|
+
## Transport Modes
|
|
123
|
+
|
|
124
|
+
### HTTP Mode (Default)
|
|
125
|
+
|
|
126
|
+
Streamable HTTP transport for web deployments and remote access:
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
MCP_TRANSPORT=http bitbucket-dc-mcp
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
Endpoints:
|
|
133
|
+
- `GET /mcp` — SSE stream for server-initiated messages
|
|
134
|
+
- `POST /mcp` — JSON-RPC requests
|
|
135
|
+
- `DELETE /mcp` — Session termination
|
|
136
|
+
- `GET /health` — Health check
|
|
137
|
+
|
|
138
|
+
### Stdio Mode
|
|
139
|
+
|
|
140
|
+
Traditional stdio transport for local clients like Claude Desktop:
|
|
141
|
+
|
|
142
|
+
```bash
|
|
143
|
+
MCP_TRANSPORT=stdio bitbucket-dc-mcp
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## Client Integration
|
|
147
|
+
|
|
148
|
+
### VS Code / GitHub Copilot
|
|
149
|
+
|
|
150
|
+
Add to your **VS Code settings** (`settings.json`) or workspace `.vscode/mcp.json`:
|
|
151
|
+
|
|
152
|
+
```json
|
|
153
|
+
{
|
|
154
|
+
"servers": {
|
|
155
|
+
"bitbucket-dc-mcp": {
|
|
156
|
+
"type": "stdio",
|
|
157
|
+
"command": "npx",
|
|
158
|
+
"args": ["-y", "@shibainu16/bitbucket-dc-mcp"],
|
|
159
|
+
"env": {
|
|
160
|
+
"BITBUCKET_URL": "https://bitbucket.example.com",
|
|
161
|
+
"BITBUCKET_TOKEN": "your-token",
|
|
162
|
+
"MCP_TRANSPORT": "stdio"
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
If using `settings.json` directly, nest it under `"mcp"`:
|
|
170
|
+
|
|
171
|
+
```jsonc
|
|
172
|
+
{
|
|
173
|
+
"mcp": {
|
|
174
|
+
"servers": {
|
|
175
|
+
"bitbucket-dc-mcp": {
|
|
176
|
+
"type": "stdio",
|
|
177
|
+
"command": "npx",
|
|
178
|
+
"args": ["-y", "@shibainu16/bitbucket-dc-mcp"],
|
|
179
|
+
"env": {
|
|
180
|
+
"BITBUCKET_URL": "https://bitbucket.example.com",
|
|
181
|
+
"BITBUCKET_TOKEN": "your-token",
|
|
182
|
+
"MCP_TRANSPORT": "stdio"
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### Claude Code
|
|
191
|
+
|
|
192
|
+
Add to your project's `.mcp.json`, or configure via the CLI:
|
|
193
|
+
|
|
194
|
+
```bash
|
|
195
|
+
claude mcp add bitbucket-dc-mcp \
|
|
196
|
+
-e BITBUCKET_URL=https://bitbucket.example.com \
|
|
197
|
+
-e BITBUCKET_TOKEN=your-token \
|
|
198
|
+
-e MCP_TRANSPORT=stdio \
|
|
199
|
+
-- npx -y @shibainu16/bitbucket-dc-mcp
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
Or manually create/edit `.mcp.json` in your project root:
|
|
203
|
+
|
|
204
|
+
```json
|
|
205
|
+
{
|
|
206
|
+
"mcpServers": {
|
|
207
|
+
"bitbucket-dc-mcp": {
|
|
208
|
+
"command": "npx",
|
|
209
|
+
"args": ["-y", "@shibainu16/bitbucket-dc-mcp"],
|
|
210
|
+
"env": {
|
|
211
|
+
"BITBUCKET_URL": "https://bitbucket.example.com",
|
|
212
|
+
"BITBUCKET_TOKEN": "your-token",
|
|
213
|
+
"MCP_TRANSPORT": "stdio"
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
## Development
|
|
221
|
+
|
|
222
|
+
```bash
|
|
223
|
+
git clone https://github.com/lvluu/bitbucket-dc-mcp.git
|
|
224
|
+
cd bitbucket-dc-mcp
|
|
225
|
+
npm install
|
|
226
|
+
npm run build
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
See `CLAUDE.md` for the full list of commands, architecture details, and contribution guidance.
|
|
230
|
+
|
|
231
|
+
## Troubleshooting
|
|
232
|
+
|
|
233
|
+
| Issue | Solution |
|
|
234
|
+
|-------|----------|
|
|
235
|
+
| `BITBUCKET_URL is required` | Set the `BITBUCKET_URL` environment variable or add it to `.env` |
|
|
236
|
+
| `Cannot find module` errors | Run `npm run build` before starting the server |
|
|
237
|
+
| `401 Unauthorized` | Check your token or username/password credentials |
|
|
238
|
+
| `deleteBranch is disabled` | Set `BITBUCKET_ENABLE_DANGEROUS=true` to enable destructive operations |
|
|
239
|
+
| Tools not loading | Verify module has a valid default export matching `RegisterableModule` |
|
|
240
|
+
|
|
241
|
+
## License
|
|
242
|
+
|
|
243
|
+
MIT — see [LICENSE](LICENSE).
|
|
244
|
+
|
|
245
|
+
## Resources
|
|
246
|
+
|
|
247
|
+
- [Model Context Protocol Documentation](https://modelcontextprotocol.io)
|
|
248
|
+
- [Bitbucket Data Center REST API](https://developer.atlassian.com/server/bitbucket/rest/)
|
|
249
|
+
- [MCP Inspector](https://github.com/modelcontextprotocol/inspector)
|
package/build/index.js
CHANGED
|
File without changes
|
package/build/lib/client.js
CHANGED
|
@@ -26,6 +26,11 @@ export function getConfig() {
|
|
|
26
26
|
}
|
|
27
27
|
return config;
|
|
28
28
|
}
|
|
29
|
+
/** Get the Bitbucket server origin (e.g. https://bitbucket.example.com) */
|
|
30
|
+
export function getOriginUrl() {
|
|
31
|
+
const cfg = getConfig();
|
|
32
|
+
return new URL(cfg.baseUrl).origin;
|
|
33
|
+
}
|
|
29
34
|
/** Build the DC API path for a project's repository */
|
|
30
35
|
export function repoPath(projectKey, repoSlug) {
|
|
31
36
|
return `/projects/${projectKey}/repos/${repoSlug}`;
|
package/build/lib/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/lib/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAsB,MAAM,OAAO,CAAC;AAClD,OAAO,EAA0B,cAAc,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEnF,IAAI,MAAiC,CAAC;AACtC,IAAI,MAA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is active for a PR, comments added via addPRComment are
|
|
5
|
+
* buffered here instead of being posted immediately. finishReview then
|
|
6
|
+
* posts them all at once.
|
|
7
|
+
*/
|
|
8
|
+
// Key: "projectKey/repoSlug/prId"
|
|
9
|
+
const reviewSessions = new Map();
|
|
10
|
+
export function reviewKey(projectKey, repoSlug, prId) {
|
|
11
|
+
return `${projectKey}/${repoSlug}/${String(prId)}`;
|
|
12
|
+
}
|
|
13
|
+
export function hasActiveReview(key) {
|
|
14
|
+
return reviewSessions.has(key);
|
|
15
|
+
}
|
|
16
|
+
export function startReviewSession(key) {
|
|
17
|
+
if (reviewSessions.has(key)) {
|
|
18
|
+
throw new Error(`A review session is already active for ${key}. Finish or discard it first.`);
|
|
19
|
+
}
|
|
20
|
+
reviewSessions.set(key, []);
|
|
21
|
+
}
|
|
22
|
+
export function getReviewSession(key) {
|
|
23
|
+
return reviewSessions.get(key);
|
|
24
|
+
}
|
|
25
|
+
export function addPendingComment(key, comment) {
|
|
26
|
+
const session = reviewSessions.get(key);
|
|
27
|
+
if (session === undefined) {
|
|
28
|
+
throw new Error(`No active review session for ${key}.`);
|
|
29
|
+
}
|
|
30
|
+
session.push(comment);
|
|
31
|
+
return session.length - 1;
|
|
32
|
+
}
|
|
33
|
+
export function clearReviewSession(key) {
|
|
34
|
+
const session = reviewSessions.get(key);
|
|
35
|
+
if (session === undefined) {
|
|
36
|
+
throw new Error(`No active review session for ${key}.`);
|
|
37
|
+
}
|
|
38
|
+
reviewSessions.delete(key);
|
|
39
|
+
return session;
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=review-state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"review-state.js","sourceRoot":"","sources":["../../src/lib/review-state.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AASH,kCAAkC;AAClC,MAAM,cAAc,GAAG,IAAI,GAAG,EAAiC,CAAC;AAEhE,MAAM,UAAU,SAAS,CACvB,UAAkB,EAClB,QAAgB,EAChB,I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