@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.
Files changed (56) hide show
  1. package/CHANGELOG.md +280 -0
  2. package/LICENSE +21 -0
  3. package/README.md +1090 -0
  4. package/build/handlers/branch-handlers.d.ts +55 -0
  5. package/build/handlers/branch-handlers.d.ts.map +1 -0
  6. package/build/handlers/branch-handlers.js +522 -0
  7. package/build/handlers/branch-handlers.js.map +1 -0
  8. package/build/handlers/file-handlers.d.ts +33 -0
  9. package/build/handlers/file-handlers.d.ts.map +1 -0
  10. package/build/handlers/file-handlers.js +308 -0
  11. package/build/handlers/file-handlers.js.map +1 -0
  12. package/build/handlers/pull-request-handlers.d.ts +101 -0
  13. package/build/handlers/pull-request-handlers.d.ts.map +1 -0
  14. package/build/handlers/pull-request-handlers.js +955 -0
  15. package/build/handlers/pull-request-handlers.js.map +1 -0
  16. package/build/handlers/review-handlers.d.ts +67 -0
  17. package/build/handlers/review-handlers.d.ts.map +1 -0
  18. package/build/handlers/review-handlers.js +252 -0
  19. package/build/handlers/review-handlers.js.map +1 -0
  20. package/build/handlers/search-handlers.d.ts +20 -0
  21. package/build/handlers/search-handlers.d.ts.map +1 -0
  22. package/build/handlers/search-handlers.js +151 -0
  23. package/build/handlers/search-handlers.js.map +1 -0
  24. package/build/index.d.ts +3 -0
  25. package/build/index.d.ts.map +1 -0
  26. package/build/index.js +120 -0
  27. package/build/index.js.map +1 -0
  28. package/build/tools/definitions.d.ts +1191 -0
  29. package/build/tools/definitions.d.ts.map +1 -0
  30. package/build/tools/definitions.js +655 -0
  31. package/build/tools/definitions.js.map +1 -0
  32. package/build/types/bitbucket.d.ts +483 -0
  33. package/build/types/bitbucket.d.ts.map +1 -0
  34. package/build/types/bitbucket.js +2 -0
  35. package/build/types/bitbucket.js.map +1 -0
  36. package/build/types/guards.d.ts +140 -0
  37. package/build/types/guards.d.ts.map +1 -0
  38. package/build/types/guards.js +140 -0
  39. package/build/types/guards.js.map +1 -0
  40. package/build/utils/api-client.d.ts +22 -0
  41. package/build/utils/api-client.d.ts.map +1 -0
  42. package/build/utils/api-client.js +111 -0
  43. package/build/utils/api-client.js.map +1 -0
  44. package/build/utils/diff-parser.d.ts +42 -0
  45. package/build/utils/diff-parser.d.ts.map +1 -0
  46. package/build/utils/diff-parser.js +165 -0
  47. package/build/utils/diff-parser.js.map +1 -0
  48. package/build/utils/formatters.d.ts +8 -0
  49. package/build/utils/formatters.d.ts.map +1 -0
  50. package/build/utils/formatters.js +207 -0
  51. package/build/utils/formatters.js.map +1 -0
  52. package/build/utils/suggestion-formatter.d.ts +6 -0
  53. package/build/utils/suggestion-formatter.d.ts.map +1 -0
  54. package/build/utils/suggestion-formatter.js +17 -0
  55. package/build/utils/suggestion-formatter.js.map +1 -0
  56. package/package.json +55 -0
