@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.
- package/dist/{chunk-WWFVD7BO.js → chunk-RHWHUY5Y.js} +3 -3
- package/dist/{chunk-WWFVD7BO.js.map → chunk-RHWHUY5Y.js.map} +1 -1
- package/dist/{chunk-H2OYWLOA.js → chunk-YOSQUY3M.js} +101 -35
- package/dist/chunk-YOSQUY3M.js.map +1 -0
- package/dist/core/index.cjs +101 -32
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +1 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.js +1 -1
- package/dist/index.cjs +97 -31
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/modules/adaptercloud/index.cjs +14 -14
- package/dist/modules/adaptercloud/index.cjs.map +1 -1
- package/dist/modules/adaptercloud/index.js +1 -1
- package/dist/modules/artistrybase/index.cjs +14 -14
- package/dist/modules/artistrybase/index.cjs.map +1 -1
- package/dist/modules/artistrybase/index.js +1 -1
- package/dist/modules/assethandler/index.cjs +14 -14
- package/dist/modules/assethandler/index.cjs.map +1 -1
- package/dist/modules/assethandler/index.js +1 -1
- package/dist/modules/atheletebridge/index.cjs +14 -14
- package/dist/modules/atheletebridge/index.cjs.map +1 -1
- package/dist/modules/atheletebridge/index.js +1 -1
- package/dist/modules/auth/index.cjs +14 -14
- package/dist/modules/auth/index.cjs.map +1 -1
- package/dist/modules/auth/index.js +3 -3
- package/dist/modules/billing/index.cjs +14 -14
- package/dist/modules/billing/index.cjs.map +1 -1
- package/dist/modules/billing/index.js +1 -1
- package/dist/modules/brainyrich/index.cjs +14 -14
- package/dist/modules/brainyrich/index.cjs.map +1 -1
- package/dist/modules/brainyrich/index.js +1 -1
- package/dist/modules/buildmyiq/index.cjs +14 -14
- package/dist/modules/buildmyiq/index.cjs.map +1 -1
- package/dist/modules/buildmyiq/index.js +1 -1
- package/dist/modules/channels/index.cjs +14 -14
- package/dist/modules/channels/index.cjs.map +1 -1
- package/dist/modules/channels/index.js +1 -1
- package/dist/modules/collabkin/index.cjs +14 -14
- package/dist/modules/collabkin/index.cjs.map +1 -1
- package/dist/modules/collabkin/index.js +1 -1
- package/dist/modules/comradecircle/index.cjs +14 -14
- package/dist/modules/comradecircle/index.cjs.map +1 -1
- package/dist/modules/comradecircle/index.js +1 -1
- package/dist/modules/conversations/index.cjs +14 -14
- package/dist/modules/conversations/index.cjs.map +1 -1
- package/dist/modules/conversations/index.js +1 -1
- package/dist/modules/coolandlovely/index.cjs +14 -14
- package/dist/modules/coolandlovely/index.cjs.map +1 -1
- package/dist/modules/coolandlovely/index.js +1 -1
- package/dist/modules/cosmicintersection/index.cjs +14 -14
- package/dist/modules/cosmicintersection/index.cjs.map +1 -1
- package/dist/modules/cosmicintersection/index.js +1 -1
- package/dist/modules/crewfoundry/index.cjs +14 -14
- package/dist/modules/crewfoundry/index.cjs.map +1 -1
- package/dist/modules/crewfoundry/index.js +1 -1
- package/dist/modules/devportal/index.cjs +14 -14
- package/dist/modules/devportal/index.cjs.map +1 -1
- package/dist/modules/devportal/index.js +1 -1
- package/dist/modules/ecoimpacthub/index.cjs +14 -14
- package/dist/modules/ecoimpacthub/index.cjs.map +1 -1
- package/dist/modules/ecoimpacthub/index.js +1 -1
- package/dist/modules/eventfullymanaged/index.cjs +14 -14
- package/dist/modules/eventfullymanaged/index.cjs.map +1 -1
- package/dist/modules/eventfullymanaged/index.js +1 -1
- package/dist/modules/export/index.cjs +14 -14
- package/dist/modules/export/index.cjs.map +1 -1
- package/dist/modules/export/index.js +1 -1
- package/dist/modules/files/index.cjs +14 -14
- package/dist/modules/files/index.cjs.map +1 -1
- package/dist/modules/files/index.js +1 -1
- package/dist/modules/ggnomad/index.cjs +14 -14
- package/dist/modules/ggnomad/index.cjs.map +1 -1
- package/dist/modules/ggnomad/index.js +1 -1
- package/dist/modules/govcitizenhub/index.cjs +14 -14
- package/dist/modules/govcitizenhub/index.cjs.map +1 -1
- package/dist/modules/govcitizenhub/index.js +1 -1
- package/dist/modules/groups/index.cjs +14 -14
- package/dist/modules/groups/index.cjs.map +1 -1
- package/dist/modules/groups/index.js +1 -1
- package/dist/modules/headshotmarketing/index.cjs +14 -14
- package/dist/modules/headshotmarketing/index.cjs.map +1 -1
- package/dist/modules/headshotmarketing/index.js +1 -1
- package/dist/modules/health/index.cjs +21 -19
- package/dist/modules/health/index.cjs.map +1 -1
- package/dist/modules/health/index.js +1 -1
- package/dist/modules/hookmovies/index.cjs +14 -14
- package/dist/modules/hookmovies/index.cjs.map +1 -1
- package/dist/modules/hookmovies/index.js +1 -1
- package/dist/modules/housingvista/index.cjs +14 -14
- package/dist/modules/housingvista/index.cjs.map +1 -1
- package/dist/modules/housingvista/index.js +1 -1
- package/dist/modules/integrations/index.cjs +14 -14
- package/dist/modules/integrations/index.cjs.map +1 -1
- package/dist/modules/integrations/index.js +1 -1
- package/dist/modules/intelwatchtower/index.cjs +14 -14
- package/dist/modules/intelwatchtower/index.cjs.map +1 -1
- package/dist/modules/intelwatchtower/index.js +1 -1
- package/dist/modules/kadaikodi/index.cjs +14 -14
- package/dist/modules/kadaikodi/index.cjs.map +1 -1
- package/dist/modules/kadaikodi/index.js +1 -1
- package/dist/modules/labsofscience/index.cjs +14 -14
- package/dist/modules/labsofscience/index.cjs.map +1 -1
- package/dist/modules/labsofscience/index.js +1 -1
- package/dist/modules/manufacturedops/index.cjs +14 -14
- package/dist/modules/manufacturedops/index.cjs.map +1 -1
- package/dist/modules/manufacturedops/index.js +1 -1
- package/dist/modules/movethewheels/index.cjs +16 -42
- package/dist/modules/movethewheels/index.cjs.map +1 -1
- package/dist/modules/movethewheels/index.js +3 -29
- package/dist/modules/movethewheels/index.js.map +1 -1
- package/dist/modules/mybodyshield/index.cjs +14 -14
- package/dist/modules/mybodyshield/index.cjs.map +1 -1
- package/dist/modules/mybodyshield/index.js +1 -1
- package/dist/modules/notifications/index.cjs +14 -14
- package/dist/modules/notifications/index.cjs.map +1 -1
- package/dist/modules/notifications/index.js +1 -1
- package/dist/modules/organizations/index.cjs +14 -14
- package/dist/modules/organizations/index.cjs.map +1 -1
- package/dist/modules/organizations/index.js +1 -1
- package/dist/modules/planmagnet/index.cjs +14 -14
- package/dist/modules/planmagnet/index.cjs.map +1 -1
- package/dist/modules/planmagnet/index.js +1 -1
- package/dist/modules/products/index.cjs +14 -14
- package/dist/modules/products/index.cjs.map +1 -1
- package/dist/modules/products/index.js +1 -1
- package/dist/modules/proserviceworld/index.cjs +14 -14
- package/dist/modules/proserviceworld/index.cjs.map +1 -1
- package/dist/modules/proserviceworld/index.js +1 -1
- package/dist/modules/rbac/index.cjs +14 -14
- package/dist/modules/rbac/index.cjs.map +1 -1
- package/dist/modules/rbac/index.js +1 -1
- package/dist/modules/sandbox/index.cjs +14 -14
- package/dist/modules/sandbox/index.cjs.map +1 -1
- package/dist/modules/sandbox/index.js +1 -1
- package/dist/modules/scheduler/index.cjs +14 -14
- package/dist/modules/scheduler/index.cjs.map +1 -1
- package/dist/modules/scheduler/index.js +1 -1
- package/dist/modules/security/index.cjs +14 -14
- package/dist/modules/security/index.cjs.map +1 -1
- package/dist/modules/security/index.js +1 -1
- package/dist/modules/semanticfed/index.cjs +14 -14
- package/dist/modules/semanticfed/index.cjs.map +1 -1
- package/dist/modules/semanticfed/index.js +1 -1
- package/dist/modules/store/index.cjs +14 -14
- package/dist/modules/store/index.cjs.map +1 -1
- package/dist/modules/store/index.js +1 -1
- package/dist/modules/subscriberbot/index.cjs +14 -14
- package/dist/modules/subscriberbot/index.cjs.map +1 -1
- package/dist/modules/subscriberbot/index.js +1 -1
- package/dist/modules/support/index.cjs +14 -14
- package/dist/modules/support/index.cjs.map +1 -1
- package/dist/modules/support/index.js +1 -1
- package/dist/modules/tags/index.cjs +14 -14
- package/dist/modules/tags/index.cjs.map +1 -1
- package/dist/modules/tags/index.js +1 -1
- package/dist/modules/technospam/index.cjs +14 -14
- package/dist/modules/technospam/index.cjs.map +1 -1
- package/dist/modules/technospam/index.js +1 -1
- package/dist/modules/theculturepost/index.cjs +14 -14
- package/dist/modules/theculturepost/index.cjs.map +1 -1
- package/dist/modules/theculturepost/index.js +1 -1
- package/dist/modules/theglobalfuel/index.cjs +14 -14
- package/dist/modules/theglobalfuel/index.cjs.map +1 -1
- package/dist/modules/theglobalfuel/index.js +1 -1
- package/dist/modules/timecampus/index.cjs +21 -16
- package/dist/modules/timecampus/index.cjs.map +1 -1
- package/dist/modules/timecampus/index.js +8 -3
- package/dist/modules/timecampus/index.js.map +1 -1
- package/dist/modules/tours/index.cjs +14 -14
- package/dist/modules/tours/index.cjs.map +1 -1
- package/dist/modules/tours/index.js +1 -1
- package/dist/modules/vibecontrols/index.cjs +14 -14
- package/dist/modules/vibecontrols/index.cjs.map +1 -1
- package/dist/modules/vibecontrols/index.js +2 -2
- package/dist/modules/workspaces/index.cjs +14 -14
- package/dist/modules/workspaces/index.cjs.map +1 -1
- package/dist/modules/workspaces/index.js +1 -1
- package/dist/{tool-name-DlnrBsZ6.d.ts → tool-name-BaPNMZdj.d.ts} +17 -1
- package/dist/{tool-name-CQf_IqAj.d.cts → tool-name-Bvb36qmq.d.cts} +17 -1
- package/package.json +1 -1
- package/dist/chunk-H2OYWLOA.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { mcpToolName, errorResult, jsonResult, mcpResourceUri, mcpPromptName } from '../../chunk-
|
|
1
|
+
import { mcpToolName, errorResult, jsonResult, mcpResourceUri, mcpPromptName } from '../../chunk-YOSQUY3M.js';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
|
|
4
4
|
// src/modules/buildmyiq/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/channels/operations.ts
|
|
54
54
|
var GET_CHANNELS = `
|
|
55
55
|
query GetChannels($filter: ChannelFilterInput, $pagination: ChannelPaginationInput) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/core/errors.ts","../../../src/core/result.ts","../../../src/core/tool-name.ts","../../../src/modules/channels/operations.ts","../../../src/modules/channels/tools.ts","../../../src/modules/channels/index.ts"],"names":["z"],"mappings":";;;;;;;;;;;AA8BO,IAAM,gBAAA,GAAN,cAA+B,KAAA,CAAM;AAAA,EACjB,KAAA;AAAA,EAEzB,WAAA,CAAY,SAAiB,KAAA,EAAiB;AAC5C,IAAA,KAAA,C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,IAAA,qBAAA,CAAsB,MAAA,EAAQ,KAAK,KAAK,CAAA;AAExC,IAAA,OAAO,EAAE,KAAA,EAAO,SAAA,EAAW,EAAC,EAAG,OAAA,EAAS,EAAC,EAAE;AAAA,EAC7C;AACF,CAAA;AAEA,IAAO,gBAAA,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 GET_CHANNELS = `\n query GetChannels($filter: ChannelFilterInput, $pagination: ChannelPaginationInput) {\n getChannels(filter: $filter, pagination: $pagination) {\n items { id name platform adapterType status connectionHealth priority createdAt }\n total hasMore\n }\n }\n`;\n\nexport const GET_CHANNEL = `\n query GetChannel($id: ID!) {\n getChannel(id: $id) {\n id name platform adapterType status channelType\n connection { id authType isActive isHealthy }\n }\n }\n`;\n\nexport const CREATE_CHANNEL = `\n mutation CreateChannel($input: CreateChannelInput!) {\n createChannel(input: $input) {\n id name platform adapterType status\n }\n }\n`;\n\nexport const UPDATE_CHANNEL = `\n mutation UpdateChannel($id: ID!, $input: UpdateChannelInput!) {\n updateChannel(id: $id, input: $input) {\n id name platform adapterType status priority\n }\n }\n`;\n\nexport const DELETE_CHANNEL = `\n mutation DeleteChannel($id: ID!) {\n deleteChannel(id: $id)\n }\n`;\n\nexport const SEND_CHANNEL_MESSAGE = `\n mutation SendChannelMessage($input: SendMessageInput!) {\n sendMessage(input: $input) {\n success messageId status sentAt\n error { code message retryable }\n }\n }\n`;\n\nexport const GET_CHANNEL_DELIVERY_ATTEMPTS = `\n query GetChannelDeliveryAttempts($channelId: ID!, $cursor: String, $limit: Int) {\n getChannelDeliveryAttempts(channelId: $channelId, cursor: $cursor, limit: $limit) {\n items { id channelId status sentAt retryCount errorMessage }\n total hasMore\n }\n }\n`;\n\nexport const LIST_CHANNEL_USERS = `\n query ListChannelUsers($channelId: ID!, $pagination: ChannelPaginationInput) {\n listUserPlatformConnectionsByChannel(channelId: $channelId, pagination: $pagination) {\n items { id externalUserId externalDisplayName platform dmAllowed presenceStatus }\n total hasMore\n }\n }\n`;\n\nexport const GET_CHANNEL_WEBHOOK_EVENTS = `\n query GetChannelWebhookEvents($channelId: ID!, $cursor: String, $limit: Int) {\n getChannelWebhookEvents(channelId: $channelId, cursor: $cursor, limit: $limit) {\n items { id eventType status createdAt }\n total hasMore\n }\n }\n`;\n\nexport const GET_CONNECTIONS_BY_ORG = `\n query GetConnectionsByOrg($organizationId: ID!, $pagination: ChannelPaginationInput) {\n getConnectionsByOrganization(organizationId: $organizationId, pagination: $pagination) {\n items { id channelId authType tokenExpiresAt isActive isHealthy }\n total hasMore\n }\n }\n`;\n\nexport const CREATE_CHANNEL_CONNECTION = `\n mutation CreateChannelConnection($input: CreateConnectionInput!) {\n createConnection(input: $input) {\n id channelId authType isActive\n }\n }\n`;\n\nexport const DELETE_CHANNEL_CONNECTION = `\n mutation DeleteChannelConnection($id: ID!) {\n deleteConnection(id: $id)\n }\n`;\n","/**\n * Channels MCP tools — multi-platform message channels (email/SMS/Slack/etc.).\n * Surface mirrors cli-sdk/src/modules/channels/commands.ts.\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 * as ops from './operations.js';\n\ninterface ChannelRow {\n id: string;\n name: string;\n platform: string;\n adapterType?: string;\n status?: string;\n priority?: number;\n createdAt?: string;\n}\n\nexport function registerChannelsTools(\n server: McpServer,\n ctx: McpContext,\n track: (n: string) => string,\n): void {\n server.registerTool(\n track(mcpToolName(ctx.productName, 'channels_list')),\n {\n title: 'List Channels',\n description: 'List channels with optional platform/status filters and pagination.',\n inputSchema: {\n platform: z.string().optional().describe('Filter by platform (will be uppercased)'),\n status: z.string().optional().describe('Filter by status (will be uppercased)'),\n limit: z.number().optional().describe('Page size (default 50)'),\n },\n },\n async ({ platform, status, limit }) => {\n try {\n const filter: Record<string, unknown> = {};\n if (platform !== undefined) filter.platform = platform.toUpperCase();\n if (status !== undefined) filter.status = status.toUpperCase();\n const data = await ctx.gql.global.request<{\n getChannels: { items: ChannelRow[]; total: number; hasMore: boolean };\n }>(ops.GET_CHANNELS, {\n filter: Object.keys(filter).length ? filter : undefined,\n pagination: { limit: limit ?? 50, offset: 0 },\n });\n return jsonResult(data.getChannels);\n } catch (error) {\n ctx.logger.error('channels_list failed', { error: String(error) });\n return errorResult(\n `Failed to list channels: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'channels_get')),\n {\n title: 'Get Channel',\n description: 'Get a channel by its ID.',\n inputSchema: { id: z.string().describe('Channel ID') },\n },\n async ({ id }) => {\n try {\n const data = await ctx.gql.global.request<{ getChannel: ChannelRow | null }>(\n ops.GET_CHANNEL,\n { id },\n );\n if (!data.getChannel) return errorResult(`Channel ${id} not found`);\n return jsonResult(data.getChannel);\n } catch (error) {\n ctx.logger.error('channels_get failed', { error: String(error) });\n return errorResult(\n `Failed to get channel: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'channels_create')),\n {\n title: 'Create Channel',\n description: 'Create a new channel.',\n inputSchema: {\n name: z.string().describe('Channel name'),\n platform: z\n .string()\n .describe('EMAIL|SMS|SLACK|TEAMS|DISCORD|WHATSAPP|WEBHOOK (will be uppercased)'),\n adapter: z.string().optional().describe('Adapter type (will be uppercased)'),\n },\n },\n async ({ name, platform, adapter }) => {\n try {\n const input: Record<string, unknown> = {\n name,\n platform: platform.toUpperCase(),\n };\n if (adapter !== undefined) input.adapterType = adapter.toUpperCase();\n const data = await ctx.gql.global.request<{ createChannel: ChannelRow }>(\n ops.CREATE_CHANNEL,\n { input },\n );\n return jsonResult(data.createChannel);\n } catch (error) {\n ctx.logger.error('channels_create failed', { error: String(error) });\n return errorResult(\n `Failed to create channel: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'channels_update')),\n {\n title: 'Update Channel',\n description:\n 'Update a channel (name/status/priority/etc). At least one field must be provided. Returns the updated Channel.',\n inputSchema: {\n id: z.string().describe('Channel ID'),\n name: z.string().optional().describe('Updated channel name'),\n description: z.string().optional().describe('Updated description'),\n status: z\n .string()\n .optional()\n .describe('Updated status (will be uppercased; e.g. ACTIVE|PAUSED|DISABLED)'),\n priority: z.number().int().optional().describe('Updated priority (lower runs first)'),\n configuration: z\n .record(z.string(), z.unknown())\n .optional()\n .describe('Channel-specific configuration overrides'),\n },\n },\n async ({ id, name, description, status, priority, configuration }) => {\n try {\n const input: Record<string, unknown> = {};\n if (name !== undefined) input.name = name;\n if (description !== undefined) input.description = description;\n if (status !== undefined) input.status = status.toUpperCase();\n if (priority !== undefined) input.priority = priority;\n if (configuration !== undefined) input.configuration = configuration;\n if (Object.keys(input).length === 0) {\n return errorResult(\n 'No updates specified — provide at least one of name/description/status/priority/configuration',\n );\n }\n const data = await ctx.gql.global.request<{ updateChannel: ChannelRow }>(\n ops.UPDATE_CHANNEL,\n { id, input },\n );\n return jsonResult(data.updateChannel);\n } catch (error) {\n ctx.logger.error('channels_update failed', { error: String(error) });\n return errorResult(\n `Failed to update channel: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'channels_delete')),\n {\n title: 'Delete Channel',\n description: 'Delete a channel by ID.',\n inputSchema: { id: z.string().describe('Channel ID') },\n },\n async ({ id }) => {\n try {\n const data = await ctx.gql.global.request<{ deleteChannel: boolean }>(ops.DELETE_CHANNEL, {\n id,\n });\n return jsonResult({ deleted: data.deleteChannel, channelId: id });\n } catch (error) {\n ctx.logger.error('channels_delete failed', { error: String(error) });\n return errorResult(\n `Failed to delete channel: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'channels_send')),\n {\n title: 'Send Channel Message',\n description: 'Send a message via a channel.',\n inputSchema: {\n channelId: z.string().describe('Channel ID'),\n content: z.string().describe('Message content'),\n recipient: z.string().optional().describe('External recipient id (e.g. email)'),\n subject: z.string().optional().describe('Message subject'),\n },\n },\n async ({ channelId, content, recipient, subject }) => {\n try {\n const input: Record<string, unknown> = { channelId, content };\n if (recipient !== undefined) input.recipientId = recipient;\n if (subject !== undefined) input.subject = subject;\n const data = await ctx.gql.global.request<{\n sendMessage: {\n success: boolean;\n messageId?: string;\n status?: string;\n sentAt?: string;\n error?: { code: string; message: string; retryable: boolean };\n };\n }>(ops.SEND_CHANNEL_MESSAGE, { input });\n return jsonResult(data.sendMessage);\n } catch (error) {\n ctx.logger.error('channels_send failed', { error: String(error) });\n return errorResult(\n `Failed to send channel message: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'channels_deliveries')),\n {\n title: 'List Channel Deliveries',\n description: 'Recent delivery attempts for a channel.',\n inputSchema: {\n channelId: z.string().describe('Channel ID'),\n cursor: z.string().optional().describe('Pagination cursor'),\n limit: z.number().optional().describe('Page size (default 100)'),\n },\n },\n async ({ channelId, cursor, limit }) => {\n try {\n const data = await ctx.gql.global.request<{\n getChannelDeliveryAttempts: {\n items: Array<Record<string, unknown>>;\n total: number;\n hasMore: boolean;\n };\n }>(ops.GET_CHANNEL_DELIVERY_ATTEMPTS, {\n channelId,\n cursor,\n limit: limit ?? 100,\n });\n return jsonResult(data.getChannelDeliveryAttempts);\n } catch (error) {\n ctx.logger.error('channels_deliveries failed', { error: String(error) });\n return errorResult(\n `Failed to list channel deliveries: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'channels_users')),\n {\n title: 'List Channel Users',\n description: 'Users connected to this channel.',\n inputSchema: {\n channelId: z.string().describe('Channel ID'),\n limit: z.number().optional().describe('Page size (default 100)'),\n },\n },\n async ({ channelId, limit }) => {\n try {\n const data = await ctx.gql.global.request<{\n listUserPlatformConnectionsByChannel: {\n items: Array<Record<string, unknown>>;\n total: number;\n hasMore: boolean;\n };\n }>(ops.LIST_CHANNEL_USERS, {\n channelId,\n pagination: { limit: limit ?? 100, offset: 0 },\n });\n return jsonResult(data.listUserPlatformConnectionsByChannel);\n } catch (error) {\n ctx.logger.error('channels_users failed', { error: String(error) });\n return errorResult(\n `Failed to list channel users: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'channels_webhooks_list')),\n {\n title: 'List Channel Webhook Events',\n description: 'List webhook events for a channel.',\n inputSchema: {\n channelId: z.string().describe('Channel ID'),\n cursor: z.string().optional().describe('Pagination cursor'),\n limit: z.number().optional().describe('Page size (default 100)'),\n },\n },\n async ({ channelId, cursor, limit }) => {\n try {\n const data = await ctx.gql.global.request<{\n getChannelWebhookEvents: {\n items: Array<{ id: string; eventType: string; status: string; createdAt: string }>;\n total: number;\n hasMore: boolean;\n };\n }>(ops.GET_CHANNEL_WEBHOOK_EVENTS, {\n channelId,\n cursor,\n limit: limit ?? 100,\n });\n return jsonResult(data.getChannelWebhookEvents);\n } catch (error) {\n ctx.logger.error('channels_webhooks_list failed', { error: String(error) });\n return errorResult(\n `Failed to list channel webhook events: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'channels_connections_list')),\n {\n title: 'List Channel Connections',\n description: 'List channel connections for an organization.',\n inputSchema: {\n organizationId: z.string().describe('Organization ID'),\n limit: z.number().optional().describe('Page size (default 100)'),\n },\n },\n async ({ organizationId, limit }) => {\n try {\n const data = await ctx.gql.global.request<{\n getConnectionsByOrganization: {\n items: Array<Record<string, unknown>>;\n total: number;\n hasMore: boolean;\n };\n }>(ops.GET_CONNECTIONS_BY_ORG, {\n organizationId,\n pagination: { limit: limit ?? 100, offset: 0 },\n });\n return jsonResult(data.getConnectionsByOrganization);\n } catch (error) {\n ctx.logger.error('channels_connections_list failed', { error: String(error) });\n return errorResult(\n `Failed to list channel connections: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'channels_connections_create')),\n {\n title: 'Create Channel Connection',\n description: 'Create a channel connection (OAuth/API key/webhook).',\n inputSchema: {\n channelId: z.string().describe('Channel ID'),\n authType: z.string().describe('OAUTH|API_KEY|WEBHOOK (will be uppercased)'),\n },\n },\n async ({ channelId, authType }) => {\n try {\n const input: Record<string, unknown> = {\n channelId,\n authType: authType.toUpperCase(),\n };\n const data = await ctx.gql.global.request<{\n createConnection: Record<string, unknown>;\n }>(ops.CREATE_CHANNEL_CONNECTION, { input });\n return jsonResult(data.createConnection);\n } catch (error) {\n ctx.logger.error('channels_connections_create failed', { error: String(error) });\n return errorResult(\n `Failed to create channel connection: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'channels_connections_delete')),\n {\n title: 'Delete Channel Connection',\n description: 'Delete a channel connection by ID.',\n inputSchema: { id: z.string().describe('Connection ID') },\n },\n async ({ id }) => {\n try {\n const data = await ctx.gql.global.request<{ deleteConnection: boolean }>(\n ops.DELETE_CHANNEL_CONNECTION,\n { id },\n );\n return jsonResult({ deleted: data.deleteConnection, connectionId: id });\n } catch (error) {\n ctx.logger.error('channels_connections_delete failed', { error: String(error) });\n return errorResult(\n `Failed to delete channel connection: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n}\n","/**\n * Channels module — multi-platform message channels CRUD + send + deliveries +\n * users + webhooks + connections. Mostly global gateway.\n * Surface mirrors cli-sdk/src/modules/channels/.\n */\n\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { McpContext, McpModule, ModuleRegistration } from '../../core/index.js';\nimport { registerChannelsTools } from './tools.js';\n\nconst channelsModule: McpModule = {\n id: 'channels',\n version: '0.0.1',\n displayName: 'Channels',\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 registerChannelsTools(server, ctx, track);\n\n return { tools, resources: [], prompts: [] };\n },\n};\n\nexport default channelsModule;\n"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/core/errors.ts","../../../src/core/tool-name.ts","../../../src/core/result.ts","../../../src/modules/channels/operations.ts","../../../src/modules/channels/tools.ts","../../../src/modules/channels/index.ts"],"names":["z"],"mappings":";;;;;;;;;;;AA8BO,IAAM,gBAAA,GAAN,cAA+B,KAAA,CAAM;AAAA,EACjB,KAAA;AAAA,EAEzB,WAAA,CAAY,SAAiB,KAAA,EAAiB;AAC5C,IAAA,KAAA,CAAM,OAAO,CAAA;AACb,IAAA,IAAA,C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EA,IAAA,qBAAA,CAAsB,MAAA,EAAQ,KAAK,KAAK,CAAA;AAExC,IAAA,OAAO,EAAE,KAAA,EAAO,SAAA,EAAW,EAAC,EAAG,OAAA,EAAS,EAAC,EAAE;AAAA,EAC7C;AACF,CAAA;AAEA,IAAO,gBAAA,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 GET_CHANNELS = `\n query GetChannels($filter: ChannelFilterInput, $pagination: ChannelPaginationInput) {\n getChannels(filter: $filter, pagination: $pagination) {\n items { id name platform adapterType status connectionHealth priority createdAt }\n total hasMore\n }\n }\n`;\n\nexport const GET_CHANNEL = `\n query GetChannel($id: ID!) {\n getChannel(id: $id) {\n id name platform adapterType status channelType\n connection { id authType isActive isHealthy }\n }\n }\n`;\n\nexport const CREATE_CHANNEL = `\n mutation CreateChannel($input: CreateChannelInput!) {\n createChannel(input: $input) {\n id name platform adapterType status\n }\n }\n`;\n\nexport const UPDATE_CHANNEL = `\n mutation UpdateChannel($id: ID!, $input: UpdateChannelInput!) {\n updateChannel(id: $id, input: $input) {\n id name platform adapterType status priority\n }\n }\n`;\n\nexport const DELETE_CHANNEL = `\n mutation DeleteChannel($id: ID!) {\n deleteChannel(id: $id)\n }\n`;\n\nexport const SEND_CHANNEL_MESSAGE = `\n mutation SendChannelMessage($input: SendMessageInput!) {\n sendMessage(input: $input) {\n success messageId status sentAt\n error { code message retryable }\n }\n }\n`;\n\nexport const GET_CHANNEL_DELIVERY_ATTEMPTS = `\n query GetChannelDeliveryAttempts($channelId: ID!, $cursor: String, $limit: Int) {\n getChannelDeliveryAttempts(channelId: $channelId, cursor: $cursor, limit: $limit) {\n items { id channelId status sentAt retryCount errorMessage }\n total hasMore\n }\n }\n`;\n\nexport const LIST_CHANNEL_USERS = `\n query ListChannelUsers($channelId: ID!, $pagination: ChannelPaginationInput) {\n listUserPlatformConnectionsByChannel(channelId: $channelId, pagination: $pagination) {\n items { id externalUserId externalDisplayName platform dmAllowed presenceStatus }\n total hasMore\n }\n }\n`;\n\nexport const GET_CHANNEL_WEBHOOK_EVENTS = `\n query GetChannelWebhookEvents($channelId: ID!, $cursor: String, $limit: Int) {\n getChannelWebhookEvents(channelId: $channelId, cursor: $cursor, limit: $limit) {\n items { id eventType status createdAt }\n total hasMore\n }\n }\n`;\n\nexport const GET_CONNECTIONS_BY_ORG = `\n query GetConnectionsByOrg($organizationId: ID!, $pagination: ChannelPaginationInput) {\n getConnectionsByOrganization(organizationId: $organizationId, pagination: $pagination) {\n items { id channelId authType tokenExpiresAt isActive isHealthy }\n total hasMore\n }\n }\n`;\n\nexport const CREATE_CHANNEL_CONNECTION = `\n mutation CreateChannelConnection($input: CreateConnectionInput!) {\n createConnection(input: $input) {\n id channelId authType isActive\n }\n }\n`;\n\nexport const DELETE_CHANNEL_CONNECTION = `\n mutation DeleteChannelConnection($id: ID!) {\n deleteConnection(id: $id)\n }\n`;\n","/**\n * Channels MCP tools — multi-platform message channels (email/SMS/Slack/etc.).\n * Surface mirrors cli-sdk/src/modules/channels/commands.ts.\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 * as ops from './operations.js';\n\ninterface ChannelRow {\n id: string;\n name: string;\n platform: string;\n adapterType?: string;\n status?: string;\n priority?: number;\n createdAt?: string;\n}\n\nexport function registerChannelsTools(\n server: McpServer,\n ctx: McpContext,\n track: (n: string) => string,\n): void {\n server.registerTool(\n track(mcpToolName(ctx.productName, 'channels_list')),\n {\n title: 'List Channels',\n description: 'List channels with optional platform/status filters and pagination.',\n inputSchema: {\n platform: z.string().optional().describe('Filter by platform (will be uppercased)'),\n status: z.string().optional().describe('Filter by status (will be uppercased)'),\n limit: z.number().optional().describe('Page size (default 50)'),\n },\n },\n async ({ platform, status, limit }) => {\n try {\n const filter: Record<string, unknown> = {};\n if (platform !== undefined) filter.platform = platform.toUpperCase();\n if (status !== undefined) filter.status = status.toUpperCase();\n const data = await ctx.gql.global.request<{\n getChannels: { items: ChannelRow[]; total: number; hasMore: boolean };\n }>(ops.GET_CHANNELS, {\n filter: Object.keys(filter).length ? filter : undefined,\n pagination: { limit: limit ?? 50, offset: 0 },\n });\n return jsonResult(data.getChannels);\n } catch (error) {\n ctx.logger.error('channels_list failed', { error: String(error) });\n return errorResult(\n `Failed to list channels: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'channels_get')),\n {\n title: 'Get Channel',\n description: 'Get a channel by its ID.',\n inputSchema: { id: z.string().describe('Channel ID') },\n },\n async ({ id }) => {\n try {\n const data = await ctx.gql.global.request<{ getChannel: ChannelRow | null }>(\n ops.GET_CHANNEL,\n { id },\n );\n if (!data.getChannel) return errorResult(`Channel ${id} not found`);\n return jsonResult(data.getChannel);\n } catch (error) {\n ctx.logger.error('channels_get failed', { error: String(error) });\n return errorResult(\n `Failed to get channel: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'channels_create')),\n {\n title: 'Create Channel',\n description: 'Create a new channel.',\n inputSchema: {\n name: z.string().describe('Channel name'),\n platform: z\n .string()\n .describe('EMAIL|SMS|SLACK|TEAMS|DISCORD|WHATSAPP|WEBHOOK (will be uppercased)'),\n adapter: z.string().optional().describe('Adapter type (will be uppercased)'),\n },\n },\n async ({ name, platform, adapter }) => {\n try {\n const input: Record<string, unknown> = {\n name,\n platform: platform.toUpperCase(),\n };\n if (adapter !== undefined) input.adapterType = adapter.toUpperCase();\n const data = await ctx.gql.global.request<{ createChannel: ChannelRow }>(\n ops.CREATE_CHANNEL,\n { input },\n );\n return jsonResult(data.createChannel);\n } catch (error) {\n ctx.logger.error('channels_create failed', { error: String(error) });\n return errorResult(\n `Failed to create channel: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'channels_update')),\n {\n title: 'Update Channel',\n description:\n 'Update a channel (name/status/priority/etc). At least one field must be provided. Returns the updated Channel.',\n inputSchema: {\n id: z.string().describe('Channel ID'),\n name: z.string().optional().describe('Updated channel name'),\n description: z.string().optional().describe('Updated description'),\n status: z\n .string()\n .optional()\n .describe('Updated status (will be uppercased; e.g. ACTIVE|PAUSED|DISABLED)'),\n priority: z.number().int().optional().describe('Updated priority (lower runs first)'),\n configuration: z\n .record(z.string(), z.unknown())\n .optional()\n .describe('Channel-specific configuration overrides'),\n },\n },\n async ({ id, name, description, status, priority, configuration }) => {\n try {\n const input: Record<string, unknown> = {};\n if (name !== undefined) input.name = name;\n if (description !== undefined) input.description = description;\n if (status !== undefined) input.status = status.toUpperCase();\n if (priority !== undefined) input.priority = priority;\n if (configuration !== undefined) input.configuration = configuration;\n if (Object.keys(input).length === 0) {\n return errorResult(\n 'No updates specified — provide at least one of name/description/status/priority/configuration',\n );\n }\n const data = await ctx.gql.global.request<{ updateChannel: ChannelRow }>(\n ops.UPDATE_CHANNEL,\n { id, input },\n );\n return jsonResult(data.updateChannel);\n } catch (error) {\n ctx.logger.error('channels_update failed', { error: String(error) });\n return errorResult(\n `Failed to update channel: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'channels_delete')),\n {\n title: 'Delete Channel',\n description: 'Delete a channel by ID.',\n inputSchema: { id: z.string().describe('Channel ID') },\n },\n async ({ id }) => {\n try {\n const data = await ctx.gql.global.request<{ deleteChannel: boolean }>(ops.DELETE_CHANNEL, {\n id,\n });\n return jsonResult({ deleted: data.deleteChannel, channelId: id });\n } catch (error) {\n ctx.logger.error('channels_delete failed', { error: String(error) });\n return errorResult(\n `Failed to delete channel: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'channels_send')),\n {\n title: 'Send Channel Message',\n description: 'Send a message via a channel.',\n inputSchema: {\n channelId: z.string().describe('Channel ID'),\n content: z.string().describe('Message content'),\n recipient: z.string().optional().describe('External recipient id (e.g. email)'),\n subject: z.string().optional().describe('Message subject'),\n },\n },\n async ({ channelId, content, recipient, subject }) => {\n try {\n const input: Record<string, unknown> = { channelId, content };\n if (recipient !== undefined) input.recipientId = recipient;\n if (subject !== undefined) input.subject = subject;\n const data = await ctx.gql.global.request<{\n sendMessage: {\n success: boolean;\n messageId?: string;\n status?: string;\n sentAt?: string;\n error?: { code: string; message: string; retryable: boolean };\n };\n }>(ops.SEND_CHANNEL_MESSAGE, { input });\n return jsonResult(data.sendMessage);\n } catch (error) {\n ctx.logger.error('channels_send failed', { error: String(error) });\n return errorResult(\n `Failed to send channel message: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'channels_deliveries')),\n {\n title: 'List Channel Deliveries',\n description: 'Recent delivery attempts for a channel.',\n inputSchema: {\n channelId: z.string().describe('Channel ID'),\n cursor: z.string().optional().describe('Pagination cursor'),\n limit: z.number().optional().describe('Page size (default 100)'),\n },\n },\n async ({ channelId, cursor, limit }) => {\n try {\n const data = await ctx.gql.global.request<{\n getChannelDeliveryAttempts: {\n items: Array<Record<string, unknown>>;\n total: number;\n hasMore: boolean;\n };\n }>(ops.GET_CHANNEL_DELIVERY_ATTEMPTS, {\n channelId,\n cursor,\n limit: limit ?? 100,\n });\n return jsonResult(data.getChannelDeliveryAttempts);\n } catch (error) {\n ctx.logger.error('channels_deliveries failed', { error: String(error) });\n return errorResult(\n `Failed to list channel deliveries: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'channels_users')),\n {\n title: 'List Channel Users',\n description: 'Users connected to this channel.',\n inputSchema: {\n channelId: z.string().describe('Channel ID'),\n limit: z.number().optional().describe('Page size (default 100)'),\n },\n },\n async ({ channelId, limit }) => {\n try {\n const data = await ctx.gql.global.request<{\n listUserPlatformConnectionsByChannel: {\n items: Array<Record<string, unknown>>;\n total: number;\n hasMore: boolean;\n };\n }>(ops.LIST_CHANNEL_USERS, {\n channelId,\n pagination: { limit: limit ?? 100, offset: 0 },\n });\n return jsonResult(data.listUserPlatformConnectionsByChannel);\n } catch (error) {\n ctx.logger.error('channels_users failed', { error: String(error) });\n return errorResult(\n `Failed to list channel users: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'channels_webhooks_list')),\n {\n title: 'List Channel Webhook Events',\n description: 'List webhook events for a channel.',\n inputSchema: {\n channelId: z.string().describe('Channel ID'),\n cursor: z.string().optional().describe('Pagination cursor'),\n limit: z.number().optional().describe('Page size (default 100)'),\n },\n },\n async ({ channelId, cursor, limit }) => {\n try {\n const data = await ctx.gql.global.request<{\n getChannelWebhookEvents: {\n items: Array<{ id: string; eventType: string; status: string; createdAt: string }>;\n total: number;\n hasMore: boolean;\n };\n }>(ops.GET_CHANNEL_WEBHOOK_EVENTS, {\n channelId,\n cursor,\n limit: limit ?? 100,\n });\n return jsonResult(data.getChannelWebhookEvents);\n } catch (error) {\n ctx.logger.error('channels_webhooks_list failed', { error: String(error) });\n return errorResult(\n `Failed to list channel webhook events: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'channels_connections_list')),\n {\n title: 'List Channel Connections',\n description: 'List channel connections for an organization.',\n inputSchema: {\n organizationId: z.string().describe('Organization ID'),\n limit: z.number().optional().describe('Page size (default 100)'),\n },\n },\n async ({ organizationId, limit }) => {\n try {\n const data = await ctx.gql.global.request<{\n getConnectionsByOrganization: {\n items: Array<Record<string, unknown>>;\n total: number;\n hasMore: boolean;\n };\n }>(ops.GET_CONNECTIONS_BY_ORG, {\n organizationId,\n pagination: { limit: limit ?? 100, offset: 0 },\n });\n return jsonResult(data.getConnectionsByOrganization);\n } catch (error) {\n ctx.logger.error('channels_connections_list failed', { error: String(error) });\n return errorResult(\n `Failed to list channel connections: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'channels_connections_create')),\n {\n title: 'Create Channel Connection',\n description: 'Create a channel connection (OAuth/API key/webhook).',\n inputSchema: {\n channelId: z.string().describe('Channel ID'),\n authType: z.string().describe('OAUTH|API_KEY|WEBHOOK (will be uppercased)'),\n },\n },\n async ({ channelId, authType }) => {\n try {\n const input: Record<string, unknown> = {\n channelId,\n authType: authType.toUpperCase(),\n };\n const data = await ctx.gql.global.request<{\n createConnection: Record<string, unknown>;\n }>(ops.CREATE_CHANNEL_CONNECTION, { input });\n return jsonResult(data.createConnection);\n } catch (error) {\n ctx.logger.error('channels_connections_create failed', { error: String(error) });\n return errorResult(\n `Failed to create channel connection: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n\n server.registerTool(\n track(mcpToolName(ctx.productName, 'channels_connections_delete')),\n {\n title: 'Delete Channel Connection',\n description: 'Delete a channel connection by ID.',\n inputSchema: { id: z.string().describe('Connection ID') },\n },\n async ({ id }) => {\n try {\n const data = await ctx.gql.global.request<{ deleteConnection: boolean }>(\n ops.DELETE_CHANNEL_CONNECTION,\n { id },\n );\n return jsonResult({ deleted: data.deleteConnection, connectionId: id });\n } catch (error) {\n ctx.logger.error('channels_connections_delete failed', { error: String(error) });\n return errorResult(\n `Failed to delete channel connection: ${error instanceof Error ? error.message : String(error)}`,\n );\n }\n },\n );\n}\n","/**\n * Channels module — multi-platform message channels CRUD + send + deliveries +\n * users + webhooks + connections. Mostly global gateway.\n * Surface mirrors cli-sdk/src/modules/channels/.\n */\n\nimport type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';\nimport type { McpContext, McpModule, ModuleRegistration } from '../../core/index.js';\nimport { registerChannelsTools } from './tools.js';\n\nconst channelsModule: McpModule = {\n id: 'channels',\n version: '0.0.1',\n displayName: 'Channels',\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 registerChannelsTools(server, ctx, track);\n\n return { tools, resources: [], prompts: [] };\n },\n};\n\nexport default channelsModule;\n"]}
|
|
@@ -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/collabkin/operations.ts
|
|
66
66
|
var TREE_FIELDS = `
|
|
67
67
|
id name surname description status tags workspaceId createdAt updatedAt
|