@kornilovsergei/bitbucket-mcp-server 0.0.0-stage → 4.0.1

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.
Files changed (168) hide show
  1. package/CHANGELOG.md +674 -0
  2. package/LICENSE +21 -0
  3. package/README.md +206 -2
  4. package/build/config/index.d.ts +15 -0
  5. package/build/config/index.d.ts.map +1 -0
  6. package/build/config/index.js +257 -0
  7. package/build/config/index.js.map +1 -0
  8. package/build/core/access.d.ts +8 -0
  9. package/build/core/access.d.ts.map +1 -0
  10. package/build/core/access.js +22 -0
  11. package/build/core/access.js.map +1 -0
  12. package/build/core/api-client.d.ts +72 -0
  13. package/build/core/api-client.d.ts.map +1 -0
  14. package/build/core/api-client.js +423 -0
  15. package/build/core/api-client.js.map +1 -0
  16. package/build/core/cache.d.ts +56 -0
  17. package/build/core/cache.d.ts.map +1 -0
  18. package/build/core/cache.js +169 -0
  19. package/build/core/cache.js.map +1 -0
  20. package/build/core/file-list.d.ts +8 -0
  21. package/build/core/file-list.d.ts.map +1 -0
  22. package/build/core/file-list.js +75 -0
  23. package/build/core/file-list.js.map +1 -0
  24. package/build/core/local-files.d.ts +3 -0
  25. package/build/core/local-files.d.ts.map +1 -0
  26. package/build/core/local-files.js +56 -0
  27. package/build/core/local-files.js.map +1 -0
  28. package/build/core/paths.d.ts +16 -0
  29. package/build/core/paths.d.ts.map +1 -0
  30. package/build/core/paths.js +42 -0
  31. package/build/core/paths.js.map +1 -0
  32. package/build/core/query-budget.d.ts +7 -0
  33. package/build/core/query-budget.d.ts.map +1 -0
  34. package/build/core/query-budget.js +84 -0
  35. package/build/core/query-budget.js.map +1 -0
  36. package/build/core/redact.d.ts +8 -0
  37. package/build/core/redact.d.ts.map +1 -0
  38. package/build/core/redact.js +40 -0
  39. package/build/core/redact.js.map +1 -0
  40. package/build/core/safe-regex.d.ts +14 -0
  41. package/build/core/safe-regex.d.ts.map +1 -0
  42. package/build/core/safe-regex.js +223 -0
  43. package/build/core/safe-regex.js.map +1 -0
  44. package/build/core/scan.d.ts +45 -0
  45. package/build/core/scan.d.ts.map +1 -0
  46. package/build/core/scan.js +102 -0
  47. package/build/core/scan.js.map +1 -0
  48. package/build/core/snapshot.d.ts +86 -0
  49. package/build/core/snapshot.d.ts.map +1 -0
  50. package/build/core/snapshot.js +502 -0
  51. package/build/core/snapshot.js.map +1 -0
  52. package/build/core/throttle.d.ts +38 -0
  53. package/build/core/throttle.d.ts.map +1 -0
  54. package/build/core/throttle.js +110 -0
  55. package/build/core/throttle.js.map +1 -0
  56. package/build/formatting/attachment-formatter.d.ts +20 -0
  57. package/build/formatting/attachment-formatter.d.ts.map +1 -0
  58. package/build/formatting/attachment-formatter.js +32 -0
  59. package/build/formatting/attachment-formatter.js.map +1 -0
  60. package/build/formatting/diff-parser.d.ts +20 -0
  61. package/build/formatting/diff-parser.d.ts.map +1 -0
  62. package/build/formatting/diff-parser.js +165 -0
  63. package/build/formatting/diff-parser.js.map +1 -0
  64. package/build/formatting/formatters.d.ts +45 -0
  65. package/build/formatting/formatters.d.ts.map +1 -0
  66. package/build/formatting/formatters.js +212 -0
  67. package/build/formatting/formatters.js.map +1 -0
  68. package/build/formatting/respond.d.ts +37 -0
  69. package/build/formatting/respond.d.ts.map +1 -0
  70. package/build/formatting/respond.js +93 -0
  71. package/build/formatting/respond.js.map +1 -0
  72. package/build/formatting/server-json-diff.d.ts +36 -0
  73. package/build/formatting/server-json-diff.d.ts.map +1 -0
  74. package/build/formatting/server-json-diff.js +55 -0
  75. package/build/formatting/server-json-diff.js.map +1 -0
  76. package/build/formatting/suggestion-formatter.d.ts +6 -0
  77. package/build/formatting/suggestion-formatter.d.ts.map +1 -0
  78. package/build/formatting/suggestion-formatter.js +17 -0
  79. package/build/formatting/suggestion-formatter.js.map +1 -0
  80. package/build/handlers/attachment-handlers.d.ts +10 -0
  81. package/build/handlers/attachment-handlers.d.ts.map +1 -0
  82. package/build/handlers/attachment-handlers.js +81 -0
  83. package/build/handlers/attachment-handlers.js.map +1 -0
  84. package/build/handlers/branch-handlers.d.ts +19 -0
  85. package/build/handlers/branch-handlers.d.ts.map +1 -0
  86. package/build/handlers/branch-handlers.js +373 -0
  87. package/build/handlers/branch-handlers.js.map +1 -0
  88. package/build/handlers/file-handlers.d.ts +13 -0
  89. package/build/handlers/file-handlers.d.ts.map +1 -0
  90. package/build/handlers/file-handlers.js +296 -0
  91. package/build/handlers/file-handlers.js.map +1 -0
  92. package/build/handlers/grep-handlers.d.ts +14 -0
  93. package/build/handlers/grep-handlers.d.ts.map +1 -0
  94. package/build/handlers/grep-handlers.js +267 -0
  95. package/build/handlers/grep-handlers.js.map +1 -0
  96. package/build/handlers/project-handlers.d.ts +10 -0
  97. package/build/handlers/project-handlers.d.ts.map +1 -0
  98. package/build/handlers/project-handlers.js +98 -0
  99. package/build/handlers/project-handlers.js.map +1 -0
  100. package/build/handlers/pull-request-handlers.d.ts +51 -0
  101. package/build/handlers/pull-request-handlers.d.ts.map +1 -0
  102. package/build/handlers/pull-request-handlers.js +990 -0
  103. package/build/handlers/pull-request-handlers.js.map +1 -0
  104. package/build/handlers/review-handlers.d.ts +27 -0
  105. package/build/handlers/review-handlers.d.ts.map +1 -0
  106. package/build/handlers/review-handlers.js +174 -0
  107. package/build/handlers/review-handlers.js.map +1 -0
  108. package/build/handlers/search-handlers.d.ts +32 -0
  109. package/build/handlers/search-handlers.d.ts.map +1 -0
  110. package/build/handlers/search-handlers.js +261 -0
  111. package/build/handlers/search-handlers.js.map +1 -0
  112. package/build/index.d.ts +3 -0
  113. package/build/index.d.ts.map +1 -0
  114. package/build/index.js +33 -0
  115. package/build/index.js.map +1 -0
  116. package/build/server.d.ts +10 -0
  117. package/build/server.d.ts.map +1 -0
  118. package/build/server.js +100 -0
  119. package/build/server.js.map +1 -0
  120. package/build/tools/definitions.d.ts +3 -0
  121. package/build/tools/definitions.d.ts.map +1 -0
  122. package/build/tools/definitions.js +582 -0
  123. package/build/tools/definitions.js.map +1 -0
  124. package/build/tools/guards.d.ts +245 -0
  125. package/build/tools/guards.d.ts.map +1 -0
  126. package/build/tools/guards.js +164 -0
  127. package/build/tools/guards.js.map +1 -0
  128. package/build/tools/registry.d.ts +16 -0
  129. package/build/tools/registry.d.ts.map +1 -0
  130. package/build/tools/registry.js +51 -0
  131. package/build/tools/registry.js.map +1 -0
  132. package/build/types/bitbucket.d.ts +610 -0
  133. package/build/types/bitbucket.d.ts.map +1 -0
  134. package/build/types/bitbucket.js +2 -0
  135. package/build/types/bitbucket.js.map +1 -0
  136. package/build/types/config.d.ts +207 -0
  137. package/build/types/config.d.ts.map +1 -0
  138. package/build/types/config.js +5 -0
  139. package/build/types/config.js.map +1 -0
  140. package/build/types/diff.d.ts +24 -0
  141. package/build/types/diff.d.ts.map +1 -0
  142. package/build/types/diff.js +3 -0
  143. package/build/types/diff.js.map +1 -0
  144. package/build/types/files.d.ts +9 -0
  145. package/build/types/files.d.ts.map +1 -0
  146. package/build/types/files.js +3 -0
  147. package/build/types/files.js.map +1 -0
  148. package/build/types/http.d.ts +49 -0
  149. package/build/types/http.d.ts.map +1 -0
  150. package/build/types/http.js +3 -0
  151. package/build/types/http.js.map +1 -0
  152. package/build/types/index.d.ts +9 -0
  153. package/build/types/index.d.ts.map +1 -0
  154. package/build/types/index.js +9 -0
  155. package/build/types/index.js.map +1 -0
  156. package/build/types/search.d.ts +66 -0
  157. package/build/types/search.d.ts.map +1 -0
  158. package/build/types/search.js +4 -0
  159. package/build/types/search.js.map +1 -0
  160. package/build/types/snapshot.d.ts +70 -0
  161. package/build/types/snapshot.d.ts.map +1 -0
  162. package/build/types/snapshot.js +3 -0
  163. package/build/types/snapshot.js.map +1 -0
  164. package/build/types/tools.d.ts +38 -0
  165. package/build/types/tools.d.ts.map +1 -0
  166. package/build/types/tools.js +3 -0
  167. package/build/types/tools.js.map +1 -0
  168. package/package.json +77 -4
