mcp-server-bitbucket 0.11.0 → 0.12.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/dist/index.js +68 -0
- package/package.json +1 -1
- package/src/client.ts +38 -0
- package/src/tools/pipelines.ts +41 -0
- package/src/types.ts +9 -0
package/dist/index.js
CHANGED
|
@@ -505,6 +505,35 @@ var BitbucketClient = class _BitbucketClient {
|
|
|
505
505
|
const result = await this.getPipeline(repoSlug, pipelineUuid);
|
|
506
506
|
return result || { uuid: pipelineUuid, state: { name: "STOPPED" } };
|
|
507
507
|
}
|
|
508
|
+
// ==================== PIPELINE CONFIG ====================
|
|
509
|
+
async getPipelineConfig(repoSlug) {
|
|
510
|
+
const result = await this.request(
|
|
511
|
+
"GET",
|
|
512
|
+
this.repoPath(repoSlug, "pipelines_config")
|
|
513
|
+
);
|
|
514
|
+
if (!result) {
|
|
515
|
+
throw new BitbucketError(`Failed to get pipeline config for: ${repoSlug}`);
|
|
516
|
+
}
|
|
517
|
+
return result;
|
|
518
|
+
}
|
|
519
|
+
async updatePipelineConfig(repoSlug, options) {
|
|
520
|
+
const payload = {};
|
|
521
|
+
if (options.enabled !== void 0) {
|
|
522
|
+
payload.enabled = options.enabled;
|
|
523
|
+
}
|
|
524
|
+
if (Object.keys(payload).length === 0) {
|
|
525
|
+
throw new BitbucketError("No fields to update");
|
|
526
|
+
}
|
|
527
|
+
const result = await this.request(
|
|
528
|
+
"PUT",
|
|
529
|
+
this.repoPath(repoSlug, "pipelines_config"),
|
|
530
|
+
payload
|
|
531
|
+
);
|
|
532
|
+
if (!result) {
|
|
533
|
+
throw new BitbucketError(`Failed to update pipeline config for: ${repoSlug}`);
|
|
534
|
+
}
|
|
535
|
+
return result;
|
|
536
|
+
}
|
|
508
537
|
// ==================== PIPELINE VARIABLES ====================
|
|
509
538
|
async listPipelineVariables(repoSlug, options = {}) {
|
|
510
539
|
return this.paginatedList(
|
|
@@ -1459,6 +1488,29 @@ var definitions3 = [
|
|
|
1459
1488
|
},
|
|
1460
1489
|
required: ["repo_slug", "variable_uuid"]
|
|
1461
1490
|
}
|
|
1491
|
+
},
|
|
1492
|
+
{
|
|
1493
|
+
name: "get_pipeline_config",
|
|
1494
|
+
description: "Get pipeline configuration for a repository (check if pipelines are enabled).",
|
|
1495
|
+
inputSchema: {
|
|
1496
|
+
type: "object",
|
|
1497
|
+
properties: {
|
|
1498
|
+
repo_slug: { type: "string", description: "Repository slug" }
|
|
1499
|
+
},
|
|
1500
|
+
required: ["repo_slug"]
|
|
1501
|
+
}
|
|
1502
|
+
},
|
|
1503
|
+
{
|
|
1504
|
+
name: "update_pipeline_config",
|
|
1505
|
+
description: "Update pipeline configuration for a repository (enable or disable pipelines).",
|
|
1506
|
+
inputSchema: {
|
|
1507
|
+
type: "object",
|
|
1508
|
+
properties: {
|
|
1509
|
+
repo_slug: { type: "string", description: "Repository slug" },
|
|
1510
|
+
enabled: { type: "boolean", description: "Enable or disable pipelines" }
|
|
1511
|
+
},
|
|
1512
|
+
required: ["repo_slug", "enabled"]
|
|
1513
|
+
}
|
|
1462
1514
|
}
|
|
1463
1515
|
];
|
|
1464
1516
|
var handlers3 = {
|
|
@@ -1598,6 +1650,22 @@ var handlers3 = {
|
|
|
1598
1650
|
const client = getClient();
|
|
1599
1651
|
await client.deletePipelineVariable(args.repo_slug, args.variable_uuid);
|
|
1600
1652
|
return {};
|
|
1653
|
+
},
|
|
1654
|
+
get_pipeline_config: async (args) => {
|
|
1655
|
+
const client = getClient();
|
|
1656
|
+
const result = await client.getPipelineConfig(args.repo_slug);
|
|
1657
|
+
return {
|
|
1658
|
+
enabled: result.enabled
|
|
1659
|
+
};
|
|
1660
|
+
},
|
|
1661
|
+
update_pipeline_config: async (args) => {
|
|
1662
|
+
const client = getClient();
|
|
1663
|
+
const result = await client.updatePipelineConfig(args.repo_slug, {
|
|
1664
|
+
enabled: args.enabled
|
|
1665
|
+
});
|
|
1666
|
+
return {
|
|
1667
|
+
enabled: result.enabled
|
|
1668
|
+
};
|
|
1601
1669
|
}
|
|
1602
1670
|
};
|
|
1603
1671
|
|
package/package.json
CHANGED
package/src/client.ts
CHANGED
|
@@ -40,6 +40,7 @@ import type {
|
|
|
40
40
|
PaginatedResponse,
|
|
41
41
|
TriggerPipelineOptions,
|
|
42
42
|
PipelineTriggerVariable,
|
|
43
|
+
BitbucketPipelineConfig,
|
|
43
44
|
} from './types.js';
|
|
44
45
|
|
|
45
46
|
/**
|
|
@@ -628,6 +629,43 @@ export class BitbucketClient {
|
|
|
628
629
|
return result || { uuid: pipelineUuid, state: { name: 'STOPPED' } };
|
|
629
630
|
}
|
|
630
631
|
|
|
632
|
+
// ==================== PIPELINE CONFIG ====================
|
|
633
|
+
|
|
634
|
+
async getPipelineConfig(repoSlug: string): Promise<BitbucketPipelineConfig> {
|
|
635
|
+
const result = await this.request<BitbucketPipelineConfig>(
|
|
636
|
+
'GET',
|
|
637
|
+
this.repoPath(repoSlug, 'pipelines_config')
|
|
638
|
+
);
|
|
639
|
+
if (!result) {
|
|
640
|
+
throw new BitbucketError(`Failed to get pipeline config for: ${repoSlug}`);
|
|
641
|
+
}
|
|
642
|
+
return result;
|
|
643
|
+
}
|
|
644
|
+
|
|
645
|
+
async updatePipelineConfig(
|
|
646
|
+
repoSlug: string,
|
|
647
|
+
options: { enabled?: boolean }
|
|
648
|
+
): Promise<BitbucketPipelineConfig> {
|
|
649
|
+
const payload: Record<string, unknown> = {};
|
|
650
|
+
if (options.enabled !== undefined) {
|
|
651
|
+
payload.enabled = options.enabled;
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
if (Object.keys(payload).length === 0) {
|
|
655
|
+
throw new BitbucketError('No fields to update');
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
const result = await this.request<BitbucketPipelineConfig>(
|
|
659
|
+
'PUT',
|
|
660
|
+
this.repoPath(repoSlug, 'pipelines_config'),
|
|
661
|
+
payload
|
|
662
|
+
);
|
|
663
|
+
if (!result) {
|
|
664
|
+
throw new BitbucketError(`Failed to update pipeline config for: ${repoSlug}`);
|
|
665
|
+
}
|
|
666
|
+
return result;
|
|
667
|
+
}
|
|
668
|
+
|
|
631
669
|
// ==================== PIPELINE VARIABLES ====================
|
|
632
670
|
|
|
633
671
|
async listPipelineVariables(
|
package/src/tools/pipelines.ts
CHANGED
|
@@ -146,6 +146,29 @@ export const definitions: Tool[] = [
|
|
|
146
146
|
required: ['repo_slug', 'variable_uuid'],
|
|
147
147
|
},
|
|
148
148
|
},
|
|
149
|
+
{
|
|
150
|
+
name: 'get_pipeline_config',
|
|
151
|
+
description: 'Get pipeline configuration for a repository (check if pipelines are enabled).',
|
|
152
|
+
inputSchema: {
|
|
153
|
+
type: 'object',
|
|
154
|
+
properties: {
|
|
155
|
+
repo_slug: { type: 'string', description: 'Repository slug' },
|
|
156
|
+
},
|
|
157
|
+
required: ['repo_slug'],
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
name: 'update_pipeline_config',
|
|
162
|
+
description: 'Update pipeline configuration for a repository (enable or disable pipelines).',
|
|
163
|
+
inputSchema: {
|
|
164
|
+
type: 'object',
|
|
165
|
+
properties: {
|
|
166
|
+
repo_slug: { type: 'string', description: 'Repository slug' },
|
|
167
|
+
enabled: { type: 'boolean', description: 'Enable or disable pipelines' },
|
|
168
|
+
},
|
|
169
|
+
required: ['repo_slug', 'enabled'],
|
|
170
|
+
},
|
|
171
|
+
},
|
|
149
172
|
];
|
|
150
173
|
|
|
151
174
|
export const handlers: Record<string, (args: Record<string, unknown>) => Promise<Record<string, unknown>>> = {
|
|
@@ -297,5 +320,23 @@ export const handlers: Record<string, (args: Record<string, unknown>) => Promise
|
|
|
297
320
|
await client.deletePipelineVariable(args.repo_slug as string, args.variable_uuid as string);
|
|
298
321
|
return {};
|
|
299
322
|
},
|
|
323
|
+
|
|
324
|
+
get_pipeline_config: async (args) => {
|
|
325
|
+
const client = getClient();
|
|
326
|
+
const result = await client.getPipelineConfig(args.repo_slug as string);
|
|
327
|
+
return {
|
|
328
|
+
enabled: result.enabled,
|
|
329
|
+
};
|
|
330
|
+
},
|
|
331
|
+
|
|
332
|
+
update_pipeline_config: async (args) => {
|
|
333
|
+
const client = getClient();
|
|
334
|
+
const result = await client.updatePipelineConfig(args.repo_slug as string, {
|
|
335
|
+
enabled: args.enabled as boolean,
|
|
336
|
+
});
|
|
337
|
+
return {
|
|
338
|
+
enabled: result.enabled,
|
|
339
|
+
};
|
|
340
|
+
},
|
|
300
341
|
};
|
|
301
342
|
|
package/src/types.ts
CHANGED
|
@@ -144,6 +144,15 @@ export interface BitbucketPipelineVariable {
|
|
|
144
144
|
secured: boolean;
|
|
145
145
|
}
|
|
146
146
|
|
|
147
|
+
export interface BitbucketPipelineConfig {
|
|
148
|
+
enabled: boolean;
|
|
149
|
+
type?: string;
|
|
150
|
+
repository?: {
|
|
151
|
+
uuid?: string;
|
|
152
|
+
full_name?: string;
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
|
|
147
156
|
// ==================== PIPELINE TRIGGER OPTIONS ====================
|
|
148
157
|
|
|
149
158
|
export interface PipelineTriggerVariable {
|