@kadoa/mcp 0.3.3 → 0.3.4-rc.1
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/index.js +185 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -49189,6 +49189,9 @@ function classifyError(error48) {
|
|
|
49189
49189
|
const status = httpError.httpStatus ? ` (HTTP ${httpError.httpStatus})` : "";
|
|
49190
49190
|
switch (code) {
|
|
49191
49191
|
case "AUTH_ERROR":
|
|
49192
|
+
if (httpError.httpStatus === 403) {
|
|
49193
|
+
return `Access denied${status}. Your current team role may not have permission for this action. Use the team_list tool to check your role, or contact your team admin to request write access.`;
|
|
49194
|
+
}
|
|
49192
49195
|
return `Authentication failed${status}. Your Kadoa API key may be invalid or expired. Please check your KADOA_API_KEY or re-authenticate.`;
|
|
49193
49196
|
case "NOT_FOUND":
|
|
49194
49197
|
return `Not found${status}. The workflow may have been deleted or the ID is incorrect.`;
|
|
@@ -49537,6 +49540,188 @@ function registerTools(server, ctx) {
|
|
|
49537
49540
|
workflow: result
|
|
49538
49541
|
});
|
|
49539
49542
|
}));
|
|
49543
|
+
server.registerTool("list_notification_channels", {
|
|
49544
|
+
description: "List notification channels configured for a workflow or across the workspace. Channels are destinations (email, Slack, webhook, websocket) where notifications are sent.",
|
|
49545
|
+
inputSchema: {
|
|
49546
|
+
workflowId: exports_external.string().optional().describe("Filter channels linked to a specific workflow. Omit to list all workspace channels.")
|
|
49547
|
+
},
|
|
49548
|
+
annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true }
|
|
49549
|
+
}, withErrorHandling("list_notification_channels", async (args) => {
|
|
49550
|
+
const channels = args.workflowId ? await ctx.client.notification.channels.listAllChannels(args.workflowId) : await ctx.client.notification.channels.listAllChannels();
|
|
49551
|
+
return jsonResult({
|
|
49552
|
+
channels: channels.map((ch) => ({
|
|
49553
|
+
id: ch.id,
|
|
49554
|
+
name: ch.name,
|
|
49555
|
+
channelType: ch.channelType,
|
|
49556
|
+
config: ch.config,
|
|
49557
|
+
linkedConfigurations: ch.linkedConfigurations,
|
|
49558
|
+
createdAt: ch.createdAt
|
|
49559
|
+
})),
|
|
49560
|
+
total: channels.length
|
|
49561
|
+
});
|
|
49562
|
+
}));
|
|
49563
|
+
server.registerTool("create_notification_channel", {
|
|
49564
|
+
description: "Create a notification channel (email, webhook, or slack). The channel can then be linked to notification settings for specific events.",
|
|
49565
|
+
inputSchema: {
|
|
49566
|
+
channelType: exports_external.enum(["EMAIL", "WEBHOOK", "SLACK"]).describe("Type of notification channel"),
|
|
49567
|
+
name: exports_external.string().optional().describe("Name for the channel (defaults to 'default')"),
|
|
49568
|
+
config: exports_external.object({
|
|
49569
|
+
recipients: exports_external.array(exports_external.string()).optional().describe("Email recipients (required for EMAIL channels)"),
|
|
49570
|
+
webhookUrl: exports_external.string().optional().describe("Webhook/Slack endpoint URL (required for WEBHOOK and SLACK channels)"),
|
|
49571
|
+
httpMethod: exports_external.enum(["POST", "GET", "PUT", "PATCH"]).optional().describe("HTTP method for WEBHOOK channels (defaults to POST)")
|
|
49572
|
+
}).optional().describe("Channel-specific configuration. For EMAIL: provide recipients. For WEBHOOK: provide webhookUrl. For SLACK: provide webhookUrl.")
|
|
49573
|
+
},
|
|
49574
|
+
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false }
|
|
49575
|
+
}, withErrorHandling("create_notification_channel", async (args) => {
|
|
49576
|
+
const channel = await ctx.client.notification.channels.createChannel(args.channelType, {
|
|
49577
|
+
name: args.name || "default",
|
|
49578
|
+
config: args.config
|
|
49579
|
+
});
|
|
49580
|
+
return jsonResult({
|
|
49581
|
+
success: true,
|
|
49582
|
+
channel: {
|
|
49583
|
+
id: channel.id,
|
|
49584
|
+
name: channel.name,
|
|
49585
|
+
channelType: channel.channelType,
|
|
49586
|
+
config: channel.config
|
|
49587
|
+
},
|
|
49588
|
+
message: `${args.channelType} notification channel created successfully.`
|
|
49589
|
+
});
|
|
49590
|
+
}));
|
|
49591
|
+
server.registerTool("delete_notification_channel", {
|
|
49592
|
+
description: "Delete a notification channel by ID",
|
|
49593
|
+
inputSchema: {
|
|
49594
|
+
channelId: exports_external.string().describe("The channel ID to delete")
|
|
49595
|
+
},
|
|
49596
|
+
annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: true }
|
|
49597
|
+
}, withErrorHandling("delete_notification_channel", async (args) => {
|
|
49598
|
+
await ctx.client.notification.channels.deleteChannel(args.channelId);
|
|
49599
|
+
return jsonResult({
|
|
49600
|
+
success: true,
|
|
49601
|
+
message: "Notification channel deleted successfully."
|
|
49602
|
+
});
|
|
49603
|
+
}));
|
|
49604
|
+
server.registerTool("list_notification_settings", {
|
|
49605
|
+
description: "List notification settings (event-to-channel mappings) for a workflow or workspace. Shows which events trigger notifications and through which channels.",
|
|
49606
|
+
inputSchema: {
|
|
49607
|
+
workflowId: exports_external.string().optional().describe("Filter settings for a specific workflow. Omit to list workspace-level settings."),
|
|
49608
|
+
eventType: exports_external.enum([
|
|
49609
|
+
"workflow_started",
|
|
49610
|
+
"workflow_finished",
|
|
49611
|
+
"workflow_failed",
|
|
49612
|
+
"workflow_sample_finished",
|
|
49613
|
+
"workflow_data_change",
|
|
49614
|
+
"system_maintenance",
|
|
49615
|
+
"service_degradation",
|
|
49616
|
+
"credits_low",
|
|
49617
|
+
"free_trial_ending"
|
|
49618
|
+
]).optional().describe("Filter by event type")
|
|
49619
|
+
},
|
|
49620
|
+
annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true }
|
|
49621
|
+
}, withErrorHandling("list_notification_settings", async (args) => {
|
|
49622
|
+
const filters = {};
|
|
49623
|
+
if (args.workflowId)
|
|
49624
|
+
filters.workflowId = args.workflowId;
|
|
49625
|
+
if (args.eventType)
|
|
49626
|
+
filters.eventType = args.eventType;
|
|
49627
|
+
const settings = await ctx.client.notification.settings.listSettings(filters);
|
|
49628
|
+
return jsonResult({
|
|
49629
|
+
settings: settings.map((s) => ({
|
|
49630
|
+
id: s.id,
|
|
49631
|
+
workflowId: s.workflowId,
|
|
49632
|
+
eventType: s.eventType,
|
|
49633
|
+
enabled: s.enabled,
|
|
49634
|
+
channels: s.channels,
|
|
49635
|
+
createdAt: s.createdAt
|
|
49636
|
+
})),
|
|
49637
|
+
total: settings.length
|
|
49638
|
+
});
|
|
49639
|
+
}));
|
|
49640
|
+
server.registerTool("configure_notifications", {
|
|
49641
|
+
description: "Set up notifications for a workflow or workspace. Creates channels and settings in one step. " + "Specify which events to listen for and which channels to deliver to (email, webhook, slack, websocket).",
|
|
49642
|
+
inputSchema: {
|
|
49643
|
+
workflowId: exports_external.string().optional().describe("Workflow ID to configure notifications for. Omit for workspace-level notifications."),
|
|
49644
|
+
events: exports_external.union([
|
|
49645
|
+
exports_external.array(exports_external.enum([
|
|
49646
|
+
"workflow_started",
|
|
49647
|
+
"workflow_finished",
|
|
49648
|
+
"workflow_failed",
|
|
49649
|
+
"workflow_sample_finished",
|
|
49650
|
+
"workflow_data_change",
|
|
49651
|
+
"system_maintenance",
|
|
49652
|
+
"service_degradation",
|
|
49653
|
+
"credits_low",
|
|
49654
|
+
"free_trial_ending"
|
|
49655
|
+
])),
|
|
49656
|
+
exports_external.literal("all")
|
|
49657
|
+
]).describe('Event types to notify on, or "all" for all events'),
|
|
49658
|
+
channels: exports_external.object({
|
|
49659
|
+
email: exports_external.boolean().optional().describe("Send to user's default email address"),
|
|
49660
|
+
webhook: exports_external.object({
|
|
49661
|
+
url: exports_external.string().url().describe("Webhook endpoint URL"),
|
|
49662
|
+
httpMethod: exports_external.enum(["POST", "GET", "PUT", "PATCH"]).optional().describe("HTTP method (defaults to POST)")
|
|
49663
|
+
}).optional().describe("Send via HTTP webhook"),
|
|
49664
|
+
slack: exports_external.object({
|
|
49665
|
+
webhookUrl: exports_external.string().url().describe("Slack incoming webhook URL")
|
|
49666
|
+
}).optional().describe("Send to Slack channel"),
|
|
49667
|
+
websocket: exports_external.boolean().optional().describe("Enable WebSocket notifications")
|
|
49668
|
+
}).describe("At least one channel must be specified")
|
|
49669
|
+
},
|
|
49670
|
+
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false }
|
|
49671
|
+
}, withErrorHandling("configure_notifications", async (args) => {
|
|
49672
|
+
const channelSetup = {};
|
|
49673
|
+
const ch = args.channels;
|
|
49674
|
+
if (ch.email)
|
|
49675
|
+
channelSetup.EMAIL = true;
|
|
49676
|
+
if (ch.websocket)
|
|
49677
|
+
channelSetup.WEBSOCKET = true;
|
|
49678
|
+
if (ch.webhook) {
|
|
49679
|
+
channelSetup.WEBHOOK = {
|
|
49680
|
+
name: "mcp-webhook",
|
|
49681
|
+
webhookUrl: ch.webhook.url,
|
|
49682
|
+
httpMethod: ch.webhook.httpMethod || "POST"
|
|
49683
|
+
};
|
|
49684
|
+
}
|
|
49685
|
+
if (ch.slack) {
|
|
49686
|
+
channelSetup.SLACK = {
|
|
49687
|
+
name: "mcp-slack",
|
|
49688
|
+
webhookUrl: ch.slack.webhookUrl
|
|
49689
|
+
};
|
|
49690
|
+
}
|
|
49691
|
+
if (Object.keys(channelSetup).length === 0) {
|
|
49692
|
+
return errorResult("At least one notification channel must be specified (email, webhook, slack, or websocket).");
|
|
49693
|
+
}
|
|
49694
|
+
const settings = await ctx.client.notification.configure({
|
|
49695
|
+
workflowId: args.workflowId,
|
|
49696
|
+
events: args.events,
|
|
49697
|
+
channels: channelSetup
|
|
49698
|
+
});
|
|
49699
|
+
const enabledChannels = Object.keys(channelSetup).map((k) => k.toLowerCase());
|
|
49700
|
+
const scope = args.workflowId ? `workflow ${args.workflowId}` : "workspace";
|
|
49701
|
+
return jsonResult({
|
|
49702
|
+
success: true,
|
|
49703
|
+
message: `Notifications configured for ${scope}. Events: ${Array.isArray(args.events) ? args.events.join(", ") : args.events}. Channels: ${enabledChannels.join(", ")}.`,
|
|
49704
|
+
settings: settings.map((s) => ({
|
|
49705
|
+
id: s.id,
|
|
49706
|
+
eventType: s.eventType,
|
|
49707
|
+
enabled: s.enabled,
|
|
49708
|
+
channels: s.channels
|
|
49709
|
+
}))
|
|
49710
|
+
});
|
|
49711
|
+
}));
|
|
49712
|
+
server.registerTool("delete_notification_setting", {
|
|
49713
|
+
description: "Delete a notification setting by ID. This removes the event-to-channel mapping but does not delete the channels themselves.",
|
|
49714
|
+
inputSchema: {
|
|
49715
|
+
settingsId: exports_external.string().describe("The notification settings ID to delete")
|
|
49716
|
+
},
|
|
49717
|
+
annotations: { readOnlyHint: false, destructiveHint: true, idempotentHint: true }
|
|
49718
|
+
}, withErrorHandling("delete_notification_setting", async (args) => {
|
|
49719
|
+
await ctx.client.notification.settings.deleteSettings(args.settingsId);
|
|
49720
|
+
return jsonResult({
|
|
49721
|
+
success: true,
|
|
49722
|
+
message: "Notification setting deleted successfully."
|
|
49723
|
+
});
|
|
49724
|
+
}));
|
|
49540
49725
|
server.registerTool("team_list", {
|
|
49541
49726
|
description: "List all teams the current user belongs to, showing which team is currently active",
|
|
49542
49727
|
inputSchema: {},
|