@burdenoff/mcp-libs 2026.704.1 → 2026.719.2

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 (185) hide show
  1. package/dist/{chunk-WWFVD7BO.js → chunk-RHWHUY5Y.js} +3 -3
  2. package/dist/{chunk-WWFVD7BO.js.map → chunk-RHWHUY5Y.js.map} +1 -1
  3. package/dist/{chunk-H2OYWLOA.js → chunk-YOSQUY3M.js} +101 -35
  4. package/dist/chunk-YOSQUY3M.js.map +1 -0
  5. package/dist/core/index.cjs +101 -32
  6. package/dist/core/index.cjs.map +1 -1
  7. package/dist/core/index.d.cts +1 -1
  8. package/dist/core/index.d.ts +1 -1
  9. package/dist/core/index.js +1 -1
  10. package/dist/index.cjs +97 -31
  11. package/dist/index.cjs.map +1 -1
  12. package/dist/index.d.cts +1 -1
  13. package/dist/index.d.ts +1 -1
  14. package/dist/index.js +1 -1
  15. package/dist/modules/adaptercloud/index.cjs +14 -14
  16. package/dist/modules/adaptercloud/index.cjs.map +1 -1
  17. package/dist/modules/adaptercloud/index.js +1 -1
  18. package/dist/modules/artistrybase/index.cjs +14 -14
  19. package/dist/modules/artistrybase/index.cjs.map +1 -1
  20. package/dist/modules/artistrybase/index.js +1 -1
  21. package/dist/modules/assethandler/index.cjs +14 -14
  22. package/dist/modules/assethandler/index.cjs.map +1 -1
  23. package/dist/modules/assethandler/index.js +1 -1
  24. package/dist/modules/atheletebridge/index.cjs +14 -14
  25. package/dist/modules/atheletebridge/index.cjs.map +1 -1
  26. package/dist/modules/atheletebridge/index.js +1 -1
  27. package/dist/modules/auth/index.cjs +14 -14
  28. package/dist/modules/auth/index.cjs.map +1 -1
  29. package/dist/modules/auth/index.js +3 -3
  30. package/dist/modules/billing/index.cjs +14 -14
  31. package/dist/modules/billing/index.cjs.map +1 -1
  32. package/dist/modules/billing/index.js +1 -1
  33. package/dist/modules/brainyrich/index.cjs +14 -14
  34. package/dist/modules/brainyrich/index.cjs.map +1 -1
  35. package/dist/modules/brainyrich/index.js +1 -1
  36. package/dist/modules/buildmyiq/index.cjs +14 -14
  37. package/dist/modules/buildmyiq/index.cjs.map +1 -1
  38. package/dist/modules/buildmyiq/index.js +1 -1
  39. package/dist/modules/channels/index.cjs +14 -14
  40. package/dist/modules/channels/index.cjs.map +1 -1
  41. package/dist/modules/channels/index.js +1 -1
  42. package/dist/modules/collabkin/index.cjs +14 -14
  43. package/dist/modules/collabkin/index.cjs.map +1 -1
  44. package/dist/modules/collabkin/index.js +1 -1
  45. package/dist/modules/comradecircle/index.cjs +14 -14
  46. package/dist/modules/comradecircle/index.cjs.map +1 -1
  47. package/dist/modules/comradecircle/index.js +1 -1
  48. package/dist/modules/conversations/index.cjs +14 -14
  49. package/dist/modules/conversations/index.cjs.map +1 -1
  50. package/dist/modules/conversations/index.js +1 -1
  51. package/dist/modules/coolandlovely/index.cjs +14 -14
  52. package/dist/modules/coolandlovely/index.cjs.map +1 -1
  53. package/dist/modules/coolandlovely/index.js +1 -1
  54. package/dist/modules/cosmicintersection/index.cjs +14 -14
  55. package/dist/modules/cosmicintersection/index.cjs.map +1 -1
  56. package/dist/modules/cosmicintersection/index.js +1 -1
  57. package/dist/modules/crewfoundry/index.cjs +14 -14
  58. package/dist/modules/crewfoundry/index.cjs.map +1 -1
  59. package/dist/modules/crewfoundry/index.js +1 -1
  60. package/dist/modules/devportal/index.cjs +14 -14
  61. package/dist/modules/devportal/index.cjs.map +1 -1
  62. package/dist/modules/devportal/index.js +1 -1
  63. package/dist/modules/ecoimpacthub/index.cjs +14 -14
  64. package/dist/modules/ecoimpacthub/index.cjs.map +1 -1
  65. package/dist/modules/ecoimpacthub/index.js +1 -1
  66. package/dist/modules/eventfullymanaged/index.cjs +14 -14
  67. package/dist/modules/eventfullymanaged/index.cjs.map +1 -1
  68. package/dist/modules/eventfullymanaged/index.js +1 -1
  69. package/dist/modules/export/index.cjs +14 -14
  70. package/dist/modules/export/index.cjs.map +1 -1
  71. package/dist/modules/export/index.js +1 -1
  72. package/dist/modules/files/index.cjs +14 -14
  73. package/dist/modules/files/index.cjs.map +1 -1
  74. package/dist/modules/files/index.js +1 -1
  75. package/dist/modules/ggnomad/index.cjs +14 -14
  76. package/dist/modules/ggnomad/index.cjs.map +1 -1
  77. package/dist/modules/ggnomad/index.js +1 -1
  78. package/dist/modules/govcitizenhub/index.cjs +14 -14
  79. package/dist/modules/govcitizenhub/index.cjs.map +1 -1
  80. package/dist/modules/govcitizenhub/index.js +1 -1
  81. package/dist/modules/groups/index.cjs +14 -14
  82. package/dist/modules/groups/index.cjs.map +1 -1
  83. package/dist/modules/groups/index.js +1 -1
  84. package/dist/modules/headshotmarketing/index.cjs +14 -14
  85. package/dist/modules/headshotmarketing/index.cjs.map +1 -1
  86. package/dist/modules/headshotmarketing/index.js +1 -1
  87. package/dist/modules/health/index.cjs +21 -19
  88. package/dist/modules/health/index.cjs.map +1 -1
  89. package/dist/modules/health/index.js +1 -1
  90. package/dist/modules/hookmovies/index.cjs +14 -14
  91. package/dist/modules/hookmovies/index.cjs.map +1 -1
  92. package/dist/modules/hookmovies/index.js +1 -1
  93. package/dist/modules/housingvista/index.cjs +14 -14
  94. package/dist/modules/housingvista/index.cjs.map +1 -1
  95. package/dist/modules/housingvista/index.js +1 -1
  96. package/dist/modules/integrations/index.cjs +14 -14
  97. package/dist/modules/integrations/index.cjs.map +1 -1
  98. package/dist/modules/integrations/index.js +1 -1
  99. package/dist/modules/intelwatchtower/index.cjs +14 -14
  100. package/dist/modules/intelwatchtower/index.cjs.map +1 -1
  101. package/dist/modules/intelwatchtower/index.js +1 -1
  102. package/dist/modules/kadaikodi/index.cjs +14 -14
  103. package/dist/modules/kadaikodi/index.cjs.map +1 -1
  104. package/dist/modules/kadaikodi/index.js +1 -1
  105. package/dist/modules/labsofscience/index.cjs +14 -14
  106. package/dist/modules/labsofscience/index.cjs.map +1 -1
  107. package/dist/modules/labsofscience/index.js +1 -1
  108. package/dist/modules/manufacturedops/index.cjs +14 -14
  109. package/dist/modules/manufacturedops/index.cjs.map +1 -1
  110. package/dist/modules/manufacturedops/index.js +1 -1
  111. package/dist/modules/movethewheels/index.cjs +16 -42
  112. package/dist/modules/movethewheels/index.cjs.map +1 -1
  113. package/dist/modules/movethewheels/index.js +3 -29
  114. package/dist/modules/movethewheels/index.js.map +1 -1
  115. package/dist/modules/mybodyshield/index.cjs +14 -14
  116. package/dist/modules/mybodyshield/index.cjs.map +1 -1
  117. package/dist/modules/mybodyshield/index.js +1 -1
  118. package/dist/modules/notifications/index.cjs +14 -14
  119. package/dist/modules/notifications/index.cjs.map +1 -1
  120. package/dist/modules/notifications/index.js +1 -1
  121. package/dist/modules/organizations/index.cjs +14 -14
  122. package/dist/modules/organizations/index.cjs.map +1 -1
  123. package/dist/modules/organizations/index.js +1 -1
  124. package/dist/modules/planmagnet/index.cjs +14 -14
  125. package/dist/modules/planmagnet/index.cjs.map +1 -1
  126. package/dist/modules/planmagnet/index.js +1 -1
  127. package/dist/modules/products/index.cjs +14 -14
  128. package/dist/modules/products/index.cjs.map +1 -1
  129. package/dist/modules/products/index.js +1 -1
  130. package/dist/modules/proserviceworld/index.cjs +14 -14
  131. package/dist/modules/proserviceworld/index.cjs.map +1 -1
  132. package/dist/modules/proserviceworld/index.js +1 -1
  133. package/dist/modules/rbac/index.cjs +14 -14
  134. package/dist/modules/rbac/index.cjs.map +1 -1
  135. package/dist/modules/rbac/index.js +1 -1
  136. package/dist/modules/sandbox/index.cjs +14 -14
  137. package/dist/modules/sandbox/index.cjs.map +1 -1
  138. package/dist/modules/sandbox/index.js +1 -1
  139. package/dist/modules/scheduler/index.cjs +14 -14
  140. package/dist/modules/scheduler/index.cjs.map +1 -1
  141. package/dist/modules/scheduler/index.js +1 -1
  142. package/dist/modules/security/index.cjs +14 -14
  143. package/dist/modules/security/index.cjs.map +1 -1
  144. package/dist/modules/security/index.js +1 -1
  145. package/dist/modules/semanticfed/index.cjs +14 -14
  146. package/dist/modules/semanticfed/index.cjs.map +1 -1
  147. package/dist/modules/semanticfed/index.js +1 -1
  148. package/dist/modules/store/index.cjs +14 -14
  149. package/dist/modules/store/index.cjs.map +1 -1
  150. package/dist/modules/store/index.js +1 -1
  151. package/dist/modules/subscriberbot/index.cjs +14 -14
  152. package/dist/modules/subscriberbot/index.cjs.map +1 -1
  153. package/dist/modules/subscriberbot/index.js +1 -1
  154. package/dist/modules/support/index.cjs +14 -14
  155. package/dist/modules/support/index.cjs.map +1 -1
  156. package/dist/modules/support/index.js +1 -1
  157. package/dist/modules/tags/index.cjs +14 -14
  158. package/dist/modules/tags/index.cjs.map +1 -1
  159. package/dist/modules/tags/index.js +1 -1
  160. package/dist/modules/technospam/index.cjs +14 -14
  161. package/dist/modules/technospam/index.cjs.map +1 -1
  162. package/dist/modules/technospam/index.js +1 -1
  163. package/dist/modules/theculturepost/index.cjs +14 -14
  164. package/dist/modules/theculturepost/index.cjs.map +1 -1
  165. package/dist/modules/theculturepost/index.js +1 -1
  166. package/dist/modules/theglobalfuel/index.cjs +14 -14
  167. package/dist/modules/theglobalfuel/index.cjs.map +1 -1
  168. package/dist/modules/theglobalfuel/index.js +1 -1
  169. package/dist/modules/timecampus/index.cjs +21 -16
  170. package/dist/modules/timecampus/index.cjs.map +1 -1
  171. package/dist/modules/timecampus/index.js +8 -3
  172. package/dist/modules/timecampus/index.js.map +1 -1
  173. package/dist/modules/tours/index.cjs +14 -14
  174. package/dist/modules/tours/index.cjs.map +1 -1
  175. package/dist/modules/tours/index.js +1 -1
  176. package/dist/modules/vibecontrols/index.cjs +14 -14
  177. package/dist/modules/vibecontrols/index.cjs.map +1 -1
  178. package/dist/modules/vibecontrols/index.js +2 -2
  179. package/dist/modules/workspaces/index.cjs +14 -14
  180. package/dist/modules/workspaces/index.cjs.map +1 -1
  181. package/dist/modules/workspaces/index.js +1 -1
  182. package/dist/{tool-name-DlnrBsZ6.d.ts → tool-name-BaPNMZdj.d.ts} +17 -1
  183. package/dist/{tool-name-CQf_IqAj.d.cts → tool-name-Bvb36qmq.d.cts} +17 -1
  184. package/package.json +1 -1
  185. package/dist/chunk-H2OYWLOA.js.map +0 -1
