@kadoa/mcp 0.3.4-rc.1 → 0.3.4-rc.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 (2) hide show
  1. package/dist/index.js +39 -34
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -49115,11 +49115,15 @@ function isJwtExpired(jwt2) {
49115
49115
  }
49116
49116
  }
49117
49117
  async function refreshSupabaseJwt(ctx) {
49118
- if (!ctx.supabaseRefreshToken)
49118
+ if (!ctx.supabaseRefreshToken) {
49119
+ console.error("[JWT Refresh] No refresh token available, cannot refresh");
49119
49120
  return;
49121
+ }
49120
49122
  const supabaseUrl = process.env.SUPABASE_URL;
49121
- if (!supabaseUrl)
49123
+ if (!supabaseUrl) {
49124
+ console.error("[JWT Refresh] SUPABASE_URL not set, cannot refresh");
49122
49125
  return;
49126
+ }
49123
49127
  try {
49124
49128
  const res = await fetch(`${supabaseUrl}/auth/v1/token?grant_type=refresh_token`, {
49125
49129
  method: "POST",
@@ -49129,14 +49133,19 @@ async function refreshSupabaseJwt(ctx) {
49129
49133
  },
49130
49134
  body: JSON.stringify({ refresh_token: ctx.supabaseRefreshToken })
49131
49135
  });
49132
- if (!res.ok)
49136
+ if (!res.ok) {
49137
+ const body = await res.text().catch(() => "");
49138
+ console.error(`[JWT Refresh] Supabase returned ${res.status}: ${body}`);
49133
49139
  return;
49140
+ }
49134
49141
  const data = await res.json();
49135
49142
  ctx.supabaseJwt = data.access_token;
49136
49143
  ctx.supabaseRefreshToken = data.refresh_token;
49137
49144
  ctx.client.setBearerToken(data.access_token);
49145
+ console.error("[JWT Refresh] Token refreshed successfully");
49138
49146
  return data.access_token;
49139
- } catch {
49147
+ } catch (error48) {
49148
+ console.error("[JWT Refresh] Failed:", error48);
49140
49149
  return;
49141
49150
  }
49142
49151
  }
@@ -49231,18 +49240,19 @@ function classifyError(error48) {
49231
49240
  }
49232
49241
  return "Unknown error";
49233
49242
  }
49234
- function withErrorHandling(name, handler) {
49235
- return async (...args) => {
49236
- try {
49237
- return await handler(...args);
49238
- } catch (error48) {
49239
- const message = classifyError(error48);
49240
- console.error(`[Tool Error] ${name}:`, error48);
49241
- return errorResult(message);
49242
- }
49243
- };
49244
- }
49245
49243
  function registerTools(server, ctx) {
49244
+ function withErrorHandling(name, handler) {
49245
+ return async (...args) => {
49246
+ try {
49247
+ await getValidJwt(ctx);
49248
+ return await handler(...args);
49249
+ } catch (error48) {
49250
+ const message = classifyError(error48);
49251
+ console.error(`[Tool Error] ${name}:`, error48);
49252
+ return errorResult(message);
49253
+ }
49254
+ };
49255
+ }
49246
49256
  server.registerTool("whoami", {
49247
49257
  description: "Show current user details: email, authentication method, and team memberships",
49248
49258
  inputSchema: {},
@@ -49641,22 +49651,11 @@ function registerTools(server, ctx) {
49641
49651
  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
49652
  inputSchema: {
49643
49653
  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'),
49654
+ events: exports_external.array(exports_external.string()).describe('Event types to notify on. Pass ["all"] for all events, or pick from: ' + "workflow_started, workflow_finished, workflow_failed, workflow_sample_finished, " + "workflow_data_change, system_maintenance, service_degradation, credits_low, free_trial_ending"),
49658
49655
  channels: exports_external.object({
49659
- email: exports_external.boolean().optional().describe("Send to user's default email address"),
49656
+ email: exports_external.object({
49657
+ recipients: exports_external.array(exports_external.string().email()).optional().describe("Email addresses to notify. Omit to use the account default email.")
49658
+ }).optional().describe("Send email notifications. Pass {} for default email or {recipients: [...]} for custom addresses."),
49660
49659
  webhook: exports_external.object({
49661
49660
  url: exports_external.string().url().describe("Webhook endpoint URL"),
49662
49661
  httpMethod: exports_external.enum(["POST", "GET", "PUT", "PATCH"]).optional().describe("HTTP method (defaults to POST)")
@@ -49669,10 +49668,16 @@ function registerTools(server, ctx) {
49669
49668
  },
49670
49669
  annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false }
49671
49670
  }, withErrorHandling("configure_notifications", async (args) => {
49671
+ const events = args.events.length === 1 && args.events[0] === "all" ? "all" : args.events;
49672
49672
  const channelSetup = {};
49673
49673
  const ch = args.channels;
49674
- if (ch.email)
49675
- channelSetup.EMAIL = true;
49674
+ if (ch.email) {
49675
+ if (ch.email.recipients?.length) {
49676
+ channelSetup.EMAIL = { name: "mcp-email", recipients: ch.email.recipients };
49677
+ } else {
49678
+ channelSetup.EMAIL = true;
49679
+ }
49680
+ }
49676
49681
  if (ch.websocket)
49677
49682
  channelSetup.WEBSOCKET = true;
49678
49683
  if (ch.webhook) {
@@ -49693,14 +49698,14 @@ function registerTools(server, ctx) {
49693
49698
  }
49694
49699
  const settings = await ctx.client.notification.configure({
49695
49700
  workflowId: args.workflowId,
49696
- events: args.events,
49701
+ events,
49697
49702
  channels: channelSetup
49698
49703
  });
49699
49704
  const enabledChannels = Object.keys(channelSetup).map((k) => k.toLowerCase());
49700
49705
  const scope = args.workflowId ? `workflow ${args.workflowId}` : "workspace";
49701
49706
  return jsonResult({
49702
49707
  success: true,
49703
- message: `Notifications configured for ${scope}. Events: ${Array.isArray(args.events) ? args.events.join(", ") : args.events}. Channels: ${enabledChannels.join(", ")}.`,
49708
+ message: `Notifications configured for ${scope}. Events: ${events === "all" ? "all" : events.join(", ")}. Channels: ${enabledChannels.join(", ")}.`,
49704
49709
  settings: settings.map((s) => ({
49705
49710
  id: s.id,
49706
49711
  eventType: s.eventType,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kadoa/mcp",
3
- "version": "0.3.4-rc.1",
3
+ "version": "0.3.4-rc.2",
4
4
  "description": "Kadoa MCP Server — manage workflows from Claude Desktop, Cursor, and other MCP clients",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",