@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/logger.js
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import winston from "winston";
|
|
2
|
+
import os from "os";
|
|
3
|
+
import path from "path";
|
|
4
|
+
import fs from "fs";
|
|
5
|
+
// =========== LOGGER SETUP ==========
|
|
6
|
+
// File-based logging with sensible defaults and ability to disable
|
|
7
|
+
function getDefaultLogDirectory() {
|
|
8
|
+
if (process.platform === "win32") {
|
|
9
|
+
const base = process.env.LOCALAPPDATA || path.join(os.homedir(), "AppData", "Local");
|
|
10
|
+
return path.join(base, "bitbucket-mcp");
|
|
11
|
+
}
|
|
12
|
+
if (process.platform === "darwin") {
|
|
13
|
+
return path.join(os.homedir(), "Library", "Logs", "bitbucket-mcp");
|
|
14
|
+
}
|
|
15
|
+
const xdgStateHome = process.env.XDG_STATE_HOME;
|
|
16
|
+
if (xdgStateHome && xdgStateHome.length > 0) {
|
|
17
|
+
return path.join(xdgStateHome, "bitbucket-mcp");
|
|
18
|
+
}
|
|
19
|
+
return path.join(os.homedir(), ".local", "state", "bitbucket-mcp");
|
|
20
|
+
}
|
|
21
|
+
export function isTruthyEnv(value) {
|
|
22
|
+
if (value === undefined || value === null)
|
|
23
|
+
return false;
|
|
24
|
+
const normalized = String(value).toLowerCase();
|
|
25
|
+
return ["1", "true", "yes", "on"].includes(normalized);
|
|
26
|
+
}
|
|
27
|
+
function getLogFilePath() {
|
|
28
|
+
if (isTruthyEnv(process.env.BITBUCKET_LOG_DISABLE)) {
|
|
29
|
+
return undefined;
|
|
30
|
+
}
|
|
31
|
+
const explicitFile = process.env.BITBUCKET_LOG_FILE;
|
|
32
|
+
if (explicitFile && explicitFile.trim().length > 0) {
|
|
33
|
+
return explicitFile;
|
|
34
|
+
}
|
|
35
|
+
const baseDir = process.env.BITBUCKET_LOG_DIR && process.env.BITBUCKET_LOG_DIR.trim().length > 0
|
|
36
|
+
? process.env.BITBUCKET_LOG_DIR
|
|
37
|
+
: getDefaultLogDirectory();
|
|
38
|
+
let effectiveDir = baseDir;
|
|
39
|
+
if (isTruthyEnv(process.env.BITBUCKET_LOG_PER_CWD)) {
|
|
40
|
+
const sanitizedCwd = process
|
|
41
|
+
.cwd()
|
|
42
|
+
.replace(/[\\/]/g, "_")
|
|
43
|
+
.replace(/[:*?"<>|]/g, "");
|
|
44
|
+
effectiveDir = path.join(baseDir, sanitizedCwd);
|
|
45
|
+
}
|
|
46
|
+
try {
|
|
47
|
+
fs.mkdirSync(effectiveDir, { recursive: true });
|
|
48
|
+
}
|
|
49
|
+
catch {
|
|
50
|
+
return undefined; // If we cannot create the directory, disable file logging rather than polluting CWD
|
|
51
|
+
}
|
|
52
|
+
return path.join(effectiveDir, "bitbucket.log");
|
|
53
|
+
}
|
|
54
|
+
const resolvedLogFile = getLogFilePath();
|
|
55
|
+
export const logger = winston.createLogger({
|
|
56
|
+
level: "info",
|
|
57
|
+
format: winston.format.json(),
|
|
58
|
+
transports: resolvedLogFile ? [new winston.transports.File({ filename: resolvedLogFile })] : [],
|
|
59
|
+
});
|
|
60
|
+
//# sourceMappingURL=logger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,IAAI,CAAC;AAEpB,sCAAsC;AACtC,mEAAmE;AACnE,SAAS,sBAAsB;IAC7B,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE,CAAC;QACjC,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY,IAAI,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;QACrF,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC;IAC1C,CAAC;IACD,IAAI,OAAO,CAAC,QAAQ,KAAK,QAAQ,EAAE,CAAC;QAClC,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,eAAe,CAAC,CAAC;IACrE,CAAC;IACD,MAAM,YAAY,GAAG,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC;IAChD,IAAI,YAAY,IAAI,YAAY,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC5C,OAAO,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,eAAe,CAAC,CAAC;IAClD,CAAC;IACD,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAA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;IAC5D,CAAC;IAED,IAAI,CAAC;QACH,EAAE,CAAC,SAAS,CAAC,YAAY,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAClD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC,CAAC,oFAAoF;IACxG,CAAC;IAED,OAAO,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,eAAe,CAAC,CAAC;AAClD,CAAC;AAED,MAAM,eAAe,GAAG,cAAc,EAAE,CAAC;AACzC,MAAM,CAAC,MAAM,MAAM,GAAG,OAAO,CAAC,YAAY,CAAC;IACzC,KAAK,EAAE,MAAM;IACb,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE;IAC7B,UAAU,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,eAAe,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE;CAChG,CAAC,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { AxiosInstance } from "axios";
|
|
2
|
+
import type winston from "winston";
|
|
3
|
+
export declare const BITBUCKET_DEFAULT_PAGELEN = 10;
|
|
4
|
+
export declare const BITBUCKET_MAX_PAGELEN = 100;
|
|
5
|
+
export declare const BITBUCKET_ALL_ITEMS_CAP = 1000;
|
|
6
|
+
export interface PaginationRequestOptions {
|
|
7
|
+
pagelen?: number;
|
|
8
|
+
page?: number;
|
|
9
|
+
all?: boolean;
|
|
10
|
+
params?: Record<string, unknown>;
|
|
11
|
+
defaultPagelen?: number;
|
|
12
|
+
maxItems?: number;
|
|
13
|
+
description?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface PaginatedValuesResult<T> {
|
|
16
|
+
values: T[];
|
|
17
|
+
page?: number;
|
|
18
|
+
pagelen: number;
|
|
19
|
+
next?: string;
|
|
20
|
+
fetchedPages: number;
|
|
21
|
+
totalFetched: number;
|
|
22
|
+
previous?: string;
|
|
23
|
+
}
|
|
24
|
+
export declare class BitbucketPaginator {
|
|
25
|
+
private readonly api;
|
|
26
|
+
private readonly logger;
|
|
27
|
+
constructor(api: AxiosInstance, logger: winston.Logger);
|
|
28
|
+
fetchValues<T>(path: string, options?: PaginationRequestOptions): Promise<PaginatedValuesResult<T>>;
|
|
29
|
+
private performRequest;
|
|
30
|
+
private extractValues;
|
|
31
|
+
private normalizePagelen;
|
|
32
|
+
}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
export const BITBUCKET_DEFAULT_PAGELEN = 10;
|
|
2
|
+
export const BITBUCKET_MAX_PAGELEN = 100;
|
|
3
|
+
export const BITBUCKET_ALL_ITEMS_CAP = 1000;
|
|
4
|
+
export class BitbucketPaginator {
|
|
5
|
+
constructor(api, logger) {
|
|
6
|
+
this.api = api;
|
|
7
|
+
this.logger = logger;
|
|
8
|
+
}
|
|
9
|
+
async fetchValues(path, options = {}) {
|
|
10
|
+
const { pagelen, page, all = false, params = {}, defaultPagelen = BITBUCKET_DEFAULT_PAGELEN, maxItems = BITBUCKET_ALL_ITEMS_CAP, description, } = options;
|
|
11
|
+
const resolvedPagelen = this.normalizePagelen(pagelen ?? defaultPagelen);
|
|
12
|
+
const requestParams = {
|
|
13
|
+
...params,
|
|
14
|
+
pagelen: resolvedPagelen,
|
|
15
|
+
};
|
|
16
|
+
if (page !== undefined) {
|
|
17
|
+
requestParams.page = page;
|
|
18
|
+
}
|
|
19
|
+
const shouldFetchAll = all === true && page === undefined;
|
|
20
|
+
const requestDescriptor = {
|
|
21
|
+
url: path,
|
|
22
|
+
params: requestParams,
|
|
23
|
+
};
|
|
24
|
+
if (!shouldFetchAll) {
|
|
25
|
+
const response = await this.performRequest(requestDescriptor, description);
|
|
26
|
+
const values = this.extractValues(response.data);
|
|
27
|
+
return {
|
|
28
|
+
values,
|
|
29
|
+
page: response.data?.page ?? page,
|
|
30
|
+
pagelen: response.data?.pagelen ?? resolvedPagelen,
|
|
31
|
+
next: response.data?.next,
|
|
32
|
+
previous: response.data?.previous,
|
|
33
|
+
fetchedPages: 1,
|
|
34
|
+
totalFetched: values.length,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
const aggregated = [];
|
|
38
|
+
let fetchedPages = 0;
|
|
39
|
+
let nextRequest = requestDescriptor;
|
|
40
|
+
let firstPageMeta = { pagelen: resolvedPagelen };
|
|
41
|
+
while (nextRequest && aggregated.length < maxItems) {
|
|
42
|
+
const response = await this.performRequest(nextRequest, description, {
|
|
43
|
+
page: fetchedPages + 1,
|
|
44
|
+
});
|
|
45
|
+
fetchedPages += 1;
|
|
46
|
+
if (fetchedPages === 1) {
|
|
47
|
+
firstPageMeta = {
|
|
48
|
+
page: response.data?.page,
|
|
49
|
+
pagelen: response.data?.pagelen ?? resolvedPagelen,
|
|
50
|
+
previous: response.data?.previous,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
const values = this.extractValues(response.data);
|
|
54
|
+
aggregated.push(...values);
|
|
55
|
+
if (!response.data?.next) {
|
|
56
|
+
break;
|
|
57
|
+
}
|
|
58
|
+
if (aggregated.length >= maxItems) {
|
|
59
|
+
this.logger.debug("Bitbucket pagination cap reached", {
|
|
60
|
+
description: description ?? path,
|
|
61
|
+
maxItems,
|
|
62
|
+
});
|
|
63
|
+
break;
|
|
64
|
+
}
|
|
65
|
+
this.logger.debug("Following Bitbucket pagination next link", {
|
|
66
|
+
description: description ?? path,
|
|
67
|
+
next: response.data.next,
|
|
68
|
+
fetchedPages,
|
|
69
|
+
totalFetched: aggregated.length,
|
|
70
|
+
});
|
|
71
|
+
nextRequest = { url: response.data.next };
|
|
72
|
+
}
|
|
73
|
+
if (aggregated.length > maxItems) {
|
|
74
|
+
aggregated.length = maxItems;
|
|
75
|
+
}
|
|
76
|
+
return {
|
|
77
|
+
values: aggregated,
|
|
78
|
+
page: firstPageMeta.page,
|
|
79
|
+
pagelen: firstPageMeta.pagelen,
|
|
80
|
+
previous: firstPageMeta.previous,
|
|
81
|
+
fetchedPages,
|
|
82
|
+
totalFetched: aggregated.length,
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
async performRequest(request, description, extra) {
|
|
86
|
+
this.logger.debug("Calling Bitbucket API", {
|
|
87
|
+
description: description ?? request.url,
|
|
88
|
+
url: request.url,
|
|
89
|
+
params: request.params,
|
|
90
|
+
...extra,
|
|
91
|
+
});
|
|
92
|
+
const config = request.params ? { params: request.params } : undefined;
|
|
93
|
+
return this.api.get(request.url, config);
|
|
94
|
+
}
|
|
95
|
+
extractValues(data) {
|
|
96
|
+
const d = data;
|
|
97
|
+
if (Array.isArray(d?.values)) {
|
|
98
|
+
return d.values;
|
|
99
|
+
}
|
|
100
|
+
if (Array.isArray(data)) {
|
|
101
|
+
return data;
|
|
102
|
+
}
|
|
103
|
+
return [];
|
|
104
|
+
}
|
|
105
|
+
normalizePagelen(value) {
|
|
106
|
+
if (value === undefined || Number.isNaN(value)) {
|
|
107
|
+
return BITBUCKET_DEFAULT_PAGELEN;
|
|
108
|
+
}
|
|
109
|
+
const integer = Math.floor(value);
|
|
110
|
+
if (!Number.isFinite(integer) || integer < 1) {
|
|
111
|
+
return 1;
|
|
112
|
+
}
|
|
113
|
+
return Math.min(integer, BITBUCKET_MAX_PAGELEN);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
//# sourceMappingURL=pagination.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagination.js","sourceRoot":"","sources":["../src/pagination.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,MAAM,yBAAyB,GAAG,EAAE,CAAC;AAC5C,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,CAAC;AACzC,MAAM,CAAC,MAAM,uBAAuB,GAAG,IAAI,CAAC;AA2B5C,MAAM,OAAO,kBAAkB;IAC7B,YACmB,GAAkB,EAClB,MAAsB;QADtB,QAAG,GAAH,GAAG,CAAe;QAClB,WAAM,GAAN,MAAM,CAAgB;IAC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B,CAAC;QACD,OAAO,EAAE,CAAC;IACZ,CAAC;IAEO,gBAAgB,CAAC,KAAc;QACrC,IAAI,KAAK,KAAK,SAAS,IAAI,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;YAC/C,OAAO,yBAAyB,CAAC;QACnC,CAAC;QACD,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAClC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,OAAO,GAAG,CAAC,EAAE,CAAC;YAC7C,OAAO,CAAC,CAAC;QACX,CAAC;QACD,OAAO,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,qBAAqB,CAAC,CAAC;IAClD,CAAC;CACF"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export declare const PAGINATION_BASE_SCHEMA: {
|
|
2
|
+
pagelen: {
|
|
3
|
+
type: string;
|
|
4
|
+
minimum: number;
|
|
5
|
+
maximum: number;
|
|
6
|
+
description: string;
|
|
7
|
+
};
|
|
8
|
+
page: {
|
|
9
|
+
type: string;
|
|
10
|
+
minimum: number;
|
|
11
|
+
description: string;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export declare const PAGINATION_ALL_SCHEMA: {
|
|
15
|
+
type: string;
|
|
16
|
+
description: string;
|
|
17
|
+
};
|
|
18
|
+
export declare const LEGACY_LIMIT_SCHEMA: {
|
|
19
|
+
type: string;
|
|
20
|
+
description: string;
|
|
21
|
+
};
|
package/dist/schemas.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { BITBUCKET_ALL_ITEMS_CAP, BITBUCKET_DEFAULT_PAGELEN, BITBUCKET_MAX_PAGELEN, } from "./pagination.js";
|
|
2
|
+
export const PAGINATION_BASE_SCHEMA = {
|
|
3
|
+
pagelen: {
|
|
4
|
+
type: "number",
|
|
5
|
+
minimum: 1,
|
|
6
|
+
maximum: BITBUCKET_MAX_PAGELEN,
|
|
7
|
+
description: `Number of items per page (Bitbucket pagelen). Defaults to ${BITBUCKET_DEFAULT_PAGELEN} and caps at ${BITBUCKET_MAX_PAGELEN}.`,
|
|
8
|
+
},
|
|
9
|
+
page: {
|
|
10
|
+
type: "number",
|
|
11
|
+
minimum: 1,
|
|
12
|
+
description: "Bitbucket page number to fetch (1-based).",
|
|
13
|
+
},
|
|
14
|
+
};
|
|
15
|
+
export const PAGINATION_ALL_SCHEMA = {
|
|
16
|
+
type: "boolean",
|
|
17
|
+
description: `When true (and no page is provided), automatically follows Bitbucket next links to return all items up to ${BITBUCKET_ALL_ITEMS_CAP}.`,
|
|
18
|
+
};
|
|
19
|
+
export const LEGACY_LIMIT_SCHEMA = {
|
|
20
|
+
type: "number",
|
|
21
|
+
description: "Deprecated alias for pagelen. Use pagelen/page/all for pagination control.",
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=schemas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.js","sourceRoot":"","sources":["../src/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,yBAAyB,EACzB,qBAAqB,GACtB,MAAM,iBAAiB,CAAC;AAEzB,MAAM,CAAC,MAAM,sBAAsB,GAAG;IACpC,OAAO,EAAE;QACP,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,CAAC;QACV,OAAO,EAAE,qBAAqB;QAC9B,WAAW,EAAE,6DAA6D,yBAAyB,gBAAgB,qBAAqB,GAAG;KAC5I;IACD,IAAI,EAAE;QACJ,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,CAAC;QACV,WAAW,EAAE,2CAA2C;KACzD;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,IAAI,EAAE,SAAS;IACf,WAAW,EAAE,6GAA6G,uBAAuB,GAAG;CACrJ,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,IAAI,EAAE,QAAQ;IACd,WAAW,EAAE,4EAA4E;CAC1F,CAAC"}
|
package/dist/server.d.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { BitbucketConfig } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Bitbucket MCP Server with modular handlers
|
|
4
|
+
*/
|
|
5
|
+
export declare class BitbucketMcpServer {
|
|
6
|
+
private readonly server;
|
|
7
|
+
private readonly client;
|
|
8
|
+
private readonly config;
|
|
9
|
+
private readonly toolHandlers;
|
|
10
|
+
private readonly toolDefinitions;
|
|
11
|
+
private readonly dangerousToolNames;
|
|
12
|
+
constructor(config: BitbucketConfig);
|
|
13
|
+
/**
|
|
14
|
+
* Register all handler modules
|
|
15
|
+
*/
|
|
16
|
+
private registerHandlers;
|
|
17
|
+
/**
|
|
18
|
+
* Check if a tool is considered dangerous
|
|
19
|
+
*/
|
|
20
|
+
private isDangerousTool;
|
|
21
|
+
/**
|
|
22
|
+
* Setup MCP tool routing
|
|
23
|
+
*/
|
|
24
|
+
private setupToolRouting;
|
|
25
|
+
/**
|
|
26
|
+
* Start the server with stdio transport
|
|
27
|
+
*/
|
|
28
|
+
run(): Promise<void>;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Create and run server from environment config
|
|
32
|
+
*/
|
|
33
|
+
export declare function main(): Promise<void>;
|
package/dist/server.js
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
2
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
3
|
+
import { CallToolRequestSchema, ErrorCode, ListToolsRequestSchema, McpError, } from "@modelcontextprotocol/sdk/types.js";
|
|
4
|
+
import axios from "axios";
|
|
5
|
+
import { BitbucketClient } from "./client.js";
|
|
6
|
+
import { loadConfigFromEnv } from "./config.js";
|
|
7
|
+
import { logger } from "./logger.js";
|
|
8
|
+
import { allModules } from "./handlers/index.js";
|
|
9
|
+
/**
|
|
10
|
+
* Bitbucket MCP Server with modular handlers
|
|
11
|
+
*/
|
|
12
|
+
export class BitbucketMcpServer {
|
|
13
|
+
constructor(config) {
|
|
14
|
+
this.toolHandlers = new Map();
|
|
15
|
+
this.toolDefinitions = [];
|
|
16
|
+
this.dangerousToolNames = new Set();
|
|
17
|
+
this.config = config;
|
|
18
|
+
this.client = new BitbucketClient(config);
|
|
19
|
+
this.server = new Server({
|
|
20
|
+
name: "bitbucket-mcp-server",
|
|
21
|
+
version: "1.0.0",
|
|
22
|
+
}, {
|
|
23
|
+
capabilities: {
|
|
24
|
+
tools: {},
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
this.registerHandlers();
|
|
28
|
+
this.setupToolRouting();
|
|
29
|
+
this.server.onerror = (error) => logger.error("[MCP Error]", error);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Register all handler modules
|
|
33
|
+
*/
|
|
34
|
+
registerHandlers() {
|
|
35
|
+
for (const module of allModules) {
|
|
36
|
+
// Collect dangerous tool names
|
|
37
|
+
if (module.dangerousTools) {
|
|
38
|
+
for (const name of module.dangerousTools) {
|
|
39
|
+
this.dangerousToolNames.add(name);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
// Filter tools based on dangerous flag
|
|
43
|
+
for (const tool of module.tools) {
|
|
44
|
+
const isDangerous = this.isDangerousTool(tool.name);
|
|
45
|
+
if (isDangerous && !this.config.allowDangerousCommands) {
|
|
46
|
+
logger.info(`Skipping dangerous tool: ${tool.name}`);
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
this.toolDefinitions.push(tool);
|
|
50
|
+
}
|
|
51
|
+
// Create handlers
|
|
52
|
+
const handlers = module.createHandlers(this.client);
|
|
53
|
+
for (const [name, handler] of Object.entries(handlers)) {
|
|
54
|
+
const isDangerous = this.isDangerousTool(name);
|
|
55
|
+
if (isDangerous && !this.config.allowDangerousCommands) {
|
|
56
|
+
continue;
|
|
57
|
+
}
|
|
58
|
+
this.toolHandlers.set(name, handler);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
logger.info(`Registered ${this.toolDefinitions.length} tools`);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Check if a tool is considered dangerous
|
|
65
|
+
*/
|
|
66
|
+
isDangerousTool(name) {
|
|
67
|
+
if (this.dangerousToolNames.has(name))
|
|
68
|
+
return true;
|
|
69
|
+
if (/^delete/i.test(name))
|
|
70
|
+
return true;
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Setup MCP tool routing
|
|
75
|
+
*/
|
|
76
|
+
setupToolRouting() {
|
|
77
|
+
// List tools handler
|
|
78
|
+
this.server.setRequestHandler(ListToolsRequestSchema, async () => ({
|
|
79
|
+
tools: this.toolDefinitions,
|
|
80
|
+
}));
|
|
81
|
+
// Call tool handler
|
|
82
|
+
this.server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
83
|
+
const { name, arguments: args } = request.params;
|
|
84
|
+
logger.info(`Tool called: ${name}`, { args });
|
|
85
|
+
const handler = this.toolHandlers.get(name);
|
|
86
|
+
if (!handler) {
|
|
87
|
+
throw new McpError(ErrorCode.MethodNotFound, `Unknown tool: ${name}`);
|
|
88
|
+
}
|
|
89
|
+
try {
|
|
90
|
+
return await handler(args ?? {});
|
|
91
|
+
}
|
|
92
|
+
catch (error) {
|
|
93
|
+
logger.error("Tool execution error", { error, tool: name });
|
|
94
|
+
if (axios.isAxiosError(error)) {
|
|
95
|
+
throw new McpError(ErrorCode.InternalError, `Bitbucket API error: ${error.response?.data?.message ?? error.message}`);
|
|
96
|
+
}
|
|
97
|
+
throw error;
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Start the server with stdio transport
|
|
103
|
+
*/
|
|
104
|
+
async run() {
|
|
105
|
+
const transport = new StdioServerTransport();
|
|
106
|
+
await this.server.connect(transport);
|
|
107
|
+
logger.info("Bitbucket MCP server running on stdio");
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Create and run server from environment config
|
|
112
|
+
*/
|
|
113
|
+
export async function main() {
|
|
114
|
+
try {
|
|
115
|
+
const config = loadConfigFromEnv();
|
|
116
|
+
const server = new BitbucketMcpServer(config);
|
|
117
|
+
await server.run();
|
|
118
|
+
}
|
|
119
|
+
catch (error) {
|
|
120
|
+
logger.error("Server startup error", { error });
|
|
121
|
+
process.exit(1);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EACL,qBAAqB,EACrB,SAAS,EACT,sBAAsB,EACtB,QAAQ,GACT,MAAM,oCAAoC,CAAC;AAC5C,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAGjD;;GAEG;AACH,MAAM,OAAO,kBAAkB;IAQ7B,YAAY,MAAuB;QAJlB,iBAAY,GAA6B,IAAI,GAAG,EAAE,CAAC;QACnD,oBAAe,GAAqB,EAAE,CAAC;QACvC,uBAAkB,GAAgB,IAAI,GAAG,EAAE,CAAC;QAG3D,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,IAAI,eAAe,CAAC,MAAM,CAAC,CAAC;QAE1C,IAAI,CAAC,MAAM,GAAG,IAAI,MAAM,CACtB;YACE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