@mcp-abap-adt/calm-server 0.1.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.
Files changed (200) hide show
  1. package/CHANGELOG.md +53 -0
  2. package/LICENSE +22 -0
  3. package/README.md +213 -0
  4. package/dist/bin/stdio.d.ts +3 -0
  5. package/dist/bin/stdio.d.ts.map +1 -0
  6. package/dist/bin/stdio.js +15 -0
  7. package/dist/bin/stdio.js.map +1 -0
  8. package/dist/index.d.ts +14 -0
  9. package/dist/index.d.ts.map +1 -0
  10. package/dist/index.js +34 -0
  11. package/dist/index.js.map +1 -0
  12. package/dist/registry/CalmToolRegistry.d.ts +27 -0
  13. package/dist/registry/CalmToolRegistry.d.ts.map +1 -0
  14. package/dist/registry/CalmToolRegistry.js +62 -0
  15. package/dist/registry/CalmToolRegistry.js.map +1 -0
  16. package/dist/registry/HandlerGroup.d.ts +14 -0
  17. package/dist/registry/HandlerGroup.d.ts.map +1 -0
  18. package/dist/registry/HandlerGroup.js +24 -0
  19. package/dist/registry/HandlerGroup.js.map +1 -0
  20. package/dist/registry/index.d.ts +5 -0
  21. package/dist/registry/index.d.ts.map +1 -0
  22. package/dist/registry/index.js +10 -0
  23. package/dist/registry/index.js.map +1 -0
  24. package/dist/registry/jsonSchemaToZod.d.ts +13 -0
  25. package/dist/registry/jsonSchemaToZod.d.ts.map +1 -0
  26. package/dist/registry/jsonSchemaToZod.js +57 -0
  27. package/dist/registry/jsonSchemaToZod.js.map +1 -0
  28. package/dist/registry/types.d.ts +59 -0
  29. package/dist/registry/types.d.ts.map +1 -0
  30. package/dist/registry/types.js +3 -0
  31. package/dist/registry/types.js.map +1 -0
  32. package/dist/server/BaseCalmMcpServer.d.ts +37 -0
  33. package/dist/server/BaseCalmMcpServer.d.ts.map +1 -0
  34. package/dist/server/BaseCalmMcpServer.js +44 -0
  35. package/dist/server/BaseCalmMcpServer.js.map +1 -0
  36. package/dist/server/buildClient.d.ts +10 -0
  37. package/dist/server/buildClient.d.ts.map +1 -0
  38. package/dist/server/buildClient.js +74 -0
  39. package/dist/server/buildClient.js.map +1 -0
  40. package/dist/server/config.d.ts +18 -0
  41. package/dist/server/config.d.ts.map +1 -0
  42. package/dist/server/config.js +58 -0
  43. package/dist/server/config.js.map +1 -0
  44. package/dist/server/index.d.ts +5 -0
  45. package/dist/server/index.d.ts.map +1 -0
  46. package/dist/server/index.js +13 -0
  47. package/dist/server/index.js.map +1 -0
  48. package/dist/server/runStdio.d.ts +12 -0
  49. package/dist/server/runStdio.d.ts.map +1 -0
  50. package/dist/server/runStdio.js +48 -0
  51. package/dist/server/runStdio.js.map +1 -0
  52. package/dist/tools/analytics/index.d.ts +8 -0
  53. package/dist/tools/analytics/index.d.ts.map +1 -0
  54. package/dist/tools/analytics/index.js +16 -0
  55. package/dist/tools/analytics/index.js.map +1 -0
  56. package/dist/tools/analytics/listAnalyticsProviders.d.ts +5 -0
  57. package/dist/tools/analytics/listAnalyticsProviders.d.ts.map +1 -0
  58. package/dist/tools/analytics/listAnalyticsProviders.js +16 -0
  59. package/dist/tools/analytics/listAnalyticsProviders.js.map +1 -0
  60. package/dist/tools/analytics/queryAnalytics.d.ts +15 -0
  61. package/dist/tools/analytics/queryAnalytics.d.ts.map +1 -0
  62. package/dist/tools/analytics/queryAnalytics.js +61 -0
  63. package/dist/tools/analytics/queryAnalytics.js.map +1 -0
  64. package/dist/tools/documents/getDocument.d.ts +7 -0
  65. package/dist/tools/documents/getDocument.d.ts.map +1 -0
  66. package/dist/tools/documents/getDocument.js +34 -0
  67. package/dist/tools/documents/getDocument.js.map +1 -0
  68. package/dist/tools/documents/index.d.ts +9 -0
  69. package/dist/tools/documents/index.d.ts.map +1 -0
  70. package/dist/tools/documents/index.js +16 -0
  71. package/dist/tools/documents/index.js.map +1 -0
  72. package/dist/tools/documents/listDocuments.d.ts +16 -0
  73. package/dist/tools/documents/listDocuments.d.ts.map +1 -0
  74. package/dist/tools/documents/listDocuments.js +85 -0
  75. package/dist/tools/documents/listDocuments.js.map +1 -0
  76. package/dist/tools/features/createFeature.d.ts +5 -0
  77. package/dist/tools/features/createFeature.d.ts.map +1 -0
  78. package/dist/tools/features/createFeature.js +55 -0
  79. package/dist/tools/features/createFeature.js.map +1 -0
  80. package/dist/tools/features/deleteFeature.d.ts +10 -0
  81. package/dist/tools/features/deleteFeature.d.ts.map +1 -0
  82. package/dist/tools/features/deleteFeature.js +35 -0
  83. package/dist/tools/features/deleteFeature.js.map +1 -0
  84. package/dist/tools/features/getFeature.d.ts +7 -0
  85. package/dist/tools/features/getFeature.d.ts.map +1 -0
  86. package/dist/tools/features/getFeature.js +37 -0
  87. package/dist/tools/features/getFeature.js.map +1 -0
  88. package/dist/tools/features/getFeatureByDisplayId.d.ts +7 -0
  89. package/dist/tools/features/getFeatureByDisplayId.d.ts.map +1 -0
  90. package/dist/tools/features/getFeatureByDisplayId.js +37 -0
  91. package/dist/tools/features/getFeatureByDisplayId.js.map +1 -0
  92. package/dist/tools/features/index.d.ts +21 -0
  93. package/dist/tools/features/index.d.ts.map +1 -0
  94. package/dist/tools/features/index.js +40 -0
  95. package/dist/tools/features/index.js.map +1 -0
  96. package/dist/tools/features/listFeaturePriorities.d.ts +7 -0
  97. package/dist/tools/features/listFeaturePriorities.d.ts.map +1 -0
  98. package/dist/tools/features/listFeaturePriorities.js +23 -0
  99. package/dist/tools/features/listFeaturePriorities.js.map +1 -0
  100. package/dist/tools/features/listFeatureStatuses.d.ts +7 -0
  101. package/dist/tools/features/listFeatureStatuses.d.ts.map +1 -0
  102. package/dist/tools/features/listFeatureStatuses.js +23 -0
  103. package/dist/tools/features/listFeatureStatuses.js.map +1 -0
  104. package/dist/tools/features/listFeatures.d.ts +19 -0
  105. package/dist/tools/features/listFeatures.d.ts.map +1 -0
  106. package/dist/tools/features/listFeatures.js +123 -0
  107. package/dist/tools/features/listFeatures.js.map +1 -0
  108. package/dist/tools/features/updateFeature.d.ts +7 -0
  109. package/dist/tools/features/updateFeature.d.ts.map +1 -0
  110. package/dist/tools/features/updateFeature.js +44 -0
  111. package/dist/tools/features/updateFeature.js.map +1 -0
  112. package/dist/tools/hierarchy/getHierarchyWithChildren.d.ts +10 -0
  113. package/dist/tools/hierarchy/getHierarchyWithChildren.d.ts.map +1 -0
  114. package/dist/tools/hierarchy/getHierarchyWithChildren.js +45 -0
  115. package/dist/tools/hierarchy/getHierarchyWithChildren.js.map +1 -0
  116. package/dist/tools/hierarchy/index.d.ts +9 -0
  117. package/dist/tools/hierarchy/index.d.ts.map +1 -0
  118. package/dist/tools/hierarchy/index.js +16 -0
  119. package/dist/tools/hierarchy/index.js.map +1 -0
  120. package/dist/tools/hierarchy/listHierarchy.d.ts +16 -0
  121. package/dist/tools/hierarchy/listHierarchy.d.ts.map +1 -0
  122. package/dist/tools/hierarchy/listHierarchy.js +74 -0
  123. package/dist/tools/hierarchy/listHierarchy.js.map +1 -0
  124. package/dist/tools/index.d.ts +16 -0
  125. package/dist/tools/index.d.ts.map +1 -0
  126. package/dist/tools/index.js +45 -0
  127. package/dist/tools/index.js.map +1 -0
  128. package/dist/tools/logs/getLogs.d.ts +15 -0
  129. package/dist/tools/logs/getLogs.d.ts.map +1 -0
  130. package/dist/tools/logs/getLogs.js +55 -0
  131. package/dist/tools/logs/getLogs.js.map +1 -0
  132. package/dist/tools/logs/index.d.ts +7 -0
  133. package/dist/tools/logs/index.d.ts.map +1 -0
  134. package/dist/tools/logs/index.js +10 -0
  135. package/dist/tools/logs/index.js.map +1 -0
  136. package/dist/tools/processMonitoring/index.d.ts +7 -0
  137. package/dist/tools/processMonitoring/index.d.ts.map +1 -0
  138. package/dist/tools/processMonitoring/index.js +12 -0
  139. package/dist/tools/processMonitoring/index.js.map +1 -0
  140. package/dist/tools/processMonitoring/listBusinessProcesses.d.ts +10 -0
  141. package/dist/tools/processMonitoring/listBusinessProcesses.d.ts.map +1 -0
  142. package/dist/tools/processMonitoring/listBusinessProcesses.js +36 -0
  143. package/dist/tools/processMonitoring/listBusinessProcesses.js.map +1 -0
  144. package/dist/tools/projects/getProject.d.ts +7 -0
  145. package/dist/tools/projects/getProject.d.ts.map +1 -0
  146. package/dist/tools/projects/getProject.js +32 -0
  147. package/dist/tools/projects/getProject.js.map +1 -0
  148. package/dist/tools/projects/index.d.ts +9 -0
  149. package/dist/tools/projects/index.d.ts.map +1 -0
  150. package/dist/tools/projects/index.js +16 -0
  151. package/dist/tools/projects/index.js.map +1 -0
  152. package/dist/tools/projects/listProjects.d.ts +16 -0
  153. package/dist/tools/projects/listProjects.d.ts.map +1 -0
  154. package/dist/tools/projects/listProjects.js +69 -0
  155. package/dist/tools/projects/listProjects.js.map +1 -0
  156. package/dist/tools/tasks/getTask.d.ts +7 -0
  157. package/dist/tools/tasks/getTask.d.ts.map +1 -0
  158. package/dist/tools/tasks/getTask.js +34 -0
  159. package/dist/tools/tasks/getTask.js.map +1 -0
  160. package/dist/tools/tasks/index.d.ts +11 -0
  161. package/dist/tools/tasks/index.d.ts.map +1 -0
  162. package/dist/tools/tasks/index.js +20 -0
  163. package/dist/tools/tasks/index.js.map +1 -0
  164. package/dist/tools/tasks/listTaskComments.d.ts +11 -0
  165. package/dist/tools/tasks/listTaskComments.d.ts.map +1 -0
  166. package/dist/tools/tasks/listTaskComments.js +46 -0
  167. package/dist/tools/tasks/listTaskComments.js.map +1 -0
  168. package/dist/tools/tasks/listTasks.d.ts +17 -0
  169. package/dist/tools/tasks/listTasks.d.ts.map +1 -0
  170. package/dist/tools/tasks/listTasks.js +89 -0
  171. package/dist/tools/tasks/listTasks.js.map +1 -0
  172. package/dist/tools/testCases/getTestCase.d.ts +7 -0
  173. package/dist/tools/testCases/getTestCase.d.ts.map +1 -0
  174. package/dist/tools/testCases/getTestCase.js +34 -0
  175. package/dist/tools/testCases/getTestCase.js.map +1 -0
  176. package/dist/tools/testCases/index.d.ts +9 -0
  177. package/dist/tools/testCases/index.d.ts.map +1 -0
  178. package/dist/tools/testCases/index.js +16 -0
  179. package/dist/tools/testCases/index.js.map +1 -0
  180. package/dist/tools/testCases/listTestCases.d.ts +16 -0
  181. package/dist/tools/testCases/listTestCases.d.ts.map +1 -0
  182. package/dist/tools/testCases/listTestCases.js +69 -0
  183. package/dist/tools/testCases/listTestCases.js.map +1 -0
  184. package/dist/utils/errorMapping.d.ts +28 -0
  185. package/dist/utils/errorMapping.d.ts.map +1 -0
  186. package/dist/utils/errorMapping.js +88 -0
  187. package/dist/utils/errorMapping.js.map +1 -0
  188. package/dist/utils/index.d.ts +4 -0
  189. package/dist/utils/index.d.ts.map +1 -0
  190. package/dist/utils/index.js +15 -0
  191. package/dist/utils/index.js.map +1 -0
  192. package/dist/utils/odataFilter.d.ts +15 -0
  193. package/dist/utils/odataFilter.d.ts.map +1 -0
  194. package/dist/utils/odataFilter.js +24 -0
  195. package/dist/utils/odataFilter.js.map +1 -0
  196. package/dist/utils/tokenEconomy.d.ts +36 -0
  197. package/dist/utils/tokenEconomy.d.ts.map +1 -0
  198. package/dist/utils/tokenEconomy.js +37 -0
  199. package/dist/utils/tokenEconomy.js.map +1 -0
  200. package/package.json +86 -0
