integrate-sdk 0.9.28-dev.1 → 0.9.30-dev.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/dist/adapters/auto-routes.js +61 -23
  2. package/dist/adapters/base-handler.d.ts.map +1 -1
  3. package/dist/adapters/base-handler.js +61 -23
  4. package/dist/adapters/index.js +99 -49
  5. package/dist/adapters/nextjs.js +61 -23
  6. package/dist/adapters/solid-start.js +99 -49
  7. package/dist/adapters/svelte-kit.js +99 -49
  8. package/dist/index.d.ts +1 -1
  9. package/dist/index.d.ts.map +1 -1
  10. package/dist/index.js +488 -101
  11. package/dist/oauth.js +60 -23
  12. package/dist/server.js +376 -122
  13. package/dist/src/adapters/base-handler.d.ts.map +1 -1
  14. package/dist/src/client.d.ts +3 -1
  15. package/dist/src/client.d.ts.map +1 -1
  16. package/dist/src/index.d.ts +8 -0
  17. package/dist/src/index.d.ts.map +1 -1
  18. package/dist/src/integrations/library-metadata.d.ts +1 -1
  19. package/dist/src/integrations/library-metadata.d.ts.map +1 -1
  20. package/dist/src/integrations/netlify-client.d.ts +161 -0
  21. package/dist/src/integrations/netlify-client.d.ts.map +1 -0
  22. package/dist/src/integrations/netlify.d.ts +18 -0
  23. package/dist/src/integrations/netlify.d.ts.map +1 -0
  24. package/dist/src/integrations/posthog-client.d.ts +222 -0
  25. package/dist/src/integrations/posthog-client.d.ts.map +1 -0
  26. package/dist/src/integrations/posthog.d.ts +30 -0
  27. package/dist/src/integrations/posthog.d.ts.map +1 -0
  28. package/dist/src/integrations/railway-client.d.ts +302 -0
  29. package/dist/src/integrations/railway-client.d.ts.map +1 -0
  30. package/dist/src/integrations/railway.d.ts +24 -0
  31. package/dist/src/integrations/railway.d.ts.map +1 -0
  32. package/dist/src/integrations/sentry-client.d.ts +78 -0
  33. package/dist/src/integrations/sentry-client.d.ts.map +1 -0
  34. package/dist/src/integrations/sentry.d.ts +22 -0
  35. package/dist/src/integrations/sentry.d.ts.map +1 -0
  36. package/dist/src/oauth/types.d.ts +2 -0
  37. package/dist/src/oauth/types.d.ts.map +1 -1
  38. package/dist/src/server.d.ts +2 -0
  39. package/dist/src/server.d.ts.map +1 -1
  40. package/index.ts +6 -1
  41. package/package.json +1 -1
