@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
|
@@ -0,0 +1,538 @@
|
|
|
1
|
+
import { PAGINATION_BASE_SCHEMA, PAGINATION_ALL_SCHEMA, LEGACY_LIMIT_SCHEMA } from "../schemas.js";
|
|
2
|
+
import { jsonResponse, textResponse } from "../utils.js";
|
|
3
|
+
import { logger } from "../logger.js";
|
|
4
|
+
import { ErrorCode, McpError } from "@modelcontextprotocol/sdk/types.js";
|
|
5
|
+
import fs from "fs";
|
|
6
|
+
import path from "path";
|
|
7
|
+
import os from "os";
|
|
8
|
+
export const pipelinesModule = {
|
|
9
|
+
tools: [
|
|
10
|
+
{
|
|
11
|
+
name: "listPipelineRuns",
|
|
12
|
+
description: "List pipeline runs for a repository",
|
|
13
|
+
inputSchema: {
|
|
14
|
+
type: "object",
|
|
15
|
+
properties: {
|
|
16
|
+
workspace: {
|
|
17
|
+
type: "string",
|
|
18
|
+
description: "Bitbucket workspace name",
|
|
19
|
+
},
|
|
20
|
+
repo_slug: { type: "string", description: "Repository slug" },
|
|
21
|
+
...PAGINATION_BASE_SCHEMA,
|
|
22
|
+
all: PAGINATION_ALL_SCHEMA,
|
|
23
|
+
limit: LEGACY_LIMIT_SCHEMA,
|
|
24
|
+
status: {
|
|
25
|
+
type: "string",
|
|
26
|
+
enum: ["PENDING", "IN_PROGRESS", "SUCCESSFUL", "FAILED", "ERROR", "STOPPED"],
|
|
27
|
+
description: "Filter pipelines by status",
|
|
28
|
+
},
|
|
29
|
+
target_branch: {
|
|
30
|
+
type: "string",
|
|
31
|
+
description: "Filter pipelines by target branch",
|
|
32
|
+
},
|
|
33
|
+
trigger_type: {
|
|
34
|
+
type: "string",
|
|
35
|
+
enum: ["manual", "push", "pullrequest", "schedule"],
|
|
36
|
+
description: "Filter pipelines by trigger type",
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
required: ["workspace", "repo_slug"],
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
name: "getPipelineRun",
|
|
44
|
+
description: "Get details for a specific pipeline run",
|
|
45
|
+
inputSchema: {
|
|
46
|
+
type: "object",
|
|
47
|
+
properties: {
|
|
48
|
+
workspace: {
|
|
49
|
+
type: "string",
|
|
50
|
+
description: "Bitbucket workspace name",
|
|
51
|
+
},
|
|
52
|
+
repo_slug: { type: "string", description: "Repository slug" },
|
|
53
|
+
pipeline_uuid: {
|
|
54
|
+
type: "string",
|
|
55
|
+
description: "Pipeline UUID",
|
|
56
|
+
},
|
|
57
|
+
...PAGINATION_BASE_SCHEMA,
|
|
58
|
+
all: PAGINATION_ALL_SCHEMA,
|
|
59
|
+
},
|
|
60
|
+
required: ["workspace", "repo_slug", "pipeline_uuid"],
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
name: "runPipeline",
|
|
65
|
+
description: "Trigger a new pipeline run",
|
|
66
|
+
inputSchema: {
|
|
67
|
+
type: "object",
|
|
68
|
+
properties: {
|
|
69
|
+
workspace: {
|
|
70
|
+
type: "string",
|
|
71
|
+
description: "Bitbucket workspace name",
|
|
72
|
+
},
|
|
73
|
+
repo_slug: { type: "string", description: "Repository slug" },
|
|
74
|
+
target: {
|
|
75
|
+
type: "object",
|
|
76
|
+
description: "Pipeline target configuration",
|
|
77
|
+
properties: {
|
|
78
|
+
ref_type: {
|
|
79
|
+
type: "string",
|
|
80
|
+
enum: ["branch", "tag", "bookmark", "named_branch"],
|
|
81
|
+
description: "Reference type",
|
|
82
|
+
},
|
|
83
|
+
ref_name: {
|
|
84
|
+
type: "string",
|
|
85
|
+
description: "Reference name (branch, tag, etc.)",
|
|
86
|
+
},
|
|
87
|
+
commit_hash: {
|
|
88
|
+
type: "string",
|
|
89
|
+
description: "Specific commit hash to run pipeline on",
|
|
90
|
+
},
|
|
91
|
+
selector_type: {
|
|
92
|
+
type: "string",
|
|
93
|
+
enum: ["default", "custom", "branches", "tags", "bookmarks"],
|
|
94
|
+
description: "Pipeline selector type",
|
|
95
|
+
},
|
|
96
|
+
selector_pattern: {
|
|
97
|
+
type: "string",
|
|
98
|
+
description: "Pipeline selector pattern (for custom pipelines)",
|
|
99
|
+
},
|
|
100
|
+
},
|
|
101
|
+
required: ["ref_type", "ref_name"],
|
|
102
|
+
},
|
|
103
|
+
variables: {
|
|
104
|
+
type: "array",
|
|
105
|
+
description: "Pipeline variables",
|
|
106
|
+
items: {
|
|
107
|
+
type: "object",
|
|
108
|
+
properties: {
|
|
109
|
+
key: { type: "string", description: "Variable name" },
|
|
110
|
+
value: { type: "string", description: "Variable value" },
|
|
111
|
+
secured: {
|
|
112
|
+
type: "boolean",
|
|
113
|
+
description: "Whether the variable is secured",
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
required: ["key", "value"],
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
required: ["workspace", "repo_slug", "target"],
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
name: "stopPipeline",
|
|
125
|
+
description: "Stop a running pipeline",
|
|
126
|
+
inputSchema: {
|
|
127
|
+
type: "object",
|
|
128
|
+
properties: {
|
|
129
|
+
workspace: {
|
|
130
|
+
type: "string",
|
|
131
|
+
description: "Bitbucket workspace name",
|
|
132
|
+
},
|
|
133
|
+
repo_slug: { type: "string", description: "Repository slug" },
|
|
134
|
+
pipeline_uuid: {
|
|
135
|
+
type: "string",
|
|
136
|
+
description: "Pipeline UUID",
|
|
137
|
+
},
|
|
138
|
+
},
|
|
139
|
+
required: ["workspace", "repo_slug", "pipeline_uuid"],
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
name: "getPipelineSteps",
|
|
144
|
+
description: "List steps for a pipeline run",
|
|
145
|
+
inputSchema: {
|
|
146
|
+
type: "object",
|
|
147
|
+
properties: {
|
|
148
|
+
workspace: {
|
|
149
|
+
type: "string",
|
|
150
|
+
description: "Bitbucket workspace name",
|
|
151
|
+
},
|
|
152
|
+
repo_slug: { type: "string", description: "Repository slug" },
|
|
153
|
+
pipeline_uuid: {
|
|
154
|
+
type: "string",
|
|
155
|
+
description: "Pipeline UUID",
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
required: ["workspace", "repo_slug", "pipeline_uuid"],
|
|
159
|
+
},
|
|
160
|
+
},
|
|
161
|
+
{
|
|
162
|
+
name: "getPipelineStep",
|
|
163
|
+
description: "Get details for a specific pipeline step",
|
|
164
|
+
inputSchema: {
|
|
165
|
+
type: "object",
|
|
166
|
+
properties: {
|
|
167
|
+
workspace: {
|
|
168
|
+
type: "string",
|
|
169
|
+
description: "Bitbucket workspace name",
|
|
170
|
+
},
|
|
171
|
+
repo_slug: { type: "string", description: "Repository slug" },
|
|
172
|
+
pipeline_uuid: {
|
|
173
|
+
type: "string",
|
|
174
|
+
description: "Pipeline UUID",
|
|
175
|
+
},
|
|
176
|
+
step_uuid: {
|
|
177
|
+
type: "string",
|
|
178
|
+
description: "Step UUID",
|
|
179
|
+
},
|
|
180
|
+
},
|
|
181
|
+
required: ["workspace", "repo_slug", "pipeline_uuid", "step_uuid"],
|
|
182
|
+
},
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
name: "getPipelineStepLogs",
|
|
186
|
+
description: "Get logs for a specific pipeline step",
|
|
187
|
+
inputSchema: {
|
|
188
|
+
type: "object",
|
|
189
|
+
properties: {
|
|
190
|
+
workspace: {
|
|
191
|
+
type: "string",
|
|
192
|
+
description: "Bitbucket workspace name",
|
|
193
|
+
},
|
|
194
|
+
repo_slug: { type: "string", description: "Repository slug" },
|
|
195
|
+
pipeline_uuid: {
|
|
196
|
+
type: "string",
|
|
197
|
+
description: "Pipeline UUID",
|
|
198
|
+
},
|
|
199
|
+
step_uuid: {
|
|
200
|
+
type: "string",
|
|
201
|
+
description: "Step UUID",
|
|
202
|
+
},
|
|
203
|
+
max_lines: {
|
|
204
|
+
type: "number",
|
|
205
|
+
description: "Maximum number of log lines to return (default 500)",
|
|
206
|
+
minimum: 1,
|
|
207
|
+
maximum: 5000,
|
|
208
|
+
},
|
|
209
|
+
tail: {
|
|
210
|
+
type: "boolean",
|
|
211
|
+
description: "When true, returns the most recent lines instead of the first lines",
|
|
212
|
+
},
|
|
213
|
+
errors_only: {
|
|
214
|
+
type: "boolean",
|
|
215
|
+
description: "When true, only include lines that look like errors (case-insensitive match on error keywords)",
|
|
216
|
+
},
|
|
217
|
+
search_term: {
|
|
218
|
+
type: "string",
|
|
219
|
+
description: "Optional case-insensitive search term to filter log lines",
|
|
220
|
+
},
|
|
221
|
+
save_to_file: {
|
|
222
|
+
type: "boolean",
|
|
223
|
+
description: "Save the full log to a temporary file and return the path for offline review",
|
|
224
|
+
},
|
|
225
|
+
},
|
|
226
|
+
required: ["workspace", "repo_slug", "pipeline_uuid", "step_uuid"],
|
|
227
|
+
},
|
|
228
|
+
},
|
|
229
|
+
],
|
|
230
|
+
createHandlers: (client) => ({
|
|
231
|
+
listPipelineRuns: async (args) => {
|
|
232
|
+
const workspace = args.workspace;
|
|
233
|
+
const repo_slug = args.repo_slug;
|
|
234
|
+
const pagelen = args.pagelen;
|
|
235
|
+
const page = args.page;
|
|
236
|
+
const all = args.all;
|
|
237
|
+
const status = args.status;
|
|
238
|
+
const target_branch = args.target_branch;
|
|
239
|
+
const trigger_type = args.trigger_type;
|
|
240
|
+
const legacyLimit = args.limit;
|
|
241
|
+
try {
|
|
242
|
+
logger.info("Listing pipeline runs", {
|
|
243
|
+
workspace,
|
|
244
|
+
repo_slug,
|
|
245
|
+
pagelen: pagelen ?? legacyLimit,
|
|
246
|
+
page,
|
|
247
|
+
all,
|
|
248
|
+
status,
|
|
249
|
+
target_branch,
|
|
250
|
+
trigger_type,
|
|
251
|
+
});
|
|
252
|
+
const params = {};
|
|
253
|
+
if (status)
|
|
254
|
+
params.status = status;
|
|
255
|
+
if (target_branch)
|
|
256
|
+
params["target.branch"] = target_branch;
|
|
257
|
+
if (trigger_type)
|
|
258
|
+
params.trigger_type = trigger_type;
|
|
259
|
+
const result = await client.paginator.fetchValues(`/repositories/${workspace}/${repo_slug}/pipelines`, {
|
|
260
|
+
pagelen: pagelen ?? legacyLimit,
|
|
261
|
+
page,
|
|
262
|
+
all,
|
|
263
|
+
params,
|
|
264
|
+
description: "listPipelineRuns",
|
|
265
|
+
});
|
|
266
|
+
return jsonResponse(result.values);
|
|
267
|
+
}
|
|
268
|
+
catch (error) {
|
|
269
|
+
logger.error("Error listing pipeline runs", {
|
|
270
|
+
error,
|
|
271
|
+
workspace,
|
|
272
|
+
repo_slug,
|
|
273
|
+
});
|
|
274
|
+
throw new McpError(ErrorCode.InternalError, `Failed to list pipeline runs: ${error instanceof Error ? error.message : String(error)}`);
|
|
275
|
+
}
|
|
276
|
+
},
|
|
277
|
+
getPipelineRun: async (args) => {
|
|
278
|
+
const workspace = args.workspace;
|
|
279
|
+
const repo_slug = args.repo_slug;
|
|
280
|
+
const pipeline_uuid = args.pipeline_uuid;
|
|
281
|
+
try {
|
|
282
|
+
logger.info("Getting pipeline run details", {
|
|
283
|
+
workspace,
|
|
284
|
+
repo_slug,
|
|
285
|
+
pipeline_uuid,
|
|
286
|
+
});
|
|
287
|
+
const response = await client.api.get(`/repositories/${workspace}/${repo_slug}/pipelines/${pipeline_uuid}`);
|
|
288
|
+
return jsonResponse(response.data);
|
|
289
|
+
}
|
|
290
|
+
catch (error) {
|
|
291
|
+
logger.error("Error getting pipeline run", {
|
|
292
|
+
error,
|
|
293
|
+
workspace,
|
|
294
|
+
repo_slug,
|
|
295
|
+
pipeline_uuid,
|
|
296
|
+
});
|
|
297
|
+
throw new McpError(ErrorCode.InternalError, `Failed to get pipeline run: ${error instanceof Error ? error.message : String(error)}`);
|
|
298
|
+
}
|
|
299
|
+
},
|
|
300
|
+
runPipeline: async (args) => {
|
|
301
|
+
const workspace = args.workspace;
|
|
302
|
+
const repo_slug = args.repo_slug;
|
|
303
|
+
const target = args.target;
|
|
304
|
+
const variables = args.variables;
|
|
305
|
+
try {
|
|
306
|
+
logger.info("Triggering pipeline run", {
|
|
307
|
+
workspace,
|
|
308
|
+
repo_slug,
|
|
309
|
+
target,
|
|
310
|
+
variables: variables?.length || 0,
|
|
311
|
+
});
|
|
312
|
+
// Build the target object based on the input
|
|
313
|
+
const pipelineTarget = {
|
|
314
|
+
type: target.commit_hash ? "pipeline_commit_target" : "pipeline_ref_target",
|
|
315
|
+
ref_type: target.ref_type,
|
|
316
|
+
ref_name: target.ref_name,
|
|
317
|
+
};
|
|
318
|
+
// Add commit if specified
|
|
319
|
+
if (target.commit_hash) {
|
|
320
|
+
pipelineTarget.commit = {
|
|
321
|
+
type: "commit",
|
|
322
|
+
hash: target.commit_hash,
|
|
323
|
+
};
|
|
324
|
+
}
|
|
325
|
+
// Add selector if specified
|
|
326
|
+
if (target.selector_type && target.selector_pattern) {
|
|
327
|
+
pipelineTarget.selector = {
|
|
328
|
+
type: target.selector_type,
|
|
329
|
+
pattern: target.selector_pattern,
|
|
330
|
+
};
|
|
331
|
+
}
|
|
332
|
+
// Build the request data
|
|
333
|
+
const requestData = {
|
|
334
|
+
target: pipelineTarget,
|
|
335
|
+
};
|
|
336
|
+
// Add variables if provided
|
|
337
|
+
if (variables && variables.length > 0) {
|
|
338
|
+
requestData.variables = variables.map((variable) => ({
|
|
339
|
+
key: variable.key,
|
|
340
|
+
value: variable.value,
|
|
341
|
+
secured: variable.secured || false,
|
|
342
|
+
}));
|
|
343
|
+
}
|
|
344
|
+
const response = await client.api.post(`/repositories/${workspace}/${repo_slug}/pipelines`, requestData);
|
|
345
|
+
return jsonResponse(response.data);
|
|
346
|
+
}
|
|
347
|
+
catch (error) {
|
|
348
|
+
logger.error("Error running pipeline", {
|
|
349
|
+
error,
|
|
350
|
+
workspace,
|
|
351
|
+
repo_slug,
|
|
352
|
+
});
|
|
353
|
+
throw new McpError(ErrorCode.InternalError, `Failed to run pipeline: ${error instanceof Error ? error.message : String(error)}`);
|
|
354
|
+
}
|
|
355
|
+
},
|
|
356
|
+
stopPipeline: async (args) => {
|
|
357
|
+
const workspace = args.workspace;
|
|
358
|
+
const repo_slug = args.repo_slug;
|
|
359
|
+
const pipeline_uuid = args.pipeline_uuid;
|
|
360
|
+
try {
|
|
361
|
+
logger.info("Stopping pipeline", {
|
|
362
|
+
workspace,
|
|
363
|
+
repo_slug,
|
|
364
|
+
pipeline_uuid,
|
|
365
|
+
});
|
|
366
|
+
await client.api.post(`/repositories/${workspace}/${repo_slug}/pipelines/${pipeline_uuid}/stopPipeline`);
|
|
367
|
+
return textResponse("Pipeline stop signal sent successfully.");
|
|
368
|
+
}
|
|
369
|
+
catch (error) {
|
|
370
|
+
logger.error("Error stopping pipeline", {
|
|
371
|
+
error,
|
|
372
|
+
workspace,
|
|
373
|
+
repo_slug,
|
|
374
|
+
pipeline_uuid,
|
|
375
|
+
});
|
|
376
|
+
throw new McpError(ErrorCode.InternalError, `Failed to stop pipeline: ${error instanceof Error ? error.message : String(error)}`);
|
|
377
|
+
}
|
|
378
|
+
},
|
|
379
|
+
getPipelineSteps: async (args) => {
|
|
380
|
+
const workspace = args.workspace;
|
|
381
|
+
const repo_slug = args.repo_slug;
|
|
382
|
+
const pipeline_uuid = args.pipeline_uuid;
|
|
383
|
+
const pagelen = args.pagelen;
|
|
384
|
+
const page = args.page;
|
|
385
|
+
const all = args.all;
|
|
386
|
+
try {
|
|
387
|
+
logger.info("Getting pipeline steps", {
|
|
388
|
+
workspace,
|
|
389
|
+
repo_slug,
|
|
390
|
+
pipeline_uuid,
|
|
391
|
+
pagelen,
|
|
392
|
+
page,
|
|
393
|
+
all,
|
|
394
|
+
});
|
|
395
|
+
const result = await client.paginator.fetchValues(`/repositories/${workspace}/${repo_slug}/pipelines/${pipeline_uuid}/steps`, {
|
|
396
|
+
pagelen,
|
|
397
|
+
page,
|
|
398
|
+
all,
|
|
399
|
+
description: "getPipelineSteps",
|
|
400
|
+
});
|
|
401
|
+
return jsonResponse(result.values);
|
|
402
|
+
}
|
|
403
|
+
catch (error) {
|
|
404
|
+
logger.error("Error getting pipeline steps", {
|
|
405
|
+
error,
|
|
406
|
+
workspace,
|
|
407
|
+
repo_slug,
|
|
408
|
+
pipeline_uuid,
|
|
409
|
+
});
|
|
410
|
+
throw new McpError(ErrorCode.InternalError, `Failed to get pipeline steps: ${error instanceof Error ? error.message : String(error)}`);
|
|
411
|
+
}
|
|
412
|
+
},
|
|
413
|
+
getPipelineStep: async (args) => {
|
|
414
|
+
const workspace = args.workspace;
|
|
415
|
+
const repo_slug = args.repo_slug;
|
|
416
|
+
const pipeline_uuid = args.pipeline_uuid;
|
|
417
|
+
const step_uuid = args.step_uuid;
|
|
418
|
+
try {
|
|
419
|
+
logger.info("Getting pipeline step details", {
|
|
420
|
+
workspace,
|
|
421
|
+
repo_slug,
|
|
422
|
+
pipeline_uuid,
|
|
423
|
+
step_uuid,
|
|
424
|
+
});
|
|
425
|
+
const response = await client.api.get(`/repositories/${workspace}/${repo_slug}/pipelines/${pipeline_uuid}/steps/${step_uuid}`);
|
|
426
|
+
return jsonResponse(response.data);
|
|
427
|
+
}
|
|
428
|
+
catch (error) {
|
|
429
|
+
logger.error("Error getting pipeline step", {
|
|
430
|
+
error,
|
|
431
|
+
workspace,
|
|
432
|
+
repo_slug,
|
|
433
|
+
pipeline_uuid,
|
|
434
|
+
step_uuid,
|
|
435
|
+
});
|
|
436
|
+
throw new McpError(ErrorCode.InternalError, `Failed to get pipeline step: ${error instanceof Error ? error.message : String(error)}`);
|
|
437
|
+
}
|
|
438
|
+
},
|
|
439
|
+
getPipelineStepLogs: async (args) => {
|
|
440
|
+
const workspace = args.workspace;
|
|
441
|
+
const repo_slug = args.repo_slug;
|
|
442
|
+
const pipeline_uuid = args.pipeline_uuid;
|
|
443
|
+
const step_uuid = args.step_uuid;
|
|
444
|
+
const maxLines = args.max_lines;
|
|
445
|
+
const tail = args.tail;
|
|
446
|
+
const errorsOnly = args.errors_only;
|
|
447
|
+
const searchTerm = args.search_term;
|
|
448
|
+
const saveToFile = args.save_to_file;
|
|
449
|
+
try {
|
|
450
|
+
logger.info("Getting pipeline step logs", {
|
|
451
|
+
workspace,
|
|
452
|
+
repo_slug,
|
|
453
|
+
pipeline_uuid,
|
|
454
|
+
step_uuid,
|
|
455
|
+
maxLines,
|
|
456
|
+
tail,
|
|
457
|
+
errorsOnly,
|
|
458
|
+
searchTerm,
|
|
459
|
+
saveToFile,
|
|
460
|
+
});
|
|
461
|
+
const response = await client.api.get(`/repositories/${workspace}/${repo_slug}/pipelines/${pipeline_uuid}/steps/${step_uuid}/log`, {
|
|
462
|
+
maxRedirects: 5, // Follow redirects to S3
|
|
463
|
+
responseType: "text",
|
|
464
|
+
});
|
|
465
|
+
const rawLog = typeof response.data === "string"
|
|
466
|
+
? response.data
|
|
467
|
+
: response.data === undefined || response.data === null
|
|
468
|
+
? ""
|
|
469
|
+
: String(response.data);
|
|
470
|
+
const allLines = rawLog.length > 0 ? rawLog.split(/\r?\n/) : [];
|
|
471
|
+
const totalLines = allLines.length;
|
|
472
|
+
let filteredLines = allLines;
|
|
473
|
+
const normalizedSearch = searchTerm?.trim().toLowerCase();
|
|
474
|
+
if (errorsOnly) {
|
|
475
|
+
const errorRegex = /(error|failed|failure|exception|traceback|fatal)/i;
|
|
476
|
+
filteredLines = filteredLines.filter((line) => errorRegex.test(line));
|
|
477
|
+
}
|
|
478
|
+
if (normalizedSearch && normalizedSearch.length > 0) {
|
|
479
|
+
filteredLines = filteredLines.filter((line) => line.toLowerCase().includes(normalizedSearch));
|
|
480
|
+
}
|
|
481
|
+
const defaultMaxLines = 500;
|
|
482
|
+
const normalizedMaxLines = typeof maxLines === "number" && Number.isFinite(maxLines)
|
|
483
|
+
? Math.floor(maxLines)
|
|
484
|
+
: defaultMaxLines;
|
|
485
|
+
const resolvedMaxLines = Math.max(1, Math.min(normalizedMaxLines, 5000));
|
|
486
|
+
const hasLines = filteredLines.length > 0;
|
|
487
|
+
const limitedLines = hasLines
|
|
488
|
+
? tail
|
|
489
|
+
? filteredLines.slice(-resolvedMaxLines)
|
|
490
|
+
: filteredLines.slice(0, resolvedMaxLines)
|
|
491
|
+
: [];
|
|
492
|
+
const wasTruncated = hasLines && filteredLines.length > limitedLines.length;
|
|
493
|
+
const summaryParts = [`Total log lines: ${totalLines}.`];
|
|
494
|
+
if (errorsOnly || (normalizedSearch && normalizedSearch.length > 0)) {
|
|
495
|
+
summaryParts.push(`Lines after filtering: ${filteredLines.length}.`);
|
|
496
|
+
}
|
|
497
|
+
if (!hasLines) {
|
|
498
|
+
summaryParts.push("No log lines matched the provided filters.");
|
|
499
|
+
}
|
|
500
|
+
else {
|
|
501
|
+
summaryParts.push(`Showing ${limitedLines.length} ${tail ? "most recent" : "earliest"} lines${wasTruncated ? ` (limited to ${resolvedMaxLines} lines)` : ""}.`);
|
|
502
|
+
}
|
|
503
|
+
if (saveToFile) {
|
|
504
|
+
try {
|
|
505
|
+
const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), "bitbucket-mcp-"));
|
|
506
|
+
const safeFileName = `pipeline-${pipeline_uuid}-step-${step_uuid}.log`.replace(/[^a-zA-Z0-9._-]/g, "_");
|
|
507
|
+
const filePath = path.join(tempDir, safeFileName);
|
|
508
|
+
fs.writeFileSync(filePath, rawLog, "utf8");
|
|
509
|
+
summaryParts.push(`Full log saved to: ${filePath}`);
|
|
510
|
+
}
|
|
511
|
+
catch (fileError) {
|
|
512
|
+
logger.warn("Failed to save pipeline step log to file", {
|
|
513
|
+
error: fileError,
|
|
514
|
+
});
|
|
515
|
+
summaryParts.push("Attempted to save the full log to a temporary file, but writing failed.");
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
if (!saveToFile && wasTruncated) {
|
|
519
|
+
summaryParts.push("Use max_lines, tail, search_term, or save_to_file to refine or download the full log.");
|
|
520
|
+
}
|
|
521
|
+
const summary = summaryParts.join(" ");
|
|
522
|
+
const textContent = hasLines ? `${summary}\n\n${limitedLines.join("\n")}` : summary;
|
|
523
|
+
return textResponse(textContent);
|
|
524
|
+
}
|
|
525
|
+
catch (error) {
|
|
526
|
+
logger.error("Error getting pipeline step logs", {
|
|
527
|
+
error,
|
|
528
|
+
workspace,
|
|
529
|
+
repo_slug,
|
|
530
|
+
pipeline_uuid,
|
|
531
|
+
step_uuid,
|
|
532
|
+
});
|
|
533
|
+
throw new McpError(ErrorCode.InternalError, `Failed to get pipeline step logs: ${error instanceof Error ? error.message : String(error)}`);
|
|
534
|
+
}
|
|
535
|
+
},
|
|
536
|
+
}),
|
|
537
|
+
};
|
|
538
|
+
//# sourceMappingURL=pipelines.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pipelines.js","sourceRoot":"","sources":["../../src/handlers/pipelines.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,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