@@ -0,0 +1,59 @@
1
+ import type { CalmClient } from '@mcp-abap-adt/calm-client';
2
+ import type { ILogger } from '@mcp-abap-adt/interfaces';
3
+ /**
4
+ * Handler context injected by the registry when a tool is invoked.
5
+ *
6
+ * Handlers never see MCP-server / transport concerns — they receive
7
+ * only the client + (optional) logger. Swap the `calm` field with a
8
+ * mock `CalmClient` to unit-test any handler without a network.
9
+ */
10
+ export interface ICalmHandlerContext {
11
+ calm: CalmClient;
12
+ logger?: ILogger;
13
+ }
14
+ /**
15
+ * MCP tool definition — schema-first, transport-agnostic.
16
+ *
17
+ * `inputSchema` is JSON Schema (draft 07). The registry converts it to
18
+ * the shape the MCP SDK expects at registration time, so handler files
19
+ * stay pure.
20
+ */
21
+ export interface ICalmToolDefinition {
22
+ name: string;
23
+ description: string;
24
+ inputSchema: Record<string, unknown>;
25
+ }
26
+ /**
27
+ * Tool handler — a pure async function. Context carries dependencies
28
+ * (calm + logger); `args` is the validated input; result is whatever
29
+ * the tool returns to the LLM.
30
+ */
31
+ /**
32
+ * Tool handler signature.
33
+ *
34
+ * NOTE: `TArgs` defaults to `any` (not `unknown`) on purpose —
35
+ * tool-entry arrays collect heterogeneously-typed tools, and `TArgs`
36
+ * sits in a contravariant (function-input) position. With `unknown`,
37
+ * a narrower concrete tool type cannot be assigned to the collection
38
+ * type. `any` is bivariant and sidesteps this. Individual tools still
39
+ * declare precise `TArgs` at their declaration site.
40
+ */
41
+ export type CalmToolHandler<TArgs = any, TResult = unknown> = (context: ICalmHandlerContext, args: TArgs) => Promise<TResult>;
42
+ /**
43
+ * Registration unit — pairs a definition with its handler. See the
44
+ * `CalmToolHandler` doc comment for the `any` default rationale.
45
+ */
46
+ export interface ICalmHandlerEntry<TArgs = any, TResult = unknown> {
47
+ toolDefinition: ICalmToolDefinition;
48
+ handler: CalmToolHandler<TArgs, TResult>;
49
+ }
50
+ /**
51
+ * Logical grouping of tools (per Cloud ALM service, typically). Enables
52
+ * ad-hoc composition — consumers can opt into subsets instead of always
53
+ * taking `ALL_TOOLS`.
54
+ */
55
+ export interface ICalmHandlerGroup {
56
+ getName(): string;
57
+ getHandlers(): readonly ICalmHandlerEntry[];
58
+ }
59
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/registry/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAExD;;;;;;GAMG;AACH,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,UAAU,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACtC;AAED;;;;GAIG;AACH;;;;;;;;;GASG;AAEH,MAAM,MAAM,eAAe,CAAC,KAAK,GAAG,GAAG,EAAE,OAAO,GAAG,OAAO,IAAI,CAC5D,OAAO,EAAE,mBAAmB,EAC5B,IAAI,EAAE,KAAK,KACR,OAAO,CAAC,OAAO,CAAC,CAAC;AAEtB;;;GAGG;AAEH,MAAM,WAAW,iBAAiB,CAAC,KAAK,GAAG,GAAG,EAAE,OAAO,GAAG,OAAO;IAC/D,cAAc,EAAE,mBAAmB,CAAC;IACpC,OAAO,EAAE,eAAe,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;CAC1C;AAED;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAChC,OAAO,IAAI,MAAM,CAAC;IAClB,WAAW,IAAI,SAAS,iBAAiB,EAAE,CAAC;CAC7C"}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/registry/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,37 @@
1
+ import type { CalmClient } from '@mcp-abap-adt/calm-client';
2
+ import type { ILogger } from '@mcp-abap-adt/interfaces';
3
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
4
+ import { CalmToolRegistry } from '../registry/CalmToolRegistry';
5
+ import type { ICalmHandlerContext, ICalmHandlerGroup } from '../registry/types';
6
+ export interface IBaseCalmMcpServerOptions {
7
+ name: string;
8
+ version?: string;
9
+ calm: CalmClient;
10
+ logger?: ILogger;
11
+ groups?: ICalmHandlerGroup[];
12
+ }
13
+ /**
14
+ * Base MCP server that hosts Cloud ALM tools.
15
+ *
16
+ * Extends the SDK's `McpServer`, exposes a `CalmToolRegistry` pre-wired
17
+ * with the groups passed in `options.groups`, and injects the
18
+ * `CalmClient` + `logger` as handler context on every tool call.
19
+ *
20
+ * Consumers typically subclass this to add their own tool groups, or
21
+ * use it directly when the default set is sufficient.
22
+ */
23
+ export declare class BaseCalmMcpServer extends McpServer {
24
+ protected readonly calm: CalmClient;
25
+ protected readonly logger?: ILogger;
26
+ protected readonly registry: CalmToolRegistry;
27
+ constructor(options: IBaseCalmMcpServerOptions);
28
+ /**
29
+ * Override in subclasses to enrich the context (e.g. per-request
30
+ * tracing metadata). Default returns the constructor-time calm +
31
+ * logger.
32
+ */
33
+ protected buildContext(): ICalmHandlerContext;
34
+ /** Names of all tools currently registered. */
35
+ listRegisteredTools(): string[];
36
+ }
37
+ //# sourceMappingURL=BaseCalmMcpServer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BaseCalmMcpServer.d.ts","sourceRoot":"","sources":["../../src/server/BaseCalmMcpServer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,KAAK,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEhF,MAAM,WAAW,yBAAyB;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,UAAU,CAAC;IACjB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,MAAM,CAAC,EAAE,iBAAiB,EAAE,CAAC;CAC9B;AAED;;;;;;;;;GASG;AACH,qBAAa,iBAAkB,SAAQ,SAAS;IAC9C,SAAS,CAAC,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IACpC,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;IACpC,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,CAAC;gBAElC,OAAO,EAAE,yBAAyB;IAW9C;;;;OAIG;IACH,SAAS,CAAC,YAAY,IAAI,mBAAmB;IAI7C,+CAA+C;IAC/C,mBAAmB,IAAI,MAAM,EAAE;CAGhC"}
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BaseCalmMcpServer = void 0;
4
+ const mcp_js_1 = require("@modelcontextprotocol/sdk/server/mcp.js");
5
+ const CalmToolRegistry_1 = require("../registry/CalmToolRegistry");
6
+ /**
7
+ * Base MCP server that hosts Cloud ALM tools.
8
+ *
9
+ * Extends the SDK's `McpServer`, exposes a `CalmToolRegistry` pre-wired
10
+ * with the groups passed in `options.groups`, and injects the
11
+ * `CalmClient` + `logger` as handler context on every tool call.
12
+ *
13
+ * Consumers typically subclass this to add their own tool groups, or
14
+ * use it directly when the default set is sufficient.
15
+ */
16
+ class BaseCalmMcpServer extends mcp_js_1.McpServer {
17
+ calm;
18
+ logger;
19
+ registry;
20
+ constructor(options) {
21
+ super({
22
+ name: options.name,
23
+ version: options.version ?? '0.0.0',
24
+ });
25
+ this.calm = options.calm;
26
+ this.logger = options.logger;
27
+ this.registry = new CalmToolRegistry_1.CalmToolRegistry(options.groups ?? []);
28
+ this.registry.registerAll(this, () => this.buildContext());
29
+ }
30
+ /**
31
+ * Override in subclasses to enrich the context (e.g. per-request
32
+ * tracing metadata). Default returns the constructor-time calm +
33
+ * logger.
34
+ */
35
+ buildContext() {
36
+ return { calm: this.calm, logger: this.logger };
37
+ }
38
+ /** Names of all tools currently registered. */
39
+ listRegisteredTools() {
40
+ return this.registry.listTools();
41
+ }
42
+ }
43
+ exports.BaseCalmMcpServer = BaseCalmMcpServer;
44
+ //# sourceMappingURL=BaseCalmMcpServer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BaseCalmMcpServer.js","sourceRoot":"","sources":["../../src/server/BaseCalmMcpServer.ts"],"names":[],"mappings":";;;AAEA,oEAAoE;AACpE,mEAAgE;AAWhE;;;;;;;;;GASG;AACH,MAAa,iBAAkB,SAAQ,kBAAS;IAC3B,IAAI,CAAa;IACjB,MAAM,CAAW;IACjB,QAAQ,CAAmB;IAE9C,YAAY,OAAkC;QAC5C,KAAK,CAAC;YACJ,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,OAAO,EAAE,OAAO,CAAC,OAAO,IAAI,OAAO;SACpC,CAAC,CAAC;QACH,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;QACzB,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAC7B,IAAI,CAAC,QAAQ,GAAG,IAAI,mCAAgB,CAAC,OAAO,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC;QAC3D,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC;IAC7D,CAAC;IAED;;;;OAIG;IACO,YAAY;QACpB,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC;IAClD,CAAC;IAED,+CAA+C;IAC/C,mBAAmB;QACjB,OAAO,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAE,CAAC;IACnC,CAAC;CACF;AA7BD,8CA6BC"}
@@ -0,0 +1,10 @@
1
+ import { CalmClient } from '@mcp-abap-adt/calm-client';
2
+ import type { ICalmServerConfig } from './config';
3
+ /**
4
+ * Build a ready-to-use `CalmClient` from a `ICalmServerConfig`. Picks
5
+ * OAuth2 or sandbox mode based on config.mode. The returned connection
6
+ * is stateless from the server's perspective — constructing a fresh
7
+ * CalmClient per process is cheap.
8
+ */
9
+ export declare function buildCalmClient(config: ICalmServerConfig): CalmClient;
10
+ //# sourceMappingURL=buildClient.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildClient.d.ts","sourceRoot":"","sources":["../../src/server/buildClient.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAkB,MAAM,2BAA2B,CAAC;AAEvE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAoDlD;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,iBAAiB,GAAG,UAAU,CAoBrE"}
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildCalmClient = buildCalmClient;
4
+ const calm_client_1 = require("@mcp-abap-adt/calm-client");
5
+ /**
6
+ * Minimal XSUAA `client_credentials` refresher — sufficient for
7
+ * standalone-mode servers where no shared auth-broker/session store is
8
+ * configured. Caches the token until explicitly refreshed. Production
9
+ * consumers that already run `@mcp-abap-adt/auth-broker` elsewhere
10
+ * should pass their own `ITokenRefresher` via `buildCalmClient.override`.
11
+ */
12
+ class XsuaaRefresher {
13
+ uaaUrl;
14
+ clientId;
15
+ clientSecret;
16
+ cached;
17
+ constructor(uaaUrl, clientId, clientSecret) {
18
+ this.uaaUrl = uaaUrl;
19
+ this.clientId = clientId;
20
+ this.clientSecret = clientSecret;
21
+ }
22
+ async getToken() {
23
+ if (!this.cached)
24
+ return this.refreshToken();
25
+ return this.cached;
26
+ }
27
+ async refreshToken() {
28
+ const url = `${this.uaaUrl.replace(/\/$/, '')}/oauth/token`;
29
+ const basic = Buffer.from(`${this.clientId}:${this.clientSecret}`).toString('base64');
30
+ const response = await fetch(url, {
31
+ method: 'POST',
32
+ headers: {
33
+ Authorization: `Basic ${basic}`,
34
+ 'Content-Type': 'application/x-www-form-urlencoded',
35
+ Accept: 'application/json',
36
+ },
37
+ body: 'grant_type=client_credentials',
38
+ });
39
+ if (!response.ok) {
40
+ const body = await response.text().catch(() => '');
41
+ throw new Error(`XSUAA token request failed: ${response.status} ${response.statusText} — ${body.slice(0, 200)}`);
42
+ }
43
+ const json = (await response.json());
44
+ if (!json.access_token) {
45
+ throw new Error('XSUAA token response missing access_token');
46
+ }
47
+ this.cached = json.access_token;
48
+ return this.cached;
49
+ }
50
+ }
51
+ /**
52
+ * Build a ready-to-use `CalmClient` from a `ICalmServerConfig`. Picks
53
+ * OAuth2 or sandbox mode based on config.mode. The returned connection
54
+ * is stateless from the server's perspective — constructing a fresh
55
+ * CalmClient per process is cheap.
56
+ */
57
+ function buildCalmClient(config) {
58
+ if (config.mode === 'oauth2') {
59
+ const refresher = new XsuaaRefresher(config.uaaUrl, config.uaaClientId, config.uaaClientSecret);
60
+ const connection = new calm_client_1.CalmConnection({
61
+ baseUrl: config.baseUrl,
62
+ tokenRefresher: refresher,
63
+ defaultTimeout: config.timeoutMs,
64
+ });
65
+ return new calm_client_1.CalmClient(connection);
66
+ }
67
+ const connection = new calm_client_1.CalmConnection({
68
+ baseUrl: config.baseUrl,
69
+ apiKey: config.apiKey,
70
+ defaultTimeout: config.timeoutMs,
71
+ });
72
+ return new calm_client_1.CalmClient(connection);
73
+ }
74
+ //# sourceMappingURL=buildClient.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"buildClient.js","sourceRoot":"","sources":["../../src/server/buildClient.ts"],"names":[],"mappings":";;AA4DA,0CAoBC;AAhFD,2DAAuE;AAIvE;;;;;;GAMG;AACH,MAAM,cAAc;IAIC;IACA;IACA;IALX,MAAM,CAAU;IAExB,YACmB,MAAc,EACd,QAAgB,EAChB,YAAoB;QAFpB,WAAM,GAAN,MAAM,CAAQ;QACd,aAAQ,GAAR,QAAQ,CAAQ;QAChB,iBAAY,GAAZ,YAAY,CAAQ;IACpC,CAAC;IAEJ,KAAK,CAAC,QAAQ;QACZ,IAAI,CAAC,IAAI,CAAC,MAAM;YAAE,OAAO,IAAI,CAAC,YAAY,EAAE,CAAC;QAC7C,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;IAED,KAAK,CAAC,YAAY;QAChB,MAAM,GAAG,GAAG,GAAG,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,cAAc,CAAC;QAC5D,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,YAAY,EAAE,CAAC,CAAC,QAAQ,CACzE,QAAQ,CACT,CAAC;QACF,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE;YAChC,MAAM,EAAE,MAAM;YACd,OAAO,EAAE;gBACP,aAAa,EAAE,SAAS,KAAK,EAAE;gBAC/B,cAAc,EAAE,mCAAmC;gBACnD,MAAM,EAAE,kBAAkB;aAC3B;YACD,IAAI,EAAE,+BAA+B;SACtC,CAAC,CAAC;QACH,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;YACjB,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC;YACnD,MAAM,IAAI,KAAK,CACb,+BAA+B,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,UAAU,MAAM,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,CAChG,CAAC;QACJ,CAAC;QACD,MAAM,IAAI,GAAG,CAAC,MAAM,QAAQ,CAAC,IAAI,EAAE,CAA8B,CAAC;QAClE,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;YACvB,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;QAC/D,CAAC;QACD,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,YAAY,CAAC;QAChC,OAAO,IAAI,CAAC,MAAM,CAAC;IACrB,CAAC;CACF;AAED;;;;;GAKG;AACH,SAAgB,eAAe,CAAC,MAAyB;IACvD,IAAI,MAAM,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC7B,MAAM,SAAS,GAAG,IAAI,cAAc,CAClC,MAAM,CAAC,MAAgB,EACvB,MAAM,CAAC,WAAqB,EAC5B,MAAM,CAAC,eAAyB,CACjC,CAAC;QACF,MAAM,UAAU,GAAG,IAAI,4BAAc,CAAC;YACpC,OAAO,EAAE,MAAM,CAAC,OAAO;YACvB,cAAc,EAAE,SAAS;YACzB,cAAc,EAAE,MAAM,CAAC,SAAS;SACjC,CAAC,CAAC;QACH,OAAO,IAAI,wBAAU,CAAC,UAAU,CAAC,CAAC;IACpC,CAAC;IACD,MAAM,UAAU,GAAG,IAAI,4BAAc,CAAC;QACpC,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,MAAM,EAAE,MAAM,CAAC,MAAgB;QAC/B,cAAc,EAAE,MAAM,CAAC,SAAS;KACjC,CAAC,CAAC;IACH,OAAO,IAAI,wBAAU,CAAC,UAAU,CAAC,CAAC;AACpC,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Load a `.env` file at the process cwd (idempotent). When launched as
3
+ * `npx calm-mcp` from a project directory, the `.env` of that project
4
+ * is picked up automatically.
5
+ */
6
+ export declare function loadEnv(): void;
7
+ export type CalmServerMode = 'oauth2' | 'sandbox';
8
+ export interface ICalmServerConfig {
9
+ mode: CalmServerMode;
10
+ baseUrl: string;
11
+ uaaUrl?: string;
12
+ uaaClientId?: string;
13
+ uaaClientSecret?: string;
14
+ apiKey?: string;
15
+ timeoutMs: number;
16
+ }
17
+ export declare function readConfig(): ICalmServerConfig;
18
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/server/config.ts"],"names":[],"mappings":"AAMA;;;;GAIG;AACH,wBAAgB,OAAO,IAAI,IAAI,CAK9B;AAED,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,SAAS,CAAC;AAElD,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,cAAc,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;CACnB;AAYD,wBAAgB,UAAU,IAAI,iBAAiB,CAkC9C"}
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.loadEnv = loadEnv;
4
+ exports.readConfig = readConfig;
5
+ const node_fs_1 = require("node:fs");
6
+ const node_path_1 = require("node:path");
7
+ const dotenv_1 = require("dotenv");
8
+ let loaded = false;
9
+ /**
10
+ * Load a `.env` file at the process cwd (idempotent). When launched as
11
+ * `npx calm-mcp` from a project directory, the `.env` of that project
12
+ * is picked up automatically.
13
+ */
14
+ function loadEnv() {
15
+ if (loaded)
16
+ return;
17
+ const path = (0, node_path_1.resolve)(process.cwd(), '.env');
18
+ if ((0, node_fs_1.existsSync)(path))
19
+ (0, dotenv_1.config)({ path });
20
+ loaded = true;
21
+ }
22
+ function required(name) {
23
+ const v = process.env[name];
24
+ if (!v) {
25
+ throw new Error(`[calm-mcp] env var ${name} is required but missing. See .env.example.`);
26
+ }
27
+ return v;
28
+ }
29
+ function readConfig() {
30
+ loadEnv();
31
+ const mode = process.env.CALM_MODE?.toLowerCase();
32
+ if (!mode) {
33
+ throw new Error('[calm-mcp] CALM_MODE is required (oauth2 or sandbox). See .env.example.');
34
+ }
35
+ const timeoutMs = process.env.CALM_TIMEOUT
36
+ ? Number(process.env.CALM_TIMEOUT)
37
+ : 30_000;
38
+ if (mode === 'oauth2') {
39
+ return {
40
+ mode,
41
+ baseUrl: required('CALM_BASE_URL'),
42
+ uaaUrl: required('CALM_UAA_URL'),
43
+ uaaClientId: required('CALM_UAA_CLIENT_ID'),
44
+ uaaClientSecret: required('CALM_UAA_CLIENT_SECRET'),
45
+ timeoutMs,
46
+ };
47
+ }
48
+ if (mode === 'sandbox') {
49
+ return {
50
+ mode,
51
+ baseUrl: process.env.CALM_BASE_URL || 'https://sandbox.api.sap.com/SAPCALM',
52
+ apiKey: required('CALM_API_KEY'),
53
+ timeoutMs,
54
+ };
55
+ }
56
+ throw new Error(`[calm-mcp] unknown CALM_MODE "${mode}"`);
57
+ }
58
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/server/config.ts"],"names":[],"mappings":";;AAWA,0BAKC;AAwBD,gCAkCC;AA1ED,qCAAqC;AACrC,yCAAoC;AACpC,mCAAgD;AAEhD,IAAI,MAAM,GAAG,KAAK,CAAC;AAEnB;;;;GAIG;AACH,SAAgB,OAAO;IACrB,IAAI,MAAM;QAAE,OAAO;IACnB,MAAM,IAAI,GAAG,IAAA,mBAAO,EAAC,OAAO,CAAC,GAAG,EAAE,EAAE,MAAM,CAAC,CAAC;IAC5C,IAAI,IAAA,oBAAU,EAAC,IAAI,CAAC;QAAE,IAAA,eAAY,EAAC,EAAE,IAAI,EAAE,CAAC,CAAC;IAC7C,MAAM,GAAG,IAAI,CAAC;AAChB,CAAC;AAcD,SAAS,QAAQ,CAAC,IAAY;IAC5B,MAAM,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAC5B,IAAI,CAAC,CAAC,EAAE,CAAC;QACP,MAAM,IAAI,KAAK,CACb,sBAAsB,IAAI,6CAA6C,CACxE,CAAC;IACJ,CAAC;IACD,OAAO,CAAC,CAAC;AACX,CAAC;AAED,SAAgB,UAAU;IACxB,OAAO,EAAE,CAAC;IACV,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,WAAW,EAElC,CAAC;IACd,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,MAAM,IAAI,KAAK,CACb,yEAAyE,CAC1E,CAAC;IACJ,CAAC;IACD,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC,YAAY;QACxC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC;QAClC,CAAC,CAAC,MAAM,CAAC;IAEX,IAAI,IAAI,KAAK,QAAQ,EAAE,CAAC;QACtB,OAAO;YACL,IAAI;YACJ,OAAO,EAAE,QAAQ,CAAC,eAAe,CAAC;YAClC,MAAM,EAAE,QAAQ,CAAC,cAAc,CAAC;YAChC,WAAW,EAAE,QAAQ,CAAC,oBAAoB,CAAC;YAC3C,eAAe,EAAE,QAAQ,CAAC,wBAAwB,CAAC;YACnD,SAAS;SACV,CAAC;IACJ,CAAC;IACD,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QACvB,OAAO;YACL,IAAI;YACJ,OAAO,EACL,OAAO,CAAC,GAAG,CAAC,aAAa,IAAI,qCAAqC;YACpE,MAAM,EAAE,QAAQ,CAAC,cAAc,CAAC;YAChC,SAAS;SACV,CAAC;IACJ,CAAC;IACD,MAAM,IAAI,KAAK,CAAC,iCAAiC,IAAI,GAAG,CAAC,CAAC;AAC5D,CAAC"}
@@ -0,0 +1,5 @@
1
+ export { BaseCalmMcpServer, type IBaseCalmMcpServerOptions, } from './BaseCalmMcpServer';
2
+ export { buildCalmClient } from './buildClient';
3
+ export { type CalmServerMode, type ICalmServerConfig, loadEnv, readConfig, } from './config';
4
+ export { runStdio } from './runStdio';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,KAAK,yBAAyB,GAC/B,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,OAAO,EACP,UAAU,GACX,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC"}
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.runStdio = exports.readConfig = exports.loadEnv = exports.buildCalmClient = exports.BaseCalmMcpServer = void 0;
4
+ var BaseCalmMcpServer_1 = require("./BaseCalmMcpServer");
5
+ Object.defineProperty(exports, "BaseCalmMcpServer", { enumerable: true, get: function () { return BaseCalmMcpServer_1.BaseCalmMcpServer; } });
6
+ var buildClient_1 = require("./buildClient");
7
+ Object.defineProperty(exports, "buildCalmClient", { enumerable: true, get: function () { return buildClient_1.buildCalmClient; } });
8
+ var config_1 = require("./config");
9
+ Object.defineProperty(exports, "loadEnv", { enumerable: true, get: function () { return config_1.loadEnv; } });
10
+ Object.defineProperty(exports, "readConfig", { enumerable: true, get: function () { return config_1.readConfig; } });
11
+ var runStdio_1 = require("./runStdio");
12
+ Object.defineProperty(exports, "runStdio", { enumerable: true, get: function () { return runStdio_1.runStdio; } });
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":";;;AAAA,yDAG6B;AAF3B,sHAAA,iBAAiB,OAAA;AAGnB,6CAAgD;AAAvC,8GAAA,eAAe,OAAA;AACxB,mCAKkB;AAFhB,iGAAA,OAAO,OAAA;AACP,oGAAA,UAAU,OAAA;AAEZ,uCAAsC;AAA7B,oGAAA,QAAQ,OAAA"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Entry point for standalone stdio mode. Reads `.env` + env vars,
3
+ * builds a `CalmClient`, wires all tool groups onto a
4
+ * `BaseCalmMcpServer`, and binds the server to the stdio transport.
5
+ *
6
+ * Errors during config/connect phase are written to stderr so the
7
+ * host (Claude Desktop / whoever) sees a meaningful failure instead
8
+ * of a silent hang. On success, stdio takes over — no console output
9
+ * from the server.
10
+ */
11
+ export declare function runStdio(): Promise<void>;
12
+ //# sourceMappingURL=runStdio.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runStdio.d.ts","sourceRoot":"","sources":["../../src/server/runStdio.ts"],"names":[],"mappings":"AASA;;;;;;;;;GASG;AACH,wBAAsB,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CA4B9C"}
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.runStdio = runStdio;
4
+ const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
5
+ const tools_1 = require("../tools");
6
+ const BaseCalmMcpServer_1 = require("./BaseCalmMcpServer");
7
+ const buildClient_1 = require("./buildClient");
8
+ const config_1 = require("./config");
9
+ const PACKAGE_NAME = '@mcp-abap-adt/calm-server';
10
+ const PACKAGE_VERSION = '0.0.1';
11
+ /**
12
+ * Entry point for standalone stdio mode. Reads `.env` + env vars,
13
+ * builds a `CalmClient`, wires all tool groups onto a
14
+ * `BaseCalmMcpServer`, and binds the server to the stdio transport.
15
+ *
16
+ * Errors during config/connect phase are written to stderr so the
17
+ * host (Claude Desktop / whoever) sees a meaningful failure instead
18
+ * of a silent hang. On success, stdio takes over — no console output
19
+ * from the server.
20
+ */
21
+ async function runStdio() {
22
+ const config = (0, config_1.readConfig)();
23
+ const calm = (0, buildClient_1.buildCalmClient)(config);
24
+ const server = new BaseCalmMcpServer_1.BaseCalmMcpServer({
25
+ name: PACKAGE_NAME,
26
+ version: PACKAGE_VERSION,
27
+ calm,
28
+ groups: [...tools_1.ALL_GROUPS],
29
+ });
30
+ // Best-effort early token / connectivity probe so misconfiguration
31
+ // surfaces on startup rather than on the first tool call.
32
+ await calm.getConnection().connect();
33
+ const transport = new stdio_js_1.StdioServerTransport();
34
+ await server.connect(transport);
35
+ // Graceful shutdown on SIGINT / SIGTERM — ensures stdio is cleanly
36
+ // closed so the host does not see a dangling child process.
37
+ const shutdown = async () => {
38
+ try {
39
+ await server.close();
40
+ }
41
+ finally {
42
+ process.exit(0);
43
+ }
44
+ };
45
+ process.on('SIGINT', shutdown);
46
+ process.on('SIGTERM', shutdown);
47
+ }
48
+ //# sourceMappingURL=runStdio.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runStdio.js","sourceRoot":"","sources":["../../src/server/runStdio.ts"],"names":[],"mappings":";;AAmBA,4BA4BC;AA/CD,wEAAiF;AACjF,oCAAsC;AACtC,2DAAwD;AACxD,+CAAgD;AAChD,qCAAsC;AAEtC,MAAM,YAAY,GAAG,2BAA2B,CAAC;AACjD,MAAM,eAAe,GAAG,OAAO,CAAC;AAEhC;;;;;;;;;GASG;AACI,KAAK,UAAU,QAAQ;IAC5B,MAAM,MAAM,GAAG,IAAA,mBAAU,GAAE,CAAC;IAC5B,MAAM,IAAI,GAAG,IAAA,6BAAe,EAAC,MAAM,CAAC,CAAC;IACrC,MAAM,MAAM,GAAG,IAAI,qCAAiB,CAAC;QACnC,IAAI,EAAE,YAAY;QAClB,OAAO,EAAE,eAAe;QACxB,IAAI;QACJ,MAAM,EAAE,CAAC,GAAG,kBAAU,CAAC;KACxB,CAAC,CAAC;IAEH,mEAAmE;IACnE,0DAA0D;IAC1D,MAAM,IAAI,CAAC,aAAa,EAAE,CAAC,OAAO,EAAE,CAAC;IAErC,MAAM,SAAS,GAAG,IAAI,+BAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAEhC,mEAAmE;IACnE,4DAA4D;IAC5D,MAAM,QAAQ,GAAG,KAAK,IAAmB,EAAE;QACzC,IAAI,CAAC;YACH,MAAM,MAAM,CAAC,KAAK,EAAE,CAAC;QACvB,CAAC;gBAAS,CAAC;YACT,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CAAC;IACF,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAC/B,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;AAClC,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { HandlerGroup } from '../../registry/HandlerGroup';
2
+ import type { ICalmHandlerEntry } from '../../registry/types';
3
+ export { listAnalyticsProvidersTool } from './listAnalyticsProviders';
4
+ export type { IQueryAnalyticsArgs, IQueryAnalyticsResult, } from './queryAnalytics';
5
+ export { queryAnalyticsTool } from './queryAnalytics';
6
+ export declare const ANALYTICS_HANDLERS: readonly ICalmHandlerEntry[];
7
+ export declare const ANALYTICS_GROUP: HandlerGroup;
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/tools/analytics/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAI9D,OAAO,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AACtE,YAAY,EACV,mBAAmB,EACnB,qBAAqB,GACtB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAEtD,eAAO,MAAM,kBAAkB,EAAE,SAAS,iBAAiB,EAG1D,CAAC;AAEF,eAAO,MAAM,eAAe,cAG3B,CAAC"}
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ANALYTICS_GROUP = exports.ANALYTICS_HANDLERS = exports.queryAnalyticsTool = exports.listAnalyticsProvidersTool = void 0;
4
+ const HandlerGroup_1 = require("../../registry/HandlerGroup");
5
+ const listAnalyticsProviders_1 = require("./listAnalyticsProviders");
6
+ const queryAnalytics_1 = require("./queryAnalytics");
7
+ var listAnalyticsProviders_2 = require("./listAnalyticsProviders");
8
+ Object.defineProperty(exports, "listAnalyticsProvidersTool", { enumerable: true, get: function () { return listAnalyticsProviders_2.listAnalyticsProvidersTool; } });
9
+ var queryAnalytics_2 = require("./queryAnalytics");
10
+ Object.defineProperty(exports, "queryAnalyticsTool", { enumerable: true, get: function () { return queryAnalytics_2.queryAnalyticsTool; } });
11
+ exports.ANALYTICS_HANDLERS = [
12
+ queryAnalytics_1.queryAnalyticsTool,
13
+ listAnalyticsProviders_1.listAnalyticsProvidersTool,
14
+ ];
15
+ exports.ANALYTICS_GROUP = new HandlerGroup_1.HandlerGroup('analytics', exports.ANALYTICS_HANDLERS);
16
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/tools/analytics/index.ts"],"names":[],"mappings":";;;AAAA,8DAA2D;AAE3D,qEAAsE;AACtE,qDAAsD;AAEtD,mEAAsE;AAA7D,oIAAA,0BAA0B,OAAA;AAKnC,mDAAsD;AAA7C,oHAAA,kBAAkB,OAAA;AAEd,QAAA,kBAAkB,GAAiC;IAC9D,mCAAkB;IAClB,mDAA0B;CAC3B,CAAC;AAEW,QAAA,eAAe,GAAG,IAAI,2BAAY,CAC7C,WAAW,EACX,0BAAkB,CACnB,CAAC"}
@@ -0,0 +1,5 @@
1
+ import type { IAnalyticsProviderInfo, IListProvidersResult } from '@mcp-abap-adt/calm-client';
2
+ import type { ICalmHandlerEntry } from '../../registry/types';
3
+ export type { IAnalyticsProviderInfo };
4
+ export declare const listAnalyticsProvidersTool: ICalmHandlerEntry<unknown, IListProvidersResult>;
5
+ //# sourceMappingURL=listAnalyticsProviders.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"listAnalyticsProviders.d.ts","sourceRoot":"","sources":["../../../src/tools/analytics/listAnalyticsProviders.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,sBAAsB,EACtB,oBAAoB,EACrB,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAEV,iBAAiB,EAElB,MAAM,sBAAsB,CAAC;AAE9B,YAAY,EAAE,sBAAsB,EAAE,CAAC;AAavC,eAAO,MAAM,0BAA0B,EAAE,iBAAiB,CACxD,OAAO,EACP,oBAAoB,CAIrB,CAAC"}
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.listAnalyticsProvidersTool = void 0;
4
+ const definition = {
5
+ name: 'calm_analytics_list_providers',
6
+ description: 'List the 17 Cloud ALM analytics dataset names available to `calm_analytics_query`. Pure client-side call — does not hit the network. Use this as discovery before forming analytics queries.',
7
+ inputSchema: { type: 'object', properties: {} },
8
+ };
9
+ const handler = async (ctx) => {
10
+ return ctx.calm.getAnalytics().listProviders();
11
+ };
12
+ exports.listAnalyticsProvidersTool = {
13
+ toolDefinition: definition,
14
+ handler,
15
+ };
16
+ //# sourceMappingURL=listAnalyticsProviders.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"listAnalyticsProviders.js","sourceRoot":"","sources":["../../../src/tools/analytics/listAnalyticsProviders.ts"],"names":[],"mappings":";;;AAYA,MAAM,UAAU,GAAwB;IACtC,IAAI,EAAE,+BAA+B;IACrC,WAAW,EACT,8LAA8L;IAChM,WAAW,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,EAAE,EAAE;CAChD,CAAC;AAEF,MAAM,OAAO,GAAmD,KAAK,EAAE,GAAG,EAAE,EAAE;IAC5E,OAAO,GAAG,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC,aAAa,EAAE,CAAC;AACjD,CAAC,CAAC;AAEW,QAAA,0BAA0B,GAGnC;IACF,cAAc,EAAE,UAAU;IAC1B,OAAO;CACR,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { type AnalyticsEndpoint } from '@mcp-abap-adt/calm-client';
2
+ import type { ICalmHandlerEntry } from '../../registry/types';
3
+ export interface IQueryAnalyticsArgs {
4
+ endpoint: AnalyticsEndpoint;
5
+ filter?: string;
6
+ select?: string[];
7
+ limit?: number;
8
+ offset?: number;
9
+ }
10
+ export interface IQueryAnalyticsResult {
11
+ endpoint: AnalyticsEndpoint;
12
+ rows: unknown[];
13
+ }
14
+ export declare const queryAnalyticsTool: ICalmHandlerEntry<IQueryAnalyticsArgs, IQueryAnalyticsResult>;
15
+ //# sourceMappingURL=queryAnalytics.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queryAnalytics.d.ts","sourceRoot":"","sources":["../../../src/tools/analytics/queryAnalytics.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,iBAAiB,EAEvB,MAAM,2BAA2B,CAAC;AACnC,OAAO,KAAK,EAEV,iBAAiB,EAElB,MAAM,sBAAsB,CAAC;AAQ9B,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,qBAAqB;IACpC,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,IAAI,EAAE,OAAO,EAAE,CAAC;CACjB;AA0DD,eAAO,MAAM,kBAAkB,EAAE,iBAAiB,CAChD,mBAAmB,EACnB,qBAAqB,CAItB,CAAC"}
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.queryAnalyticsTool = void 0;
4
+ const calm_client_1 = require("@mcp-abap-adt/calm-client");
5
+ const utils_1 = require("../../utils");
6
+ const definition = {
7
+ name: 'calm_analytics_query',
8
+ description: 'Query a pre-aggregated Cloud ALM analytics dataset (read-only). Endpoint names come from `calm_analytics_list_providers`. Optional `filter` is a raw OData filter string (advanced users only — prefer per-dataset named args when added). `rows` contains the raw JSON from the server; schema varies per endpoint.',
9
+ inputSchema: {
10
+ type: 'object',
11
+ required: ['endpoint'],
12
+ properties: {
13
+ endpoint: {
14
+ type: 'string',
15
+ description: 'One of the Cloud ALM analytics endpoint names.',
16
+ enum: [...calm_client_1.ANALYTICS_ENDPOINTS],
17
+ },
18
+ filter: {
19
+ type: 'string',
20
+ description: 'Raw OData $filter expression, e.g. "statusCode eq \'OPEN\'". Used as-is; caller is responsible for escaping.',
21
+ },
22
+ select: {
23
+ type: 'array',
24
+ description: 'Subset of dataset columns to return ($select).',
25
+ items: { type: 'string' },
26
+ },
27
+ limit: { type: 'integer', minimum: 1, maximum: utils_1.MAX_LIST_LIMIT },
28
+ offset: { type: 'integer', minimum: 0 },
29
+ },
30
+ },
31
+ };
32
+ const handler = async (ctx, args) => {
33
+ if (!args?.endpoint) {
34
+ throw new utils_1.CalmToolError({
35
+ code: 'INVALID_ARGUMENT',
36
+ message: 'endpoint is required',
37
+ });
38
+ }
39
+ const limit = (0, utils_1.clampListLimit)(args.limit);
40
+ const offset = args.offset && args.offset > 0 ? Math.floor(args.offset) : 0;
41
+ let query = calm_client_1.ODataQuery.new().top(limit).skip(offset);
42
+ if (args.filter)
43
+ query = query.filter(args.filter);
44
+ if (args.select && args.select.length > 0)
45
+ query = query.select(args.select);
46
+ try {
47
+ const raw = await ctx.calm
48
+ .getAnalytics()
49
+ .getEndpoint(args.endpoint, query);
50
+ const rows = Array.isArray(raw) ? raw : (raw?.value ?? []);
51
+ return { endpoint: args.endpoint, rows };
52
+ }
53
+ catch (err) {
54
+ throw (0, utils_1.mapCalmErrorForTool)(err);
55
+ }
56
+ };
57
+ exports.queryAnalyticsTool = {
58
+ toolDefinition: definition,
59
+ handler,
60
+ };
61
+ //# sourceMappingURL=queryAnalytics.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"queryAnalytics.js","sourceRoot":"","sources":["../../../src/tools/analytics/queryAnalytics.ts"],"names":[],"mappings":";;;AAAA,2DAImC;AAMnC,uCAKqB;AAerB,MAAM,UAAU,GAAwB;IACtC,IAAI,EAAE,sBAAsB;IAC5B,WAAW,EACT,sTAAsT;IACxT,WAAW,EAAE;QACX,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,CAAC,UAAU,CAAC;QACtB,UAAU,EAAE;YACV,QAAQ,EAAE;gBACR,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,gDAAgD;gBAC7D,IAAI,EAAE,CAAC,GAAG,iCAAmB,CAAC;aAC/B;YACD,MAAM,EAAE;gBACN,IAAI,EAAE,QAAQ;gBACd,WAAW,EACT,8GAA8G;aACjH;YACD,MAAM,EAAE;gBACN,IAAI,EAAE,OAAO;gBACb,WAAW,EAAE,gDAAgD;gBAC7D,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE;aAC1B;YACD,KAAK,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,sBAAc,EAAE;YAC/D,MAAM,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,EAAE;SACxC;KACF;CACF,CAAC;AAEF,MAAM,OAAO,GAGT,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,EAAE;IACtB,IAAI,CAAC,IAAI,EAAE,QAAQ,EAAE,CAAC;QACpB,MAAM,IAAI,qBAAa,CAAC;YACtB,IAAI,EAAE,kBAAkB;YACxB,OAAO,EAAE,sBAAsB;SAChC,CAAC,CAAC;IACL,CAAC;IACD,MAAM,KAAK,GAAG,IAAA,sBAAc,EAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACzC,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC5E,IAAI,KAAK,GAAG,wBAAU,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACrD,IAAI,IAAI,CAAC,MAAM;QAAE,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACnD,IAAI,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC;QAAE,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAE7E,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,MAAM,GAAG,CAAC,IAAI;aACvB,YAAY,EAAE;aACd,WAAW,CAAoC,IAAI,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;QACxE,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC;QAC3D,OAAO,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC3C,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,IAAA,2BAAmB,EAAC,GAAG,CAAC,CAAC;IACjC,CAAC;AACH,CAAC,CAAC;AAEW,QAAA,kBAAkB,GAG3B;IACF,cAAc,EAAE,UAAU;IAC1B,OAAO;CACR,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { IDocument } from '@mcp-abap-adt/calm-client';
2
+ import type { ICalmHandlerEntry } from '../../registry/types';
3
+ export interface IGetDocumentArgs {
4
+ uuid: string;
5
+ }
6
+ export declare const getDocumentTool: ICalmHandlerEntry<IGetDocumentArgs, IDocument>;
7
+ //# sourceMappingURL=getDocument.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getDocument.d.ts","sourceRoot":"","sources":["../../../src/tools/documents/getDocument.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,KAAK,EAEV,iBAAiB,EAElB,MAAM,sBAAsB,CAAC;AAG9B,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;CACd;AAgCD,eAAO,MAAM,eAAe,EAAE,iBAAiB,CAAC,gBAAgB,EAAE,SAAS,CAG1E,CAAC"}