@zhanglc77/bitbucket-mcp-server 1.0.11 → 1.0.13

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 (52) hide show
  1. package/build/handlers/pull-request-handlers.d.ts.map +1 -1
  2. package/build/handlers/pull-request-handlers.js +5 -2
  3. package/build/handlers/pull-request-handlers.js.map +1 -1
  4. package/build/handlers/resource-handlers.d.ts +20 -0
  5. package/build/handlers/resource-handlers.d.ts.map +1 -0
  6. package/build/handlers/resource-handlers.js +32 -0
  7. package/build/handlers/resource-handlers.js.map +1 -0
  8. package/build/index.d.ts +1245 -4
  9. package/build/index.d.ts.map +1 -1
  10. package/build/index.js +25 -86
  11. package/build/index.js.map +1 -1
  12. package/build/resources/field-schemas.d.ts +11 -108
  13. package/build/resources/field-schemas.d.ts.map +1 -1
  14. package/build/resources/field-schemas.js +169 -871
  15. package/build/resources/field-schemas.js.map +1 -1
  16. package/build/resources/resource-definitions.d.ts +19 -0
  17. package/build/resources/resource-definitions.d.ts.map +1 -0
  18. package/build/resources/resource-definitions.js +327 -0
  19. package/build/resources/resource-definitions.js.map +1 -0
  20. package/build/tools/definitions.d.ts +19 -0
  21. package/build/tools/definitions.d.ts.map +1 -1
  22. package/build/tools/definitions.js +4 -0
  23. package/build/tools/definitions.js.map +1 -1
  24. package/build/types/guards.d.ts +1 -0
  25. package/build/types/guards.d.ts.map +1 -1
  26. package/build/types/guards.js +2 -1
  27. package/build/types/guards.js.map +1 -1
  28. package/build/utils/field-filter.d.ts +42 -0
  29. package/build/utils/field-filter.d.ts.map +1 -0
  30. package/build/utils/field-filter.js +224 -0
  31. package/build/utils/field-filter.js.map +1 -0
  32. package/package.json +1 -1
  33. package/build/resources/handlers.d.ts +0 -65
  34. package/build/resources/handlers.d.ts.map +0 -1
  35. package/build/resources/handlers.js +0 -571
  36. package/build/resources/handlers.js.map +0 -1
  37. package/build/resources/schema-handlers.d.ts +0 -44
  38. package/build/resources/schema-handlers.d.ts.map +0 -1
  39. package/build/resources/schema-handlers.js +0 -183
  40. package/build/resources/schema-handlers.js.map +0 -1
  41. package/build/resources/static-resources.d.ts +0 -20
  42. package/build/resources/static-resources.d.ts.map +0 -1
  43. package/build/resources/static-resources.js +0 -73
  44. package/build/resources/static-resources.js.map +0 -1
  45. package/build/resources/templates.d.ts +0 -4
  46. package/build/resources/templates.d.ts.map +0 -1
  47. package/build/resources/templates.js +0 -306
  48. package/build/resources/templates.js.map +0 -1
  49. package/build/utils/bitbucket-uri.d.ts +0 -52
  50. package/build/utils/bitbucket-uri.d.ts.map +0 -1
  51. package/build/utils/bitbucket-uri.js +0 -139
  52. package/build/utils/bitbucket-uri.js.map +0 -1
