@zhanglc77/bitbucket-mcp-server 1.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.
- package/CHANGELOG.md +280 -0
- package/LICENSE +21 -0
- package/README.md +1090 -0
- package/build/handlers/branch-handlers.d.ts +55 -0
- package/build/handlers/branch-handlers.d.ts.map +1 -0
- package/build/handlers/branch-handlers.js +522 -0
- package/build/handlers/branch-handlers.js.map +1 -0
- package/build/handlers/file-handlers.d.ts +33 -0
- package/build/handlers/file-handlers.d.ts.map +1 -0
- package/build/handlers/file-handlers.js +308 -0
- package/build/handlers/file-handlers.js.map +1 -0
- package/build/handlers/pull-request-handlers.d.ts +101 -0
- package/build/handlers/pull-request-handlers.d.ts.map +1 -0
- package/build/handlers/pull-request-handlers.js +955 -0
- package/build/handlers/pull-request-handlers.js.map +1 -0
- package/build/handlers/review-handlers.d.ts +67 -0
- package/build/handlers/review-handlers.d.ts.map +1 -0
- package/build/handlers/review-handlers.js +252 -0
- package/build/handlers/review-handlers.js.map +1 -0
- package/build/handlers/search-handlers.d.ts +20 -0
- package/build/handlers/search-handlers.d.ts.map +1 -0
- package/build/handlers/search-handlers.js +151 -0
- package/build/handlers/search-handlers.js.map +1 -0
- package/build/index.d.ts +3 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +120 -0
- package/build/index.js.map +1 -0
- package/build/tools/definitions.d.ts +1191 -0
- package/build/tools/definitions.d.ts.map +1 -0
- package/build/tools/definitions.js +655 -0
- package/build/tools/definitions.js.map +1 -0
- package/build/types/bitbucket.d.ts +483 -0
- package/build/types/bitbucket.d.ts.map +1 -0
- package/build/types/bitbucket.js +2 -0
- package/build/types/bitbucket.js.map +1 -0
- package/build/types/guards.d.ts +140 -0
- package/build/types/guards.d.ts.map +1 -0
- package/build/types/guards.js +140 -0
- package/build/types/guards.js.map +1 -0
- package/build/utils/api-client.d.ts +22 -0
- package/build/utils/api-client.d.ts.map +1 -0
- package/build/utils/api-client.js +111 -0
- package/build/utils/api-client.js.map +1 -0
- package/build/utils/diff-parser.d.ts +42 -0
- package/build/utils/diff-parser.d.ts.map +1 -0
- package/build/utils/diff-parser.js +165 -0
- package/build/utils/diff-parser.js.map +1 -0
- package/build/utils/formatters.d.ts +8 -0
- package/build/utils/formatters.d.ts.map +1 -0
- package/build/utils/formatters.js +207 -0
- package/build/utils/formatters.js.map +1 -0
- package/build/utils/suggestion-formatter.d.ts +6 -0
- package/build/utils/suggestion-formatter.d.ts.map +1 -0
- package/build/utils/suggestion-formatter.js +17 -0
- package/build/utils/suggestion-formatter.js.map +1 -0
- package/package.json +55 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,280 @@
|
|
|
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
|
+
## [1.0.1] - 2025-08-08
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
- **Improved search_code tool response formatting**:
|
|
12
|
+
- Added simplified `formatCodeSearchOutput` for cleaner AI consumption
|
|
13
|
+
- Enhanced HTML entity decoding (handles ", <, >, &, /, ')
|
|
14
|
+
- Improved response structure showing file paths and line numbers clearly
|
|
15
|
+
- Removed HTML formatting tags for better readability
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
- Search results now use simplified formatter by default for better AI tool integration
|
|
19
|
+
- Enhanced query display to show actual search patterns used
|
|
20
|
+
|
|
21
|
+
## [1.0.0] - 2025-07-25
|
|
22
|
+
|
|
23
|
+
### Added
|
|
24
|
+
- **New `search_code` tool for searching code across repositories**:
|
|
25
|
+
- Search for code snippets, functions, or any text within Bitbucket repositories
|
|
26
|
+
- Supports searching within a specific repository or across all repositories in a workspace
|
|
27
|
+
- File path pattern filtering with glob patterns (e.g., `*.java`, `src/**/*.ts`)
|
|
28
|
+
- Returns matched lines with highlighted segments showing exact matches
|
|
29
|
+
- Pagination support for large result sets
|
|
30
|
+
- Currently only supports Bitbucket Server (Cloud API support planned for future)
|
|
31
|
+
- Added `SearchHandlers` class following the modular architecture pattern
|
|
32
|
+
- Added TypeScript interfaces for search requests and responses
|
|
33
|
+
- Added `formatSearchResults` formatter function for consistent output
|
|
34
|
+
|
|
35
|
+
### Changed
|
|
36
|
+
- Major version bump to 1.0.0 indicating stable API with comprehensive feature set
|
|
37
|
+
- Enhanced documentation with search examples
|
|
38
|
+
|
|
39
|
+
## [0.10.0] - 2025-07-03
|
|
40
|
+
|
|
41
|
+
### Added
|
|
42
|
+
- **New `list_branch_commits` tool for retrieving commit history**:
|
|
43
|
+
- List all commits in a specific branch with detailed information
|
|
44
|
+
- Advanced filtering options:
|
|
45
|
+
- `since` and `until` parameters for date range filtering (ISO date strings)
|
|
46
|
+
- `author` parameter to filter by author email/username
|
|
47
|
+
- `include_merge_commits` parameter to include/exclude merge commits (default: true)
|
|
48
|
+
- `search` parameter to search in commit messages
|
|
49
|
+
- Returns branch head information and paginated commit list
|
|
50
|
+
- Each commit includes hash, message, author details, date, parents, and merge status
|
|
51
|
+
- Supports both Bitbucket Server and Cloud APIs with appropriate parameter mapping
|
|
52
|
+
- Useful for reviewing commit history, tracking changes, and analyzing branch activity
|
|
53
|
+
|
|
54
|
+
- **New `list_pr_commits` tool for pull request commits**:
|
|
55
|
+
- List all commits that are part of a specific pull request
|
|
56
|
+
- Returns PR title and paginated commit list
|
|
57
|
+
- Simpler than branch commits - focused specifically on PR changes
|
|
58
|
+
- Each commit includes same detailed information as branch commits
|
|
59
|
+
- Supports pagination with `limit` and `start` parameters
|
|
60
|
+
- Useful for reviewing all changes in a PR before merging
|
|
61
|
+
|
|
62
|
+
### Changed
|
|
63
|
+
- Added new TypeScript interfaces for commit types:
|
|
64
|
+
- `BitbucketServerCommit` and `BitbucketCloudCommit` for API responses
|
|
65
|
+
- `FormattedCommit` for consistent commit representation
|
|
66
|
+
- Added formatter functions `formatServerCommit` and `formatCloudCommit` for unified output
|
|
67
|
+
- Enhanced type guards with `isListBranchCommitsArgs` and `isListPrCommitsArgs`
|
|
68
|
+
|
|
69
|
+
## [0.9.1] - 2025-01-27
|
|
70
|
+
|
|
71
|
+
### Fixed
|
|
72
|
+
- **Fixed `update_pull_request` reviewer preservation**:
|
|
73
|
+
- When updating a PR without specifying reviewers, existing reviewers are now preserved
|
|
74
|
+
- Previously, omitting the `reviewers` parameter would clear all reviewers
|
|
75
|
+
- Now properly includes existing reviewers in the API request when not explicitly updating them
|
|
76
|
+
- When updating reviewers, approval status is preserved for existing reviewers
|
|
77
|
+
- This prevents accidentally removing reviewers when only updating PR title or description
|
|
78
|
+
|
|
79
|
+
### Changed
|
|
80
|
+
- Updated tool documentation to clarify reviewer behavior in `update_pull_request`
|
|
81
|
+
- Enhanced README with detailed explanation of reviewer handling
|
|
82
|
+
|
|
83
|
+
## [0.9.0] - 2025-01-26
|
|
84
|
+
|
|
85
|
+
### Added
|
|
86
|
+
- **Code snippet support in `add_comment` tool**:
|
|
87
|
+
- Added `code_snippet` parameter to find line numbers automatically using code text
|
|
88
|
+
- Added `search_context` parameter with `before` and `after` arrays to disambiguate multiple matches
|
|
89
|
+
- Added `match_strategy` parameter with options:
|
|
90
|
+
- `"strict"` (default): Fails with detailed error when multiple matches found
|
|
91
|
+
- `"best"`: Auto-selects the highest confidence match
|
|
92
|
+
- Returns detailed error with all occurrences when multiple matches found in strict mode
|
|
93
|
+
- Particularly useful for AI-powered code review tools that analyze diffs
|
|
94
|
+
- Created comprehensive line matching algorithm that:
|
|
95
|
+
- Parses diffs to find exact code snippets
|
|
96
|
+
- Calculates confidence scores based on context matching
|
|
97
|
+
- Handles added, removed, and context lines appropriately
|
|
98
|
+
|
|
99
|
+
### Changed
|
|
100
|
+
- Enhanced `add_comment` tool to resolve line numbers from code snippets when `line_number` is not provided
|
|
101
|
+
- Improved error messages to include preview and suggestions for resolving ambiguous matches
|
|
102
|
+
|
|
103
|
+
## [0.8.0] - 2025-01-26
|
|
104
|
+
|
|
105
|
+
### Added
|
|
106
|
+
- **Code suggestions support in `add_comment` tool**:
|
|
107
|
+
- Added `suggestion` parameter to add code suggestions in comments
|
|
108
|
+
- Added `suggestion_end_line` parameter for multi-line suggestions
|
|
109
|
+
- Suggestions are formatted using GitHub-style markdown ````suggestion` blocks
|
|
110
|
+
- Works with both single-line and multi-line code replacements
|
|
111
|
+
- Requires `file_path` and `line_number` to be specified when using suggestions
|
|
112
|
+
- Compatible with both Bitbucket Cloud and Server
|
|
113
|
+
- Created `suggestion-formatter.ts` utility for formatting suggestion comments
|
|
114
|
+
|
|
115
|
+
### Changed
|
|
116
|
+
- Enhanced `add_comment` tool to validate suggestion requirements
|
|
117
|
+
- Updated tool response to indicate when a comment contains a suggestion
|
|
118
|
+
|
|
119
|
+
## [0.7.0] - 2025-01-26
|
|
120
|
+
|
|
121
|
+
### Added
|
|
122
|
+
- **Enhanced `get_pull_request_diff` with filtering capabilities**:
|
|
123
|
+
- Added `include_patterns` parameter to filter diff by file patterns (whitelist)
|
|
124
|
+
- Added `exclude_patterns` parameter to exclude files from diff (blacklist)
|
|
125
|
+
- Added `file_path` parameter to get diff for a specific file only
|
|
126
|
+
- Patterns support standard glob syntax (e.g., `*.js`, `src/**/*.res`, `node_modules/**`)
|
|
127
|
+
- Response includes filtering metadata showing total files, included/excluded counts, and excluded file list
|
|
128
|
+
- Added `minimatch` dependency for glob pattern matching
|
|
129
|
+
- Created `DiffParser` utility class for parsing and filtering unified diff format
|
|
130
|
+
|
|
131
|
+
### Changed
|
|
132
|
+
- Modified `get_pull_request_diff` tool to support optional filtering without breaking existing usage
|
|
133
|
+
- Updated tool definition and type guards to include new optional parameters
|
|
134
|
+
- Enhanced documentation with comprehensive examples of filtering usage
|
|
135
|
+
|
|
136
|
+
## [0.6.1] - 2025-01-26
|
|
137
|
+
|
|
138
|
+
### Added
|
|
139
|
+
- Support for nested comment replies in Bitbucket Server
|
|
140
|
+
- Added `replies` field to `FormattedComment` interface to support nested comment threads
|
|
141
|
+
- Comments now include nested replies that are still relevant (not orphaned or resolved)
|
|
142
|
+
- Total and active comment counts now include nested replies
|
|
143
|
+
|
|
144
|
+
### Changed
|
|
145
|
+
- Updated comment fetching logic to handle Bitbucket Server's nested comment structure
|
|
146
|
+
- Server uses `comments` array inside each comment object for replies
|
|
147
|
+
- Cloud continues to use `parent` field for reply relationships
|
|
148
|
+
- Improved comment filtering to exclude orphaned inline comments when code has changed
|
|
149
|
+
|
|
150
|
+
### Fixed
|
|
151
|
+
- Fixed missing comment replies in PR details - replies are now properly included in the response
|
|
152
|
+
|
|
153
|
+
## [0.6.0] - 2025-01-26
|
|
154
|
+
|
|
155
|
+
### Added
|
|
156
|
+
- **Enhanced `get_pull_request` with active comments and file changes**:
|
|
157
|
+
- Fetches and displays active (unresolved) comments that need attention
|
|
158
|
+
- Shows up to 20 most recent active comments with:
|
|
159
|
+
- Comment text, author, and creation date
|
|
160
|
+
- Inline comment details (file path and line number)
|
|
161
|
+
- Comment state (OPEN/RESOLVED for Server)
|
|
162
|
+
- Provides comment counts:
|
|
163
|
+
- `active_comment_count`: Total unresolved comments
|
|
164
|
+
- `total_comment_count`: Total comments including resolved
|
|
165
|
+
- Includes file change statistics:
|
|
166
|
+
- List of all modified files with lines added/removed
|
|
167
|
+
- File status (added, modified, removed, renamed)
|
|
168
|
+
- Summary statistics (total files, lines added/removed)
|
|
169
|
+
- Added new TypeScript interfaces for comments and file changes
|
|
170
|
+
- Added `FormattedComment` and `FormattedFileChange` types for consistent response format
|
|
171
|
+
|
|
172
|
+
### Changed
|
|
173
|
+
- Modified `handleGetPullRequest` to make parallel API calls for better performance
|
|
174
|
+
- Enhanced error handling to gracefully continue if comment/file fetching fails
|
|
175
|
+
|
|
176
|
+
## [0.5.0] - 2025-01-21
|
|
177
|
+
|
|
178
|
+
### Added
|
|
179
|
+
- **New file and directory handling tools**:
|
|
180
|
+
- `list_directory_content` - List files and directories in any repository path
|
|
181
|
+
- Shows file/directory type, size, and full paths
|
|
182
|
+
- Supports browsing specific branches
|
|
183
|
+
- Works with both Bitbucket Server and Cloud APIs
|
|
184
|
+
- `get_file_content` - Retrieve file content with smart truncation for large files
|
|
185
|
+
- Automatic smart defaults by file type (config: 200 lines, docs: 300 lines, code: 500 lines)
|
|
186
|
+
- Pagination support with `start_line` and `line_count` parameters
|
|
187
|
+
- Tail functionality using negative `start_line` values (e.g., -50 for last 50 lines)
|
|
188
|
+
- Automatic truncation for files >50KB to prevent token overload
|
|
189
|
+
- Files >1MB require explicit `full_content: true` parameter
|
|
190
|
+
- Returns metadata including file size, encoding, and last modified info
|
|
191
|
+
- Added `FileHandlers` class following existing modular architecture patterns
|
|
192
|
+
- Added TypeScript interfaces for file/directory entries and metadata
|
|
193
|
+
- Added type guards `isListDirectoryContentArgs` and `isGetFileContentArgs`
|
|
194
|
+
|
|
195
|
+
### Changed
|
|
196
|
+
- Enhanced documentation with comprehensive examples for file handling tools
|
|
197
|
+
|
|
198
|
+
## [0.4.0] - 2025-01-21
|
|
199
|
+
|
|
200
|
+
### Added
|
|
201
|
+
- **New `get_branch` tool for comprehensive branch information**:
|
|
202
|
+
- Returns detailed branch information including name, ID, and latest commit details
|
|
203
|
+
- Lists all open pull requests originating from the branch with approval status
|
|
204
|
+
- Optionally includes merged pull requests when `include_merged_prs` is true
|
|
205
|
+
- Provides useful statistics like PR counts and days since last commit
|
|
206
|
+
- Supports both Bitbucket Server and Cloud APIs
|
|
207
|
+
- Particularly useful for checking if a branch has open PRs before deletion
|
|
208
|
+
- Added TypeScript interfaces for `BitbucketServerBranch` and `BitbucketCloudBranch`
|
|
209
|
+
- Added type guard `isGetBranchArgs` for input validation
|
|
210
|
+
|
|
211
|
+
### Changed
|
|
212
|
+
- Updated documentation to include the new `get_branch` tool with comprehensive examples
|
|
213
|
+
|
|
214
|
+
## [0.3.0] - 2025-01-06
|
|
215
|
+
|
|
216
|
+
### Added
|
|
217
|
+
- **Enhanced merge commit details in `get_pull_request`**:
|
|
218
|
+
- Added `merge_commit_hash` field for both Cloud and Server
|
|
219
|
+
- Added `merged_by` field showing who performed the merge
|
|
220
|
+
- Added `merged_at` timestamp for when the merge occurred
|
|
221
|
+
- Added `merge_commit_message` with the merge commit message
|
|
222
|
+
- For Bitbucket Server: Fetches merge details from activities API when PR is merged
|
|
223
|
+
- For Bitbucket Cloud: Extracts merge information from existing response fields
|
|
224
|
+
|
|
225
|
+
### Changed
|
|
226
|
+
- **Major code refactoring for better maintainability**:
|
|
227
|
+
- Split monolithic `index.ts` into modular architecture
|
|
228
|
+
- Created separate handler classes for different tool categories:
|
|
229
|
+
- `PullRequestHandlers` for PR lifecycle operations
|
|
230
|
+
- `BranchHandlers` for branch management
|
|
231
|
+
- `ReviewHandlers` for code review tools
|
|
232
|
+
- Extracted types into dedicated files (`types/bitbucket.ts`, `types/guards.ts`)
|
|
233
|
+
- Created utility modules (`utils/api-client.ts`, `utils/formatters.ts`)
|
|
234
|
+
- Centralized tool definitions in `tools/definitions.ts`
|
|
235
|
+
- Improved error handling and API client abstraction
|
|
236
|
+
- Better separation of concerns between Cloud and Server implementations
|
|
237
|
+
|
|
238
|
+
### Fixed
|
|
239
|
+
- Improved handling of merge commit information retrieval failures
|
|
240
|
+
- Fixed API parameter passing for GET requests across all handlers (was passing config as third parameter instead of fourth)
|
|
241
|
+
- Updated Bitbucket Server branch listing to use `/rest/api/latest/` endpoint with proper parameters
|
|
242
|
+
- Branch filtering now works correctly with the `filterText` parameter for Bitbucket Server
|
|
243
|
+
|
|
244
|
+
## [0.2.0] - 2025-06-04
|
|
245
|
+
|
|
246
|
+
### Added
|
|
247
|
+
- Complete implementation of all Bitbucket MCP tools
|
|
248
|
+
- Support for both Bitbucket Cloud and Server
|
|
249
|
+
- Core PR lifecycle tools:
|
|
250
|
+
- `create_pull_request` - Create new pull requests
|
|
251
|
+
- `update_pull_request` - Update PR details
|
|
252
|
+
- `merge_pull_request` - Merge pull requests
|
|
253
|
+
- `list_branches` - List repository branches
|
|
254
|
+
- `delete_branch` - Delete branches
|
|
255
|
+
- Enhanced `add_comment` with inline comment support
|
|
256
|
+
- Code review tools:
|
|
257
|
+
- `get_pull_request_diff` - Get PR diff/changes
|
|
258
|
+
- `approve_pull_request` - Approve PRs
|
|
259
|
+
- `unapprove_pull_request` - Remove approval
|
|
260
|
+
- `request_changes` - Request changes on PRs
|
|
261
|
+
- `remove_requested_changes` - Remove change requests
|
|
262
|
+
- npm package configuration for easy installation via npx
|
|
263
|
+
|
|
264
|
+
### Fixed
|
|
265
|
+
- Author filter for Bitbucket Server (uses `role.1=AUTHOR` and `username.1=email`)
|
|
266
|
+
- Branch deletion handling for 204 No Content responses
|
|
267
|
+
|
|
268
|
+
### Changed
|
|
269
|
+
- Package name to `@nexus2520/bitbucket-mcp-server` for npm publishing
|
|
270
|
+
|
|
271
|
+
## [0.1.0] - 2025-06-03
|
|
272
|
+
|
|
273
|
+
### Added
|
|
274
|
+
- Initial implementation with basic tools:
|
|
275
|
+
- `get_pull_request` - Get PR details
|
|
276
|
+
- `list_pull_requests` - List PRs with filters
|
|
277
|
+
- Support for Bitbucket Cloud with app passwords
|
|
278
|
+
- Support for Bitbucket Server with HTTP access tokens
|
|
279
|
+
- Authentication setup script
|
|
280
|
+
- Comprehensive documentation
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Parth Dogra
|
|
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.
|