package/dist/server.js CHANGED
@@ -148,10 +148,26 @@ var init_library_metadata = __esm(() => {
148
148
  description: "Manage Polar products, orders, and subscriptions",
149
149
  category: "Business"
150
150
  },
151
+ posthog: {
152
+ description: "Read PostHog organizations, projects, insights, and feature flags",
153
+ category: "Analytics"
154
+ },
151
155
  ramp: {
152
156
  description: "Manage Ramp corporate cards, bills, and spend",
153
157
  category: "Business"
154
158
  },
159
+ railway: {
160
+ description: "Manage Railway workspaces, projects, services, deployments, variables, domains, and volumes",
161
+ category: "Infrastructure"
162
+ },
163
+ sentry: {
164
+ description: "Monitor Sentry errors, issues, releases, and projects",
165
+ category: "Engineering"
166
+ },
167
+ netlify: {
168
+ description: "Manage Netlify sites, deploys, builds, and environment variables",
169
+ category: "Infrastructure"
170
+ },
155
171
  slack: {
156
172
  description: "Send and manage Slack messages and channels",
157
173
  category: "Communication"
@@ -905,6 +921,21 @@ var exports_base_handler = {};
905
921
  __export(exports_base_handler, {
906
922
  OAuthHandler: () => OAuthHandler
907
923
  });
924
+ function getForwardableProviderConfig(config) {
925
+ if (!config) {
926
+ return {};
927
+ }
928
+ return Object.fromEntries(Object.entries(config).filter(([key, value]) => value !== undefined && value !== null && !OAUTH_CONFIG_FIELDS.has(key)).map(([key, value]) => [key, String(value)]));
929
+ }
930
+ function getStoredProviderConfig(config) {
931
+ const baseUrl = config?.baseUrl || config?.apiBaseUrl;
932
+ if (!baseUrl) {
933
+ return;
934
+ }
935
+ return {
936
+ baseUrl: String(baseUrl)
937
+ };
938
+ }
908
939
 
909
940
  class OAuthHandler {
910
941
  config;
@@ -976,25 +1007,9 @@ class OAuthHandler {
976
1007
  if (redirectUri) {
977
1008
  url.searchParams.set("redirect_uri", redirectUri);
978
1009
  }
979
- const OAUTH_FIELDS = new Set([
980
- "clientId",
981
- "clientSecret",
982
- "scopes",
983
- "optionalScopes",
984
- "redirectUri",
985
- "client_id",
986
- "client_secret",
987
- "scope",
988
- "optional_scope",
989
- "redirect_uri",
990
- "provider"
991
- ]);
992
- if (providerConfig.config) {
993
- for (const [key, value] of Object.entries(providerConfig.config)) {
994
- if (value !== undefined && value !== null && !OAUTH_FIELDS.has(key)) {
995
- url.searchParams.set(key, String(value));
996
- }
997
- }
1010
+ const extraConfig = getForwardableProviderConfig(providerConfig.config);
1011
+ for (const [key, value] of Object.entries(extraConfig)) {
1012
+ url.searchParams.set(key, value);
998
1013
  }
999
1014
  const response = await fetch(url.toString(), {
1000
1015
  method: "GET",
@@ -1081,7 +1096,8 @@ class OAuthHandler {
1081
1096
  state: callbackRequest.state,
1082
1097
  client_id: providerConfig.clientId,
1083
1098
  client_secret: providerConfig.clientSecret,
1084
- redirect_uri: providerConfig.redirectUri
1099
+ redirect_uri: providerConfig.redirectUri,
1100
+ ...getForwardableProviderConfig(providerConfig.config)
1085
1101
  })
1086
1102
  });
1087
1103
  if (!response.ok) {
@@ -1099,7 +1115,8 @@ class OAuthHandler {
1099
1115
  tokenType: result.tokenType,
1100
1116
  expiresIn: result.expiresIn,
1101
1117
  expiresAt: result.expiresAt,
1102
- scopes: result.scopes ? result.scopes.flatMap((s) => s.split(" ").filter(Boolean)) : result.scopes
1118
+ scopes: result.scopes ? result.scopes.flatMap((s) => s.split(" ").filter(Boolean)) : result.scopes,
1119
+ providerConfig: getStoredProviderConfig(providerConfig.config)
1103
1120
  };
1104
1121
  const email = result.email || await fetchUserEmail(callbackRequest.provider, tokenData);
1105
1122
  if (email) {
@@ -1216,6 +1233,12 @@ class OAuthHandler {
1216
1233
  if (providerConfig.config?.subdomain) {
1217
1234
  body.subdomain = providerConfig.config.subdomain;
1218
1235
  }
1236
+ const extraConfig = getForwardableProviderConfig(providerConfig.config);
1237
+ for (const [key, value] of Object.entries(extraConfig)) {
1238
+ if (body[key] === undefined) {
1239
+ body[key] = value;
1240
+ }
1241
+ }
1219
1242
  const url = new URL("/oauth/refresh", this.serverUrl);
1220
1243
  const response = await fetch(url.toString(), {
1221
1244
  method: "POST",
@@ -1242,7 +1265,8 @@ class OAuthHandler {
1242
1265
  tokenType: result.tokenType,
1243
1266
  expiresIn: result.expiresIn,
1244
1267
  expiresAt: result.expiresAt,
1245
- scopes: result.scopes ? result.scopes.flatMap((s) => s.split(" ").filter(Boolean)) : result.scopes
1268
+ scopes: result.scopes ? result.scopes.flatMap((s) => s.split(" ").filter(Boolean)) : result.scopes,
1269
+ providerConfig: getStoredProviderConfig(providerConfig.config)
1246
1270
  };
1247
1271
  const email = result.email || await fetchUserEmail(refreshRequest.provider, tokenData);
1248
1272
  if (email) {
@@ -1309,12 +1333,25 @@ class OAuthHandler {
1309
1333
  return jsonRpcResponse.result;
1310
1334
  }
1311
1335
  }
1312
- var SERVER_LOG_CONTEXT = "server", logger6, MCP_SERVER_URL2 = "https://mcp.integrate.dev/api/v1/mcp";
1336
+ var SERVER_LOG_CONTEXT = "server", logger6, OAUTH_CONFIG_FIELDS, MCP_SERVER_URL2 = "https://mcp.integrate.dev/api/v1/mcp";
1313
1337
  var init_base_handler = __esm(() => {
1314
1338
  init_integration_summary();
1315
1339
  init_email_fetcher();
1316
1340
  init_logger();
1317
1341
  logger6 = createLogger("OAuthHandler", SERVER_LOG_CONTEXT);
1342
+ OAUTH_CONFIG_FIELDS = new Set([
1343
+ "clientId",
1344
+ "clientSecret",
1345
+ "scopes",
1346
+ "optionalScopes",
1347
+ "redirectUri",
1348
+ "client_id",
1349
+ "client_secret",
1350
+ "scope",
1351
+ "optional_scope",
1352
+ "redirect_uri",
1353
+ "provider"
1354
+ ]);
1318
1355
  });
1319
1356
 
1320
1357
  // src/utils/env.ts
@@ -2203,7 +2240,7 @@ async function deliverWebhook(webhook, payload, timeoutMs) {
2203
2240
  signal: controller.signal
2204
2241
  });
2205
2242
  if (!response.ok) {
2206
- logger38.warn(`Webhook delivery to ${webhook.url} returned ${response.status}`);
2243
+ logger40.warn(`Webhook delivery to ${webhook.url} returned ${response.status}`);
2207
2244
  }
2208
2245
  } finally {
2209
2246
  clearTimeout(timeout);
@@ -2216,14 +2253,14 @@ async function deliverWebhooks(webhooks, payload, timeoutMs) {
2216
2253
  for (let i = 0;i < results.length; i++) {
2217
2254
  const result = results[i];
2218
2255
  if (result.status === "rejected") {
2219
- logger38.warn(`Webhook delivery to ${webhooks[i].url} failed:`, result.reason);
2256
+ logger40.warn(`Webhook delivery to ${webhooks[i].url} failed:`, result.reason);
2220
2257
  }
2221
2258
  }
2222
2259
  }
2223
- var logger38;
2260
+ var logger40;
2224
2261
  var init_webhooks = __esm(() => {
2225
2262
  init_logger();
2226
- logger38 = createLogger("Webhooks", "server");
2263
+ logger40 = createLogger("Webhooks", "server");
2227
2264
  });
2228
2265
 
2229
2266
  // src/triggers/types.ts
@@ -2243,13 +2280,13 @@ async function executeTrigger(trigger, config, context) {
2243
2280
  while (stepIndex < MAX_TRIGGER_STEPS) {
2244
2281
  const stepValidation = validateStepLimit(stepIndex, MAX_TRIGGER_STEPS);
2245
2282
  if (!stepValidation.valid) {
2246
- logger39.error(`[Trigger ${trigger.id}] ${stepValidation.error}`);
2283
+ logger41.error(`[Trigger ${trigger.id}] ${stepValidation.error}`);
2247
2284
  break;
2248
2285
  }
2249
2286
  const providerToken = await config.getProviderToken(currentProvider, undefined, context);
2250
2287
  if (!providerToken) {
2251
2288
  const error = `No OAuth token available for provider '${currentProvider}'`;
2252
- logger39.error(`[Trigger ${trigger.id}] ${error}`);
2289
+ logger41.error(`[Trigger ${trigger.id}] ${error}`);
2253
2290
  steps.push({
2254
2291
  stepIndex,
2255
2292
  toolName: currentToolName,
@@ -2275,7 +2312,7 @@ async function executeTrigger(trigger, config, context) {
2275
2312
  } catch (err) {
2276
2313
  stepSuccess = false;
2277
2314
  stepError = err.message || "Tool execution failed";
2278
- logger39.error(`[Trigger ${trigger.id}] Step ${stepIndex} failed:`, err);
2315
+ logger41.error(`[Trigger ${trigger.id}] Step ${stepIndex} failed:`, err);
2279
2316
  }
2280
2317
  if (stepSuccess && toolResult) {
2281
2318
  if (toolResult.isError === true) {
@@ -2368,7 +2405,7 @@ async function executeTrigger(trigger, config, context) {
2368
2405
  return { success: steps.every((s) => s.success), steps, error: stepError };
2369
2406
  }
2370
2407
  const limitError = `Trigger execution exceeded maximum of ${MAX_TRIGGER_STEPS} steps`;
2371
- logger39.error(`[Trigger ${trigger.id}] ${limitError}`);
2408
+ logger41.error(`[Trigger ${trigger.id}] ${limitError}`);
2372
2409
  await config.triggers.update(trigger.id, {
2373
2410
  lastRunAt: new Date().toISOString(),
2374
2411
  runCount: (trigger.runCount || 0) + 1,
@@ -2377,12 +2414,12 @@ async function executeTrigger(trigger, config, context) {
2377
2414
  }, context);
2378
2415
  return { success: false, steps, error: limitError };
2379
2416
  }
2380
- var logger39;
2417
+ var logger41;
2381
2418
  var init_executor2 = __esm(() => {
2382
2419
  init_logger();
2383
2420
  init_utils();
2384
2421
  init_webhooks();
2385
- logger39 = createLogger("TriggerExecutor", "server");
2422
+ logger41 = createLogger("TriggerExecutor", "server");
2386
2423
  });
2387
2424
 
2388
2425
  // src/protocol/jsonrpc.ts
@@ -3830,6 +3867,9 @@ class MCPClientBase {
3830
3867
  if (integrationIds.includes("linear")) {
3831
3868
  this.linear = this.createIntegrationProxy("linear");
3832
3869
  }
3870
+ if (integrationIds.includes("railway")) {
3871
+ this.railway = this.createIntegrationProxy("railway");
3872
+ }
3833
3873
  if (integrationIds.includes("vercel")) {
3834
3874
  this.vercel = this.createIntegrationProxy("vercel");
3835
3875
  }
@@ -3860,6 +3900,9 @@ class MCPClientBase {
3860
3900
  if (integrationIds.includes("gslides")) {
3861
3901
  this.gslides = this.createIntegrationProxy("gslides");
3862
3902
  }
3903
+ if (integrationIds.includes("posthog")) {
3904
+ this.posthog = this.createIntegrationProxy("posthog");
3905
+ }
3863
3906
  this.server = this.createServerProxy();
3864
3907
  this.trigger = new TriggerClient({
3865
3908
  apiRouteBase: this.apiRouteBase,
@@ -5233,9 +5276,123 @@ function linearIntegration(config = {}) {
5233
5276
  }
5234
5277
  };
5235
5278
  }
5279
+ // src/integrations/railway.ts
5280
+ init_logger();
5281
+ var logger13 = createLogger("Railway");
5282
+ var RAILWAY_SCOPES = [
5283
+ "openid",
5284
+ "profile",
5285
+ "email",
5286
+ "workspace:admin",
5287
+ "project:member"
5288
+ ];
5289
+ var RAILWAY_TOOLS = [
5290
+ "railway_get_current_user",
5291
+ "railway_get_workspace",
5292
+ "railway_list_regions",
5293
+ "railway_list_projects",
5294
+ "railway_get_project",
5295
+ "railway_create_project",
5296
+ "railway_update_project",
5297
+ "railway_delete_project",
5298
+ "railway_transfer_project",
5299
+ "railway_list_project_members",
5300
+ "railway_list_environments",
5301
+ "railway_get_environment",
5302
+ "railway_create_environment",
5303
+ "railway_rename_environment",
5304
+ "railway_delete_environment",
5305
+ "railway_get_environment_logs",
5306
+ "railway_get_environment_staged_changes",
5307
+ "railway_commit_environment_staged_changes",
5308
+ "railway_get_service",
5309
+ "railway_get_service_instance",
5310
+ "railway_create_service",
5311
+ "railway_update_service",
5312
+ "railway_update_service_instance",
5313
+ "railway_connect_service",
5314
+ "railway_disconnect_service",
5315
+ "railway_deploy_service",
5316
+ "railway_redeploy_service",
5317
+ "railway_get_service_limits",
5318
+ "railway_delete_service",
5319
+ "railway_list_deployments",
5320
+ "railway_get_deployment",
5321
+ "railway_get_latest_active_deployment",
5322
+ "railway_get_deployment_build_logs",
5323
+ "railway_get_deployment_runtime_logs",
5324
+ "railway_get_deployment_http_logs",
5325
+ "railway_redeploy_deployment",
5326
+ "railway_restart_deployment",
5327
+ "railway_rollback_deployment",
5328
+ "railway_stop_deployment",
5329
+ "railway_cancel_deployment",
5330
+ "railway_remove_deployment",
5331
+ "railway_get_variables",
5332
+ "railway_get_unrendered_variables",
5333
+ "railway_upsert_variable",
5334
+ "railway_upsert_variables",
5335
+ "railway_delete_variable",
5336
+ "railway_get_rendered_variables",
5337
+ "railway_list_domains",
5338
+ "railway_create_service_domain",
5339
+ "railway_delete_service_domain",
5340
+ "railway_check_custom_domain_availability",
5341
+ "railway_create_custom_domain",
5342
+ "railway_get_custom_domain_status",
5343
+ "railway_update_custom_domain",
5344
+ "railway_delete_custom_domain",
5345
+ "railway_list_project_volumes",
5346
+ "railway_get_volume_instance",
5347
+ "railway_create_volume",
5348
+ "railway_update_volume",
5349
+ "railway_update_volume_instance",
5350
+ "railway_delete_volume",
5351
+ "railway_list_volume_backups",
5352
+ "railway_create_volume_backup",
5353
+ "railway_restore_volume_backup",
5354
+ "railway_lock_volume_backup",
5355
+ "railway_delete_volume_backup",
5356
+ "railway_list_volume_backup_schedules",
5357
+ "railway_list_tcp_proxies"
5358
+ ];
5359
+ function railwayIntegration(config = {}) {
5360
+ const oauth = {
5361
+ provider: "railway",
5362
+ clientId: config.clientId ?? getEnv("RAILWAY_CLIENT_ID"),
5363
+ clientSecret: config.clientSecret ?? getEnv("RAILWAY_CLIENT_SECRET"),
5364
+ scopes: config.scopes ?? [...RAILWAY_SCOPES],
5365
+ optionalScopes: config.optionalScopes,
5366
+ redirectUri: config.redirectUri,
5367
+ config: {
5368
+ authorization_endpoint: "https://backboard.railway.com/oauth/auth",
5369
+ token_endpoint: "https://backboard.railway.com/oauth/token",
5370
+ response_type: "code",
5371
+ grant_types_supported: ["authorization_code", "refresh_token"],
5372
+ code_challenge_method: "S256",
5373
+ apiBaseUrl: "https://backboard.railway.com/graphql/v2",
5374
+ ...config
5375
+ }
5376
+ };
5377
+ return {
5378
+ id: "railway",
5379
+ name: "Railway",
5380
+ logoUrl: "https://wdvtnli2jn3texa6.public.blob.vercel-storage.com/railway.png",
5381
+ description: "Manage Railway workspaces, projects, services, deployments, variables, domains, and volumes",
5382
+ category: "Infrastructure",
5383
+ tools: [...RAILWAY_TOOLS],
5384
+ oauth,
5385
+ async onInit(_client) {
5386
+ logger13.debug("Railway integration initialized");
5387
+ },
5388
+ async onAfterConnect(_client) {
5389
+ logger13.debug("Railway integration connected");
5390
+ }
5391
+ };
5392
+ }
5236
5393
  // src/integrations/vercel.ts
5237
5394
  init_logger();
5238
- var logger13 = createLogger("Vercel");
5395
+ var logger14 = createLogger("Vercel");
5239
5396
  var VERCEL_TOOLS = [
5240
5397
  "vercel_list_projects",
5241
5398
  "vercel_get_project",
@@ -5278,16 +5435,16 @@ function vercelIntegration(config = {}) {
5278
5435
  tools: [...VERCEL_TOOLS],
5279
5436
  oauth,
5280
5437
  async onInit(_client) {
5281
- logger13.debug("Vercel integration initialized");
5438
+ logger14.debug("Vercel integration initialized");
5282
5439
  },
5283
5440
  async onAfterConnect(_client) {
5284
- logger13.debug("Vercel integration connected");
5441
+ logger14.debug("Vercel integration connected");
5285
5442
  }
5286
5443
  };
5287
5444
  }
5288
5445
  // src/integrations/zendesk.ts
5289
5446
  init_logger();
5290
- var logger14 = createLogger("Zendesk");
5447
+ var logger15 = createLogger("Zendesk");
5291
5448
  var ZENDESK_TOOLS = [
5292
5449
  "zendesk_list_tickets",
5293
5450
  "zendesk_get_ticket",
@@ -5336,16 +5493,16 @@ function zendeskIntegration(config = {}) {
5336
5493
  tools: [...ZENDESK_TOOLS],
5337
5494
  oauth,
5338
5495
  async onInit(_client) {
5339
- logger14.debug("Zendesk integration initialized");
5496
+ logger15.debug("Zendesk integration initialized");
5340
5497
  },
5341
5498
  async onAfterConnect(_client) {
5342
- logger14.debug("Zendesk integration connected");
5499
+ logger15.debug("Zendesk integration connected");
5343
5500
  }
5344
5501
  };
5345
5502
  }
5346
5503
  // src/integrations/stripe.ts
5347
5504
  init_logger();
5348
- var logger15 = createLogger("Stripe");
5505
+ var logger16 = createLogger("Stripe");
5349
5506
  var STRIPE_TOOLS = [
5350
5507
  "stripe_list_customers",
5351
5508
  "stripe_get_customer",
@@ -5401,16 +5558,16 @@ function stripeIntegration(config = {}) {
5401
5558
  tools: [...STRIPE_TOOLS],
5402
5559
  oauth,
5403
5560
  async onInit(_client) {
5404
- logger15.debug("Stripe integration initialized");
5561
+ logger16.debug("Stripe integration initialized");
5405
5562
  },
5406
5563
  async onAfterConnect(_client) {
5407
- logger15.debug("Stripe integration connected");
5564
+ logger16.debug("Stripe integration connected");
5408
5565
  }
5409
5566
  };
5410
5567
  }
5411
5568
  // src/integrations/gcal.ts
5412
5569
  init_logger();
5413
- var logger16 = createLogger("Google Calendar");
5570
+ var logger17 = createLogger("Google Calendar");
5414
5571
  var GCAL_TOOLS = [
5415
5572
  "gcal_list_calendars",
5416
5573
  "gcal_get_calendar",
@@ -5443,16 +5600,16 @@ function gcalIntegration(config = {}) {
5443
5600
  tools: [...GCAL_TOOLS],
5444
5601
  oauth,
5445
5602
  async onInit(_client) {
5446
- logger16.debug("Google Calendar integration initialized");
5603
+ logger17.debug("Google Calendar integration initialized");
5447
5604
  },
5448
5605
  async onAfterConnect(_client) {
5449
- logger16.debug("Google Calendar integration connected");
5606
+ logger17.debug("Google Calendar integration connected");
5450
5607
  }
5451
5608
  };
5452
5609
  }
5453
5610
  // src/integrations/outlook.ts
5454
5611
  init_logger();
5455
- var logger17 = createLogger("Outlook");
5612
+ var logger18 = createLogger("Outlook");
5456
5613
  var OUTLOOK_TOOLS = [
5457
5614
  "outlook_list_messages",
5458
5615
  "outlook_get_message",
@@ -5499,16 +5656,16 @@ function outlookIntegration(config = {}) {
5499
5656
  tools: [...OUTLOOK_TOOLS],
5500
5657
  oauth,
5501
5658
  async onInit(_client) {
5502
- logger17.debug("Outlook integration initialized");
5659
+ logger18.debug("Outlook integration initialized");
5503
5660
  },
5504
5661
  async onAfterConnect(_client) {
5505
- logger17.debug("Outlook integration connected");
5662
+ logger18.debug("Outlook integration connected");
5506
5663
  }
5507
5664
  };
5508
5665
  }
5509
5666
  // src/integrations/airtable.ts
5510
5667
  init_logger();
5511
- var logger18 = createLogger("Airtable");
5668
+ var logger19 = createLogger("Airtable");
5512
5669
  var AIRTABLE_TOOLS = [
5513
5670
  "airtable_list_bases",
5514
5671
  "airtable_get_base",
@@ -5554,16 +5711,16 @@ function airtableIntegration(config = {}) {
5554
5711
  tools: [...AIRTABLE_TOOLS],
5555
5712
  oauth,
5556
5713
  async onInit(_client) {
5557
- logger18.debug("Airtable integration initialized");
5714
+ logger19.debug("Airtable integration initialized");
5558
5715
  },
5559
5716
  async onAfterConnect(_client) {
5560
- logger18.debug("Airtable integration connected");
5717
+ logger19.debug("Airtable integration connected");
5561
5718
  }
5562
5719
  };
5563
5720
  }
5564
5721
  // src/integrations/todoist.ts
5565
5722
  init_logger();
5566
- var logger19 = createLogger("Todoist");
5723
+ var logger20 = createLogger("Todoist");
5567
5724
  var TODOIST_TOOLS = [
5568
5725
  "todoist_list_projects",
5569
5726
  "todoist_get_project",
@@ -5618,16 +5775,16 @@ function todoistIntegration(config = {}) {
5618
5775
  tools: [...TODOIST_TOOLS],
5619
5776
  oauth,
5620
5777
  async onInit(_client) {
5621
- logger19.debug("Todoist integration initialized");
5778
+ logger20.debug("Todoist integration initialized");
5622
5779
  },
5623
5780
  async onAfterConnect(_client) {
5624
- logger19.debug("Todoist integration connected");
5781
+ logger20.debug("Todoist integration connected");
5625
5782
  }
5626
5783
  };
5627
5784
  }
5628
5785
  // src/integrations/whatsapp.ts
5629
5786
  init_logger();
5630
- var logger20 = createLogger("WhatsApp");
5787
+ var logger21 = createLogger("WhatsApp");
5631
5788
  var WHATSAPP_TOOLS = [
5632
5789
  "whatsapp_send_message",
5633
5790
  "whatsapp_reply_message",
@@ -5673,16 +5830,16 @@ function whatsappIntegration(config = {}) {
5673
5830
  tools: [...WHATSAPP_TOOLS],
5674
5831
  oauth,
5675
5832
  async onInit(_client) {
5676
- logger20.debug("WhatsApp Business integration initialized");
5833
+ logger21.debug("WhatsApp Business integration initialized");
5677
5834
  },
5678
5835
  async onAfterConnect(_client) {
5679
- logger20.debug("WhatsApp Business integration connected");
5836
+ logger21.debug("WhatsApp Business integration connected");
5680
5837
  }
5681
5838
  };
5682
5839
  }
5683
5840
  // src/integrations/calcom.ts
5684
5841
  init_logger();
5685
- var logger21 = createLogger("Cal.com");
5842
+ var logger22 = createLogger("Cal.com");
5686
5843
  var CALCOM_TOOLS = [
5687
5844
  "calcom_list_bookings",
5688
5845
  "calcom_get_booking",
@@ -5758,16 +5915,16 @@ function calcomIntegration(config = {}) {
5758
5915
  tools: [...CALCOM_TOOLS],
5759
5916
  oauth,
5760
5917
  async onInit(_client) {
5761
- logger21.debug("Cal.com integration initialized");
5918
+ logger22.debug("Cal.com integration initialized");
5762
5919
  },
5763
5920
  async onAfterConnect(_client) {
5764
- logger21.debug("Cal.com integration connected");
5921
+ logger22.debug("Cal.com integration connected");
5765
5922
  }
5766
5923
  };
5767
5924
  }
5768
5925
  // src/integrations/ramp.ts
5769
5926
  init_logger();
5770
- var logger22 = createLogger("Ramp");
5927
+ var logger23 = createLogger("Ramp");
5771
5928
  var RAMP_TOOLS = [
5772
5929
  "ramp_list_transactions",
5773
5930
  "ramp_get_transaction",
@@ -5799,16 +5956,16 @@ function rampIntegration(config = {}) {
5799
5956
  tools: [...RAMP_TOOLS],
5800
5957
  oauth,
5801
5958
  async onInit(_client) {
5802
- logger22.debug("Ramp integration initialized");
5959
+ logger23.debug("Ramp integration initialized");
5803
5960
  },
5804
5961
  async onAfterConnect(_client) {
5805
- logger22.debug("Ramp integration connected");
5962
+ logger23.debug("Ramp integration connected");
5806
5963
  }
5807
5964
  };
5808
5965
  }
5809
5966
  // src/integrations/onedrive.ts
5810
5967
  init_logger();
5811
- var logger23 = createLogger("OneDrive");
5968
+ var logger24 = createLogger("OneDrive");
5812
5969
  var ONEDRIVE_TOOLS = [
5813
5970
  "onedrive_list_files",
5814
5971
  "onedrive_get_file",
@@ -5837,16 +5994,16 @@ function onedriveIntegration(config = {}) {
5837
5994
  tools: [...ONEDRIVE_TOOLS],
5838
5995
  oauth,
5839
5996
  async onInit(_client) {
5840
- logger23.debug("OneDrive integration initialized");
5997
+ logger24.debug("OneDrive integration initialized");
5841
5998
  },
5842
5999
  async onAfterConnect(_client) {
5843
- logger23.debug("OneDrive integration connected");
6000
+ logger24.debug("OneDrive integration connected");
5844
6001
  }
5845
6002
  };
5846
6003
  }
5847
6004
  // src/integrations/dropbox.ts
5848
6005
  init_logger();
5849
- var logger24 = createLogger("Dropbox");
6006
+ var logger25 = createLogger("Dropbox");
5850
6007
  var DROPBOX_TOOLS = [
5851
6008
  "dropbox_get_current_account",
5852
6009
  "dropbox_get_space_usage",
@@ -5885,16 +6042,16 @@ function dropboxIntegration(options = {}) {
5885
6042
  authType: "oauth",
5886
6043
  oauth,
5887
6044
  async onInit(_client) {
5888
- logger24.debug("Dropbox integration initialized");
6045
+ logger25.debug("Dropbox integration initialized");
5889
6046
  },
5890
6047
  async onAfterConnect(_client) {
5891
- logger24.debug("Dropbox integration connected");
6048
+ logger25.debug("Dropbox integration connected");
5892
6049
  }
5893
6050
  };
5894
6051
  }
5895
6052
  // src/integrations/word.ts
5896
6053
  init_logger();
5897
- var logger25 = createLogger("Word");
6054
+ var logger26 = createLogger("Word");
5898
6055
  var WORD_TOOLS = [
5899
6056
  "word_list",
5900
6057
  "word_get",
@@ -5920,16 +6077,16 @@ function wordIntegration(config = {}) {
5920
6077
  tools: [...WORD_TOOLS],
5921
6078
  oauth,
5922
6079
  async onInit(_client) {
5923
- logger25.debug("Word integration initialized");
6080
+ logger26.debug("Word integration initialized");
5924
6081
  },
5925
6082
  async onAfterConnect(_client) {
5926
- logger25.debug("Word integration connected");
6083
+ logger26.debug("Word integration connected");
5927
6084
  }
5928
6085
  };
5929
6086
  }
5930
6087
  // src/integrations/excel.ts
5931
6088
  init_logger();
5932
- var logger26 = createLogger("Excel");
6089
+ var logger27 = createLogger("Excel");
5933
6090
  var EXCEL_TOOLS = [
5934
6091
  "excel_list",
5935
6092
  "excel_get",
@@ -5965,16 +6122,16 @@ function excelIntegration(config = {}) {
5965
6122
  tools: [...EXCEL_TOOLS],
5966
6123
  oauth,
5967
6124
  async onInit(_client) {
5968
- logger26.debug("Excel integration initialized");
6125
+ logger27.debug("Excel integration initialized");
5969
6126
  },
5970
6127
  async onAfterConnect(_client) {
5971
- logger26.debug("Excel integration connected");
6128
+ logger27.debug("Excel integration connected");
5972
6129
  }
5973
6130
  };
5974
6131
  }
5975
6132
  // src/integrations/powerpoint.ts
5976
6133
  init_logger();
5977
- var logger27 = createLogger("PowerPoint");
6134
+ var logger28 = createLogger("PowerPoint");
5978
6135
  var POWERPOINT_TOOLS = [
5979
6136
  "powerpoint_list",
5980
6137
  "powerpoint_get",
@@ -6000,16 +6157,16 @@ function powerpointIntegration(config = {}) {
6000
6157
  tools: [...POWERPOINT_TOOLS],
6001
6158
  oauth,
6002
6159
  async onInit(_client) {
6003
- logger27.debug("PowerPoint integration initialized");
6160
+ logger28.debug("PowerPoint integration initialized");
6004
6161
  },
6005
6162
  async onAfterConnect(_client) {
6006
- logger27.debug("PowerPoint integration connected");
6163
+ logger28.debug("PowerPoint integration connected");
6007
6164
  }
6008
6165
  };
6009
6166
  }
6010
6167
  // src/integrations/gdocs.ts
6011
6168
  init_logger();
6012
- var logger28 = createLogger("Google Docs");
6169
+ var logger29 = createLogger("Google Docs");
6013
6170
  var GDOCS_TOOLS = [
6014
6171
  "gdocs_list",
6015
6172
  "gdocs_get",
@@ -6034,16 +6191,16 @@ function gdocsIntegration(config = {}) {
6034
6191
  tools: [...GDOCS_TOOLS],
6035
6192
  oauth,
6036
6193
  async onInit(_client) {
6037
- logger28.debug("Google Docs integration initialized");
6194
+ logger29.debug("Google Docs integration initialized");
6038
6195
  },
6039
6196
  async onAfterConnect(_client) {
6040
- logger28.debug("Google Docs integration connected");
6197
+ logger29.debug("Google Docs integration connected");
6041
6198
  }
6042
6199
  };
6043
6200
  }
6044
6201
  // src/integrations/gdrive.ts
6045
6202
  init_logger();
6046
- var logger29 = createLogger("Google Drive");
6203
+ var logger30 = createLogger("Google Drive");
6047
6204
  var GDRIVE_TOOLS = [
6048
6205
  "gdrive_list_files",
6049
6206
  "gdrive_get_file",
@@ -6077,16 +6234,16 @@ function gdriveIntegration(config = {}) {
6077
6234
  tools: [...GDRIVE_TOOLS],
6078
6235
  oauth,
6079
6236
  async onInit(_client) {
6080
- logger29.debug("Google Drive integration initialized");
6237
+ logger30.debug("Google Drive integration initialized");
6081
6238
  },
6082
6239
  async onAfterConnect(_client) {
6083
- logger29.debug("Google Drive integration connected");
6240
+ logger30.debug("Google Drive integration connected");
6084
6241
  }
6085
6242
  };
6086
6243
  }
6087
6244
  // src/integrations/gsheets.ts
6088
6245
  init_logger();
6089
- var logger30 = createLogger("Google Sheets");
6246
+ var logger31 = createLogger("Google Sheets");
6090
6247
  var GSHEETS_TOOLS = [
6091
6248
  "gsheets_list",
6092
6249
  "gsheets_get",
@@ -6114,16 +6271,16 @@ function gsheetsIntegration(config = {}) {
6114
6271
  tools: [...GSHEETS_TOOLS],
6115
6272
  oauth,
6116
6273
  async onInit(_client) {
6117
- logger30.debug("Google Sheets integration initialized");
6274
+ logger31.debug("Google Sheets integration initialized");
6118
6275
  },
6119
6276
  async onAfterConnect(_client) {
6120
- logger30.debug("Google Sheets integration connected");
6277
+ logger31.debug("Google Sheets integration connected");
6121
6278
  }
6122
6279
  };
6123
6280
  }
6124
6281
  // src/integrations/gslides.ts
6125
6282
  init_logger();
6126
- var logger31 = createLogger("Google Slides");
6283
+ var logger32 = createLogger("Google Slides");
6127
6284
  var GSLIDES_TOOLS = [
6128
6285
  "gslides_list",
6129
6286
  "gslides_get",
@@ -6150,16 +6307,16 @@ function gslidesIntegration(config = {}) {
6150
6307
  tools: [...GSLIDES_TOOLS],
6151
6308
  oauth,
6152
6309
  async onInit(_client) {
6153
- logger31.debug("Google Slides integration initialized");
6310
+ logger32.debug("Google Slides integration initialized");
6154
6311
  },
6155
6312
  async onAfterConnect(_client) {
6156
- logger31.debug("Google Slides integration connected");
6313
+ logger32.debug("Google Slides integration connected");
6157
6314
  }
6158
6315
  };
6159
6316
  }
6160
6317
  // src/integrations/polar.ts
6161
6318
  init_logger();
6162
- var logger32 = createLogger("Polar");
6319
+ var logger33 = createLogger("Polar");
6163
6320
  var POLAR_TOOLS = [
6164
6321
  "polar_list_products",
6165
6322
  "polar_get_product",
@@ -6216,16 +6373,16 @@ function polarIntegration(config = {}) {
6216
6373
  tools: [...POLAR_TOOLS],
6217
6374
  oauth,
6218
6375
  async onInit(_client) {
6219
- logger32.debug("Polar integration initialized");
6376
+ logger33.debug("Polar integration initialized");
6220
6377
  },
6221
6378
  async onAfterConnect(_client) {
6222
- logger32.debug("Polar integration connected");
6379
+ logger33.debug("Polar integration connected");
6223
6380
  }
6224
6381
  };
6225
6382
  }
6226
6383
  // src/integrations/figma.ts
6227
6384
  init_logger();
6228
- var logger33 = createLogger("Figma");
6385
+ var logger34 = createLogger("Figma");
6229
6386
  var FIGMA_TOOLS = [
6230
6387
  "figma_get_file",
6231
6388
  "figma_get_file_nodes",
@@ -6291,16 +6448,16 @@ function figmaIntegration(config = {}) {
6291
6448
  tools: [...FIGMA_TOOLS],
6292
6449
  oauth,
6293
6450
  async onInit(_client) {
6294
- logger33.debug("Figma integration initialized");
6451
+ logger34.debug("Figma integration initialized");
6295
6452
  },
6296
6453
  async onAfterConnect(_client) {
6297
- logger33.debug("Figma integration connected");
6454
+ logger34.debug("Figma integration connected");
6298
6455
  }
6299
6456
  };
6300
6457
  }
6301
6458
  // src/integrations/intercom.ts
6302
6459
  init_logger();
6303
- var logger34 = createLogger("Intercom");
6460
+ var logger35 = createLogger("Intercom");
6304
6461
  var INTERCOM_TOOLS = [
6305
6462
  "intercom_list_contacts",
6306
6463
  "intercom_get_contact",
@@ -6331,16 +6488,16 @@ function intercomIntegration(config = {}) {
6331
6488
  tools: [...INTERCOM_TOOLS],
6332
6489
  oauth,
6333
6490
  async onInit(_client) {
6334
- logger34.debug("Intercom integration initialized");
6491
+ logger35.debug("Intercom integration initialized");
6335
6492
  },
6336
6493
  async onAfterConnect(_client) {
6337
- logger34.debug("Intercom integration connected");
6494
+ logger35.debug("Intercom integration connected");
6338
6495
  }
6339
6496
  };
6340
6497
  }
6341
6498
  // src/integrations/hubspot.ts
6342
6499
  init_logger();
6343
- var logger35 = createLogger("HubSpot");
6500
+ var logger36 = createLogger("HubSpot");
6344
6501
  var HUBSPOT_TOOLS = [
6345
6502
  "hubspot_list_contacts",
6346
6503
  "hubspot_get_contact",
@@ -6390,16 +6547,16 @@ function hubspotIntegration(config = {}) {
6390
6547
  tools: [...HUBSPOT_TOOLS],
6391
6548
  oauth,
6392
6549
  async onInit(_client) {
6393
- logger35.debug("HubSpot integration initialized");
6550
+ logger36.debug("HubSpot integration initialized");
6394
6551
  },
6395
6552
  async onAfterConnect(_client) {
6396
- logger35.debug("HubSpot integration connected");
6553
+ logger36.debug("HubSpot integration connected");
6397
6554
  }
6398
6555
  };
6399
6556
  }
6400
6557
  // src/integrations/youtube.ts
6401
6558
  init_logger();
6402
- var logger36 = createLogger("YouTube");
6559
+ var logger37 = createLogger("YouTube");
6403
6560
  var YOUTUBE_TOOLS = [
6404
6561
  "youtube_search",
6405
6562
  "youtube_get_video",
@@ -6445,16 +6602,16 @@ function youtubeIntegration(config = {}) {
6445
6602
  tools: [...YOUTUBE_TOOLS],
6446
6603
  oauth,
6447
6604
  async onInit(_client) {
6448
- logger36.debug("YouTube integration initialized");
6605
+ logger37.debug("YouTube integration initialized");
6449
6606
  },
6450
6607
  async onAfterConnect(_client) {
6451
- logger36.debug("YouTube integration connected");
6608
+ logger37.debug("YouTube integration connected");
6452
6609
  }
6453
6610
  };
6454
6611
  }
6455
6612
  // src/integrations/cursor.ts
6456
6613
  init_logger();
6457
- var logger37 = createLogger("Cursor");
6614
+ var logger38 = createLogger("Cursor");
6458
6615
  var CURSOR_TOOLS = [
6459
6616
  "cursor_list_agents",
6460
6617
  "cursor_get_agent",
@@ -6474,10 +6631,105 @@ function cursorIntegration(_config = {}) {
6474
6631
  logoUrl: "https://wdvtnli2jn3texa6.public.blob.vercel-storage.com/cursor.jpeg",
6475
6632
  tools: [...CURSOR_TOOLS],
6476
6633
  async onInit(_client) {
6477
- logger37.debug("Cursor integration initialized");
6634
+ logger38.debug("Cursor integration initialized");
6635
+ },
6636
+ async onAfterConnect(_client) {
6637
+ logger38.debug("Cursor integration connected");
6638
+ }
6639
+ };
6640
+ }
6641
+ // src/integrations/posthog.ts
6642
+ init_logger();
6643
+ var logger39 = createLogger("PostHog");
6644
+ var DEFAULT_POSTHOG_BASE_URL = "https://us.posthog.com";
6645
+ var POSTHOG_SCOPES = [
6646
+ "openid",
6647
+ "profile",
6648
+ "email",
6649
+ "organization:read",
6650
+ "project:read",
6651
+ "user:read",
6652
+ "query:read",
6653
+ "insight:read",
6654
+ "dashboard:read",
6655
+ "feature_flag:read",
6656
+ "experiment:read",
6657
+ "annotation:read",
6658
+ "cohort:read",
6659
+ "person:read",
6660
+ "event_definition:read",
6661
+ "property_definition:read",
6662
+ "session_recording:read",
6663
+ "action:read"
6664
+ ];
6665
+ var POSTHOG_TOOLS = [
6666
+ "posthog_get_current_user",
6667
+ "posthog_list_organizations",
6668
+ "posthog_get_organization",
6669
+ "posthog_list_projects",
6670
+ "posthog_get_project",
6671
+ "posthog_run_hogql_query",
6672
+ "posthog_list_insights",
6673
+ "posthog_get_insight",
6674
+ "posthog_list_dashboards",
6675
+ "posthog_get_dashboard",
6676
+ "posthog_list_feature_flags",
6677
+ "posthog_get_feature_flag",
6678
+ "posthog_list_experiments",
6679
+ "posthog_get_experiment",
6680
+ "posthog_list_annotations",
6681
+ "posthog_get_annotation",
6682
+ "posthog_list_cohorts",
6683
+ "posthog_get_cohort",
6684
+ "posthog_list_event_definitions",
6685
+ "posthog_get_event_definition",
6686
+ "posthog_list_property_definitions",
6687
+ "posthog_get_property_definition",
6688
+ "posthog_list_persons",
6689
+ "posthog_get_person",
6690
+ "posthog_list_session_recordings",
6691
+ "posthog_get_session_recording"
6692
+ ];
6693
+ function normalizePostHogBaseUrl(baseUrl) {
6694
+ const value = (baseUrl || DEFAULT_POSTHOG_BASE_URL).trim().replace(/\/+$/, "");
6695
+ if (!value) {
6696
+ return DEFAULT_POSTHOG_BASE_URL;
6697
+ }
6698
+ return /^https?:\/\//i.test(value) ? value : `https://${value}`;
6699
+ }
6700
+ function posthogIntegration(config = {}) {
6701
+ const baseUrl = normalizePostHogBaseUrl(config.baseUrl);
6702
+ const oauth = {
6703
+ provider: "posthog",
6704
+ clientId: config.clientId ?? getEnv("POSTHOG_CLIENT_ID"),
6705
+ clientSecret: config.clientSecret ?? getEnv("POSTHOG_CLIENT_SECRET"),
6706
+ scopes: config.scopes ?? [...POSTHOG_SCOPES],
6707
+ optionalScopes: config.optionalScopes,
6708
+ redirectUri: config.redirectUri,
6709
+ config: {
6710
+ baseUrl,
6711
+ apiBaseUrl: baseUrl,
6712
+ authorization_endpoint: `${baseUrl}/oauth/authorize/`,
6713
+ token_endpoint: `${baseUrl}/oauth/token/`,
6714
+ token_auth_method: "client_secret_post",
6715
+ response_type: "code",
6716
+ grant_types_supported: ["authorization_code", "refresh_token"],
6717
+ code_challenge_method: "S256"
6718
+ }
6719
+ };
6720
+ return {
6721
+ id: "posthog",
6722
+ name: "PostHog",
6723
+ logoUrl: "https://wdvtnli2jn3texa6.public.blob.vercel-storage.com/posthog.png",
6724
+ description: "Read PostHog organizations, projects, insights, flags, and analytics data",
6725
+ category: "Analytics",
6726
+ tools: [...POSTHOG_TOOLS],
6727
+ oauth,
6728
+ async onInit(_client) {
6729
+ logger39.debug("PostHog integration initialized");
6478
6730
  },
6479
6731
  async onAfterConnect(_client) {
6480
- logger37.debug("Cursor integration connected");
6732
+ logger39.debug("PostHog integration connected");
6481
6733
  }
6482
6734
  };
6483
6735
  }
@@ -12753,7 +13005,7 @@ function convertJsonSchemaToGoogleSchema(jsonSchema, TypeEnum) {
12753
13005
  }
12754
13006
  // src/server.ts
12755
13007
  var SERVER_LOG_CONTEXT3 = "server";
12756
- var logger40 = createLogger("MCPServer", SERVER_LOG_CONTEXT3);
13008
+ var logger42 = createLogger("MCPServer", SERVER_LOG_CONTEXT3);
12757
13009
  var globalServerConfig = null;
12758
13010
  var globalMCPHandler = null;
12759
13011
  var codeVerifierStorage = new Map;
@@ -12859,7 +13111,7 @@ function createMCPServer(config) {
12859
13111
  if (integration.oauth) {
12860
13112
  const { clientId, clientSecret, redirectUri: integrationRedirectUri, config: oauthConfig } = integration.oauth;
12861
13113
  if (!clientId || !clientSecret) {
12862
- logger40.warn(`Warning: Integration "${integration.id}" is missing OAuth credentials. ` + `Provide clientId and clientSecret in the integration configuration.`);
13114
+ logger42.warn(`Warning: Integration "${integration.id}" is missing OAuth credentials. ` + `Provide clientId and clientSecret in the integration configuration.`);
12863
13115
  return integration;
12864
13116
  }
12865
13117
  const redirectUri = integrationRedirectUri || config.redirectUri || getDefaultRedirectUri();
@@ -13036,7 +13288,7 @@ function createMCPServer(config) {
13036
13288
  }
13037
13289
  return response2;
13038
13290
  } catch (error) {
13039
- logger40.error("[MCP Tool Call] Error:", error);
13291
+ logger42.error("[MCP Tool Call] Error:", error);
13040
13292
  return Response.json({ error: error.message || "Failed to execute tool call" }, { status: error.statusCode || 500 });
13041
13293
  }
13042
13294
  }
@@ -13085,7 +13337,7 @@ function createMCPServer(config) {
13085
13337
  });
13086
13338
  return Response.json(result, { status: result.success ? 200 : 500 });
13087
13339
  } catch (error) {
13088
- logger40.error("[Code Mode] Error:", error);
13340
+ logger42.error("[Code Mode] Error:", error);
13089
13341
  return Response.json({ error: error?.message || "Failed to execute code" }, { status: 500 });
13090
13342
  }
13091
13343
  }
@@ -13143,7 +13395,7 @@ function createMCPServer(config) {
13143
13395
  error: executionResult.error
13144
13396
  });
13145
13397
  } catch (error) {
13146
- logger40.error("[Trigger Notify] Error:", error);
13398
+ logger42.error("[Trigger Notify] Error:", error);
13147
13399
  return Response.json({ error: error.message || "Failed to execute trigger" }, { status: 500 });
13148
13400
  }
13149
13401
  }
@@ -13207,7 +13459,7 @@ function createMCPServer(config) {
13207
13459
  })
13208
13460
  });
13209
13461
  } catch (scheduleError) {
13210
- logger40.error("[Trigger] Failed to register with scheduler:", scheduleError);
13462
+ logger42.error("[Trigger] Failed to register with scheduler:", scheduleError);
13211
13463
  }
13212
13464
  return Response.json(created, { status: 201 });
13213
13465
  }
@@ -13242,7 +13494,7 @@ function createMCPServer(config) {
13242
13494
  body: JSON.stringify({ triggerId })
13243
13495
  });
13244
13496
  } catch (error) {
13245
- logger40.error("[Trigger] Failed to pause in scheduler:", error);
13497
+ logger42.error("[Trigger] Failed to pause in scheduler:", error);
13246
13498
  }
13247
13499
  return Response.json(updated);
13248
13500
  } else if (subAction === "resume" && method === "POST") {
@@ -13270,7 +13522,7 @@ function createMCPServer(config) {
13270
13522
  body: JSON.stringify({ triggerId })
13271
13523
  });
13272
13524
  } catch (error) {
13273
- logger40.error("[Trigger] Failed to resume in scheduler:", error);
13525
+ logger42.error("[Trigger] Failed to resume in scheduler:", error);
13274
13526
  }
13275
13527
  return Response.json(updated);
13276
13528
  } else if (subAction === "run" && method === "POST") {
@@ -13341,7 +13593,7 @@ function createMCPServer(config) {
13341
13593
  })
13342
13594
  });