@@ -1,52 +0,0 @@
1
- /**
2
- * Bitbucket URI parser and handler
3
- * Supports both formats:
4
- * - bitbucket://workspace/repo/resourceType/...?params
5
- * - bitbucket:workspace/repo/resourceType/...?params
6
- */
7
- export declare class BitbucketURI {
8
- readonly original: string;
9
- readonly url: URL;
10
- readonly scheme: string;
11
- readonly workspace?: string;
12
- readonly repo?: string;
13
- readonly resourceType: string;
14
- readonly resourcePath?: string;
15
- readonly params: Record<string, string>;
16
- constructor(uriString: string);
17
- private _parseComponents;
18
- /**
19
- * Check if this is a schema URI
20
- */
21
- isSchemaUri(): boolean;
22
- /**
23
- * Check if this is a repository resource URI
24
- */
25
- isRepositoryUri(): boolean;
26
- /**
27
- * Get parameter value by key
28
- */
29
- getParam(key: string): string | undefined;
30
- /**
31
- * Get parameter value as number
32
- */
33
- getParamAsNumber(key: string): number | undefined;
34
- /**
35
- * Get parameter value as boolean
36
- */
37
- getParamAsBoolean(key: string): boolean | undefined;
38
- /**
39
- * Convert to plain object for debugging/logging
40
- */
41
- toJSON(): {
42
- original: string;
43
- scheme: string;
44
- workspace: string | undefined;
45
- repo: string | undefined;
46
- resourceType: string;
47
- resourcePath: string | undefined;
48
- params: Record<string, string>;
49
- };
50
- toString(): string;
51
- }
52
- //# sourceMappingURL=bitbucket-uri.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bitbucket-uri.d.ts","sourceRoot":"","sources":["../../src/utils/bitbucket-uri.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,qBAAa,YAAY;IACvB,SAAgB,QAAQ,EAAE,MAAM,CAAC;IACjC,SAAgB,GAAG,EAAE,GAAG,CAAC;IACzB,SAAgB,MAAM,EAAE,MAAM,CAAC;IAC/B,SAAgB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnC,SAAgB,IAAI,CAAC,EAAE,MAAM,CAAC;IAC9B,SAAgB,YAAY,EAAE,MAAM,CAAC;IACrC,SAAgB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtC,SAAgB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;gBAEnC,SAAS,EAAE,MAAM;IAkB7B,OAAO,CAAC,gBAAgB;IAiExB;;OAEG;IACH,WAAW,IAAI,OAAO;IAItB;;OAEG;IACH,eAAe,IAAI,OAAO;IAI1B;;OAEG;IACH,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAIzC;;OAEG;IACH,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAKjD;;OAEG;IACH,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS;IAKnD;;OAEG;IACH,MAAM;;;;;;;;;IAYN,QAAQ,IAAI,MAAM;CAGnB"}
@@ -1,139 +0,0 @@
1
- import { ErrorCode, McpError } from '@modelcontextprotocol/sdk/types.js';
2
- /**
3
- * Bitbucket URI parser and handler
4
- * Supports both formats:
5
- * - bitbucket://workspace/repo/resourceType/...?params
6
- * - bitbucket:workspace/repo/resourceType/...?params
7
- */
8
- export class BitbucketURI {
9
- original;
10
- url;
11
- scheme;
12
- workspace;
13
- repo;
14
- resourceType;
15
- resourcePath;
16
- params;
17
- constructor(uriString) {
18
- this.original = uriString;
19
- this.url = new URL(uriString);
20
- this.scheme = this.url.protocol;
21
- // Validate scheme
22
- if (this.url.protocol !== 'bitbucket:') {
23
- throw new McpError(ErrorCode.InvalidParams, `Invalid URI scheme: ${this.url.protocol}`);
24
- }
25
- const parseResult = this._parseComponents();
26
- this.workspace = parseResult.workspace;
27
- this.repo = parseResult.repo;
28
- this.resourceType = parseResult.resourceType;
29
- this.resourcePath = parseResult.resourcePath;
30
- this.params = parseResult.params;
31
- }
32
- _parseComponents() {
33
- let workspace;
34
- let repo;
35
- let resourceType;
36
- let resourcePath;
37
- if (this.url.hostname) {
38
- // Format: bitbucket://workspace/repo/resourceType/...
39
- workspace = this.url.hostname;
40
- const pathParts = this.url.pathname.split('/').filter(p => p);
41
- // Special handling for schema URIs: bitbucket://schema/...
42
- if (workspace === 'schema') {
43
- return {
44
- workspace: undefined,
45
- repo: undefined,
46
- resourceType: 'schema',
47
- resourcePath: pathParts.join('/'),
48
- params: Object.fromEntries(this.url.searchParams.entries())
49
- };
50
- }
51
- if (pathParts.length < 2) {
52
- throw new McpError(ErrorCode.InvalidParams, `Invalid URI format: ${this.original}. Expected bitbucket://workspace/repo/resourceType`);
53
- }
54
- const [repoName, resourceTypeName, ...remainingParts] = pathParts;
55
- repo = repoName;
56
- resourceType = resourceTypeName;
57
- resourcePath = remainingParts.length > 0 ? remainingParts.join('/') : undefined;
58
- }
59
- else {
60
- // Legacy format: bitbucket:workspace/repo/resourceType/...
61
- const pathParts = this.url.pathname.split('/').filter(p => p);
62
- // Special handling for schema URIs: bitbucket:schema/...
63
- if (pathParts.length >= 1 && pathParts[0] === 'schema') {
64
- return {
65
- workspace: undefined,
66
- repo: undefined,
67
- resourceType: 'schema',
68
- resourcePath: pathParts.slice(1).join('/'),
69
- params: Object.fromEntries(this.url.searchParams.entries())
70
- };
71
- }
72
- if (pathParts.length < 3) {
73
- throw new McpError(ErrorCode.InvalidParams, `Invalid URI format: ${this.original}. Expected bitbucket:workspace/repo/resourceType or bitbucket://workspace/repo/resourceType`);
74
- }
75
- const [workspaceName, repoName, resourceTypeName, ...remainingParts] = pathParts;
76
- workspace = workspaceName;
77
- repo = repoName;
78
- resourceType = resourceTypeName;
79
- resourcePath = remainingParts.length > 0 ? remainingParts.join('/') : undefined;
80
- }
81
- return {
82
- workspace,
83
- repo,
84
- resourceType,
85
- resourcePath,
86
- params: Object.fromEntries(this.url.searchParams.entries())
87
- };
88
- }
89
- /**
90
- * Check if this is a schema URI
91
- */
92
- isSchemaUri() {
93
- return this.resourceType === 'schema';
94
- }
95
- /**
96
- * Check if this is a repository resource URI
97
- */
98
- isRepositoryUri() {
99
- return !this.isSchemaUri() && !!this.workspace && !!this.repo;
100
- }
101
- /**
102
- * Get parameter value by key
103
- */
104
- getParam(key) {
105
- return this.params[key];
106
- }
107
- /**
108
- * Get parameter value as number
109
- */
110
- getParamAsNumber(key) {
111
- const value = this.params[key];
112
- return value ? parseInt(value) : undefined;
113
- }
114
- /**
115
- * Get parameter value as boolean
116
- */
117
- getParamAsBoolean(key) {
118
- const value = this.params[key];
119
- return value ? value === 'true' : undefined;
120
- }
121
- /**
122
- * Convert to plain object for debugging/logging
123
- */
124
- toJSON() {
125
- return {
126
- original: this.original,
127
- scheme: this.scheme,
128
- workspace: this.workspace,
129
- repo: this.repo,
130
- resourceType: this.resourceType,
131
- resourcePath: this.resourcePath,
132
- params: this.params
133
- };
134
- }
135
- toString() {
136
- return this.original;
137
- }
138
- }
139
- //# sourceMappingURL=bitbucket-uri.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"bitbucket-uri.js","sourceRoot":"","sources":["../../src/utils/bitbucket-uri.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAEzE;;;;;GAKG;AACH,MAAM,OAAO,YAAY;IACP,QAAQ,CAAS;IACjB,GAAG,CAAM;IACT,MAAM,CAAS;IACf,SAAS,CAAU;IACnB,IAAI,CAAU;IACd,YAAY,CAAS;IACrB,YAA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