package/CHANGELOG.md ADDED
@@ -0,0 +1,674 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## 4.0.1 (fork)
9
+
10
+ ### Bug Fixes
11
+
12
+ * diffs on Bitbucket Server older than 7.x: `get_commit_detail` and `get_pull_request_diff` got HTTP 406 for `Accept: text/plain`; on 406 the diff is now read as JSON and rendered to unified diff text (`src/formatting/server-json-diff.ts`)
13
+
14
+ ## [4.0.0](https://github.com/pdogra1299/bitbucket-mcp-server/compare/v3.0.1...v4.0.0) (2026-10-26)
15
+
16
+ ### ⚠ BREAKING CHANGES
17
+
18
+ * Node.js 22 or newer is required (18 and 20 are end-of-life).
19
+ * attachment uploads are disabled until BITBUCKET_ATTACHMENT_ROOT names the only directory they may read from.
20
+ * grep/search_code regexes with a quantified group that contains another quantifier (e.g. `(\d+\s*)+`) are rejected with a rewrite hint.
21
+
22
+ ### Bug Fixes
23
+
24
+ * harden against path steering, file exfiltration, ReDoS and token leaks ([8cc9495](https://github.com/pdogra1299/bitbucket-mcp-server/commit/8cc949532a53d99798bf7db66b0c9721a2b0b3b5))
25
+
26
+ ## [3.0.1](https://github.com/pdogra1299/bitbucket-mcp-server/compare/v3.0.0...v3.0.1) (2026-09-26)
27
+
28
+ ### Bug Fixes
29
+
30
+ * **ci:** add ci, release and commit policy workflows ([b73ee2d](https://github.com/pdogra1299/bitbucket-mcp-server/commit/b73ee2d0f17ee7a9f8134fcd3794d4d43cf8a349))
31
+ * **release:** pin conventionalcommits preset to v8 for writer compatibility ([e9cb095](https://github.com/pdogra1299/bitbucket-mcp-server/commit/e9cb0958f07bc1dd2a8020d7c8a9574315507f48))
32
+
33
+ ## [3.0.0] - 2026-07-09
34
+
35
+ Complete revamp: grep-like repo search, drastically fewer Bitbucket API calls, rate-limit-safe transport, compact token-efficient responses, and a consolidated 25-tool surface. Design and verified API research in `REVAMP_PLAN.md`.
36
+
37
+ ### Added
38
+
39
+ - **`grep` tool — search a repo like ripgrep on a local clone (Server/DC only).** One `archive?at=<sha>` download per repo+commit is streamed (tar.gz, constant memory), regex-scanned line-by-line, and cached in an in-memory byte-budget LRU with content-hash blob dedup across branches. Warm queries cost **1 API call** (the freshness check) instead of a listing + up to 3000 raw file GETs. Full regex, any branch, no index gaps, `content`/`files`/`count` modes, context lines, ripgrep-style output with `as_of <commit>`. Falls back to a bounded per-file scan when the archive endpoint is unavailable. Completeness contract: retention caps never reduce scan coverage (oversized text files are stream-scanned and re-fetched individually on warm hits); binaries are skipped and counted, never silent.
40
+ - **Client-side rate-limit pacing.** All requests flow through a token bucket sized to Bitbucket DC's per-user limiter (default 5 req/s sustained, burst 50 — DC's server default is 60/5) plus a global concurrency cap, making 429s mathematically avoidable on default instances. Bounded retries with full-jitter backoff (Retry-After honored opportunistically; DC documents none), in-flight GET coalescing, keep-alive sockets, request timeouts.
41
+ - **Central config module (`src/config`).** Every numeric policy (rate limits, retries, snapshot budgets, page sizes, truncation caps) is env-overridable — nothing hard-coded at call sites. See `CONFIG_REFERENCE` for the full table. Legacy env names (`BITBUCKET_DEFAULT_PARALLELISM`, `BITBUCKET_MAX_SCAN_FILES`, …) still work.
42
+ - **`version` pass-through on all mutations.** `update/merge/decline_pull_request` and `manage_comment` accept the entity `version` from a prior read (now included in `get_pull_request`/list outputs), turning 2-call mutations into 1 call, with an automatic refetch-and-retry on 409 conflicts.
43
+ - **Cross-repo PR listing.** `list_pull_requests` without `repository` uses the dashboard endpoint (Server) — "my PRs across all repos" in one call.
44
+
45
+ ### Changed
46
+
47
+ - **Diffs are raw unified diff text** (`Accept: text/plain`) — ~5–10× fewer tokens than the old per-line JSON objects with zero information loss (line numbers derive from `@@` headers). Applies to `get_pull_request_diff` and `get_commit_detail`; `get_commit_detail` gains `detail:"files"` for a body-less changed-file list.
48
+ - **`get_file_content` reads a line window server-side in ONE call** (browse endpoint pages over lines; ≤5000/page) instead of metadata + full raw download; `full_content`/negative `start_line` still fetch whole files.
49
+ - **`get_file_blame` fetches only the pages covering the requested window** — a 50-line blame in a 100k-line file is 1 call (was up to 100). Output is a compact commit legend + line spans.
50
+ - **`get_pull_request` is 1 call for metadata** (merge commit + closed date + comment/task counts come from the PR resource itself) and at most 3–4 with `include_comments`/`include_file_changes`/`include_tasks` (tasks via the `blocker-comments` endpoint, DC 7.2+). Activities pagination is honest: server clamps at 500/page and truncation is reported (the old `limit=1000` silently lost data). `merged_by` is extracted from the same activities page that serves comments — no extra calls.
51
+ - **`search_code`**: the redundant case-variant second query is removed (the index is case-insensitive per Atlassian docs); the zero-hit index-gap probe is a single one-page listing (was up to 40 calls); pagination stops with steering text at the search server's ~1000-result window; output is ripgrep-style text.
52
+ - **All responses compacted**: no pretty-printed JSON, ISO-8601 dates, no argument echoes or derivable fields, bulk content as plain text blocks, all truncation explicitly marked, error details capped, text attachment downloads capped (config).
53
+ - **Repo restructured**: `src/{config,core,formatting,handlers,tools,types}` with a canonical types barrel, `type` aliases only (no `interface`), and a tool registry that enforces group/availability filtering at dispatch (hidden tools are no longer callable by name). `BITBUCKET_TOOL_GROUPS` values are validated with warnings.
54
+
55
+ ### Removed (breaking — consolidation, same capabilities)
56
+
57
+ | v2 tool | v3 replacement |
58
+ |---|---|
59
+ | `find_in_files` | `grep` (query = regex) |
60
+ | `search_files` | `grep` (omit query; `glob`) |
61
+ | `list_pr_tasks` | `get_pull_request` with `include_tasks: true` |
62
+ | `create_pr_task` | `add_comment` with `severity: "BLOCKER"` |
63
+ | `update_pr_task` | `manage_comment` `action: "edit"` |
64
+ | `delete_pr_task` / `delete_comment` | `manage_comment` `action: "delete"` |
65
+ | `set_pr_task_status` | `manage_comment` `action: "resolve"` / `"reopen"` |
66
+ | `convert_pr_item` | `manage_comment` `action: "to_task"` / `"to_comment"` |
67
+ | `set_pr_approval` | `set_review_status` `status: "APPROVED"` / `"UNAPPROVED"` |
68
+
69
+ Update Claude Code permission allowlists (`mcp__bitbucket__*`) and prompts accordingly. 33 → 25 tools; tool-definition context cost drops ~30%.
70
+
71
+ ## [2.3.1] - 2026-07-05
72
+
73
+ ### Fixed
74
+
75
+ - **Auth and server errors now include Bitbucket's request id for log correlation.** 401 (authentication failed), 403 (permission denied), and generic API error messages append `[bitbucket-ref: <x-arequestid>]` when Bitbucket returns the `x-arequestid` response header, so operators can correlate a failure to the exact entry in the Bitbucket Data Center access logs. No change when the header is absent; 404 responses are untouched. ([#16](https://github.com/pdogra1299/bitbucket-mcp-server/pull/16))
76
+
77
+ ## [2.3.0] - 2026-07-03
78
+
79
+ ### Fixed
80
+
81
+ - **`find_in_files` no longer fabricates rate-limit errors from permission denials.** Previously, 3 consecutive HTTP 403s aborted the whole scan and reported `RATE_LIMITED: Bitbucket returned 429/403...` — but 403 is authorization, not throttling, so a permission-scoped directory could falsely kill the scan. 403'd files are now skipped individually and reported via a new `PERMISSION_DENIED` warning (with `files_permission_denied` in diagnostics); the scan continues. The racy shared `consecutive403s` counter is gone. Only HTTP 429 means rate-limiting.
82
+ - **HTTP 429 during a scan is retried instead of instantly aborting.** Each throttled file fetch is retried up to 3 attempts, honoring the `Retry-After` header (fallback: 2s/4s exponential backoff with jitter, 30s cap). Only after retries are exhausted does the scan stop — keeping all results gathered so far — with an accurate `RATE_LIMITED` warning.
83
+ - **Repository file listings now paginate.** `find_in_files`, the index-gap probe, and `search_files` previously issued a single `limit=100000` request and silently dropped everything past the first page on instances that clamp page size. Listings now follow `isLastPage`/`nextPageStart` (Server) and the `next` cursor (Cloud, `search_files`), and surface `FILE_LIST_TRUNCATED` / `file_list_truncated` when the pagination safety cap is genuinely hit.
84
+ - **`get_file_blame` reports truncation.** If the 100-page safety cap stops blame pagination early, the response now carries `truncated: true` and a warning instead of silently returning partial blame.
85
+ - **Real Bitbucket throttling is labeled as such.** `handleApiError` now maps HTTP 429 to a clear "Rate limited by Bitbucket" message including `Retry-After` when present, instead of the generic API-error text.
86
+
87
+ ### Added
88
+
89
+ - **In-memory file-list cache (60s TTL)** shared by `find_in_files`, the index-gap probe, and `search_files` — repeated searches against the same repo/branch no longer re-download the full file tree each call. API-only; nothing is written to disk.
90
+ - **`comment_limit` parameter on `get_pull_request`** (default 20, previously a hard-coded slice) to fetch more active comments when a PR has long discussions.
91
+ - **Env-tunable scan knobs:** `BITBUCKET_DEFAULT_PARALLELISM` (default 4), `BITBUCKET_MAX_PARALLELISM` (cap 20), `BITBUCKET_MAX_SCAN_FILES` (default 3000).
92
+
93
+ ## [2.2.0] - 2026-06-05
94
+
95
+ ### Added
96
+
97
+ - **File attachments (Bitbucket Server / Data Center only).** Upload local files and embed them in PR comments and descriptions:
98
+ - New **`attachments`** parameter on `add_comment`, `create_pull_request`, and `update_pull_request`. Each item is a local file path string or `{ file_path, alt_text?, render? }`. Files are uploaded to the repository and a Markdown reference (`attachment:N/M`) is appended automatically — `render: "image"` embeds inline (`![alt](…)`), `"link"` embeds a download link, `"auto"` (default) picks based on file type. For `update_pull_request`, attachments-only updates append to the existing description instead of replacing it.
99
+ - New **`manage_attachments`** tool (new `attachments` tool group, Server only) with `action: "download"` (returns text/image/metadata by numeric id) and `action: "delete"` (by numeric id, requires `REPO_ADMIN`). No `list` action — Bitbucket exposes no attachment-listing API.
100
+ - **Bitbucket Cloud** has no public attachment API; using `attachments` or `manage_attachments` on a Cloud connection returns a clear, explanatory error.
101
+
102
+ ### Changed
103
+
104
+ - **API client** gained multipart upload (`uploadAttachment`) and binary download (`downloadAttachment`) support; previously the client was JSON-only. The upload posts to the prefix-less `/projects/{key}/repos/{slug}/attachments` path (the servlet that actually accepts uploads on Bitbucket DC), falling back to the `/rest/api/1.0/...` form, and sends `Accept: */*` — verified against a live Bitbucket Data Center instance where axios's default `Accept` header is rejected with HTTP 405 by the fronting proxy. Download/delete use the documented `/rest/api/1.0/.../attachments/{id}` resource (delete requires `REPO_ADMIN`).
105
+ - Added `form-data` as a direct dependency (previously only transitive via axios).
106
+
107
+ ## [2.1.0] - 2026-05-10
108
+
109
+ ### Added
110
+
111
+ - **`find_in_files` tool** — Content search by listing files and reading them through the raw endpoint. The escape hatch for everything Bitbucket's index does not cover: full PCRE regex, languages the index ignores (e.g. `.hs`), feature branches, and files Bitbucket's index missed despite indexing the language. Same dense JSON output as `search_code`. Concurrency-capped (default 4) with rate-limit detection (429 aborts immediately; 3+ consecutive 403s aborts; transient single 403s are tolerated as per-file permission denials). Surfaces honest diagnostics: `files_scanned`, `files_attempted`, `files_failed`, `files_truncated`. **Bitbucket Server only.**
112
+
113
+ - **New `search_code` parameters** mapping directly to documented Bitbucket modifiers:
114
+ - `lang` (`lang:`), `ext` (`ext:`), `path` (`path:`), `archived` (`archived:`), `fork` (`fork:`), `exclude_terms` (each becomes `-term`).
115
+ - `regex_filter` — client-side regex applied to returned hit lines as a post-filter; lets you narrow without spending Bitbucket query budget.
116
+ - `case_variants` — runs the query with snake_case ↔ camelCase converted and merges results in one tool call.
117
+
118
+ - **Index-reach probe** — when `search_code` returns zero hits, the server lists matching files via the same filters; if files exist it surfaces an `INDEX_GAP_LIKELY` warning that names the file count, calls out an unrecognized `lang:` filter when present, and tells the LLM to fall back to `find_in_files`. Distinguishes `PROBE_UNAVAILABLE` (probe could not run) from real zero-results.
119
+
120
+ - **Soft-degrade query builder** — Bitbucket caps queries at 250 characters and 9 expressions. When constructed clauses exceed either cap, optional clauses (drop priority: `exclude_terms` → `archived` → `fork` → `ext` → `lang` → `path` → `repo`) are removed one at a time with a `QUERY_TRUNCATED` warning. Previously this returned a hard error.
121
+
122
+ - **Dense JSON response shape** for both search tools:
123
+ - Only matched lines are returned (previously surrounding-context lines were rendered as if they were matches, inflating output ~10x).
124
+ - Distinct `total_files` and `total_matches`, plus an `engine` field (`bitbucket_index` or `find_in_files`) so callers know which path served the result.
125
+ - `diagnostics` block exposes `expression_count`, `query_length`, `dropped_clauses`, and (for `find_in_files`) honest scan counts.
126
+
127
+ - **Structured warnings** at every failure mode: `INDEX_GAP_LIKELY`, `REGEX_FILTER_REJECTED_ALL`, `PROBE_UNAVAILABLE`, `RATE_LIMITED`, `FETCH_FAILURES`, `FILES_TRUNCATED`, `POSSIBLE_FALSE_NEGATIVE`, `QUERY_TRUNCATED`, `INVALID_REGEX`, `DEPRECATED_PARAM`. Each names the specific cause and the next action.
128
+
129
+ ### Changed
130
+
131
+ - **Tool descriptions rewritten** for `search_code`, `find_in_files`, `search_files`, `search_repositories`. Lead with USE WHEN / DO NOT USE WHEN, document Bitbucket index quirks (punctuation stripping, ALL-CAPS operators, single-character terms ignored), and state hard limits (250-char query, 9 expressions, 512 KiB per file, default branch only). Language-neutral throughout — no per-language regex tables baked into the server.
132
+
133
+ - **`search_code` parameter renames** — `search_query` → `query`, `file_pattern` → `ext` / `path`. Old names still accepted with a `DEPRECATED_PARAM` warning. `search_context` and `include_patterns` are accepted but ignored with a deprecation warning (their patterns collapsed at index time due to Bitbucket's punctuation-stripping behavior).
134
+
135
+ - **`search_repositories`** modernized to the dense JSON shape; accepts both `query` and `search_query` (deprecated).
136
+
137
+ ### Fixed
138
+
139
+ - **`search_code` smart-query layer was a no-op.** The previous `buildContextualPatterns` generated 7 OR'd patterns (`"foo ="`, `"foo:"`, `"function foo"`, etc.) that all collapsed to bare-term searches at index time because Bitbucket strips punctuation other than `.` and `_`. Worse, the OR-expanded query overflowed the 250-character cap for any identifier roughly 16 characters or longer, returning a hard error. Removed in favor of raw query passthrough plus optional `regex_filter` post-filter.
140
+
141
+ - **Output bloat** — `formatCodeSearchOutput` printed every line in `hitContexts` (including blank lines, docstring fences, surrounding context) as `Line N: ...`, conflating actual hits with their surroundings. Replaced with a hit-only formatter that filters on Bitbucket's `<em>` markers.
142
+
143
+ - **Silent fetch failures** in file fan-outs were treated as "no match" and returned with confidence. Now tracked separately; `FETCH_FAILURES` warning includes counts and a sample of failing paths.
144
+
145
+ - **Inconsistent API path versions** — `listFiles` used `/rest/api/latest/...` while raw content used `/rest/api/1.0/...`. Unified to `latest`.
146
+
147
+ - **Filters JSON included `undefined` keys** — now stripped.
148
+
149
+ ### Notes
150
+
151
+ - The Bitbucket index itself has known coverage gaps that cannot be fixed from the MCP layer (e.g. some real source files are simply missing from the index even on the default branch, languages like Haskell appear unindexed in some installations). This release does not paper over those gaps; it makes them visible to the LLM via `INDEX_GAP_LIKELY` and provides `find_in_files` as a working recovery path.
152
+
153
+ ## [2.0.4] - 2026-04-21
154
+
155
+ ### Added
156
+ - **`get_file_blame` tool** — Per-line blame for a file: who last modified each line, the commit hash, author, and timestamp. Supports `branch`, `start_line`/`line_count` windowing, and `group_by_commit` to toggle between range-compressed output (default) and one-entry-per-line output. Feed the returned `commit_id` into `get_commit_detail` to see what actually changed. **Bitbucket Server only** — Bitbucket Cloud does not expose a blame API.
157
+
158
+ ## [2.0.3] - 2026-04-08
159
+
160
+ ### Added
161
+ - **`get_commit_detail` tool** — Get the diff for a specific commit (by SHA) with structured line-by-line information. Supports `context_lines`, `file_path`, `include_patterns`, and `exclude_patterns` filtering. Works on both Bitbucket Server (structured JSON response) and Bitbucket Cloud (unified diff with optional filtering).
162
+
163
+ ## [2.0.2] - 2026-03-29
164
+
165
+ ### Fixed
166
+ - **Validate `search_code` query length before calling Bitbucket API** — returns a clear error when the constructed query exceeds Bitbucket's 250-character limit, preventing a confusing API-level failure and showing the full constructed query to help users shorten their search
167
+
168
+ ## [2.0.1] - 2026-03-07
169
+
170
+ ### Fixed
171
+ - Republish to restore README display on npm registry page
172
+
173
+ ## [2.0.0] - 2026-03-07
174
+
175
+ ### BREAKING CHANGES
176
+
177
+ - **Merged 8 inverse-operation tool pairs into 4 unified tools** — any client or LLM prompt referencing the old tool names must be updated:
178
+
179
+ | Removed (old) | Replacement |
180
+ |---|---|
181
+ | `approve_pull_request` | `set_pr_approval` with `approved: true` |
182
+ | `unapprove_pull_request` | `set_pr_approval` with `approved: false` |
183
+ | `request_changes` | `set_review_status` with `request_changes: true` |
184
+ | `remove_requested_changes` | `set_review_status` with `request_changes: false` |
185
+ | `mark_pr_task_done` | `set_pr_task_status` with `done: true` |
186
+ | `unmark_pr_task_done` | `set_pr_task_status` with `done: false` |
187
+ | `convert_comment_to_task` | `convert_pr_item` with `direction: "to_task"` |
188
+ | `convert_task_to_comment` | `convert_pr_item` with `direction: "to_comment"` |
189
+
190
+ - **Removed fields from `list_pull_requests` response** — slim list format no longer includes `is_open`, `is_closed`, `api_url`, `description`. Use `get_pull_request` for full details.
191
+
192
+ - **Removed fields from `list_projects` / `list_repositories` responses** — `id`, `state`, `is_forkable`, `clone_urls` removed (not useful for LLM navigation).
193
+
194
+ - **Removed fields from commit responses** — `author.email` and `parents[]` removed from `FormattedCommit`. Use `is_merge_commit` boolean (retained) instead of checking `parents.length`.
195
+
196
+ - **Removed fields from file/directory responses** — `size` removed from `list_directory_content` entries; `size` and `encoding` removed from `get_file_content`; `workspace`, `repository`, `total_files_scanned` removed from `search_files`.
197
+
198
+ - **Removed fields from diff response** — `message`, `from_hash`, `to_hash` removed from `get_pull_request_diff` structured response.
199
+
200
+ ### Added
201
+
202
+ - **Tool group filtering via `BITBUCKET_TOOL_GROUPS` environment variable**:
203
+ - Set a comma-separated list of group names to expose only the tools your use case needs
204
+ - Groups: `pr_core`, `pr_comments`, `pr_review`, `pr_tasks`, `commits`, `branches`, `files`, `search`, `discovery`
205
+ - Example: `BITBUCKET_TOOL_GROUPS=pr_core,pr_review,files` exposes only 12 tools (~2,100 tokens) instead of all 29
206
+ - When unset, all applicable tools are exposed (default behaviour)
207
+
208
+ - **Automatic server-only tool filtering for Bitbucket Cloud**:
209
+ - When connected to Bitbucket Cloud, 10 server-only tools are automatically hidden from the LLM
210
+ - Cloud users see 21 tools instead of 29, saving ~1,100 tokens per request without any configuration
211
+ - Server-only tools: `list_pr_tasks`, `create_pr_task`, `update_pr_task`, `set_pr_task_status`, `delete_pr_task`, `convert_pr_item`, `list_branch_commits`, `search_code`, `search_repositories`, and `search_files`
212
+
213
+ - **Tool group metadata** on every tool definition (`group` + `availability` fields) for runtime filtering
214
+
215
+ ### Changed
216
+
217
+ - **Token usage reduced by ~25% (Server) to ~43% (Cloud)** in tool definition payload sent to LLM on every request:
218
+ - Before: 33 tools, ~6,800 tokens
219
+ - After (Server, all groups): 29 tools, ~5,100 tokens
220
+ - After (Cloud, auto-filtered): 21 tools, ~3,900 tokens
221
+ - After (minimal group preset): 12 tools, ~2,100 tokens
222
+
223
+ - **Shared parameter constants** (`W`, `R`, `PRID`, `BRANCH`, `LIMIT`, `START`, `TASK_ID`) used across all tool definitions to avoid repeating identical parameter descriptions
224
+
225
+ - **Compressed tool descriptions** — all tool and parameter descriptions trimmed to remove redundant wording while preserving full semantic meaning
226
+
227
+ - **Author filter in `list_branch_commits`** now matches by `author.name` only (email was removed from `FormattedCommit`)
228
+
229
+ ## [1.4.0] - 2026-01-28
230
+
231
+ ### Added
232
+
233
+ - **New `search_files` tool for finding files by name or path pattern**:
234
+ - Search for files using glob patterns (e.g., `*.ts`, `**/*Controller*`, `src/**/*.res`)
235
+ - Case-insensitive matching for user-friendly searches (like VS Code's Ctrl+P)
236
+ - Supports searching within specific subdirectories via `path` parameter
237
+ - Branch selection support to search files on any branch
238
+ - Configurable result limit (default: 100) with truncation indicator
239
+ - Returns comprehensive response with:
240
+ - Matched file paths
241
+ - Total files scanned in repository
242
+ - Total matches found
243
+ - Truncation status when results exceed limit
244
+ - Works with both Bitbucket Server and Cloud
245
+ - Uses Bitbucket Server's `/files` endpoint for efficient recursive file listing
246
+ - Client-side glob filtering using `minimatch` library
247
+
248
+ ### Technical Details
249
+
250
+ - Added `isSearchFilesArgs` type guard for input validation
251
+ - Added `handleSearchFiles` method to `FileHandlers` class
252
+ - Uses `minimatch` with `matchBase: true` and `nocase: true` options for flexible pattern matching
253
+ - Bitbucket Server: Single API call fetches all files recursively
254
+ - Bitbucket Cloud: Uses `/src` endpoint with `max_depth` parameter
255
+
256
+ ## [1.4.1] - 2026-02-23
257
+
258
+ ### Fixed
259
+
260
+ - **Pinned `minimatch` to `9.0.5` to avoid `9.0.6` runtime crash for `npx` consumers**
261
+ - Ensures registry installs do not pull the broken `9.0.6` release
262
+
263
+ ## [1.3.0] - 2026-01-25
264
+
265
+ ### Added
266
+
267
+ - **New `search_repositories` tool (Bitbucket Server only)**:
268
+ - Search for repositories by name or description across all accessible projects
269
+ - Optional filtering by project/workspace
270
+ - Uses Bitbucket Server's search API for efficient repository discovery
271
+ - Configurable result limit
272
+
273
+ - **New `decline_pull_request` tool**:
274
+ - Decline/reject a pull request with optional comment
275
+ - Works with both Bitbucket Server and Cloud
276
+ - Fetches current PR version automatically to handle optimistic locking
277
+
278
+ - **New `delete_comment` tool**:
279
+ - Delete a comment from a pull request
280
+ - Handles version tracking automatically
281
+ - Returns appropriate error for comments with replies (which cannot be deleted)
282
+ - Only comment author, PR author, or repo admin can delete comments
283
+
284
+ - **New PR Task Management tools (Bitbucket Server only)**:
285
+ - Tasks are checklist items on pull requests (implemented as BLOCKER severity comments)
286
+ - `list_pr_tasks` - List all tasks on a PR with open/resolved summary
287
+ - `create_pr_task` - Create a new task directly on a PR
288
+ - `update_pr_task` - Edit the text of an existing task
289
+ - `mark_pr_task_done` - Mark a task as resolved
290
+ - `unmark_pr_task_done` - Reopen a resolved task
291
+ - `delete_pr_task` - Delete a task from a PR
292
+ - `convert_comment_to_task` - Convert a regular comment to a task
293
+ - `convert_task_to_comment` - Convert a task back to a regular comment
294
+
295
+ ### Changed
296
+
297
+ - Enhanced `BitbucketServerSearchRequest` type to include `repositories` entity and `limits` for pagination
298
+ - Enhanced `BitbucketServerSearchResult` type to include repository search results
299
+ - Added new type guards for all new tools
300
+ - Updated README with comprehensive documentation for all new tools
301
+
302
+ ### Technical Details
303
+
304
+ - Tasks use `severity: "BLOCKER"` for tasks and `severity: "NORMAL"` for regular comments
305
+ - Task state can be `OPEN` or `RESOLVED`
306
+ - All task operations require version tracking for optimistic locking
307
+
308
+ ## [1.2.3] - 2026-01-20
309
+
310
+ ### Added
311
+ - **Structured diff response for `get_pull_request_diff` tool (Bitbucket Server)**:
312
+ - Returns structured JSON with line-by-line information instead of raw unified diff
313
+ - Each line includes `source_line`, `destination_line`, `type` (ADDED/REMOVED/CONTEXT), and `content`
314
+ - Files organized into hunks with start positions and spans
315
+ - Makes it easy for AI tools to add inline comments with correct line numbers
316
+ - Native file path filtering via Bitbucket API (added file path to URL)
317
+
318
+ ### Changed
319
+ - **Bitbucket Server now uses JSON API** (`Accept: application/json`) instead of text/plain for diff endpoint
320
+ - Response format changed from `{ diff: "raw diff string" }` to structured `{ files: [...] }` format
321
+ - Updated tool description to document structured response and line number usage
322
+ - Updated README with comprehensive documentation of new response format
323
+
324
+ ### How to Use for Inline Comments
325
+ | Line Type | Line Number to Use | `line_type` param |
326
+ |-----------|-------------------|-------------------|
327
+ | `ADDED` | `destination_line` | `"ADDED"` |
328
+ | `REMOVED` | `source_line` | `"REMOVED"` |
329
+ | `CONTEXT` | `destination_line` | `"CONTEXT"` |
330
+
331
+ ### Note
332
+ - Bitbucket Cloud continues to use raw diff format (unchanged)
333
+ - Glob pattern filtering (`include_patterns`/`exclude_patterns`) still works client-side
334
+
335
+ ## [1.1.3] - 2026-01-08
336
+
337
+ ### Fixed
338
+ - **Fixed username encoding for Bitbucket Server participant endpoints**:
339
+ - Usernames containing `+` characters (e.g., `user+1@domain.com`) are now properly converted to slug format
340
+ - Both `@` and `+` are replaced with `_` to match Bitbucket Server's user slug format
341
+ - Affects `approve_pull_request`, `unapprove_pull_request`, `request_changes`, and `remove_requested_changes` tools
342
+ - Previously, the `+` character would cause 404 errors when approving/requesting changes on PRs
343
+
344
+ ## [1.1.2] - 2025-10-14
345
+
346
+ ### Added
347
+ - **CI/CD build status support in `list_pr_commits` tool**:
348
+ - Added `include_build_status` optional parameter to fetch build/CI status for pull request commits
349
+ - Returns build status with counts: successful, failed, in_progress, and unknown builds
350
+ - Uses same Bitbucket Server UI API endpoint as `list_branch_commits` for consistency
351
+ - Graceful degradation: failures in fetching build status don't break commit listing
352
+ - Currently only supports Bitbucket Server (Cloud has different build status APIs)
353
+ - Useful for tracking CI/CD pipeline status for all commits in a pull request
354
+
355
+ ### Changed
356
+ - Enhanced README.md with comprehensive documentation for new v1.1.0 features:
357
+ - Added usage examples and documentation for `include_build_status` parameter in `list_branch_commits` tool
358
+ - Added complete documentation for `list_projects` tool with examples, parameters, and response format
359
+ - Added complete documentation for `list_repositories` tool with examples, parameters, and response format
360
+ - Improved feature list to include new Project and Repository Discovery Tools section
361
+
362
+ ## [1.1.0] - 2025-10-14
363
+
364
+ ### Added
365
+ - **CI/CD build status support in `list_branch_commits` tool**:
366
+ - Added `include_build_status` optional parameter to fetch build/CI status for commits
367
+ - Returns build status with counts: successful, failed, in_progress, and unknown builds
368
+ - Uses Bitbucket Server UI API endpoint for efficient batch fetching of build summaries
369
+ - Graceful degradation: failures in fetching build status don't break commit listing
370
+ - Currently only supports Bitbucket Server (Cloud has different build status APIs)
371
+ - Useful for tracking CI/CD pipeline status alongside commit history
372
+
373
+ - **New `list_projects` tool for project/workspace discovery**:
374
+ - List all accessible Bitbucket projects (Server) or workspaces (Cloud)
375
+ - Optional filtering by project name and permission level
376
+ - Returns project metadata: key, ID, name, description, visibility, and type
377
+ - Pagination support with `limit` and `start` parameters
378
+ - Works with both Bitbucket Server and Cloud with unified response format
379
+
380
+ - **New `list_repositories` tool for repository discovery**:
381
+ - List repositories within a specific project/workspace or across all accessible repos
382
+ - Optional filtering by repository name and permission level
383
+ - Returns comprehensive repository details:
384
+ - Basic info: slug, ID, name, description, state
385
+ - Project association: project key and name
386
+ - Clone URLs for both HTTP(S) and SSH
387
+ - Repository settings: visibility, forkable status
388
+ - Pagination support with `limit` and `start` parameters
389
+ - Bitbucket Cloud requires workspace parameter (documented in response)
390
+ - Bitbucket Server supports listing all accessible repos without workspace filter
391
+
392
+ ### Changed
393
+ - Added `ProjectHandlers` class following the modular architecture pattern
394
+ - Enhanced TypeScript interfaces with project and repository types:
395
+ - `BitbucketServerProject` and `BitbucketCloudProject`
396
+ - `BitbucketServerRepository` and `BitbucketCloudRepository`
397
+ - `BitbucketServerBuildSummary` and `BuildStatus`
398
+ - Added custom params serializer for multiple `commitId` parameters in build status API
399
+ - Enhanced `FormattedCommit` interface with optional `build_status` field
400
+ - Updated API client with `getBuildSummaries` method for batch build status fetching
401
+
402
+ ## [1.0.1] - 2025-08-08
403
+
404
+ ### Fixed
405
+ - **Improved search_code tool response formatting**:
406
+ - Added simplified `formatCodeSearchOutput` for cleaner AI consumption
407
+ - Enhanced HTML entity decoding (handles &quot;, &lt;, &gt;, &amp;, &#x2F;, &#x27;)
408
+ - Improved response structure showing file paths and line numbers clearly
409
+ - Removed HTML formatting tags for better readability
410
+
411
+ ### Changed
412
+ - Search results now use simplified formatter by default for better AI tool integration
413
+ - Enhanced query display to show actual search patterns used
414
+
415
+ ## [1.0.0] - 2025-07-25
416
+
417
+ ### Added
418
+ - **New `search_code` tool for searching code across repositories**:
419
+ - Search for code snippets, functions, or any text within Bitbucket repositories
420
+ - Supports searching within a specific repository or across all repositories in a workspace
421
+ - File path pattern filtering with glob patterns (e.g., `*.java`, `src/**/*.ts`)
422
+ - Returns matched lines with highlighted segments showing exact matches
423
+ - Pagination support for large result sets
424
+ - Currently only supports Bitbucket Server (Cloud API support planned for future)
425
+ - Added `SearchHandlers` class following the modular architecture pattern
426
+ - Added TypeScript interfaces for search requests and responses
427
+ - Added `formatSearchResults` formatter function for consistent output
428
+
429
+ ### Changed
430
+ - Major version bump to 1.0.0 indicating stable API with comprehensive feature set
431
+ - Enhanced documentation with search examples
432
+
433
+ ## [0.10.0] - 2025-07-03
434
+
435
+ ### Added
436
+ - **New `list_branch_commits` tool for retrieving commit history**:
437
+ - List all commits in a specific branch with detailed information
438
+ - Advanced filtering options:
439
+ - `since` and `until` parameters for date range filtering (ISO date strings)
440
+ - `author` parameter to filter by author email/username
441
+ - `include_merge_commits` parameter to include/exclude merge commits (default: true)
442
+ - `search` parameter to search in commit messages
443
+ - Returns branch head information and paginated commit list
444
+ - Each commit includes hash, message, author details, date, parents, and merge status
445
+ - Supports both Bitbucket Server and Cloud APIs with appropriate parameter mapping
446
+ - Useful for reviewing commit history, tracking changes, and analyzing branch activity
447
+
448
+ - **New `list_pr_commits` tool for pull request commits**:
449
+ - List all commits that are part of a specific pull request
450
+ - Returns PR title and paginated commit list
451
+ - Simpler than branch commits - focused specifically on PR changes
452
+ - Each commit includes same detailed information as branch commits
453
+ - Supports pagination with `limit` and `start` parameters
454
+ - Useful for reviewing all changes in a PR before merging
455
+
456
+ ### Changed
457
+ - Added new TypeScript interfaces for commit types:
458
+ - `BitbucketServerCommit` and `BitbucketCloudCommit` for API responses
459
+ - `FormattedCommit` for consistent commit representation
460
+ - Added formatter functions `formatServerCommit` and `formatCloudCommit` for unified output
461
+ - Enhanced type guards with `isListBranchCommitsArgs` and `isListPrCommitsArgs`
462
+
463
+ ## [0.9.1] - 2025-01-27
464
+
465
+ ### Fixed
466
+ - **Fixed `update_pull_request` reviewer preservation**:
467
+ - When updating a PR without specifying reviewers, existing reviewers are now preserved
468
+ - Previously, omitting the `reviewers` parameter would clear all reviewers
469
+ - Now properly includes existing reviewers in the API request when not explicitly updating them
470
+ - When updating reviewers, approval status is preserved for existing reviewers
471
+ - This prevents accidentally removing reviewers when only updating PR title or description
472
+
473
+ ### Changed
474
+ - Updated tool documentation to clarify reviewer behavior in `update_pull_request`
475
+ - Enhanced README with detailed explanation of reviewer handling
476
+
477
+ ## [0.9.0] - 2025-01-26
478
+
479
+ ### Added
480
+ - **Code snippet support in `add_comment` tool**:
481
+ - Added `code_snippet` parameter to find line numbers automatically using code text
482
+ - Added `search_context` parameter with `before` and `after` arrays to disambiguate multiple matches
483
+ - Added `match_strategy` parameter with options:
484
+ - `"strict"` (default): Fails with detailed error when multiple matches found
485
+ - `"best"`: Auto-selects the highest confidence match
486
+ - Returns detailed error with all occurrences when multiple matches found in strict mode
487
+ - Particularly useful for AI-powered code review tools that analyze diffs
488
+ - Created comprehensive line matching algorithm that:
489
+ - Parses diffs to find exact code snippets
490
+ - Calculates confidence scores based on context matching
491
+ - Handles added, removed, and context lines appropriately
492
+
493
+ ### Changed
494
+ - Enhanced `add_comment` tool to resolve line numbers from code snippets when `line_number` is not provided
495
+ - Improved error messages to include preview and suggestions for resolving ambiguous matches
496
+
497
+ ## [0.8.0] - 2025-01-26
498
+
499
+ ### Added
500
+ - **Code suggestions support in `add_comment` tool**:
501
+ - Added `suggestion` parameter to add code suggestions in comments
502
+ - Added `suggestion_end_line` parameter for multi-line suggestions
503
+ - Suggestions are formatted using GitHub-style markdown ````suggestion` blocks
504
+ - Works with both single-line and multi-line code replacements
505
+ - Requires `file_path` and `line_number` to be specified when using suggestions
506
+ - Compatible with both Bitbucket Cloud and Server
507
+ - Created `suggestion-formatter.ts` utility for formatting suggestion comments
508
+
509
+ ### Changed
510
+ - Enhanced `add_comment` tool to validate suggestion requirements
511
+ - Updated tool response to indicate when a comment contains a suggestion
512
+
513
+ ## [0.7.0] - 2025-01-26
514
+
515
+ ### Added
516
+ - **Enhanced `get_pull_request_diff` with filtering capabilities**:
517
+ - Added `include_patterns` parameter to filter diff by file patterns (whitelist)
518
+ - Added `exclude_patterns` parameter to exclude files from diff (blacklist)
519
+ - Added `file_path` parameter to get diff for a specific file only
520
+ - Patterns support standard glob syntax (e.g., `*.js`, `src/**/*.res`, `node_modules/**`)
521
+ - Response includes filtering metadata showing total files, included/excluded counts, and excluded file list
522
+ - Added `minimatch` dependency for glob pattern matching
523
+ - Created `DiffParser` utility class for parsing and filtering unified diff format
524
+
525
+ ### Changed
526
+ - Modified `get_pull_request_diff` tool to support optional filtering without breaking existing usage
527
+ - Updated tool definition and type guards to include new optional parameters
528
+ - Enhanced documentation with comprehensive examples of filtering usage
529
+
530
+ ## [0.6.1] - 2025-01-26
531
+
532
+ ### Added
533
+ - Support for nested comment replies in Bitbucket Server
534
+ - Added `replies` field to `FormattedComment` interface to support nested comment threads
535
+ - Comments now include nested replies that are still relevant (not orphaned or resolved)
536
+ - Total and active comment counts now include nested replies
537
+
538
+ ### Changed
539
+ - Updated comment fetching logic to handle Bitbucket Server's nested comment structure
540
+ - Server uses `comments` array inside each comment object for replies
541
+ - Cloud continues to use `parent` field for reply relationships
542
+ - Improved comment filtering to exclude orphaned inline comments when code has changed
543
+
544
+ ### Fixed
545
+ - Fixed missing comment replies in PR details - replies are now properly included in the response
546
+
547
+ ## [0.6.0] - 2025-01-26
548
+
549
+ ### Added
550
+ - **Enhanced `get_pull_request` with active comments and file changes**:
551
+ - Fetches and displays active (unresolved) comments that need attention
552
+ - Shows up to 20 most recent active comments with:
553
+ - Comment text, author, and creation date
554
+ - Inline comment details (file path and line number)
555
+ - Comment state (OPEN/RESOLVED for Server)
556
+ - Provides comment counts:
557
+ - `active_comment_count`: Total unresolved comments
558
+ - `total_comment_count`: Total comments including resolved
559
+ - Includes file change statistics:
560
+ - List of all modified files with lines added/removed
561
+ - File status (added, modified, removed, renamed)
562
+ - Summary statistics (total files, lines added/removed)
563
+ - Added new TypeScript interfaces for comments and file changes
564
+ - Added `FormattedComment` and `FormattedFileChange` types for consistent response format
565
+
566
+ ### Changed
567
+ - Modified `handleGetPullRequest` to make parallel API calls for better performance
568
+ - Enhanced error handling to gracefully continue if comment/file fetching fails
569
+
570
+ ## [0.5.0] - 2025-01-21
571
+
572
+ ### Added
573
+ - **New file and directory handling tools**:
574
+ - `list_directory_content` - List files and directories in any repository path
575
+ - Shows file/directory type, size, and full paths
576
+ - Supports browsing specific branches
577
+ - Works with both Bitbucket Server and Cloud APIs
578
+ - `get_file_content` - Retrieve file content with smart truncation for large files
579
+ - Automatic smart defaults by file type (config: 200 lines, docs: 300 lines, code: 500 lines)
580
+ - Pagination support with `start_line` and `line_count` parameters
581
+ - Tail functionality using negative `start_line` values (e.g., -50 for last 50 lines)
582
+ - Automatic truncation for files >50KB to prevent token overload
583
+ - Files >1MB require explicit `full_content: true` parameter
584
+ - Returns metadata including file size, encoding, and last modified info
585
+ - Added `FileHandlers` class following existing modular architecture patterns
586
+ - Added TypeScript interfaces for file/directory entries and metadata
587
+ - Added type guards `isListDirectoryContentArgs` and `isGetFileContentArgs`
588
+
589
+ ### Changed
590
+ - Enhanced documentation with comprehensive examples for file handling tools
591
+
592
+ ## [0.4.0] - 2025-01-21
593
+
594
+ ### Added
595
+ - **New `get_branch` tool for comprehensive branch information**:
596
+ - Returns detailed branch information including name, ID, and latest commit details
597
+ - Lists all open pull requests originating from the branch with approval status
598
+ - Optionally includes merged pull requests when `include_merged_prs` is true
599
+ - Provides useful statistics like PR counts and days since last commit
600
+ - Supports both Bitbucket Server and Cloud APIs
601
+ - Particularly useful for checking if a branch has open PRs before deletion
602
+ - Added TypeScript interfaces for `BitbucketServerBranch` and `BitbucketCloudBranch`
603
+ - Added type guard `isGetBranchArgs` for input validation
604
+
605
+ ### Changed
606
+ - Updated documentation to include the new `get_branch` tool with comprehensive examples
607
+
608
+ ## [0.3.0] - 2025-01-06
609
+
610
+ ### Added
611
+ - **Enhanced merge commit details in `get_pull_request`**:
612
+ - Added `merge_commit_hash` field for both Cloud and Server
613
+ - Added `merged_by` field showing who performed the merge
614
+ - Added `merged_at` timestamp for when the merge occurred
615
+ - Added `merge_commit_message` with the merge commit message
616
+ - For Bitbucket Server: Fetches merge details from activities API when PR is merged
617
+ - For Bitbucket Cloud: Extracts merge information from existing response fields
618
+
619
+ ### Changed
620
+ - **Major code refactoring for better maintainability**:
621
+ - Split monolithic `index.ts` into modular architecture
622
+ - Created separate handler classes for different tool categories:
623
+ - `PullRequestHandlers` for PR lifecycle operations
624
+ - `BranchHandlers` for branch management
625
+ - `ReviewHandlers` for code review tools
626
+ - Extracted types into dedicated files (`types/bitbucket.ts`, `types/guards.ts`)
627
+ - Created utility modules (`utils/api-client.ts`, `utils/formatters.ts`)
628
+ - Centralized tool definitions in `tools/definitions.ts`
629
+ - Improved error handling and API client abstraction
630
+ - Better separation of concerns between Cloud and Server implementations
631
+
632
+ ### Fixed
633
+ - Improved handling of merge commit information retrieval failures
634
+ - Fixed API parameter passing for GET requests across all handlers (was passing config as third parameter instead of fourth)
635
+ - Updated Bitbucket Server branch listing to use `/rest/api/latest/` endpoint with proper parameters
636
+ - Branch filtering now works correctly with the `filterText` parameter for Bitbucket Server
637
+
638
+ ## [0.2.0] - 2025-06-04
639
+
640
+ ### Added
641
+ - Complete implementation of all Bitbucket MCP tools
642
+ - Support for both Bitbucket Cloud and Server
643
+ - Core PR lifecycle tools:
644
+ - `create_pull_request` - Create new pull requests
645
+ - `update_pull_request` - Update PR details
646
+ - `merge_pull_request` - Merge pull requests
647
+ - `list_branches` - List repository branches
648
+ - `delete_branch` - Delete branches
649
+ - Enhanced `add_comment` with inline comment support
650
+ - Code review tools:
651
+ - `get_pull_request_diff` - Get PR diff/changes
652
+ - `approve_pull_request` - Approve PRs
653
+ - `unapprove_pull_request` - Remove approval
654
+ - `request_changes` - Request changes on PRs
655
+ - `remove_requested_changes` - Remove change requests
656
+ - npm package configuration for easy installation via npx
657
+
658
+ ### Fixed
659
+ - Author filter for Bitbucket Server (uses `role.1=AUTHOR` and `username.1=email`)
660
+ - Branch deletion handling for 204 No Content responses
661
+
662
+ ### Changed
663
+ - Package name to `@nexus2520/bitbucket-mcp-server` for npm publishing
664
+
665
+ ## [0.1.0] - 2025-06-03
666
+
667
+ ### Added
668
+ - Initial implementation with basic tools:
669
+ - `get_pull_request` - Get PR details
670
+ - `list_pull_requests` - List PRs with filters
671
+ - Support for Bitbucket Cloud with app passwords
672
+ - Support for Bitbucket Server with HTTP access tokens
673
+ - Authentication setup script
674
+ - Comprehensive documentation