13343
13595
  } catch (error) {
13344
- logger40.error("[Trigger] Failed to update scheduler:", error);
13596
+ logger42.error("[Trigger] Failed to update scheduler:", error);
13345
13597
  }
13346
13598
  }
13347
13599
  return Response.json(updated);
@@ -13358,14 +13610,14 @@ function createMCPServer(config) {
13358
13610
  body: JSON.stringify({ triggerId })
13359
13611
  });
13360
13612
  } catch (error) {
13361
- logger40.error("[Trigger] Failed to unregister from scheduler:", error);
13613
+ logger42.error("[Trigger] Failed to unregister from scheduler:", error);
13362
13614
  }
13363
13615
  return new Response(null, { status: 204 });
13364
13616
  }
13365
13617
  }
13366
13618
  return Response.json({ error: "Invalid trigger route or method" }, { status: 404 });
13367
13619
  } catch (error) {
13368
- logger40.error("[Trigger] Error:", error);
13620
+ logger42.error("[Trigger] Error:", error);
13369
13621
  return Response.json({ error: error.message || "Failed to process trigger request" }, { status: error.statusCode || 500 });
13370
13622
  }
13371
13623
  }
@@ -13391,11 +13643,11 @@ function createMCPServer(config) {
13391
13643
  const errorRedirectUrl = "/auth-error";
13392
13644
  if (error) {
13393
13645
  const errorMsg = errorDescription || error;
13394
- logger40.error("[OAuth Redirect] Error:", errorMsg);
13646
+ logger42.error("[OAuth Redirect] Error:", errorMsg);
13395
13647
  return Response.redirect(new URL(`${errorRedirectUrl}?error=${encodeURIComponent(errorMsg)}`, webRequest.url));
13396
13648
  }
13397
13649
  if (!code || !state) {
13398
- logger40.error("[OAuth Redirect] Missing code or state parameter");
13650
+ logger42.error("[OAuth Redirect] Missing code or state parameter");
13399
13651
  return Response.redirect(new URL(`${errorRedirectUrl}?error=${encodeURIComponent("Invalid OAuth callback")}`, webRequest.url));
13400
13652
  }
13401
13653
  let returnUrl = defaultRedirectUrl;
@@ -13472,7 +13724,7 @@ function createMCPServer(config) {
13472
13724
  frontendUrl.hash = `oauth_callback=${encodeURIComponent(JSON.stringify({ code, state, tokenData }))}`;
13473
13725
  return Response.redirect(frontendUrl);
13474
13726
  } catch (error2) {
13475
- logger40.error("[OAuth Backend Callback] Error:", error2);
13727
+ logger42.error("[OAuth Backend Callback] Error:", error2);
13476
13728
  return Response.redirect(new URL(`${errorRedirectUrl}?error=${encodeURIComponent(error2.message || "Failed to exchange token")}`, webRequest.url));
13477
13729
  }
13478
13730
  } else {
@@ -13768,7 +14020,9 @@ export {
13768
14020
  slackIntegration,
13769
14021
  sendWebResponse,
13770
14022
  rampIntegration,
14023
+ railwayIntegration,
13771
14024
  powerpointIntegration,
14025
+ posthogIntegration,
13772
14026
  polarIntegration,
13773
14027
  outlookIntegration,
13774
14028
  onedriveIntegration,