@@ -1,4 +1,4 @@
1
- import { mcpToolName, errorResult, jsonResult, mcpResourceUri, mcpPromptName } from '../../chunk-H2OYWLOA.js';
1
+ import { mcpToolName, errorResult, jsonResult, mcpResourceUri, mcpPromptName } from '../../chunk-YOSQUY3M.js';
2
2
  import { z } from 'zod';
3
3
 
4
4
  // src/modules/semanticfed/operations.ts
@@ -18,20 +18,6 @@ var McpInternalError = class extends Error {
18
18
  }
19
19
  };
20
20
 
21
- // src/core/result.ts
22
- function jsonResult(data, structured) {
23
- const result = {
24
- content: [{ type: "text", text: JSON.stringify(data, null, 2) }]
25
- };
26
- return result;
27
- }
28
- function errorResult(message, hint) {
29
- const text = hint ? `${message}
30
-
31
- Hint: ${hint}` : message;
32
- return { content: [{ type: "text", text }], isError: true };
33
- }
34
-
35
21
  // src/core/tool-name.ts
36
22
  var MAX_TOOL_NAME_LENGTH = 63;
37
23
  function assertSafeName(name, kind) {
@@ -50,6 +36,20 @@ function mcpToolName(productName, ...parts) {
50
36
  return assertSafeName(name);
51
37
  }
52
38
 
39
+ // src/core/result.ts
40
+ function jsonResult(data, structured) {
41
+ const result = {
42
+ content: [{ type: "text", text: JSON.stringify(data, null, 2) }]
43
+ };
44
+ return result;
45
+ }
46
+ function errorResult(message, hint) {
47
+ const text = hint ? `${message}
48
+
49
+ Hint: ${hint}` : message;
50
+ return { content: [{ type: "text", text }], isError: true };
51
+ }
52
+
53
53
  // src/modules/store/operations.ts
54
54
  var BROWSE_STORE = `
55
55
  query BrowseStore($input: BrowseStoreInput!) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/core/errors.ts","../../../src/core/result.ts","../../../src/core/tool-name.ts","../../../src/modules/store/operations.ts","../../../src/modules/store/tools.ts","../../../src/modules/store/index.ts"],"names":["z"],"mappings":";;;;;;;;;;;AA8BO,IAAM,gBAAA,GAAN,cAA+B,KA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A,EACb,SAAA,EAAW,CAAC,MAAM,CAAA;AAAA,EAClB,YAAA,EAAc,EAAE,KAAA,EAAO,EAAC,EAAE;AAAA,EAE1B,QAAA,CAAS,QAAmB,GAAA,EAAqC;AAC/D,IAAA,MAAM,QAAkB,EAAC;AACzB,IAAA,MAAM,KAAA,GAAQ,CAAC,CAAA,KAAsB;AACnC,MAAA,KAAA,CAAM,KAAK,CAAC,CAAA;AACZ,MAAA,OAAO,CAAA;AAAA,IACT,CAAA;AAEA,IAAA,kBAAA,CAAmB,MAAA,EAAQ,KAAK,KAAK,CAAA;AAErC,IAAA,OAAO,EAAE,KAAA,EAAO,SAAA,EAAW,EAAC,EAAG,OAAA,EAAS,EAAC,EAAE;AAAA,EAC7C;AACF,CAAA;AAEA,IAAO,aAAA,GAAQ","file":"index.cjs","sourcesContent":["/**\n * Error classes for MCP SDK.\n *\n * Modules MUST throw these instead of throwing raw Errors. The registerTool\n * wrapper in result.ts catches and maps them to MCP-protocol-compliant\n * `{ isError: true, content: [...] }` responses.\n *\n * Throwing past the wrapper to the protocol surfaces as JSON-RPC -32603 to\n * the client and is a protocol bug.\n */\n\nexport class McpUserError extends Error {\n public readonly hint: string | undefined;\n\n constructor(message: string, opts?: { hint?: string }) {\n super(message);\n this.name = 'McpUserError';\n this.hint = opts?.hint;\n }\n}\n\nexport class McpAuthError extends McpUserError {\n constructor(message: string, opts?: { hint?: string }) {\n super(message, {\n hint: opts?.hint ?? 'Run the auth_login tool to authenticate.',\n });\n this.name = 'McpAuthError';\n }\n}\n\nexport class McpInternalError extends Error {\n public override readonly cause: unknown;\n\n constructor(message: string, cause?: unknown) {\n super(message);\n this.name = 'McpInternalError';\n this.cause = cause;\n }\n}\n","/**\n * MCP tool result helpers + central handler.\n *\n * Modules NEVER call server.registerTool directly — they use registerTool()\n * from this module so the central try/catch wraps the handler and:\n * - maps thrown McpUserError / McpAuthError / McpInternalError to\n * MCP-protocol-compliant `{ isError: true, content: [...] }` shapes\n * - threads `_meta.progressToken` into ctx.progress for long ops\n * - emits a structured log line on every error\n * - never leaks `cause` from McpInternalError to the client\n *\n * This is the analog of cli-sdk's createProgram() central error handler.\n */\n\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { ZodRawShape } from 'zod';\nimport type { McpContext } from './context.js';\nimport { McpAuthError, McpInternalError, McpUserError } from './errors.js';\n\nexport interface ToolTextContent {\n type: 'text';\n text: string;\n [k: string]: unknown;\n}\n\nexport interface ToolResult {\n content: ToolTextContent[];\n isError?: boolean;\n structuredContent?: Record<string, unknown>;\n [k: string]: unknown;\n}\n\nexport interface ToolMeta {\n progressToken?: string | number;\n}\n\n/**\n * Build a successful tool result with JSON content (pretty-printed).\n */\nexport function jsonResult(data: unknown, structured?: Record<string, unknown>): ToolResult {\n const result: ToolResult = {\n content: [{ type: 'text', text: JSON.stringify(data, null, 2) }],\n };\n if (structured !== undefined) {\n result.structuredContent = structured;\n }\n return result;\n}\n\n/**\n * Build a successful tool result with plain text content.\n */\nexport function textResult(text: string): ToolResult {\n return { content: [{ type: 'text', text }] };\n}\n\n/**\n * Build an error tool result. Honors MCP's `{ isError: true, content }` shape.\n * Optional hint is appended on a new line so the LLM can react.\n */\nexport function errorResult(message: string, hint?: string): ToolResult {\n const text = hint ? `${message}\\n\\nHint: ${hint}` : message;\n return { content: [{ type: 'text', text }], isError: true };\n}\n\nexport interface ToolMetadata {\n title: string;\n description: string;\n inputSchema?: ZodRawShape;\n}\n\nexport type ToolHandler<TArgs = Record<string, unknown>> = (\n args: TArgs,\n ctx: McpContext,\n meta: ToolMeta,\n) => Promise<unknown>;\n\n/**\n * Register a tool with the central error wrapper.\n *\n * The handler returns a plain value or void. The wrapper:\n * - wraps non-undefined returns in jsonResult()\n * - if the value already looks like a ToolResult (has `content`), passes through\n * - catches McpAuthError / McpUserError / McpInternalError / generic Error\n * - logs every error via ctx.logger.error\n */\nexport function registerTool<TArgs extends Record<string, unknown>>(\n server: McpServer,\n ctx: McpContext,\n name: string,\n metadata: ToolMetadata,\n handler: ToolHandler<TArgs>,\n): void {\n const sdkConfig = {\n title: metadata.title,\n description: metadata.description,\n ...(metadata.inputSchema ? { inputSchema: metadata.inputSchema } : {}),\n };\n\n // The MCP SDK's registerTool signature is `(name, config, handler)`. The\n // handler arity depends on whether inputSchema is present (1-arg without,\n // 2-arg with). We accept a unified handler shape and dispatch at runtime.\n // The SDK's typing is strict and conditional on the inputSchema generic;\n // bypass with a cast since runtime acceptance is unconditional.\n const wrapped = async (...callbackArgs: unknown[]): Promise<ToolResult> => {\n const hasArgs = callbackArgs.length === 2;\n const args = (hasArgs ? callbackArgs[0] : {}) as TArgs;\n const extra = (hasArgs ? callbackArgs[1] : callbackArgs[0]) as\n | { _meta?: { progressToken?: string | number } }\n | undefined;\n\n const progressToken = extra?._meta?.progressToken;\n const meta: ToolMeta = progressToken !== undefined ? { progressToken } : {};\n\n try {\n const result = await handler(args, ctx, meta);\n if (isToolResult(result)) return result;\n if (result === undefined) return textResult('OK');\n return jsonResult(result);\n } catch (error) {\n return mapErrorToResult(error, ctx, name);\n }\n };\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (server as any).registerTool(name, sdkConfig, wrapped);\n}\n\nfunction isToolResult(value: unknown): value is ToolResult {\n return (\n !!value &&\n typeof value === 'object' &&\n 'content' in value &&\n Array.isArray((value as ToolResult).content)\n );\n}\n\nfunction mapErrorToResult(error: unknown, ctx: McpContext, toolName: string): ToolResult {\n if (error instanceof McpAuthError) {\n ctx.logger.warn(`${toolName}: auth required`, { message: error.message });\n return errorResult(error.message, error.hint);\n }\n if (error instanceof McpUserError) {\n ctx.logger.info(`${toolName}: user error`, { message: error.message });\n return errorResult(error.message, error.hint);\n }\n if (error instanceof McpInternalError) {\n ctx.logger.error(`${toolName}: internal error`, {\n message: error.message,\n cause: stringifyCause(error.cause),\n });\n return errorResult(`Internal error in ${toolName}.`);\n }\n const message = error instanceof Error ? error.message : String(error);\n ctx.logger.error(`${toolName}: unhandled error`, { message });\n return errorResult(`${toolName}: ${message}`);\n}\n\nfunction stringifyCause(cause: unknown): string | undefined {\n if (cause === undefined || cause === null) return undefined;\n if (cause instanceof Error) return cause.message;\n try {\n return JSON.stringify(cause);\n } catch {\n return String(cause);\n }\n}\n","/**\n * Tool / resource / prompt naming helpers.\n *\n * Mandatory product prefix avoids collisions when Claude Desktop runs\n * multiple MCP servers concurrently (typical setup is ~6).\n *\n * Tool names are capped at 63 characters — Claude Desktop pre-1.x\n * truncated at 64 in some versions.\n */\n\nimport { McpInternalError } from './errors.js';\n\nconst MAX_TOOL_NAME_LENGTH = 63;\n\nfunction assertSafeName(name: string, kind: 'tool' | 'resource' | 'prompt'): string {\n if (kind === 'tool' && name.length > MAX_TOOL_NAME_LENGTH) {\n throw new McpInternalError(\n `Tool name '${name}' exceeds ${MAX_TOOL_NAME_LENGTH} characters (some MCP clients truncate at 64).`,\n );\n }\n return name;\n}\n\n/**\n * Build a tool name. Format: `<productName>_<...parts>` (snake_case).\n * Example: mcpToolName('vibecontrols', 'vibes', 'list') -> 'vibecontrols_vibes_list'\n */\nexport function mcpToolName(productName: string, ...parts: string[]): string {\n if (!productName) {\n throw new McpInternalError('mcpToolName: productName is required');\n }\n const name = [productName, ...parts].filter(Boolean).join('_');\n return assertSafeName(name, 'tool');\n}\n\n/**\n * Build a resource URI. Format: `<productName>://<...parts>`.\n * Example: mcpResourceUri('vibecontrols', 'schema') -> 'vibecontrols://schema'\n */\nexport function mcpResourceUri(productName: string, ...parts: string[]): string {\n if (!productName) {\n throw new McpInternalError('mcpResourceUri: productName is required');\n }\n return `${productName}://${parts.filter(Boolean).join('/')}`;\n}\n\n/**\n * Build a prompt name. Format: `<productName>-<...parts>` (kebab-case).\n * Example: mcpPromptName('vibecontrols', 'setup') -> 'vibecontrols-setup'\n */\nexport function mcpPromptName(productName: string, ...parts: string[]): string {\n if (!productName) {\n throw new McpInternalError('mcpPromptName: productName is required');\n }\n return [productName, ...parts].filter(Boolean).join('-');\n}\n\nexport const TOOL_NAME_LIMIT = MAX_TOOL_NAME_LENGTH;\n","export const BROWSE_STORE = `\n query BrowseStore($input: BrowseStoreInput!) {\n browseStore(input: $input) {\n products { id name description price currency type status }\n facets { categories types }\n totalCount hasMore\n }\n }\n`;\n\nexport const SEARCH_STORE = `\n query SearchStore($query: String!, $filters: StoreFiltersInput) {\n searchStore(query: $query, filters: $filters) {\n id name price currency type activeInstallCount\n }\n }\n`;\n\nexport const GET_STORE_PRODUCT = `\n query GetStoreProduct($id: ID!) {\n getProduct(id: $id) {\n id name description price currency type status\n publisher { name }\n }\n }\n`;\n\nexport const MY_CART = `\n query MyCart {\n myCart {\n id currency subtotal total itemCount isEmpty\n items { id productId quantity }\n }\n }\n`;\n\nexport const ADD_TO_CART = `\n mutation AddToCart($input: AddToCartInput!) {\n addToCart(input: $input) {\n id itemCount subtotal items { productId quantity }\n }\n }\n`;\n\nexport const REMOVE_FROM_CART = `\n mutation RemoveFromCart($cartId: ID!, $itemId: ID!) {\n removeFromCart(cartId: $cartId, itemId: $itemId) {\n id itemCount subtotal\n }\n }\n`;\n\nexport const CHECKOUT_CART = `\n mutation CheckoutCart($cartId: ID!) {\n checkoutCart(cartId: $cartId) {\n success order { id total status }\n }\n }\n`;\n\nexport const GET_ORDERS = `\n query GetOrders($limit: Int, $offset: Int) {\n getOrders(limit: $limit, offset: $offset) {\n id status total currency createdAt\n }\n }\n`;\n\nexport const GET_ORDER = `\n query GetOrder($id: ID!) {\n getOrder(id: $id) {\n id status total currency paidAt billingAccountId\n lineItems { productId quantity unitPrice }\n }\n }\n`;\n\nexport const GET_INSTALLED_PRODUCTS = `\n query GetInstalledProducts($workspaceId: ID!) {\n getInstalledProducts(workspaceId: $workspaceId) {\n id application { id name } status installedAt lastUsedAt\n }\n }\n`;\n\nexport const UNINSTALL_PRODUCT = `\n mutation UninstallProduct($installationId: ID!) {\n uninstallProduct(installationId: $installationId) { success }\n }\n`;\n\nexport const GET_LICENSES = `\n query GetLicenses($entitlementId: ID!) {\n getLicenses(entitlementId: $entitlementId) {\n id status validFrom expiresAt\n }\n }\n`;\n\nexport const CLEAR_CART = `\n mutation ClearCart {\n clearCart {\n cart {\n id currency subtotal total itemCount isEmpty\n items { id productId quantity }\n }\n errors { code field message }\n }\n }\n`;\n\nexport const GET_MY_PUBLISHER = `\n query MyPublisher {\n myPublisher {\n id name legalName email contactEmail websiteUrl\n bio logoUrl isVerified verificationStatus\n productCount totalSales totalEarnings tier\n createdAt updatedAt\n }\n }\n`;\n\nexport const GET_MY_PUBLISHER_PRODUCTS = `\n query MyPublisherProducts {\n myPublisher {\n id productCount\n products {\n id name slug description price currency type status downloads\n publisher { id name isVerified }\n }\n }\n }\n`;\n","/**\n * Store module tools — marketplace search, cart, orders, installed apps,\n * licenses. Backend: ~/products/global/store/global-store-svc/.\n * Ported from cli-sdk/src/modules/store/.\n *\n * Note: store_cart_checkout completes the cart server-side (no browser\n * redirect). Provider-bound payment capture (Stripe checkout pages) is not\n * exposed in cli-sdk and is omitted here.\n */\n\nimport { z } from 'zod';\nimport { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { jsonResult, errorResult, mcpToolName, type McpContext } from '../../core/index.js';\nimport {\n BROWSE_STORE,\n SEARCH_STORE,\n GET_STORE_PRODUCT,\n MY_CART,\n ADD_TO_CART,\n REMOVE_FROM_CART,\n CHECKOUT_CART,\n CLEAR_CART,\n GET_ORDERS,\n GET_ORDER,\n GET_INSTALLED_PRODUCTS,\n UNINSTALL_PRODUCT,\n GET_LICENSES,\n GET_MY_PUBLISHER,\n GET_MY_PUBLISHER_PRODUCTS,\n} from './operations.js';\n\ninterface StoreProduct {\n id: string;\n name: string;\n price?: number;\n currency?: string;\n type?: string;\n status?: string;\n}\n\ninterface CartRow {\n id: string;\n itemCount?: number;\n subtotal?: number;\n total?: number;\n currency?: string;\n isEmpty?: boolean;\n items?: Array<{ id: string; productId: string; quantity: number }>;\n}\n\ninterface OrderRow {\n id: string;\n status?: string;\n total?: number;\n currency?: string;\n createdAt?: string;\n}\n\nfunction resolveWorkspaceId(ctx: McpContext, override: string | undefined): string | null {\n if (override !== undefined && override !== '') return override;\n const auth = ctx.auth.read();\n if (!auth?.workspaceId) return null;\n return auth.workspaceId;\n}\n\nexport function registerStoreTools(\n server: McpServer,\n ctx: McpContext,\n track: (n: string) => string,\n): void {\n // ── Search / browse / get ──────────────────────────────────────────────\n server.registerTool(\n track(mcpToolName(ctx.productName, 'store_search')),\n {\n title: 'Search Store',\n description: 'Search the marketplace for products by query and optional filters.',\n inputSchema: {\n query: z.string().describe('Search query'),\n type: z.string().optional().describe('Product type filter'),\n category: z.string().optional().describe('Category filter'),\n },\n },\n async ({ query, type, category }) => {\n try {\n const filters: Record<string, unknown> = {};\n if (type !== undefined) filters.productType = type.toUpperCase();\n if (category !== undefined) filters.category = category;\n const data = await ctx.gql.global.request<{ searchStore: StoreProduct[] }>(SEARCH_STORE, {\n query,\n filters: Object.keys(filters).length ? filters : undefined,\n });\n return jsonResult(data.searchStore);\n } catch (error) {\n ctx.logger.error('store_search failed', { error: String(error) });\n return errorResult(\n `Failed to search store: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'store_browse')),\n {\n title: 'Browse Store',\n description: 'Browse the marketplace with structured input (categories, facets, paging).',\n inputSchema: {\n category: z.string().optional().describe('Category filter'),\n type: z.string().optional().describe('Product type filter'),\n limit: z.number().optional().describe('Page size'),\n offset: z.number().optional().describe('Skip results'),\n },\n },\n async ({ category, type, limit, offset }) => {\n try {\n const input: Record<string, unknown> = {};\n if (category !== undefined) input.category = category;\n if (type !== undefined) input.productType = type.toUpperCase();\n if (limit !== undefined) input.limit = limit;\n if (offset !== undefined) input.offset = offset;\n const data = await ctx.gql.global.request<{\n browseStore: {\n products: StoreProduct[];\n facets: { categories: string[]; types: string[] };\n totalCount: number;\n hasMore: boolean;\n };\n }>(BROWSE_STORE, { input });\n return jsonResult(data.browseStore);\n } catch (error) {\n ctx.logger.error('store_browse failed', { error: String(error) });\n return errorResult(\n `Failed to browse store: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'store_get_product')),\n {\n title: 'Get Store Product',\n description: 'Get a marketplace product by ID.',\n inputSchema: { id: z.string().describe('Product ID') },\n },\n async ({ id }) => {\n try {\n const data = await ctx.gql.global.request<{ getProduct: StoreProduct | null }>(\n GET_STORE_PRODUCT,\n { id },\n );\n if (!data.getProduct) return errorResult(`Product ${id} not found`);\n return jsonResult(data.getProduct);\n } catch (error) {\n ctx.logger.error('store_get_product failed', { error: String(error) });\n return errorResult(\n `Failed to get product: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n // ── Cart ───────────────────────────────────────────────────────────────\n server.registerTool(\n track(mcpToolName(ctx.productName, 'store_cart_list')),\n {\n title: 'Show Cart',\n description: \"Show the current user's cart.\",\n inputSchema: {},\n },\n async () => {\n try {\n const data = await ctx.gql.global.request<{ myCart: CartRow }>(MY_CART);\n return jsonResult(data.myCart);\n } catch (error) {\n ctx.logger.error('store_cart_list failed', { error: String(error) });\n return errorResult(\n `Failed to fetch cart: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'store_cart_add')),\n {\n title: 'Add to Cart',\n description: 'Add a product (and optional variant) to the cart.',\n inputSchema: {\n product: z.string().describe('Product ID'),\n quantity: z.number().optional().describe('Quantity (default 1)'),\n variant: z.string().optional().describe('Variant ID'),\n },\n },\n async ({ product, quantity, variant }) => {\n try {\n const input: Record<string, unknown> = { productId: product };\n if (quantity !== undefined) input.quantity = quantity;\n if (variant !== undefined) input.variantId = variant;\n const data = await ctx.gql.global.request<{ addToCart: CartRow }>(ADD_TO_CART, { input });\n return jsonResult(data.addToCart);\n } catch (error) {\n ctx.logger.error('store_cart_add failed', { error: String(error) });\n return errorResult(\n `Failed to add to cart: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'store_cart_remove')),\n {\n title: 'Remove from Cart',\n description: 'Remove an item from the cart.',\n inputSchema: {\n cart: z.string().describe('Cart ID'),\n item: z.string().describe('Cart item ID'),\n },\n },\n async ({ cart, item }) => {\n try {\n await ctx.gql.global.request(REMOVE_FROM_CART, { cartId: cart, itemId: item });\n return jsonResult({ status: 'success', message: 'Item removed from cart', cart, item });\n } catch (error) {\n ctx.logger.error('store_cart_remove failed', { error: String(error) });\n return errorResult(\n `Failed to remove cart item: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'store_cart_checkout')),\n {\n title: 'Checkout Cart',\n description:\n 'Check out the cart server-side (uses default payment method on the billing account).',\n inputSchema: { cartId: z.string().describe('Cart ID') },\n },\n async ({ cartId }) => {\n try {\n const data = await ctx.gql.global.request<{\n checkoutCart: { success: boolean; order?: OrderRow };\n }>(CHECKOUT_CART, { cartId });\n return jsonResult(data.checkoutCart);\n } catch (error) {\n ctx.logger.error('store_cart_checkout failed', { error: String(error) });\n return errorResult(\n `Failed to checkout cart: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'store_cart_clear')),\n {\n title: 'Clear Cart',\n description:\n \"Remove every item from the current user's active cart. Returns the resulting empty cart payload.\",\n inputSchema: {},\n },\n async () => {\n try {\n const data = await ctx.gql.global.request<{\n clearCart: {\n cart: CartRow | null;\n errors: Array<{ code: string; field?: string; message: string }> | null;\n };\n }>(CLEAR_CART);\n const payload = data.clearCart;\n if (payload?.errors && payload.errors.length > 0) {\n const first = payload.errors[0];\n return errorResult(`Failed to clear cart: ${first.code} ${first.message}`);\n }\n return jsonResult(payload?.cart ?? null);\n } catch (error) {\n ctx.logger.error('store_cart_clear failed', { error: String(error) });\n return errorResult(\n `Failed to clear cart: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n // ── Orders ─────────────────────────────────────────────────────────────\n server.registerTool(\n track(mcpToolName(ctx.productName, 'store_orders_list')),\n {\n title: 'List Orders',\n description: 'List orders for the current user.',\n inputSchema: {\n limit: z.number().optional().describe('Page size (default 50)'),\n offset: z.number().optional().describe('Skip results (default 0)'),\n },\n },\n async ({ limit, offset }) => {\n try {\n const data = await ctx.gql.global.request<{ getOrders: OrderRow[] }>(GET_ORDERS, {\n limit,\n offset: offset ?? 0,\n });\n return jsonResult(data.getOrders);\n } catch (error) {\n ctx.logger.error('store_orders_list failed', { error: String(error) });\n return errorResult(\n `Failed to list orders: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'store_orders_get')),\n {\n title: 'Get Order',\n description: 'Get an order by ID.',\n inputSchema: { id: z.string().describe('Order ID') },\n },\n async ({ id }) => {\n try {\n const data = await ctx.gql.global.request<{ getOrder: OrderRow | null }>(GET_ORDER, { id });\n if (!data.getOrder) return errorResult(`Order ${id} not found`);\n return jsonResult(data.getOrder);\n } catch (error) {\n ctx.logger.error('store_orders_get failed', { error: String(error) });\n return errorResult(\n `Failed to get order: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n // ── Installed ──────────────────────────────────────────────────────────\n server.registerTool(\n track(mcpToolName(ctx.productName, 'store_installed_list')),\n {\n title: 'List Installed Products',\n description: 'List installed products in the current (or specified) workspace.',\n inputSchema: {\n workspace: z.string().optional().describe('Workspace ID (defaults to current)'),\n },\n },\n async ({ workspace }) => {\n try {\n const wid = resolveWorkspaceId(ctx, workspace);\n if (!wid) {\n return errorResult(\n 'No active workspace. Bind a workspace via the auth login flow first.',\n );\n }\n const data = await ctx.gql.global.request<{\n getInstalledProducts: Array<{\n id: string;\n application: { id: string; name: string };\n status: string;\n installedAt: string;\n }>;\n }>(GET_INSTALLED_PRODUCTS, { workspaceId: wid });\n return jsonResult(data.getInstalledProducts);\n } catch (error) {\n ctx.logger.error('store_installed_list failed', { error: String(error) });\n return errorResult(\n `Failed to list installed products: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'store_installed_uninstall')),\n {\n title: 'Uninstall Product',\n description: 'Uninstall a product by installation ID.',\n inputSchema: { installationId: z.string().describe('Installation ID') },\n },\n async ({ installationId }) => {\n try {\n await ctx.gql.global.request(UNINSTALL_PRODUCT, { installationId });\n return jsonResult({ status: 'success', message: 'Product uninstalled', installationId });\n } catch (error) {\n ctx.logger.error('store_installed_uninstall failed', { error: String(error) });\n return errorResult(\n `Failed to uninstall product: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n // ── Licenses ───────────────────────────────────────────────────────────\n server.registerTool(\n track(mcpToolName(ctx.productName, 'store_licenses_list')),\n {\n title: 'List Licenses',\n description: 'List licenses for an entitlement.',\n inputSchema: { entitlement: z.string().describe('Entitlement ID') },\n },\n async ({ entitlement }) => {\n try {\n const data = await ctx.gql.global.request<{\n getLicenses: Array<{ id: string; status: string; validFrom: string; expiresAt: string }>;\n }>(GET_LICENSES, { entitlementId: entitlement });\n return jsonResult(data.getLicenses);\n } catch (error) {\n ctx.logger.error('store_licenses_list failed', { error: String(error) });\n return errorResult(\n `Failed to list licenses: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n // ── Publisher ──────────────────────────────────────────────────────────\n // Schema reality: global-store-svc only exposes `myPublisher` (the current\n // user's own publisher profile). There is no public `getPublisher(id)` —\n // these tools target the bound user.\n server.registerTool(\n track(mcpToolName(ctx.productName, 'store_publisher_get')),\n {\n title: 'Get Publisher',\n description:\n \"Fetch the current user's publisher profile (verification status, tier, totals). Returns null if no publisher profile exists yet.\",\n inputSchema: {},\n },\n async () => {\n try {\n const data = await ctx.gql.global.request<{ myPublisher: unknown | null }>(\n GET_MY_PUBLISHER,\n );\n return jsonResult(data.myPublisher);\n } catch (error) {\n ctx.logger.error('store_publisher_get failed', { error: String(error) });\n return errorResult(\n `Failed to get publisher: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'store_publisher_products')),\n {\n title: 'List Publisher Products',\n description:\n \"List products published by the current user's publisher profile. Returns { publisherId, productCount, products } or null if no profile exists.\",\n inputSchema: {},\n },\n async () => {\n try {\n const data = await ctx.gql.global.request<{\n myPublisher: { id: string; productCount: number; products: StoreProduct[] } | null;\n }>(GET_MY_PUBLISHER_PRODUCTS);\n const p = data.myPublisher;\n if (!p) return jsonResult(null);\n return jsonResult({\n publisherId: p.id,\n productCount: p.productCount,\n products: p.products,\n });\n } catch (error) {\n ctx.logger.error('store_publisher_products failed', { error: String(error) });\n return errorResult(\n `Failed to list publisher products: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n}\n","/**\n * Store module — marketplace search/browse, cart, orders, installed apps,\n * licenses. Backend: ~/products/global/store/global-store-svc/.\n * Ported from cli-sdk/src/modules/store/.\n */\n\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { McpContext, McpModule, ModuleRegistration } from '../../core/index.js';\nimport { registerStoreTools } from './tools.js';\n\nconst storeModule: McpModule = {\n id: 'store',\n version: '0.0.1',\n displayName: 'Store',\n dependsOn: ['auth'],\n capabilities: { tools: {} },\n\n register(server: McpServer, ctx: McpContext): ModuleRegistration {\n const tools: string[] = [];\n const track = (n: string): string => {\n tools.push(n);\n return n;\n };\n\n registerStoreTools(server, ctx, track);\n\n return { tools, resources: [], prompts: [] };\n },\n};\n\nexport default storeModule;\n"]}
1
+ {"version":3,"sources":["../../../src/core/errors.ts","../../../src/core/tool-name.ts","../../../src/core/result.ts","../../../src/modules/store/operations.ts","../../../src/modules/store/tools.ts","../../../src/modules/store/index.ts"],"names":["z"],"mappings":";;;;;;;;;;;AA8BO,IAAM,gBAAA,GAAN,cAA+B,KAAA,CAAM;AAAA,EACjB,KAAA;AAAA,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A,EAAW,CAAC,MAAM,CAAA;AAAA,EAClB,YAAA,EAAc,EAAE,KAAA,EAAO,EAAC,EAAE;AAAA,EAE1B,QAAA,CAAS,QAAmB,GAAA,EAAqC;AAC/D,IAAA,MAAM,QAAkB,EAAC;AACzB,IAAA,MAAM,KAAA,GAAQ,CAAC,CAAA,KAAsB;AACnC,MAAA,KAAA,CAAM,KAAK,CAAC,CAAA;AACZ,MAAA,OAAO,CAAA;AAAA,IACT,CAAA;AAEA,IAAA,kBAAA,CAAmB,MAAA,EAAQ,KAAK,KAAK,CAAA;AAErC,IAAA,OAAO,EAAE,KAAA,EAAO,SAAA,EAAW,EAAC,EAAG,OAAA,EAAS,EAAC,EAAE;AAAA,EAC7C;AACF,CAAA;AAEA,IAAO,aAAA,GAAQ","file":"index.cjs","sourcesContent":["/**\n * Error classes for MCP SDK.\n *\n * Modules MUST throw these instead of throwing raw Errors. The registerTool\n * wrapper in result.ts catches and maps them to MCP-protocol-compliant\n * `{ isError: true, content: [...] }` responses.\n *\n * Throwing past the wrapper to the protocol surfaces as JSON-RPC -32603 to\n * the client and is a protocol bug.\n */\n\nexport class McpUserError extends Error {\n public readonly hint: string | undefined;\n\n constructor(message: string, opts?: { hint?: string }) {\n super(message);\n this.name = 'McpUserError';\n this.hint = opts?.hint;\n }\n}\n\nexport class McpAuthError extends McpUserError {\n constructor(message: string, opts?: { hint?: string }) {\n super(message, {\n hint: opts?.hint ?? 'Run the auth_login tool to authenticate.',\n });\n this.name = 'McpAuthError';\n }\n}\n\nexport class McpInternalError extends Error {\n public override readonly cause: unknown;\n\n constructor(message: string, cause?: unknown) {\n super(message);\n this.name = 'McpInternalError';\n this.cause = cause;\n }\n}\n","/**\n * Tool / resource / prompt naming helpers.\n *\n * Mandatory product prefix avoids collisions when Claude Desktop runs\n * multiple MCP servers concurrently (typical setup is ~6).\n *\n * Tool names are capped at 63 characters — Claude Desktop pre-1.x\n * truncated at 64 in some versions.\n */\n\nimport { McpInternalError } from './errors.js';\n\nconst MAX_TOOL_NAME_LENGTH = 63;\n\nfunction assertSafeName(name: string, kind: 'tool' | 'resource' | 'prompt'): string {\n if (kind === 'tool' && name.length > MAX_TOOL_NAME_LENGTH) {\n throw new McpInternalError(\n `Tool name '${name}' exceeds ${MAX_TOOL_NAME_LENGTH} characters (some MCP clients truncate at 64).`,\n );\n }\n return name;\n}\n\n/**\n * Build a tool name. Format: `<productName>_<...parts>` (snake_case).\n * Example: mcpToolName('vibecontrols', 'vibes', 'list') -> 'vibecontrols_vibes_list'\n */\nexport function mcpToolName(productName: string, ...parts: string[]): string {\n if (!productName) {\n throw new McpInternalError('mcpToolName: productName is required');\n }\n const name = [productName, ...parts].filter(Boolean).join('_');\n return assertSafeName(name, 'tool');\n}\n\n/**\n * Build a resource URI. Format: `<productName>://<...parts>`.\n * Example: mcpResourceUri('vibecontrols', 'schema') -> 'vibecontrols://schema'\n */\nexport function mcpResourceUri(productName: string, ...parts: string[]): string {\n if (!productName) {\n throw new McpInternalError('mcpResourceUri: productName is required');\n }\n return `${productName}://${parts.filter(Boolean).join('/')}`;\n}\n\n/**\n * Build a prompt name. Format: `<productName>-<...parts>` (kebab-case).\n * Example: mcpPromptName('vibecontrols', 'setup') -> 'vibecontrols-setup'\n */\nexport function mcpPromptName(productName: string, ...parts: string[]): string {\n if (!productName) {\n throw new McpInternalError('mcpPromptName: productName is required');\n }\n return [productName, ...parts].filter(Boolean).join('-');\n}\n\nexport const TOOL_NAME_LIMIT = MAX_TOOL_NAME_LENGTH;\n\n/**\n * Name-based hint heuristics for MCP `annotations` (readOnlyHint /\n * destructiveHint). Used by tool-governance.ts to auto-fill annotations for\n * the fleet of product modules that call `server.registerTool` directly\n * (bypassing the `registerTool()` core helper) and so never set them\n * explicitly today (BOFF-3903). Deliberately conservative — matched against\n * whole `_`-delimited segments so e.g. `timeentries_delete` and\n * `pomodoro_delete_goal` match, but a hypothetical `undeletable_check`\n * would not.\n *\n * A module can always override the inference by passing an explicit\n * `annotations` object to `registerTool()` / `server.registerTool()`.\n */\nconst DESTRUCTIVE_NAME_SEGMENT = /(?:^|_)delete(?:_|$)/i;\nconst READ_ONLY_NAME_SEGMENT = /(?:^|_)(?:list|get|search|check|read|count|stats|by_date)(?:_|$)/i;\n\n/** True when a tool name looks destructive (irreversibly deletes data) by naming convention. */\nexport function inferDestructiveHint(toolName: string): boolean {\n return DESTRUCTIVE_NAME_SEGMENT.test(toolName);\n}\n\n/**\n * True when a tool name looks read-only by naming convention. Never true for\n * a name that also looks destructive (a tool can't be both).\n */\nexport function inferReadOnlyHint(toolName: string): boolean {\n return !inferDestructiveHint(toolName) && READ_ONLY_NAME_SEGMENT.test(toolName);\n}\n","/**\n * MCP tool result helpers + central handler.\n *\n * Modules NEVER call server.registerTool directly — they use registerTool()\n * from this module so the central try/catch wraps the handler and:\n * - maps thrown McpUserError / McpAuthError / McpInternalError to\n * MCP-protocol-compliant `{ isError: true, content: [...] }` shapes\n * - threads `_meta.progressToken` into ctx.progress for long ops\n * - emits a structured log line on every error\n * - never leaks `cause` from McpInternalError to the client\n *\n * This is the analog of cli-sdk's createProgram() central error handler.\n */\n\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { ZodRawShape } from 'zod';\nimport type { McpContext } from './context.js';\nimport { McpAuthError, McpInternalError, McpUserError } from './errors.js';\nimport type { ToolAnnotations } from './tool-governance.js';\n\nexport interface ToolTextContent {\n type: 'text';\n text: string;\n [k: string]: unknown;\n}\n\nexport interface ToolResult {\n content: ToolTextContent[];\n isError?: boolean;\n structuredContent?: Record<string, unknown>;\n [k: string]: unknown;\n}\n\nexport interface ToolMeta {\n progressToken?: string | number;\n}\n\n/**\n * Build a successful tool result with JSON content (pretty-printed).\n */\nexport function jsonResult(data: unknown, structured?: Record<string, unknown>): ToolResult {\n const result: ToolResult = {\n content: [{ type: 'text', text: JSON.stringify(data, null, 2) }],\n };\n if (structured !== undefined) {\n result.structuredContent = structured;\n }\n return result;\n}\n\n/**\n * Build a successful tool result with plain text content.\n */\nexport function textResult(text: string): ToolResult {\n return { content: [{ type: 'text', text }] };\n}\n\n/**\n * Build an error tool result. Honors MCP's `{ isError: true, content }` shape.\n * Optional hint is appended on a new line so the LLM can react.\n */\nexport function errorResult(message: string, hint?: string): ToolResult {\n const text = hint ? `${message}\\n\\nHint: ${hint}` : message;\n return { content: [{ type: 'text', text }], isError: true };\n}\n\nexport interface ToolMetadata {\n title: string;\n description: string;\n inputSchema?: ZodRawShape;\n /**\n * Explicit MCP annotations (readOnlyHint / destructiveHint / ...). Optional\n * — when omitted, `wrapServerWithToolGovernance` (applied centrally in\n * `createMcpServer`) infers them from the tool name. Set this to override\n * the inference for a tool whose name doesn't match the naming convention.\n */\n annotations?: ToolAnnotations;\n}\n\nexport type ToolHandler<TArgs = Record<string, unknown>> = (\n args: TArgs,\n ctx: McpContext,\n meta: ToolMeta,\n) => Promise<unknown>;\n\n/**\n * Register a tool with the central error wrapper.\n *\n * The handler returns a plain value or void. The wrapper:\n * - wraps non-undefined returns in jsonResult()\n * - if the value already looks like a ToolResult (has `content`), passes through\n * - catches McpAuthError / McpUserError / McpInternalError / generic Error\n * - logs every error via ctx.logger.error\n */\nexport function registerTool<TArgs extends Record<string, unknown>>(\n server: McpServer,\n ctx: McpContext,\n name: string,\n metadata: ToolMetadata,\n handler: ToolHandler<TArgs>,\n): void {\n const sdkConfig = {\n title: metadata.title,\n description: metadata.description,\n ...(metadata.inputSchema ? { inputSchema: metadata.inputSchema } : {}),\n ...(metadata.annotations ? { annotations: metadata.annotations } : {}),\n };\n\n // The MCP SDK's registerTool signature is `(name, config, handler)`. The\n // handler arity depends on whether inputSchema is present (1-arg without,\n // 2-arg with). We accept a unified handler shape and dispatch at runtime.\n // The SDK's typing is strict and conditional on the inputSchema generic;\n // bypass with a cast since runtime acceptance is unconditional.\n const wrapped = async (...callbackArgs: unknown[]): Promise<ToolResult> => {\n const hasArgs = callbackArgs.length === 2;\n const args = (hasArgs ? callbackArgs[0] : {}) as TArgs;\n const extra = (hasArgs ? callbackArgs[1] : callbackArgs[0]) as\n | { _meta?: { progressToken?: string | number } }\n | undefined;\n\n const progressToken = extra?._meta?.progressToken;\n const meta: ToolMeta = progressToken !== undefined ? { progressToken } : {};\n\n try {\n const result = await handler(args, ctx, meta);\n if (isToolResult(result)) return result;\n if (result === undefined) return textResult('OK');\n return jsonResult(result);\n } catch (error) {\n return mapErrorToResult(error, ctx, name);\n }\n };\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n (server as any).registerTool(name, sdkConfig, wrapped);\n}\n\nfunction isToolResult(value: unknown): value is ToolResult {\n return (\n !!value &&\n typeof value === 'object' &&\n 'content' in value &&\n Array.isArray((value as ToolResult).content)\n );\n}\n\nfunction mapErrorToResult(error: unknown, ctx: McpContext, toolName: string): ToolResult {\n if (error instanceof McpAuthError) {\n ctx.logger.warn(`${toolName}: auth required`, { message: error.message });\n return errorResult(error.message, error.hint);\n }\n if (error instanceof McpUserError) {\n ctx.logger.info(`${toolName}: user error`, { message: error.message });\n return errorResult(error.message, error.hint);\n }\n if (error instanceof McpInternalError) {\n ctx.logger.error(`${toolName}: internal error`, {\n message: error.message,\n cause: stringifyCause(error.cause),\n });\n return errorResult(`Internal error in ${toolName}.`);\n }\n const message = error instanceof Error ? error.message : String(error);\n ctx.logger.error(`${toolName}: unhandled error`, { message });\n return errorResult(`${toolName}: ${message}`);\n}\n\nfunction stringifyCause(cause: unknown): string | undefined {\n if (cause === undefined || cause === null) return undefined;\n if (cause instanceof Error) return cause.message;\n try {\n return JSON.stringify(cause);\n } catch {\n return String(cause);\n }\n}\n","export const BROWSE_STORE = `\n query BrowseStore($input: BrowseStoreInput!) {\n browseStore(input: $input) {\n products { id name description price currency type status }\n facets { categories types }\n totalCount hasMore\n }\n }\n`;\n\nexport const SEARCH_STORE = `\n query SearchStore($query: String!, $filters: StoreFiltersInput) {\n searchStore(query: $query, filters: $filters) {\n id name price currency type activeInstallCount\n }\n }\n`;\n\nexport const GET_STORE_PRODUCT = `\n query GetStoreProduct($id: ID!) {\n getProduct(id: $id) {\n id name description price currency type status\n publisher { name }\n }\n }\n`;\n\nexport const MY_CART = `\n query MyCart {\n myCart {\n id currency subtotal total itemCount isEmpty\n items { id productId quantity }\n }\n }\n`;\n\nexport const ADD_TO_CART = `\n mutation AddToCart($input: AddToCartInput!) {\n addToCart(input: $input) {\n id itemCount subtotal items { productId quantity }\n }\n }\n`;\n\nexport const REMOVE_FROM_CART = `\n mutation RemoveFromCart($cartId: ID!, $itemId: ID!) {\n removeFromCart(cartId: $cartId, itemId: $itemId) {\n id itemCount subtotal\n }\n }\n`;\n\nexport const CHECKOUT_CART = `\n mutation CheckoutCart($cartId: ID!) {\n checkoutCart(cartId: $cartId) {\n success order { id total status }\n }\n }\n`;\n\nexport const GET_ORDERS = `\n query GetOrders($limit: Int, $offset: Int) {\n getOrders(limit: $limit, offset: $offset) {\n id status total currency createdAt\n }\n }\n`;\n\nexport const GET_ORDER = `\n query GetOrder($id: ID!) {\n getOrder(id: $id) {\n id status total currency paidAt billingAccountId\n lineItems { productId quantity unitPrice }\n }\n }\n`;\n\nexport const GET_INSTALLED_PRODUCTS = `\n query GetInstalledProducts($workspaceId: ID!) {\n getInstalledProducts(workspaceId: $workspaceId) {\n id application { id name } status installedAt lastUsedAt\n }\n }\n`;\n\nexport const UNINSTALL_PRODUCT = `\n mutation UninstallProduct($installationId: ID!) {\n uninstallProduct(installationId: $installationId) { success }\n }\n`;\n\nexport const GET_LICENSES = `\n query GetLicenses($entitlementId: ID!) {\n getLicenses(entitlementId: $entitlementId) {\n id status validFrom expiresAt\n }\n }\n`;\n\nexport const CLEAR_CART = `\n mutation ClearCart {\n clearCart {\n cart {\n id currency subtotal total itemCount isEmpty\n items { id productId quantity }\n }\n errors { code field message }\n }\n }\n`;\n\nexport const GET_MY_PUBLISHER = `\n query MyPublisher {\n myPublisher {\n id name legalName email contactEmail websiteUrl\n bio logoUrl isVerified verificationStatus\n productCount totalSales totalEarnings tier\n createdAt updatedAt\n }\n }\n`;\n\nexport const GET_MY_PUBLISHER_PRODUCTS = `\n query MyPublisherProducts {\n myPublisher {\n id productCount\n products {\n id name slug description price currency type status downloads\n publisher { id name isVerified }\n }\n }\n }\n`;\n","/**\n * Store module tools — marketplace search, cart, orders, installed apps,\n * licenses. Backend: ~/products/global/store/global-store-svc/.\n * Ported from cli-sdk/src/modules/store/.\n *\n * Note: store_cart_checkout completes the cart server-side (no browser\n * redirect). Provider-bound payment capture (Stripe checkout pages) is not\n * exposed in cli-sdk and is omitted here.\n */\n\nimport { z } from 'zod';\nimport { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport { jsonResult, errorResult, mcpToolName, type McpContext } from '../../core/index.js';\nimport {\n BROWSE_STORE,\n SEARCH_STORE,\n GET_STORE_PRODUCT,\n MY_CART,\n ADD_TO_CART,\n REMOVE_FROM_CART,\n CHECKOUT_CART,\n CLEAR_CART,\n GET_ORDERS,\n GET_ORDER,\n GET_INSTALLED_PRODUCTS,\n UNINSTALL_PRODUCT,\n GET_LICENSES,\n GET_MY_PUBLISHER,\n GET_MY_PUBLISHER_PRODUCTS,\n} from './operations.js';\n\ninterface StoreProduct {\n id: string;\n name: string;\n price?: number;\n currency?: string;\n type?: string;\n status?: string;\n}\n\ninterface CartRow {\n id: string;\n itemCount?: number;\n subtotal?: number;\n total?: number;\n currency?: string;\n isEmpty?: boolean;\n items?: Array<{ id: string; productId: string; quantity: number }>;\n}\n\ninterface OrderRow {\n id: string;\n status?: string;\n total?: number;\n currency?: string;\n createdAt?: string;\n}\n\nfunction resolveWorkspaceId(ctx: McpContext, override: string | undefined): string | null {\n if (override !== undefined && override !== '') return override;\n const auth = ctx.auth.read();\n if (!auth?.workspaceId) return null;\n return auth.workspaceId;\n}\n\nexport function registerStoreTools(\n server: McpServer,\n ctx: McpContext,\n track: (n: string) => string,\n): void {\n // ── Search / browse / get ──────────────────────────────────────────────\n server.registerTool(\n track(mcpToolName(ctx.productName, 'store_search')),\n {\n title: 'Search Store',\n description: 'Search the marketplace for products by query and optional filters.',\n inputSchema: {\n query: z.string().describe('Search query'),\n type: z.string().optional().describe('Product type filter'),\n category: z.string().optional().describe('Category filter'),\n },\n },\n async ({ query, type, category }) => {\n try {\n const filters: Record<string, unknown> = {};\n if (type !== undefined) filters.productType = type.toUpperCase();\n if (category !== undefined) filters.category = category;\n const data = await ctx.gql.global.request<{ searchStore: StoreProduct[] }>(SEARCH_STORE, {\n query,\n filters: Object.keys(filters).length ? filters : undefined,\n });\n return jsonResult(data.searchStore);\n } catch (error) {\n ctx.logger.error('store_search failed', { error: String(error) });\n return errorResult(\n `Failed to search store: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'store_browse')),\n {\n title: 'Browse Store',\n description: 'Browse the marketplace with structured input (categories, facets, paging).',\n inputSchema: {\n category: z.string().optional().describe('Category filter'),\n type: z.string().optional().describe('Product type filter'),\n limit: z.number().optional().describe('Page size'),\n offset: z.number().optional().describe('Skip results'),\n },\n },\n async ({ category, type, limit, offset }) => {\n try {\n const input: Record<string, unknown> = {};\n if (category !== undefined) input.category = category;\n if (type !== undefined) input.productType = type.toUpperCase();\n if (limit !== undefined) input.limit = limit;\n if (offset !== undefined) input.offset = offset;\n const data = await ctx.gql.global.request<{\n browseStore: {\n products: StoreProduct[];\n facets: { categories: string[]; types: string[] };\n totalCount: number;\n hasMore: boolean;\n };\n }>(BROWSE_STORE, { input });\n return jsonResult(data.browseStore);\n } catch (error) {\n ctx.logger.error('store_browse failed', { error: String(error) });\n return errorResult(\n `Failed to browse store: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'store_get_product')),\n {\n title: 'Get Store Product',\n description: 'Get a marketplace product by ID.',\n inputSchema: { id: z.string().describe('Product ID') },\n },\n async ({ id }) => {\n try {\n const data = await ctx.gql.global.request<{ getProduct: StoreProduct | null }>(\n GET_STORE_PRODUCT,\n { id },\n );\n if (!data.getProduct) return errorResult(`Product ${id} not found`);\n return jsonResult(data.getProduct);\n } catch (error) {\n ctx.logger.error('store_get_product failed', { error: String(error) });\n return errorResult(\n `Failed to get product: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n // ── Cart ───────────────────────────────────────────────────────────────\n server.registerTool(\n track(mcpToolName(ctx.productName, 'store_cart_list')),\n {\n title: 'Show Cart',\n description: \"Show the current user's cart.\",\n inputSchema: {},\n },\n async () => {\n try {\n const data = await ctx.gql.global.request<{ myCart: CartRow }>(MY_CART);\n return jsonResult(data.myCart);\n } catch (error) {\n ctx.logger.error('store_cart_list failed', { error: String(error) });\n return errorResult(\n `Failed to fetch cart: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'store_cart_add')),\n {\n title: 'Add to Cart',\n description: 'Add a product (and optional variant) to the cart.',\n inputSchema: {\n product: z.string().describe('Product ID'),\n quantity: z.number().optional().describe('Quantity (default 1)'),\n variant: z.string().optional().describe('Variant ID'),\n },\n },\n async ({ product, quantity, variant }) => {\n try {\n const input: Record<string, unknown> = { productId: product };\n if (quantity !== undefined) input.quantity = quantity;\n if (variant !== undefined) input.variantId = variant;\n const data = await ctx.gql.global.request<{ addToCart: CartRow }>(ADD_TO_CART, { input });\n return jsonResult(data.addToCart);\n } catch (error) {\n ctx.logger.error('store_cart_add failed', { error: String(error) });\n return errorResult(\n `Failed to add to cart: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'store_cart_remove')),\n {\n title: 'Remove from Cart',\n description: 'Remove an item from the cart.',\n inputSchema: {\n cart: z.string().describe('Cart ID'),\n item: z.string().describe('Cart item ID'),\n },\n },\n async ({ cart, item }) => {\n try {\n await ctx.gql.global.request(REMOVE_FROM_CART, { cartId: cart, itemId: item });\n return jsonResult({ status: 'success', message: 'Item removed from cart', cart, item });\n } catch (error) {\n ctx.logger.error('store_cart_remove failed', { error: String(error) });\n return errorResult(\n `Failed to remove cart item: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'store_cart_checkout')),\n {\n title: 'Checkout Cart',\n description:\n 'Check out the cart server-side (uses default payment method on the billing account).',\n inputSchema: { cartId: z.string().describe('Cart ID') },\n },\n async ({ cartId }) => {\n try {\n const data = await ctx.gql.global.request<{\n checkoutCart: { success: boolean; order?: OrderRow };\n }>(CHECKOUT_CART, { cartId });\n return jsonResult(data.checkoutCart);\n } catch (error) {\n ctx.logger.error('store_cart_checkout failed', { error: String(error) });\n return errorResult(\n `Failed to checkout cart: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'store_cart_clear')),\n {\n title: 'Clear Cart',\n description:\n \"Remove every item from the current user's active cart. Returns the resulting empty cart payload.\",\n inputSchema: {},\n },\n async () => {\n try {\n const data = await ctx.gql.global.request<{\n clearCart: {\n cart: CartRow | null;\n errors: Array<{ code: string; field?: string; message: string }> | null;\n };\n }>(CLEAR_CART);\n const payload = data.clearCart;\n if (payload?.errors && payload.errors.length > 0) {\n const first = payload.errors[0];\n return errorResult(`Failed to clear cart: ${first.code} ${first.message}`);\n }\n return jsonResult(payload?.cart ?? null);\n } catch (error) {\n ctx.logger.error('store_cart_clear failed', { error: String(error) });\n return errorResult(\n `Failed to clear cart: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n // ── Orders ─────────────────────────────────────────────────────────────\n server.registerTool(\n track(mcpToolName(ctx.productName, 'store_orders_list')),\n {\n title: 'List Orders',\n description: 'List orders for the current user.',\n inputSchema: {\n limit: z.number().optional().describe('Page size (default 50)'),\n offset: z.number().optional().describe('Skip results (default 0)'),\n },\n },\n async ({ limit, offset }) => {\n try {\n const data = await ctx.gql.global.request<{ getOrders: OrderRow[] }>(GET_ORDERS, {\n limit,\n offset: offset ?? 0,\n });\n return jsonResult(data.getOrders);\n } catch (error) {\n ctx.logger.error('store_orders_list failed', { error: String(error) });\n return errorResult(\n `Failed to list orders: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'store_orders_get')),\n {\n title: 'Get Order',\n description: 'Get an order by ID.',\n inputSchema: { id: z.string().describe('Order ID') },\n },\n async ({ id }) => {\n try {\n const data = await ctx.gql.global.request<{ getOrder: OrderRow | null }>(GET_ORDER, { id });\n if (!data.getOrder) return errorResult(`Order ${id} not found`);\n return jsonResult(data.getOrder);\n } catch (error) {\n ctx.logger.error('store_orders_get failed', { error: String(error) });\n return errorResult(\n `Failed to get order: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n // ── Installed ──────────────────────────────────────────────────────────\n server.registerTool(\n track(mcpToolName(ctx.productName, 'store_installed_list')),\n {\n title: 'List Installed Products',\n description: 'List installed products in the current (or specified) workspace.',\n inputSchema: {\n workspace: z.string().optional().describe('Workspace ID (defaults to current)'),\n },\n },\n async ({ workspace }) => {\n try {\n const wid = resolveWorkspaceId(ctx, workspace);\n if (!wid) {\n return errorResult(\n 'No active workspace. Bind a workspace via the auth login flow first.',\n );\n }\n const data = await ctx.gql.global.request<{\n getInstalledProducts: Array<{\n id: string;\n application: { id: string; name: string };\n status: string;\n installedAt: string;\n }>;\n }>(GET_INSTALLED_PRODUCTS, { workspaceId: wid });\n return jsonResult(data.getInstalledProducts);\n } catch (error) {\n ctx.logger.error('store_installed_list failed', { error: String(error) });\n return errorResult(\n `Failed to list installed products: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'store_installed_uninstall')),\n {\n title: 'Uninstall Product',\n description: 'Uninstall a product by installation ID.',\n inputSchema: { installationId: z.string().describe('Installation ID') },\n },\n async ({ installationId }) => {\n try {\n await ctx.gql.global.request(UNINSTALL_PRODUCT, { installationId });\n return jsonResult({ status: 'success', message: 'Product uninstalled', installationId });\n } catch (error) {\n ctx.logger.error('store_installed_uninstall failed', { error: String(error) });\n return errorResult(\n `Failed to uninstall product: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n // ── Licenses ───────────────────────────────────────────────────────────\n server.registerTool(\n track(mcpToolName(ctx.productName, 'store_licenses_list')),\n {\n title: 'List Licenses',\n description: 'List licenses for an entitlement.',\n inputSchema: { entitlement: z.string().describe('Entitlement ID') },\n },\n async ({ entitlement }) => {\n try {\n const data = await ctx.gql.global.request<{\n getLicenses: Array<{ id: string; status: string; validFrom: string; expiresAt: string }>;\n }>(GET_LICENSES, { entitlementId: entitlement });\n return jsonResult(data.getLicenses);\n } catch (error) {\n ctx.logger.error('store_licenses_list failed', { error: String(error) });\n return errorResult(\n `Failed to list licenses: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n // ── Publisher ──────────────────────────────────────────────────────────\n // Schema reality: global-store-svc only exposes `myPublisher` (the current\n // user's own publisher profile). There is no public `getPublisher(id)` —\n // these tools target the bound user.\n server.registerTool(\n track(mcpToolName(ctx.productName, 'store_publisher_get')),\n {\n title: 'Get Publisher',\n description:\n \"Fetch the current user's publisher profile (verification status, tier, totals). Returns null if no publisher profile exists yet.\",\n inputSchema: {},\n },\n async () => {\n try {\n const data = await ctx.gql.global.request<{ myPublisher: unknown | null }>(\n GET_MY_PUBLISHER,\n );\n return jsonResult(data.myPublisher);\n } catch (error) {\n ctx.logger.error('store_publisher_get failed', { error: String(error) });\n return errorResult(\n `Failed to get publisher: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'store_publisher_products')),\n {\n title: 'List Publisher Products',\n description:\n \"List products published by the current user's publisher profile. Returns { publisherId, productCount, products } or null if no profile exists.\",\n inputSchema: {},\n },\n async () => {\n try {\n const data = await ctx.gql.global.request<{\n myPublisher: { id: string; productCount: number; products: StoreProduct[] } | null;\n }>(GET_MY_PUBLISHER_PRODUCTS);\n const p = data.myPublisher;\n if (!p) return jsonResult(null);\n return jsonResult({\n publisherId: p.id,\n productCount: p.productCount,\n products: p.products,\n });\n } catch (error) {\n ctx.logger.error('store_publisher_products failed', { error: String(error) });\n return errorResult(\n `Failed to list publisher products: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n}\n","/**\n * Store module — marketplace search/browse, cart, orders, installed apps,\n * licenses. Backend: ~/products/global/store/global-store-svc/.\n * Ported from cli-sdk/src/modules/store/.\n */\n\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { McpContext, McpModule, ModuleRegistration } from '../../core/index.js';\nimport { registerStoreTools } from './tools.js';\n\nconst storeModule: McpModule = {\n id: 'store',\n version: '0.0.1',\n displayName: 'Store',\n dependsOn: ['auth'],\n capabilities: { tools: {} },\n\n register(server: McpServer, ctx: McpContext): ModuleRegistration {\n const tools: string[] = [];\n const track = (n: string): string => {\n tools.push(n);\n return n;\n };\n\n registerStoreTools(server, ctx, track);\n\n return { tools, resources: [], prompts: [] };\n },\n};\n\nexport default storeModule;\n"]}
@@ -1,4 +1,4 @@
1
- import { mcpToolName, jsonResult, errorResult } from '../../chunk-H2OYWLOA.js';
1
+ import { mcpToolName, jsonResult, errorResult } from '../../chunk-YOSQUY3M.js';
2
2
  import { z } from 'zod';
3
3
 
4
4
  // src/modules/store/operations.ts
@@ -18,20 +18,6 @@ var McpInternalError = class extends Error {
18
18
  }
19
19
  };
