@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 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
- [![npm version](https://img.shields.io/npm/v/@shibainu16/bitbucket-dc-mcp.svg)](https://www.npmjs.com/package/@shibainu16/bitbucket-dc-mcp)
4
- [![CI](https://github.com/lvluu/bitbucket-dc-mcp/actions/workflows/ci.yml/badge.svg)](https://github.com/lvluu/bitbucket-dc-mcp/actions/workflows/ci.yml)
5
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](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 — browsing projects, managing repositories, creating and reviewing pull requests, and more — through 48 tools.
12
-
13
- ```mermaid
14
- graph LR
15
- A[AI Client] <-->|MCP| B[bitbucket-dc-mcp]
16
- B <-->|REST API v1.0| C[Bitbucket Data Center]
17
- ```
18
-
19
- ## Installation
20
-
21
- ### Global install
22
-
23
- ```bash
24
- npm install -g @shibainu16/bitbucket-dc-mcp
25
- ```
26
-
27
- ### Using npx (no install required)
28
-
29
- ```bash
30
- BITBUCKET_URL=https://bitbucket.example.com \
31
- BITBUCKET_TOKEN=your-token \
32
- MCP_TRANSPORT=stdio \
33
- npx @shibainu16/bitbucket-dc-mcp
34
- ```
35
-
36
- ## Prerequisites
37
-
38
- - Node.js >= 20.11.0
39
- - A Bitbucket Data Center instance with API access
40
- - A personal access token or username/password credentials
41
-
42
- ## Quick Start
43
-
44
- ### 1. Configure environment
45
-
46
- Create a `.env` file (or export variables in your shell):
47
-
48
- ```env
49
- # Required — your Bitbucket DC base URL
50
- BITBUCKET_URL=https://bitbucket.example.com
51
-
52
- # Authentication (choose one)
53
- BITBUCKET_TOKEN=your-personal-access-token
54
- # OR
55
- BITBUCKET_USERNAME=your-username
56
- BITBUCKET_PASSWORD=your-password
57
-
58
- # Optional
59
- BITBUCKET_DEFAULT_PROJECT=MYPROJ
60
- BITBUCKET_ENABLE_DANGEROUS=false
61
- MCP_TRANSPORT=http
62
- PORT=3000
63
- ```
64
-
65
- ### 2. Run
66
-
67
- ```bash
68
- # If installed globally
69
- bitbucket-dc-mcp
70
-
71
- # Or via npx
72
- npx @shibainu16/bitbucket-dc-mcp
73
- ```
74
-
75
- The server starts in HTTP mode by default at `http://localhost:3000/mcp`.
76
-
77
- ## Configuration
78
-
79
- ### Environment Variables
80
-
81
- | Variable | Required | Description | Default |
82
- |----------|----------|-------------|---------|
83
- | `BITBUCKET_URL` | Yes | Bitbucket DC base URL (auto-appends `/rest/api/1.0`) | — |
84
- | `BITBUCKET_TOKEN` | Yes* | Personal access token (Bearer auth) | — |
85
- | `BITBUCKET_USERNAME` | Yes* | Username for basic auth | — |
86
- | `BITBUCKET_PASSWORD` | Yes* | Password for basic auth | — |
87
- | `BITBUCKET_DEFAULT_PROJECT` | No | Default project key for tools that accept `projectKey` | — |
88
- | `BITBUCKET_ENABLE_DANGEROUS` | No | Enable destructive operations (`deletePRComment`, `deleteBranch`) | `false` |
89
- | `MCP_TRANSPORT` | No | Transport mode: `stdio` or `http` | `http` |
90
- | `PORT` | No | HTTP server port | `3000` |
91
- | `CORS_ORIGIN` | No | CORS allowed origins | `*` |
92
-
93
- \* Either `BITBUCKET_TOKEN` or both `BITBUCKET_USERNAME` + `BITBUCKET_PASSWORD` are required.
94
-
95
- ## Transport Modes
96
-
97
- ### HTTP Mode (Default)
98
-
99
- Streamable HTTP transport for web deployments and remote access:
100
-
101
- ```bash
102
- MCP_TRANSPORT=http bitbucket-dc-mcp
103
- ```
104
-
105
- Endpoints:
106
- - `GET /mcp` — SSE stream for server-initiated messages
107
- - `POST /mcp` — JSON-RPC requests
108
- - `DELETE /mcp` Session termination
109
- - `GET /health` — Health check
110
-
111
- ### Stdio Mode
112
-
113
- Traditional stdio transport for local clients like Claude Desktop:
114
-
115
- ```bash
116
- MCP_TRANSPORT=stdio bitbucket-dc-mcp
117
- ```
118
-
119
- ## Client Integration
120
-
121
- ### VS Code / GitHub Copilot
122
-
123
- Add to your **VS Code settings** (`settings.json`) or workspace `.vscode/mcp.json`:
124
-
125
- ```json
126
- {
127
- "servers": {
128
- "bitbucket-dc-mcp": {
129
- "type": "stdio",
130
- "command": "npx",
131
- "args": ["-y", "@shibainu16/bitbucket-dc-mcp"],
132
- "env": {
133
- "BITBUCKET_URL": "https://bitbucket.example.com",
134
- "BITBUCKET_TOKEN": "your-token",
135
- "MCP_TRANSPORT": "stdio"
136
- }
137
- }
138
- }
139
- }
140
- ```
141
-
142
- If using `settings.json` directly, nest it under `"mcp"`:
143
-
144
- ```jsonc
145
- {
146
- "mcp": {
147
- "servers": {
148
- "bitbucket-dc-mcp": {
149
- "type": "stdio",
150
- "command": "npx",
151
- "args": ["-y", "@shibainu16/bitbucket-dc-mcp"],
152
- "env": {
153
- "BITBUCKET_URL": "https://bitbucket.example.com",
154
- "BITBUCKET_TOKEN": "your-token",
155
- "MCP_TRANSPORT": "stdio"
156
- }
157
- }
158
- }
159
- }
160
- }
161
- ```
162
-
163
- ### Claude Code
164
-
165
- Add to your project's `.mcp.json`, or configure via the CLI:
166
-
167
- ```bash
168
- claude mcp add bitbucket-dc-mcp \
169
- -e BITBUCKET_URL=https://bitbucket.example.com \
170
- -e BITBUCKET_TOKEN=your-token \
171
- -e MCP_TRANSPORT=stdio \
172
- -- npx -y @shibainu16/bitbucket-dc-mcp
173
- ```
174
-
175
- Or manually create/edit `.mcp.json` in your project root:
176
-
177
- ```json
178
- {
179
- "mcpServers": {
180
- "bitbucket-dc-mcp": {
181
- "command": "npx",
182
- "args": ["-y", "@shibainu16/bitbucket-dc-mcp"],
183
- "env": {
184
- "BITBUCKET_URL": "https://bitbucket.example.com",
185
- "BITBUCKET_TOKEN": "your-token",
186
- "MCP_TRANSPORT": "stdio"
187
- }
188
- }
189
- }
190
- }
191
- ```
192
-
193
- ### Claude Desktop
194
-
195
- Add to your Claude Desktop configuration (`claude_desktop_config.json`):
196
-
197
- ```json
198
- {
199
- "mcpServers": {
200
- "bitbucket-dc-mcp": {
201
- "command": "npx",
202
- "args": ["-y", "@shibainu16/bitbucket-dc-mcp"],
203
- "env": {
204
- "BITBUCKET_URL": "https://bitbucket.example.com",
205
- "BITBUCKET_TOKEN": "your-token",
206
- "MCP_TRANSPORT": "stdio"
207
- }
208
- }
209
- }
210
- }
211
- ```
212
-
213
- ## Development
214
-
215
- ### From source
216
-
217
- ```bash
218
- git clone https://github.com/lvluu/bitbucket-dc-mcp.git
219
- cd bitbucket-dc-mcp
220
- npm install
221
- npm run build
222
- ```
223
-
224
- ### Commands
225
-
226
- | Command | Description |
227
- |---------|-------------|
228
- | `npm run build` | Compile TypeScript to `build/` |
229
- | `npm run typecheck` | Type-check without emitting |
230
- | `npm run lint` | Run ESLint |
231
- | `npm run lint:fix` | Auto-fix ESLint issues |
232
- | `npm test` | Run all tests |
233
- | `npm run test:watch` | Run tests in watch mode |
234
- | `npm run inspect` | Build + launch MCP Inspector (stdio) |
235
- | `npm run inspect:http` | MCP Inspector against HTTP endpoint |
236
- | `npm run dev` | Build + interactive JSON-RPC REPL |
237
- | `npm run knip` | Find unused exports/dependencies |
238
- | `npm run gen:tool` | Generate a new tool module with test |
239
-
240
- ### Testing with MCP Inspector
241
-
242
- ```bash
243
- # Stdio mode
244
- npm run inspect
245
-
246
- # HTTP mode (start server first, then in another terminal)
247
- npm run inspect:http
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
+ [![npm version](https://img.shields.io/npm/v/@shibainu16/bitbucket-dc-mcp.svg)](https://www.npmjs.com/package/@shibainu16/bitbucket-dc-mcp)
4
+ [![CI](https://github.com/lvluu/bitbucket-dc-mcp/actions/workflows/ci.yml/badge.svg)](https://github.com/lvluu/bitbucket-dc-mcp/actions/workflows/ci.yml)
5
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](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
@@ -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}`;
@@ -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,MAAqC,CAAC;AAE1C,MAAM,UAAU,UAAU,CAAC,GAAsB;IAC/C,MAAM,GAAG,GAAG,CAAC;IACb,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;QACpB,OAAO,EAAE,GAAG,CAAC,OAAO;QACpB,OAAO,EAAE;YACP,GAAG,cAAc,CAAC,GAAG,CAAC;YACtB,cAAc,EAAE,kBAAkB;YAClC,MAAM,EAAE,kBAAkB;SAC3B;QACD,IAAI,EAAE,YAAY,CAAC,GAAG,CAAC;KACxB,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,SAAS;IACvB,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CAAC,4DAA4D,CAAC,CAAC;IAChF,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,UAAU,SAAS;IACvB,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;IACtE,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED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U,YAAY;IAC1B,MAAM,GAAG,GAAG,SAAS,EAAE,CAAC;IACxB,OAAO,IAAI,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC;AACrC,CAAC;AAED,uDAAuD;AACvD,MAAM,UAAU,QAAQ,CAAC,UAAkB,EAAE,QAAgB;IAC3D,OAAO,aAAa,UAAU,UAAU,QAAQ,EAAE,CAAC;AACrD,CAAC;AAED,+CAA+C;AAC/C,MAAM,UAAU,MAAM,CAAC,UAAkB,EAAE,QAAgB,EAAE,IAAqB;IAChF,OAAO,GAAG,QAAQ,CAAC,UAAU,EAAE,QAAQ,CAAC,kBAAkB,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;AAC3E,CAAC"}
@@ -0,0 +1,41 @@
1
+ /**
2
+ * In-memory review session state management.
3
+ *
4
+ * When a review 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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