@atercates/bitbucket-mcp 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +347 -0
- package/dist/client.d.ts +16 -0
- package/dist/client.js +35 -0
- package/dist/client.js.map +1 -0
- package/dist/config.d.ts +11 -0
- package/dist/config.js +54 -0
- package/dist/config.js.map +1 -0
- package/dist/handlers/branching-model.d.ts +2 -0
- package/dist/handlers/branching-model.js +324 -0
- package/dist/handlers/branching-model.js.map +1 -0
- package/dist/handlers/commits.d.ts +2 -0
- package/dist/handlers/commits.js +78 -0
- package/dist/handlers/commits.js.map +1 -0
- package/dist/handlers/index.d.ts +17 -0
- package/dist/handlers/index.js +29 -0
- package/dist/handlers/index.js.map +1 -0
- package/dist/handlers/pipelines.d.ts +2 -0
- package/dist/handlers/pipelines.js +538 -0
- package/dist/handlers/pipelines.js.map +1 -0
- package/dist/handlers/pr-comments.d.ts +2 -0
- package/dist/handlers/pr-comments.js +509 -0
- package/dist/handlers/pr-comments.js.map +1 -0
- package/dist/handlers/pr-content.d.ts +2 -0
- package/dist/handlers/pr-content.js +332 -0
- package/dist/handlers/pr-content.js.map +1 -0
- package/dist/handlers/pr-tasks.d.ts +2 -0
- package/dist/handlers/pr-tasks.js +275 -0
- package/dist/handlers/pr-tasks.js.map +1 -0
- package/dist/handlers/pull-requests.d.ts +2 -0
- package/dist/handlers/pull-requests.js +902 -0
- package/dist/handlers/pull-requests.js.map +1 -0
- package/dist/handlers/refs.d.ts +2 -0
- package/dist/handlers/refs.js +225 -0
- package/dist/handlers/refs.js.map +1 -0
- package/dist/handlers/repositories.d.ts +2 -0
- package/dist/handlers/repositories.js +131 -0
- package/dist/handlers/repositories.js.map +1 -0
- package/dist/handlers/source.d.ts +2 -0
- package/dist/handlers/source.js +35 -0
- package/dist/handlers/source.js.map +1 -0
- package/dist/handlers/types.d.ts +42 -0
- package/dist/handlers/types.js +2 -0
- package/dist/handlers/types.js.map +1 -0
- package/dist/handlers/users.d.ts +2 -0
- package/dist/handlers/users.js +38 -0
- package/dist/handlers/users.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/logger.d.ts +3 -0
- package/dist/logger.js +60 -0
- package/dist/logger.js.map +1 -0
- package/dist/pagination.d.ts +32 -0
- package/dist/pagination.js +116 -0
- package/dist/pagination.js.map +1 -0
- package/dist/schemas.d.ts +21 -0
- package/dist/schemas.js +23 -0
- package/dist/schemas.js.map +1 -0
- package/dist/server.d.ts +33 -0
- package/dist/server.js +124 -0
- package/dist/server.js.map +1 -0
- package/dist/types.d.ts +296 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/dist/utils.d.ts +18 -0
- package/dist/utils.js +17 -0
- package/dist/utils.js.map +1 -0
- package/docs/README.md +216 -0
- package/docs/TOOLS.md +464 -0
- package/docs/architecture/ARCHITECTURE.md +302 -0
- package/docs/guides/ENVIRONMENT_VARIABLES.md +306 -0
- package/docs/guides/GETTING_STARTED.md +267 -0
- package/docs/guides/GITHUB_ACTIONS_SETUP.md +148 -0
- package/docs/guides/NPM_DEPLOYMENT.md +266 -0
- package/docs/guides/PROJECT_STRUCTURE.md +317 -0
- package/package.json +84 -0
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,296 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Represents a hyperlink in Bitbucket API responses
|
|
3
|
+
*/
|
|
4
|
+
export interface BitbucketLink {
|
|
5
|
+
href: string;
|
|
6
|
+
name?: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Represents a Bitbucket account (user or team)
|
|
10
|
+
*/
|
|
11
|
+
export interface BitbucketAccount {
|
|
12
|
+
uuid: string;
|
|
13
|
+
display_name: string;
|
|
14
|
+
account_id: string;
|
|
15
|
+
nickname?: string;
|
|
16
|
+
type: "user" | "team";
|
|
17
|
+
links: Record<string, BitbucketLink[]>;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Represents a Bitbucket workspace
|
|
21
|
+
*/
|
|
22
|
+
export interface BitbucketWorkspace {
|
|
23
|
+
uuid: string;
|
|
24
|
+
name: string;
|
|
25
|
+
slug: string;
|
|
26
|
+
type: "workspace";
|
|
27
|
+
links: Record<string, BitbucketLink[]>;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Represents a Bitbucket project
|
|
31
|
+
*/
|
|
32
|
+
export interface BitbucketProject {
|
|
33
|
+
uuid: string;
|
|
34
|
+
key: string;
|
|
35
|
+
name: string;
|
|
36
|
+
description?: string;
|
|
37
|
+
is_private: boolean;
|
|
38
|
+
type: "project";
|
|
39
|
+
links: Record<string, BitbucketLink[]>;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Represents a Bitbucket branch reference
|
|
43
|
+
*/
|
|
44
|
+
export interface BitbucketBranch {
|
|
45
|
+
name: string;
|
|
46
|
+
type: "branch";
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Represents a Bitbucket repository
|
|
50
|
+
*/
|
|
51
|
+
export interface BitbucketRepository {
|
|
52
|
+
uuid: string;
|
|
53
|
+
name: string;
|
|
54
|
+
full_name: string;
|
|
55
|
+
description: string;
|
|
56
|
+
is_private: boolean;
|
|
57
|
+
created_on: string;
|
|
58
|
+
updated_on: string;
|
|
59
|
+
size: number;
|
|
60
|
+
language: string;
|
|
61
|
+
has_issues: boolean;
|
|
62
|
+
has_wiki: boolean;
|
|
63
|
+
fork_policy: string;
|
|
64
|
+
owner: BitbucketAccount;
|
|
65
|
+
workspace: BitbucketWorkspace;
|
|
66
|
+
project: BitbucketProject;
|
|
67
|
+
mainbranch?: BitbucketBranch;
|
|
68
|
+
website?: string;
|
|
69
|
+
scm: string;
|
|
70
|
+
links: Record<string, BitbucketLink[]>;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Represents a branch reference in a pull request
|
|
74
|
+
*/
|
|
75
|
+
export interface BitbucketBranchReference {
|
|
76
|
+
branch: {
|
|
77
|
+
name: string;
|
|
78
|
+
};
|
|
79
|
+
commit: {
|
|
80
|
+
hash: string;
|
|
81
|
+
};
|
|
82
|
+
repository: BitbucketRepository;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Represents a participant in a pull request
|
|
86
|
+
*/
|
|
87
|
+
export interface BitbucketParticipant {
|
|
88
|
+
user: BitbucketAccount;
|
|
89
|
+
role: "PARTICIPANT" | "REVIEWER";
|
|
90
|
+
approved: boolean;
|
|
91
|
+
state?: "approved" | "changes_requested" | null;
|
|
92
|
+
participated_on: string;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Represents a Bitbucket pull request
|
|
96
|
+
*/
|
|
97
|
+
export interface BitbucketPullRequest {
|
|
98
|
+
id: number;
|
|
99
|
+
title: string;
|
|
100
|
+
description: string;
|
|
101
|
+
state: "OPEN" | "MERGED" | "DECLINED" | "SUPERSEDED";
|
|
102
|
+
author: BitbucketAccount;
|
|
103
|
+
source: BitbucketBranchReference;
|
|
104
|
+
destination: BitbucketBranchReference;
|
|
105
|
+
created_on: string;
|
|
106
|
+
updated_on: string;
|
|
107
|
+
closed_on?: string;
|
|
108
|
+
comment_count: number;
|
|
109
|
+
task_count: number;
|
|
110
|
+
close_source_branch: boolean;
|
|
111
|
+
reviewers: BitbucketAccount[];
|
|
112
|
+
participants: BitbucketParticipant[];
|
|
113
|
+
links: Record<string, BitbucketLink[]>;
|
|
114
|
+
summary?: {
|
|
115
|
+
raw: string;
|
|
116
|
+
markup: string;
|
|
117
|
+
html: string;
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Represents inline comment positioning information
|
|
122
|
+
*/
|
|
123
|
+
export interface InlineCommentInline {
|
|
124
|
+
path: string;
|
|
125
|
+
from?: number;
|
|
126
|
+
to?: number;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Represents a Bitbucket branching model
|
|
130
|
+
*/
|
|
131
|
+
export interface BitbucketBranchingModel {
|
|
132
|
+
type: "branching_model";
|
|
133
|
+
development: {
|
|
134
|
+
name: string;
|
|
135
|
+
branch?: BitbucketBranch;
|
|
136
|
+
use_mainbranch: boolean;
|
|
137
|
+
};
|
|
138
|
+
production?: {
|
|
139
|
+
name: string;
|
|
140
|
+
branch?: BitbucketBranch;
|
|
141
|
+
use_mainbranch: boolean;
|
|
142
|
+
};
|
|
143
|
+
branch_types: Array<{
|
|
144
|
+
kind: string;
|
|
145
|
+
prefix: string;
|
|
146
|
+
}>;
|
|
147
|
+
links: Record<string, BitbucketLink[]>;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Represents a Bitbucket branching model settings
|
|
151
|
+
*/
|
|
152
|
+
export interface BitbucketBranchingModelSettings {
|
|
153
|
+
type: "branching_model_settings";
|
|
154
|
+
development: {
|
|
155
|
+
name: string;
|
|
156
|
+
use_mainbranch: boolean;
|
|
157
|
+
is_valid?: boolean;
|
|
158
|
+
};
|
|
159
|
+
production: {
|
|
160
|
+
name: string;
|
|
161
|
+
use_mainbranch: boolean;
|
|
162
|
+
enabled: boolean;
|
|
163
|
+
is_valid?: boolean;
|
|
164
|
+
};
|
|
165
|
+
branch_types: Array<{
|
|
166
|
+
kind: string;
|
|
167
|
+
prefix: string;
|
|
168
|
+
enabled: boolean;
|
|
169
|
+
}>;
|
|
170
|
+
links: Record<string, BitbucketLink[]>;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Represents a Bitbucket project branching model
|
|
174
|
+
*/
|
|
175
|
+
export interface BitbucketProjectBranchingModel {
|
|
176
|
+
type: "project_branching_model";
|
|
177
|
+
development: {
|
|
178
|
+
name: string;
|
|
179
|
+
use_mainbranch: boolean;
|
|
180
|
+
};
|
|
181
|
+
production?: {
|
|
182
|
+
name: string;
|
|
183
|
+
use_mainbranch: boolean;
|
|
184
|
+
};
|
|
185
|
+
branch_types: Array<{
|
|
186
|
+
kind: string;
|
|
187
|
+
prefix: string;
|
|
188
|
+
}>;
|
|
189
|
+
links: Record<string, BitbucketLink[]>;
|
|
190
|
+
}
|
|
191
|
+
/**
|
|
192
|
+
* Represents the configuration for a Bitbucket client
|
|
193
|
+
*/
|
|
194
|
+
export interface BitbucketConfig {
|
|
195
|
+
baseUrl: string;
|
|
196
|
+
token?: string;
|
|
197
|
+
username?: string;
|
|
198
|
+
password?: string;
|
|
199
|
+
defaultWorkspace?: string;
|
|
200
|
+
allowDangerousCommands?: boolean;
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Represents a pipeline target
|
|
204
|
+
*/
|
|
205
|
+
export interface BitbucketPipelineTarget {
|
|
206
|
+
type: string;
|
|
207
|
+
ref_type?: string;
|
|
208
|
+
ref_name?: string;
|
|
209
|
+
commit?: {
|
|
210
|
+
type: "commit";
|
|
211
|
+
hash: string;
|
|
212
|
+
};
|
|
213
|
+
selector?: {
|
|
214
|
+
type: string;
|
|
215
|
+
pattern: string;
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Represents a pipeline trigger
|
|
220
|
+
*/
|
|
221
|
+
export interface BitbucketPipelineTrigger {
|
|
222
|
+
type: string;
|
|
223
|
+
name?: string;
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Represents a pipeline state
|
|
227
|
+
*/
|
|
228
|
+
export interface BitbucketPipelineState {
|
|
229
|
+
type: string;
|
|
230
|
+
name: "PENDING" | "IN_PROGRESS" | "SUCCESSFUL" | "FAILED" | "ERROR" | "STOPPED";
|
|
231
|
+
result?: {
|
|
232
|
+
type: string;
|
|
233
|
+
name: "SUCCESSFUL" | "FAILED" | "ERROR" | "STOPPED";
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Represents a pipeline variable
|
|
238
|
+
*/
|
|
239
|
+
export interface BitbucketPipelineVariable {
|
|
240
|
+
type: "pipeline_variable";
|
|
241
|
+
key: string;
|
|
242
|
+
value: string;
|
|
243
|
+
secured?: boolean;
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Represents a pipeline configuration source
|
|
247
|
+
*/
|
|
248
|
+
export interface BitbucketPipelineConfigurationSource {
|
|
249
|
+
source: string;
|
|
250
|
+
uri: string;
|
|
251
|
+
}
|
|
252
|
+
/**
|
|
253
|
+
* Represents a pipeline command
|
|
254
|
+
*/
|
|
255
|
+
export interface BitbucketPipelineCommand {
|
|
256
|
+
name?: string;
|
|
257
|
+
command: string;
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Represents a pipeline step
|
|
261
|
+
*/
|
|
262
|
+
export interface BitbucketPipelineStep {
|
|
263
|
+
uuid: string;
|
|
264
|
+
type: "pipeline_step";
|
|
265
|
+
name?: string;
|
|
266
|
+
started_on?: string;
|
|
267
|
+
completed_on?: string;
|
|
268
|
+
state: BitbucketPipelineState;
|
|
269
|
+
image?: {
|
|
270
|
+
name: string;
|
|
271
|
+
username?: string;
|
|
272
|
+
password?: string;
|
|
273
|
+
email?: string;
|
|
274
|
+
};
|
|
275
|
+
setup_commands?: BitbucketPipelineCommand[];
|
|
276
|
+
script_commands?: BitbucketPipelineCommand[];
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Represents a Bitbucket pipeline
|
|
280
|
+
*/
|
|
281
|
+
export interface BitbucketPipeline {
|
|
282
|
+
uuid: string;
|
|
283
|
+
type: "pipeline";
|
|
284
|
+
build_number: number;
|
|
285
|
+
creator: BitbucketAccount;
|
|
286
|
+
repository: BitbucketRepository;
|
|
287
|
+
target: BitbucketPipelineTarget;
|
|
288
|
+
trigger: BitbucketPipelineTrigger;
|
|
289
|
+
state: BitbucketPipelineState;
|
|
290
|
+
created_on: string;
|
|
291
|
+
completed_on?: string;
|
|
292
|
+
build_seconds_used?: number;
|
|
293
|
+
variables?: BitbucketPipelineVariable[];
|
|
294
|
+
configuration_sources?: BitbucketPipelineConfigurationSource[];
|
|
295
|
+
links: Record<string, BitbucketLink[]>;
|
|
296
|
+
}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,2CAA2C"}
|
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wraps data in MCP tool response format with JSON content
|
|
3
|
+
*/
|
|
4
|
+
export declare function jsonResponse(data: unknown): {
|
|
5
|
+
content: {
|
|
6
|
+
type: "text";
|
|
7
|
+
text: string;
|
|
8
|
+
}[];
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Wraps text in MCP tool response format
|
|
12
|
+
*/
|
|
13
|
+
export declare function textResponse(text: string): {
|
|
14
|
+
content: {
|
|
15
|
+
type: "text";
|
|
16
|
+
text: string;
|
|
17
|
+
}[];
|
|
18
|
+
};
|
package/dist/utils.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wraps data in MCP tool response format with JSON content
|
|
3
|
+
*/
|
|
4
|
+
export function jsonResponse(data) {
|
|
5
|
+
return {
|
|
6
|
+
content: [{ type: "text", text: JSON.stringify(data, null, 2) }],
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Wraps text in MCP tool response format
|
|
11
|
+
*/
|
|
12
|
+
export function textResponse(text) {
|
|
13
|
+
return {
|
|
14
|
+
content: [{ type: "text", text }],
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,IAAa;IACxC,OAAO;QACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;KAC1E,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,YAAY,CAAC,IAAY;IACvC,OAAO;QACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,CAAC;KAC3C,CAAC;AACJ,CAAC"}
|
package/docs/README.md
ADDED
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
# Bitbucket MCP Server Documentation
|
|
2
|
+
|
|
3
|
+
Welcome to the Bitbucket MCP (Model Context Protocol) Server documentation. This server provides AI assistants and other MCP clients with programmatic access to Bitbucket Cloud and Server APIs.
|
|
4
|
+
|
|
5
|
+
## Quick Links
|
|
6
|
+
|
|
7
|
+
- **[Getting Started Guide](guides/GETTING_STARTED.md)** - Installation and configuration
|
|
8
|
+
- **[Tools Reference](TOOLS.md)** - Complete list of all available tools
|
|
9
|
+
- **[Architecture](architecture/ARCHITECTURE.md)** - Technical design and structure
|
|
10
|
+
- **[Project Structure](guides/PROJECT_STRUCTURE.md)** - Explanation of files and directories
|
|
11
|
+
- **[Environment Variables](guides/ENVIRONMENT_VARIABLES.md)** - Configuration reference
|
|
12
|
+
- **[NPM Deployment](guides/NPM_DEPLOYMENT.md)** - Publishing to NPM
|
|
13
|
+
- **[GitHub Actions Setup](guides/GITHUB_ACTIONS_SETUP.md)** - Automatic CI/CD configuration
|
|
14
|
+
|
|
15
|
+
## What is Bitbucket MCP?
|
|
16
|
+
|
|
17
|
+
The Bitbucket MCP server is a standardized interface that allows AI assistants (like Claude, integrated in Cursor) to interact with Bitbucket repositories programmatically. It enables:
|
|
18
|
+
|
|
19
|
+
- **Repository Management**: List, create, and manage repositories
|
|
20
|
+
- **Pull Request Operations**: Create, approve, merge, and manage PRs
|
|
21
|
+
- **Code Review**: Add comments, tasks, and request changes on PRs
|
|
22
|
+
- **Branch Management**: Create, list, and delete branches and tags
|
|
23
|
+
- **Pipeline Control**: Trigger and monitor CI/CD pipelines
|
|
24
|
+
- **Source Code Access**: Read file content from repositories
|
|
25
|
+
- **Commit History**: Query commits and changes
|
|
26
|
+
|
|
27
|
+
## Key Features
|
|
28
|
+
|
|
29
|
+
✨ **Modular Architecture** - Organized by feature domain for easy maintenance and extension
|
|
30
|
+
|
|
31
|
+
🔒 **Secure** - Token-based authentication with fine-grained permission control
|
|
32
|
+
|
|
33
|
+
📝 **Well-Documented** - Comprehensive API reference and architecture guide
|
|
34
|
+
|
|
35
|
+
🧪 **Tested** - Full unit test suite with 100% tool coverage
|
|
36
|
+
|
|
37
|
+
⚡ **Fast** - Efficient pagination and minimal dependencies
|
|
38
|
+
|
|
39
|
+
🛡️ **Safe** - Dangerous operations (deletes) require explicit enablement
|
|
40
|
+
|
|
41
|
+
## Quick Start
|
|
42
|
+
|
|
43
|
+
1. **Install:**
|
|
44
|
+
```bash
|
|
45
|
+
npm install -g bitbucket-mcp
|
|
46
|
+
# or
|
|
47
|
+
npx -y bitbucket-mcp@latest
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
2. **Configure:**
|
|
51
|
+
```bash
|
|
52
|
+
export BITBUCKET_TOKEN="your_app_password"
|
|
53
|
+
export BITBUCKET_WORKSPACE="my-workspace"
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
3. **Run:**
|
|
57
|
+
```bash
|
|
58
|
+
bitbucket-mcp
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
4. **Connect:** Configure your MCP client (Claude, Cursor) to use this server
|
|
62
|
+
|
|
63
|
+
For detailed setup instructions, see [Getting Started Guide](guides/GETTING_STARTED.md).
|
|
64
|
+
|
|
65
|
+
## Core Concepts
|
|
66
|
+
|
|
67
|
+
### MCP (Model Context Protocol)
|
|
68
|
+
|
|
69
|
+
MCP is a standardized protocol that allows AI models to interact with external tools and data sources. This server implements the MCP specification to expose Bitbucket operations as "tools" that AI assistants can call.
|
|
70
|
+
|
|
71
|
+
### Handler Modules
|
|
72
|
+
|
|
73
|
+
The server is organized into feature-based handler modules:
|
|
74
|
+
|
|
75
|
+
| Module | Purpose |
|
|
76
|
+
|--------|---------|
|
|
77
|
+
| `repositories` | Repository operations |
|
|
78
|
+
| `pull-requests` | PR creation, approval, merging |
|
|
79
|
+
| `pr-comments` | PR comments and discussions |
|
|
80
|
+
| `pr-tasks` | PR tasks (TODO items) |
|
|
81
|
+
| `pr-content` | PR diffs and commits |
|
|
82
|
+
| `refs` | Branches and tags |
|
|
83
|
+
| `commits` | Commit history and details |
|
|
84
|
+
| `pipelines` | CI/CD pipeline management |
|
|
85
|
+
| `source` | Source code file access |
|
|
86
|
+
| `users` | User and workspace information |
|
|
87
|
+
| `branching-model` | Branching strategy configuration |
|
|
88
|
+
|
|
89
|
+
### Authentication
|
|
90
|
+
|
|
91
|
+
The server supports two authentication methods:
|
|
92
|
+
|
|
93
|
+
1. **Token Authentication** (Recommended)
|
|
94
|
+
```bash
|
|
95
|
+
BITBUCKET_TOKEN=your_app_password
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
2. **Basic Authentication**
|
|
99
|
+
```bash
|
|
100
|
+
BITBUCKET_USERNAME=your_email@example.com
|
|
101
|
+
BITBUCKET_PASSWORD=your_app_password
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Workspace Resolution
|
|
105
|
+
|
|
106
|
+
Workspaces can be specified in multiple ways:
|
|
107
|
+
|
|
108
|
+
1. **Default workspace** (via `BITBUCKET_WORKSPACE` env var)
|
|
109
|
+
2. **Per-call** (via `workspace` parameter in tool arguments)
|
|
110
|
+
3. **Auto-detection** (from API responses)
|
|
111
|
+
|
|
112
|
+
## Available Tools
|
|
113
|
+
|
|
114
|
+
The server exposes 59 tools across 11 categories. See [TOOLS.md](TOOLS.md) for complete reference.
|
|
115
|
+
|
|
116
|
+
**Quick Examples:**
|
|
117
|
+
|
|
118
|
+
- `listRepositories` - List repos in a workspace
|
|
119
|
+
- `createPullRequest` - Create a new PR
|
|
120
|
+
- `approvePullRequest` - Approve a PR
|
|
121
|
+
- `mergePullRequest` - Merge a PR
|
|
122
|
+
- `listBranches` - List repository branches
|
|
123
|
+
- `runPipeline` - Trigger a pipeline run
|
|
124
|
+
- `getFileContent` - Read file from repository
|
|
125
|
+
|
|
126
|
+
## Architecture Overview
|
|
127
|
+
|
|
128
|
+
```
|
|
129
|
+
┌─────────────────────────────────────────┐
|
|
130
|
+
│ MCP Client (Cursor, Claude, etc) │
|
|
131
|
+
└──────────────┬──────────────────────────┘
|
|
132
|
+
│
|
|
133
|
+
▼
|
|
134
|
+
┌──────────────────────────────────────────┐
|
|
135
|
+
│ Bitbucket MCP Server │
|
|
136
|
+
├──────────────────────────────────────────┤
|
|
137
|
+
│ • Tool Registration │
|
|
138
|
+
│ • Request Routing │
|
|
139
|
+
│ • Authentication │
|
|
140
|
+
└──────────────┬───────────────────────────┘
|
|
141
|
+
│
|
|
142
|
+
┌──────▼──────────────────────────┐
|
|
143
|
+
│ Handler Modules │
|
|
144
|
+
│ (repositories, PRs, etc) │
|
|
145
|
+
└──────┬───────────────────────────┘
|
|
146
|
+
│
|
|
147
|
+
┌──────────┴──────────────┐
|
|
148
|
+
▼ ▼
|
|
149
|
+
┌──────────────────┐ ┌──────────────────┐
|
|
150
|
+
│ BitbucketClient │ │ Logger │
|
|
151
|
+
│ (API Wrapper) │ │ (File-based) │
|
|
152
|
+
└────────┬─────────┘ └──────────────────┘
|
|
153
|
+
│
|
|
154
|
+
▼
|
|
155
|
+
┌─────────────────┐
|
|
156
|
+
│ Bitbucket API │
|
|
157
|
+
│ (Cloud/Server) │
|
|
158
|
+
└─────────────────┘
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
For more details, see [Architecture](architecture/ARCHITECTURE.md).
|
|
162
|
+
|
|
163
|
+
## Environment Variables
|
|
164
|
+
|
|
165
|
+
### Required
|
|
166
|
+
|
|
167
|
+
- `BITBUCKET_TOKEN` - App password for authentication (recommended)
|
|
168
|
+
- OR `BITBUCKET_USERNAME` + `BITBUCKET_PASSWORD` - Basic auth credentials
|
|
169
|
+
|
|
170
|
+
### Optional
|
|
171
|
+
|
|
172
|
+
- `BITBUCKET_URL` - API base URL (default: `https://api.bitbucket.org/2.0`)
|
|
173
|
+
- `BITBUCKET_WORKSPACE` - Default workspace name
|
|
174
|
+
- `BITBUCKET_ALLOW_DANGEROUS` - Enable delete operations (default: false)
|
|
175
|
+
- `BITBUCKET_LOG_DISABLE` - Disable file logging (default: false)
|
|
176
|
+
- `BITBUCKET_LOG_FILE` - Custom log file path
|
|
177
|
+
- `BITBUCKET_LOG_DIR` - Custom log directory
|
|
178
|
+
- `BITBUCKET_LOG_PER_CWD` - Create per-directory logs (default: false)
|
|
179
|
+
|
|
180
|
+
## Getting Help
|
|
181
|
+
|
|
182
|
+
- 📖 Check [TOOLS.md](TOOLS.md) for tool-specific documentation
|
|
183
|
+
- 🏗️ Review [Architecture](architecture/ARCHITECTURE.md) for technical details
|
|
184
|
+
- 📁 See [Project Structure](guides/PROJECT_STRUCTURE.md) for file organization
|
|
185
|
+
- 🚀 See [Getting Started](guides/GETTING_STARTED.md) for setup help
|
|
186
|
+
- ⚙️ Check [Environment Variables](guides/ENVIRONMENT_VARIABLES.md) for config options
|
|
187
|
+
- 📦 See [NPM Deployment](guides/NPM_DEPLOYMENT.md) for publishing
|
|
188
|
+
- ⚡ See [GitHub Actions Setup](guides/GITHUB_ACTIONS_SETUP.md) for CI/CD automation
|
|
189
|
+
- 🐛 Check logs in your platform's log directory (see Getting Started guide)
|
|
190
|
+
|
|
191
|
+
## Contributing
|
|
192
|
+
|
|
193
|
+
Contributions are welcome! To add new features:
|
|
194
|
+
|
|
195
|
+
1. Create a new handler module in `src/handlers/`
|
|
196
|
+
2. Implement the `HandlerModule` interface
|
|
197
|
+
3. Register it in `src/handlers/index.ts`
|
|
198
|
+
4. Add tests in `__tests__/handlers/`
|
|
199
|
+
5. Submit a pull request
|
|
200
|
+
|
|
201
|
+
For detailed contribution guidelines, see [CONTRIBUTING.md](CONTRIBUTING.md).
|
|
202
|
+
|
|
203
|
+
## License
|
|
204
|
+
|
|
205
|
+
MIT License - See LICENSE file for details.
|
|
206
|
+
|
|
207
|
+
## Support
|
|
208
|
+
|
|
209
|
+
- Report issues on GitHub
|
|
210
|
+
- Check existing issues for solutions
|
|
211
|
+
- Review logs for error details (enable with `BITBUCKET_LOG_DISABLE=false`)
|
|
212
|
+
|
|
213
|
+
---
|
|
214
|
+
|
|
215
|
+
**Last Updated:** 2024
|
|
216
|
+
**Version:** 5.0.0+
|