@@ -0,0 +1,207 @@
1
+ export function formatServerResponse(pr, mergeInfo, baseUrl) {
2
+ const webUrl = `${baseUrl}/projects/${pr.toRef.repository.project.key}/repos/${pr.toRef.repository.slug}/pull-requests/${pr.id}`;
3
+ return {
4
+ id: pr.id,
5
+ title: pr.title,
6
+ description: pr.description || 'No description provided',
7
+ state: pr.state,
8
+ is_open: pr.open,
9
+ is_closed: pr.closed,
10
+ author: pr.author.user.displayName,
11
+ author_username: pr.author.user.name,
12
+ author_email: pr.author.user.emailAddress,
13
+ source_branch: pr.fromRef.displayId,
14
+ destination_branch: pr.toRef.displayId,
15
+ source_commit: pr.fromRef.latestCommit,
16
+ destination_commit: pr.toRef.latestCommit,
17
+ reviewers: pr.reviewers.map(r => ({
18
+ name: r.user.displayName,
19
+ approved: r.approved,
20
+ status: r.status,
21
+ })),
22
+ participants: pr.participants.map(p => ({
23
+ name: p.user.displayName,
24
+ role: p.role,
25
+ approved: p.approved,
26
+ status: p.status,
27
+ })),
28
+ created_on: new Date(pr.createdDate).toLocaleString(),
29
+ updated_on: new Date(pr.updatedDate).toLocaleString(),
30
+ web_url: webUrl,
31
+ api_url: pr.links.self[0]?.href || '',
32
+ is_locked: pr.locked,
33
+ // Add merge commit details
34
+ is_merged: pr.state === 'MERGED',
35
+ merge_commit_hash: mergeInfo?.mergeCommitHash || pr.properties?.mergeCommit?.id || null,
36
+ merged_by: mergeInfo?.mergedBy || null,
37
+ merged_at: mergeInfo?.mergedAt || null,
38
+ merge_commit_message: mergeInfo?.mergeCommitMessage || null,
39
+ };
40
+ }
41
+ export function formatCloudResponse(pr) {
42
+ return {
43
+ id: pr.id,
44
+ title: pr.title,
45
+ description: pr.description || 'No description provided',
46
+ state: pr.state,
47
+ author: pr.author.display_name,
48
+ source_branch: pr.source.branch.name,
49
+ destination_branch: pr.destination.branch.name,
50
+ reviewers: pr.reviewers.map(r => r.display_name),
51
+ participants: pr.participants.map(p => ({
52
+ name: p.user.display_name,
53
+ role: p.role,
54
+ approved: p.approved,
55
+ })),
56
+ created_on: new Date(pr.created_on).toLocaleString(),
57
+ updated_on: new Date(pr.updated_on).toLocaleString(),
58
+ web_url: pr.links.html.href,
59
+ api_url: pr.links.self.href,
60
+ diff_url: pr.links.diff.href,
61
+ is_merged: pr.state === 'MERGED',
62
+ merge_commit_hash: pr.merge_commit?.hash || null,
63
+ merged_by: pr.closed_by?.display_name || null,
64
+ merged_at: pr.state === 'MERGED' ? pr.updated_on : null,
65
+ merge_commit_message: null, // Would need additional API call to get this
66
+ close_source_branch: pr.close_source_branch,
67
+ };
68
+ }
69
+ export function formatServerCommit(commit) {
70
+ return {
71
+ hash: commit.id,
72
+ abbreviated_hash: commit.displayId,
73
+ message: commit.message,
74
+ author: {
75
+ name: commit.author.name,
76
+ email: commit.author.emailAddress,
77
+ },
78
+ date: new Date(commit.authorTimestamp).toISOString(),
79
+ parents: commit.parents.map(p => p.id),
80
+ is_merge_commit: commit.parents.length > 1,
81
+ };
82
+ }
83
+ export function formatCloudCommit(commit) {
84
+ // Parse the author raw string which is in format "Name <email>"
85
+ const authorMatch = commit.author.raw.match(/^(.+?)\s*<(.+?)>$/);
86
+ const authorName = authorMatch ? authorMatch[1] : (commit.author.user?.display_name || commit.author.raw);
87
+ const authorEmail = authorMatch ? authorMatch[2] : '';
88
+ return {
89
+ hash: commit.hash,
90
+ abbreviated_hash: commit.hash.substring(0, 7),
91
+ message: commit.message,
92
+ author: {
93
+ name: authorName,
94
+ email: authorEmail,
95
+ },
96
+ date: commit.date,
97
+ parents: commit.parents.map(p => p.hash),
98
+ is_merge_commit: commit.parents.length > 1,
99
+ };
100
+ }
101
+ export function formatSearchResults(searchResult) {
102
+ const results = [];
103
+ if (!searchResult.code?.values) {
104
+ return results;
105
+ }
106
+ for (const value of searchResult.code.values) {
107
+ // Extract file name from path
108
+ const fileName = value.file.split('/').pop() || value.file;
109
+ const formattedResult = {
110
+ file_path: value.file,
111
+ file_name: fileName,
112
+ repository: value.repository.slug,
113
+ project: value.repository.project.key,
114
+ matches: []
115
+ };
116
+ // Process hitContexts (array of arrays of line contexts)
117
+ if (value.hitContexts && value.hitContexts.length > 0) {
118
+ for (const contextGroup of value.hitContexts) {
119
+ for (const lineContext of contextGroup) {
120
+ // Parse HTML to extract text and highlight information
121
+ const { text, segments } = parseHighlightedText(lineContext.text);
122
+ formattedResult.matches.push({
123
+ line_number: lineContext.line,
124
+ line_content: text,
125
+ highlighted_segments: segments
126
+ });
127
+ }
128
+ }
129
+ }
130
+ results.push(formattedResult);
131
+ }
132
+ return results;
133
+ }
134
+ // Helper function to parse HTML-formatted text with <em> tags
135
+ function parseHighlightedText(htmlText) {
136
+ // Decode HTML entities
137
+ const decodedText = htmlText
138
+ .replace(/&quot;/g, '"')
139
+ .replace(/&lt;/g, '<')
140
+ .replace(/&gt;/g, '>')
141
+ .replace(/&amp;/g, '&')
142
+ .replace(/&#x2F;/g, '/');
143
+ // Remove HTML tags and track highlighted segments
144
+ const segments = [];
145
+ let plainText = '';
146
+ let currentPos = 0;
147
+ // Match all <em> tags and their content
148
+ const emRegex = /<em>(.*?)<\/em>/g;
149
+ let lastEnd = 0;
150
+ let match;
151
+ while ((match = emRegex.exec(decodedText)) !== null) {
152
+ // Add non-highlighted text before this match
153
+ if (match.index > lastEnd) {
154
+ const beforeText = decodedText.substring(lastEnd, match.index);
155
+ segments.push({ text: beforeText, is_match: false });
156
+ plainText += beforeText;
157
+ }
158
+ // Add highlighted text
159
+ const highlightedText = match[1];
160
+ segments.push({ text: highlightedText, is_match: true });
161
+ plainText += highlightedText;
162
+ lastEnd = match.index + match[0].length;
163
+ }
164
+ // Add any remaining non-highlighted text
165
+ if (lastEnd < decodedText.length) {
166
+ const remainingText = decodedText.substring(lastEnd);
167
+ segments.push({ text: remainingText, is_match: false });
168
+ plainText += remainingText;
169
+ }
170
+ // If no <em> tags were found, the entire text is non-highlighted
171
+ if (segments.length === 0) {
172
+ segments.push({ text: decodedText, is_match: false });
173
+ plainText = decodedText;
174
+ }
175
+ return { text: plainText, segments };
176
+ }
177
+ // Simplified formatter for MCP tool output
178
+ export function formatCodeSearchOutput(searchResult) {
179
+ if (!searchResult.code?.values || searchResult.code.values.length === 0) {
180
+ return 'No results found';
181
+ }
182
+ const outputLines = [];
183
+ for (const value of searchResult.code.values) {
184
+ outputLines.push(`File: ${value.file}`);
185
+ // Process all hit contexts
186
+ if (value.hitContexts && value.hitContexts.length > 0) {
187
+ for (const contextGroup of value.hitContexts) {
188
+ for (const lineContext of contextGroup) {
189
+ // Remove HTML tags and decode entities
190
+ const cleanText = lineContext.text
191
+ .replace(/<em>/g, '')
192
+ .replace(/<\/em>/g, '')
193
+ .replace(/&quot;/g, '"')
194
+ .replace(/&lt;/g, '<')
195
+ .replace(/&gt;/g, '>')
196
+ .replace(/&amp;/g, '&')
197
+ .replace(/&#x2F;/g, '/')
198
+ .replace(/&#x27;/g, "'");
199
+ outputLines.push(` Line ${lineContext.line}: ${cleanText}`);
200
+ }
201
+ }
202
+ }
203
+ outputLines.push(''); // Empty line between files
204
+ }
205
+ return outputLines.join('\n').trim();
206
+ }
207
+ //# sourceMappingURL=form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BACvC,uCAAuC;oBACvC,MAAM,SAAS,GAAG,WAAW,CAAC,IAAI;yBAC/B,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC;yBACpB,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC;yBACtB,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC;yBACvB,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC;yBACrB,OAAO,CAAC,OAAO,EAAE,GAAG,CAAC;yBACrB,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC;yBACtB,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC;yBACvB,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC,CAAC;oBAE3B,WAAW,CAAC,IAAI,CAAC,UAAU,WAAW,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC,CAAC;gBAC/D,CAAC;YACH,CAAC;QACH,CAAC;QAED,WAAW,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,2BAA2B;IACnD,CAAC;IAED,OAAO,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC;AACvC,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Formats a comment with a code suggestion in markdown format
3
+ * that Bitbucket can render as an applicable suggestion
4
+ */
5
+ export declare function formatSuggestionComment(commentText: string, suggestion: string, startLine?: number, endLine?: number): string;
6
+ //# sourceMappingURL=suggestion-formatter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"suggestion-formatter.d.ts","sourceRoot":"","sources":["../../src/utils/suggestion-formatter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,wBAAgB,uBAAuB,CACrC,WAAW,EAAE,MAAM,EACnB,UAAU,EAAE,MAAM,EAClB,SAAS,CAAC,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE,MAAM,GACf,MAAM,CAYR"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Formats a comment with a code suggestion in markdown format
3
+ * that Bitbucket can render as an applicable suggestion
4
+ */
5
+ export function formatSuggestionComment(commentText, suggestion, startLine, endLine) {
6
+ // Add line range info if it's a multi-line suggestion
7
+ const lineInfo = startLine && endLine && endLine > startLine
8
+ ? ` (lines ${startLine}-${endLine})`
9
+ : '';
10
+ // Format with GitHub-style suggestion markdown
11
+ return `${commentText}${lineInfo}
12
+
13
+ \`\`\`suggestion
14
+ ${suggestion}
15
+ \`\`\``;
16
+ }
17
+ //# sourceMappingURL=suggestion-formatter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"suggestion-formatter.js","sourceRoot":"","sources":["../../src/utils/suggestion-formatter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,UAAU,uBAAuB,CACrC,WAAmB,EACnB,UAAkB,EAClB,SAAkB,EAClB,OAAgB;IAEhB,sDAAsD;IACtD,MAAM,QAAQ,GAAG,SAAS,IAAI,OAAO,IAAI,OAAO,GAAG,SAAS;QAC1D,CAAC,CAAC,WAAW,SAAS,IAAI,OAAO,GAAG;QACpC,CAAC,CAAC,EAAE,CAAC;IAEP,+CAA+C;IAC/C,OAAO,GAAG,WAAW,GAAG,QAAQ;;;EAGhC,UAAU;OACL,CAAC;AACR,CAAC"}
package/package.json ADDED
@@ -0,0 +1,55 @@
1
+ {
2
+ "name": "@zhanglc77/bitbucket-mcp-server",
3
+ "version": "1.0.1",
4
+ "description": "MCP server for Bitbucket API integration - supports both Cloud and Server",
5
+ "type": "module",
6
+ "main": "./build/index.js",
7
+ "bin": {
8
+ "bitbucket-mcp-server": "./build/index.js"
9
+ },
10
+ "files": [
11
+ "build/**/*",
12
+ "README.md",
13
+ "LICENSE",
14
+ "CHANGELOG.md"
15
+ ],
16
+ "scripts": {
17
+ "build": "tsc && node -e \"require('fs').chmodSync('build/index.js', '755')\"",
18
+ "dev": "tsc --watch",
19
+ "start": "node build/index.js",
20
+ "prepublishOnly": "npm run build"
21
+ },
22
+ "keywords": [
23
+ "mcp",
24
+ "bitbucket",
25
+ "api",
26
+ "model-context-protocol",
27
+ "bitbucket-server",
28
+ "bitbucket-cloud",
29
+ "pull-request",
30
+ "code-review"
31
+ ],
32
+ "author": "zhanglc77",
33
+ "license": "MIT",
34
+ "repository": {
35
+ "type": "git",
36
+ "url": "https://github.com/zhanglc/bitbucket-mcp-server.git"
37
+ },
38
+ "bugs": {
39
+ "url": "https://github.com/zhanglc/bitbucket-mcp-server/issues"
40
+ },
41
+ "homepage": "https://github.com/zhanglc/bitbucket-mcp-server#readme",
42
+ "engines": {
43
+ "node": ">=16.0.0"
44
+ },
45
+ "dependencies": {
46
+ "@modelcontextprotocol/sdk": "^1.12.1",
47
+ "axios": "^1.10.0",
48
+ "minimatch": "^9.0.3"
49
+ },
50
+ "devDependencies": {
51
+ "@types/minimatch": "^5.1.2",
52
+ "@types/node": "^22.15.29",
53
+ "typescript": "^5.8.3"
54
+ }
55
+ }