20
20
 
21
- // src/core/result.ts
22
- function jsonResult(data, structured) {
23
- const result = {
24
- content: [{ type: "text", text: JSON.stringify(data, null, 2) }]
25
- };
26
- return result;
27
- }
28
- function errorResult(message, hint) {
29
- const text = hint ? `${message}
30
-
31
- Hint: ${hint}` : message;
32
- return { content: [{ type: "text", text }], isError: true };
33
- }
34
-
35
21
  // src/core/tool-name.ts
36
22
  var MAX_TOOL_NAME_LENGTH = 63;
37
23
  function assertSafeName(name, kind) {
@@ -62,6 +48,20 @@ function mcpPromptName(productName, ...parts) {
62
48
  return [productName, ...parts].filter(Boolean).join("-");
63
49
  }
64
50
 
51
+ // src/core/result.ts
52
+ function jsonResult(data, structured) {
53
+ const result = {
54
+ content: [{ type: "text", text: JSON.stringify(data, null, 2) }]
55
+ };
56
+ return result;
57
+ }
58
+ function errorResult(message, hint) {
59
+ const text = hint ? `${message}
60
+
61
+ Hint: ${hint}` : message;
62
+ return { content: [{ type: "text", text }], isError: true };
63
+ }
64
+
65
65
  // src/modules/subscriberbot/operations.ts
66
66
  var PROVIDER_FIELDS = `
67
67
  id name slug description category status industry region language