integrate-sdk 0.9.28-dev.1 → 0.9.29-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.
package/dist/server.js CHANGED
@@ -148,10 +148,18 @@ 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
+ },
155
163
  slack: {
156
164
  description: "Send and manage Slack messages and channels",
157
165
  category: "Communication"
@@ -905,6 +913,21 @@ var exports_base_handler = {};
905
913
  __export(exports_base_handler, {
906
914
  OAuthHandler: () => OAuthHandler
907
915
  });
916
+ function getForwardableProviderConfig(config) {
917
+ if (!config) {
918
+ return {};
919
+ }
920
+ return Object.fromEntries(Object.entries(config).filter(([key, value]) => value !== undefined && value !== null && !OAUTH_CONFIG_FIELDS.has(key)).map(([key, value]) => [key, String(value)]));
921
+ }
922
+ function getStoredProviderConfig(config) {
923
+ const baseUrl = config?.baseUrl || config?.apiBaseUrl;
924
+ if (!baseUrl) {
925
+ return;
926
+ }
927
+ return {
928
+ baseUrl: String(baseUrl)
929
+ };
930
+ }
908
931
 
909
932
  class OAuthHandler {
910
933
  config;
@@ -976,25 +999,9 @@ class OAuthHandler {
976
999
  if (redirectUri) {
977
1000
  url.searchParams.set("redirect_uri", redirectUri);
978
1001
  }
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
- }
1002
+ const extraConfig = getForwardableProviderConfig(providerConfig.config);
1003
+ for (const [key, value] of Object.entries(extraConfig)) {
1004
+ url.searchParams.set(key, value);
998
1005
  }
999
1006
  const response = await fetch(url.toString(), {
1000
1007
  method: "GET",
@@ -1081,7 +1088,8 @@ class OAuthHandler {
1081
1088
  state: callbackRequest.state,
1082
1089
  client_id: providerConfig.clientId,
1083
1090
  client_secret: providerConfig.clientSecret,
1084
- redirect_uri: providerConfig.redirectUri
1091
+ redirect_uri: providerConfig.redirectUri,
1092
+ ...getForwardableProviderConfig(providerConfig.config)
1085
1093
  })
1086
1094
  });
1087
1095
  if (!response.ok) {
@@ -1099,7 +1107,8 @@ class OAuthHandler {
1099
1107
  tokenType: result.tokenType,
1100
1108
  expiresIn: result.expiresIn,
1101
1109
  expiresAt: result.expiresAt,
1102
- scopes: result.scopes ? result.scopes.flatMap((s) => s.split(" ").filter(Boolean)) : result.scopes
1110
+ scopes: result.scopes ? result.scopes.flatMap((s) => s.split(" ").filter(Boolean)) : result.scopes,
1111
+ providerConfig: getStoredProviderConfig(providerConfig.config)
1103
1112
  };
1104
1113
  const email = result.email || await fetchUserEmail(callbackRequest.provider, tokenData);
1105
1114
  if (email) {
@@ -1216,6 +1225,12 @@ class OAuthHandler {
1216
1225
  if (providerConfig.config?.subdomain) {
1217
1226
  body.subdomain = providerConfig.config.subdomain;
1218
1227
  }
1228
+ const extraConfig = getForwardableProviderConfig(providerConfig.config);
1229
+ for (const [key, value] of Object.entries(extraConfig)) {
1230
+ if (body[key] === undefined) {
1231
+ body[key] = value;
1232
+ }
1233
+ }
1219
1234
  const url = new URL("/oauth/refresh", this.serverUrl);
1220
1235
  const response = await fetch(url.toString(), {
1221
1236
  method: "POST",
@@ -1242,7 +1257,8 @@ class OAuthHandler {
1242
1257
  tokenType: result.tokenType,
1243
1258
  expiresIn: result.expiresIn,
1244
1259
  expiresAt: result.expiresAt,
1245
- scopes: result.scopes ? result.scopes.flatMap((s) => s.split(" ").filter(Boolean)) : result.scopes
1260
+ scopes: result.scopes ? result.scopes.flatMap((s) => s.split(" ").filter(Boolean)) : result.scopes,
1261
+ providerConfig: getStoredProviderConfig(providerConfig.config)
1246
1262
  };
1247
1263
  const email = result.email || await fetchUserEmail(refreshRequest.provider, tokenData);
1248
1264
  if (email) {
@@ -1309,12 +1325,25 @@ class OAuthHandler {
1309
1325
  return jsonRpcResponse.result;
1310
1326
  }
1311
1327
  }
1312
- var SERVER_LOG_CONTEXT = "server", logger6, MCP_SERVER_URL2 = "https://mcp.integrate.dev/api/v1/mcp";
1328
+ var SERVER_LOG_CONTEXT = "server", logger6, OAUTH_CONFIG_FIELDS, MCP_SERVER_URL2 = "https://mcp.integrate.dev/api/v1/mcp";
1313
1329
  var init_base_handler = __esm(() => {
1314
1330
  init_integration_summary();
1315
1331
  init_email_fetcher();
1316
1332
  init_logger();
1317
1333
  logger6 = createLogger("OAuthHandler", SERVER_LOG_CONTEXT);
1334
+ OAUTH_CONFIG_FIELDS = new Set([
1335
+ "clientId",
1336
+ "clientSecret",
1337
+ "scopes",
1338
+ "optionalScopes",
1339
+ "redirectUri",
1340
+ "client_id",
1341
+ "client_secret",
1342
+ "scope",
1343
+ "optional_scope",
1344
+ "redirect_uri",
1345
+ "provider"
1346
+ ]);
1318
1347
  });
1319
1348
 
1320
1349
  // src/utils/env.ts
@@ -2203,7 +2232,7 @@ async function deliverWebhook(webhook, payload, timeoutMs) {
2203
2232
  signal: controller.signal
2204
2233
  });
2205
2234
  if (!response.ok) {
2206
- logger38.warn(`Webhook delivery to ${webhook.url} returned ${response.status}`);
2235
+ logger40.warn(`Webhook delivery to ${webhook.url} returned ${response.status}`);
2207
2236
  }
2208
2237
  } finally {
2209
2238
  clearTimeout(timeout);
@@ -2216,14 +2245,14 @@ async function deliverWebhooks(webhooks, payload, timeoutMs) {
2216
2245
  for (let i = 0;i < results.length; i++) {
2217
2246
  const result = results[i];
2218
2247
  if (result.status === "rejected") {
2219
- logger38.warn(`Webhook delivery to ${webhooks[i].url} failed:`, result.reason);
2248
+ logger40.warn(`Webhook delivery to ${webhooks[i].url} failed:`, result.reason);
2220
2249
  }
2221
2250
  }
2222
2251
  }
2223
- var logger38;
2252
+ var logger40;
2224
2253
  var init_webhooks = __esm(() => {
2225
2254
  init_logger();
2226
- logger38 = createLogger("Webhooks", "server");
2255
+ logger40 = createLogger("Webhooks", "server");
2227
2256
  });
2228
2257
 
2229
2258
  // src/triggers/types.ts
@@ -2243,13 +2272,13 @@ async function executeTrigger(trigger, config, context) {
2243
2272
  while (stepIndex < MAX_TRIGGER_STEPS) {
2244
2273
  const stepValidation = validateStepLimit(stepIndex, MAX_TRIGGER_STEPS);
2245
2274
  if (!stepValidation.valid) {
2246
- logger39.error(`[Trigger ${trigger.id}] ${stepValidation.error}`);
2275
+ logger41.error(`[Trigger ${trigger.id}] ${stepValidation.error}`);
2247
2276
  break;
2248
2277
  }
2249
2278
  const providerToken = await config.getProviderToken(currentProvider, undefined, context);
2250
2279
  if (!providerToken) {
2251
2280
  const error = `No OAuth token available for provider '${currentProvider}'`;
2252
- logger39.error(`[Trigger ${trigger.id}] ${error}`);
2281
+ logger41.error(`[Trigger ${trigger.id}] ${error}`);
2253
2282
  steps.push({
2254
2283
  stepIndex,
2255
2284
  toolName: currentToolName,
@@ -2275,7 +2304,7 @@ async function executeTrigger(trigger, config, context) {
2275
2304
  } catch (err) {
2276
2305
  stepSuccess = false;
2277
2306
  stepError = err.message || "Tool execution failed";
2278
- logger39.error(`[Trigger ${trigger.id}] Step ${stepIndex} failed:`, err);
2307
+ logger41.error(`[Trigger ${trigger.id}] Step ${stepIndex} failed:`, err);
2279
2308
  }
2280
2309
  if (stepSuccess && toolResult) {
2281
2310
  if (toolResult.isError === true) {
@@ -2368,7 +2397,7 @@ async function executeTrigger(trigger, config, context) {
2368
2397
  return { success: steps.every((s) => s.success), steps, error: stepError };
2369
2398
  }
2370
2399
  const limitError = `Trigger execution exceeded maximum of ${MAX_TRIGGER_STEPS} steps`;
2371
- logger39.error(`[Trigger ${trigger.id}] ${limitError}`);
2400
+ logger41.error(`[Trigger ${trigger.id}] ${limitError}`);
2372
2401
  await config.triggers.update(trigger.id, {
2373
2402
  lastRunAt: new Date().toISOString(),
2374
2403
  runCount: (trigger.runCount || 0) + 1,
@@ -2377,12 +2406,12 @@ async function executeTrigger(trigger, config, context) {
2377
2406
  }, context);
2378
2407
  return { success: false, steps, error: limitError };
2379
2408
  }
2380
- var logger39;
2409
+ var logger41;
2381
2410
  var init_executor2 = __esm(() => {
2382
2411
  init_logger();
2383
2412
  init_utils();
2384
2413
  init_webhooks();
2385
- logger39 = createLogger("TriggerExecutor", "server");
2414
+ logger41 = createLogger("TriggerExecutor", "server");
2386
2415
  });
2387
2416
 
2388
2417
  // src/protocol/jsonrpc.ts
@@ -3830,6 +3859,9 @@ class MCPClientBase {
3830
3859
  if (integrationIds.includes("linear")) {
3831
3860
  this.linear = this.createIntegrationProxy("linear");
3832
3861
  }
3862
+ if (integrationIds.includes("railway")) {
3863
+ this.railway = this.createIntegrationProxy("railway");
3864
+ }
3833
3865
  if (integrationIds.includes("vercel")) {
3834
3866
  this.vercel = this.createIntegrationProxy("vercel");
3835
3867
  }
@@ -3860,6 +3892,9 @@ class MCPClientBase {
3860
3892
  if (integrationIds.includes("gslides")) {
3861
3893
  this.gslides = this.createIntegrationProxy("gslides");
3862
3894
  }
3895
+ if (integrationIds.includes("posthog")) {
3896
+ this.posthog = this.createIntegrationProxy("posthog");
3897
+ }
3863
3898
  this.server = this.createServerProxy();
3864
3899
  this.trigger = new TriggerClient({
3865
3900
  apiRouteBase: this.apiRouteBase,
@@ -5233,9 +5268,123 @@ function linearIntegration(config = {}) {
5233
5268
  }
5234
5269
  };
5235
5270
  }
5271
+ // src/integrations/railway.ts
5272
+ init_logger();
5273
+ var logger13 = createLogger("Railway");
5274
+ var RAILWAY_SCOPES = [
5275
+ "openid",
5276
+ "profile",
5277
+ "email",
5278
+ "workspace:admin",
5279
+ "project:member"
5280
+ ];
5281
+ var RAILWAY_TOOLS = [
5282
+ "railway_get_current_user",
5283
+ "railway_get_workspace",
5284
+ "railway_list_regions",
5285
+ "railway_list_projects",
5286
+ "railway_get_project",
5287
+ "railway_create_project",
5288
+ "railway_update_project",
5289
+ "railway_delete_project",
5290
+ "railway_transfer_project",
5291
+ "railway_list_project_members",
5292
+ "railway_list_environments",
5293
+ "railway_get_environment",
5294
+ "railway_create_environment",
5295
+ "railway_rename_environment",
5296
+ "railway_delete_environment",
5297
+ "railway_get_environment_logs",
5298
+ "railway_get_environment_staged_changes",
5299
+ "railway_commit_environment_staged_changes",
5300
+ "railway_get_service",
5301
+ "railway_get_service_instance",
5302
+ "railway_create_service",
5303
+ "railway_update_service",
5304
+ "railway_update_service_instance",
5305
+ "railway_connect_service",
5306
+ "railway_disconnect_service",
5307
+ "railway_deploy_service",
5308
+ "railway_redeploy_service",
5309
+ "railway_get_service_limits",
5310
+ "railway_delete_service",
5311
+ "railway_list_deployments",
5312
+ "railway_get_deployment",
5313
+ "railway_get_latest_active_deployment",
5314
+ "railway_get_deployment_build_logs",
5315
+ "railway_get_deployment_runtime_logs",
5316
+ "railway_get_deployment_http_logs",
5317
+ "railway_redeploy_deployment",
5318
+ "railway_restart_deployment",
5319
+ "railway_rollback_deployment",
5320
+ "railway_stop_deployment",
5321
+ "railway_cancel_deployment",
5322
+ "railway_remove_deployment",
5323
+ "railway_get_variables",
5324
+ "railway_get_unrendered_variables",
5325
+ "railway_upsert_variable",
5326
+ "railway_upsert_variables",
5327
+ "railway_delete_variable",
5328
+ "railway_get_rendered_variables",
5329
+ "railway_list_domains",
5330
+ "railway_create_service_domain",
5331
+ "railway_delete_service_domain",
5332
+ "railway_check_custom_domain_availability",
5333
+ "railway_create_custom_domain",
5334
+ "railway_get_custom_domain_status",
5335
+ "railway_update_custom_domain",
5336
+ "railway_delete_custom_domain",
5337
+ "railway_list_project_volumes",
5338
+ "railway_get_volume_instance",
5339
+ "railway_create_volume",
5340
+ "railway_update_volume",
5341
+ "railway_update_volume_instance",
5342
+ "railway_delete_volume",
5343
+ "railway_list_volume_backups",
5344
+ "railway_create_volume_backup",
5345
+ "railway_restore_volume_backup",
5346
+ "railway_lock_volume_backup",
5347
+ "railway_delete_volume_backup",
5348
+ "railway_list_volume_backup_schedules",
5349
+ "railway_list_tcp_proxies"
5350
+ ];
5351
+ function railwayIntegration(config = {}) {
5352
+ const oauth = {
5353
+ provider: "railway",
5354
+ clientId: config.clientId ?? getEnv("RAILWAY_CLIENT_ID"),
5355
+ clientSecret: config.clientSecret ?? getEnv("RAILWAY_CLIENT_SECRET"),
5356
+ scopes: config.scopes ?? [...RAILWAY_SCOPES],
5357
+ optionalScopes: config.optionalScopes,
5358
+ redirectUri: config.redirectUri,
5359
+ config: {
5360
+ authorization_endpoint: "https://backboard.railway.com/oauth/auth",
5361
+ token_endpoint: "https://backboard.railway.com/oauth/token",
5362
+ response_type: "code",
5363
+ grant_types_supported: ["authorization_code", "refresh_token"],
5364
+ code_challenge_method: "S256",
5365
+ apiBaseUrl: "https://backboard.railway.com/graphql/v2",
5366
+ ...config
5367
+ }
5368
+ };
5369
+ return {
5370
+ id: "railway",
5371
+ name: "Railway",
5372
+ logoUrl: "https://wdvtnli2jn3texa6.public.blob.vercel-storage.com/railway.png",
5373
+ description: "Manage Railway workspaces, projects, services, deployments, variables, domains, and volumes",
5374
+ category: "Infrastructure",
5375
+ tools: [...RAILWAY_TOOLS],
5376
+ oauth,
5377
+ async onInit(_client) {
5378
+ logger13.debug("Railway integration initialized");
5379
+ },
5380
+ async onAfterConnect(_client) {
5381
+ logger13.debug("Railway integration connected");
5382
+ }
5383
+ };
5384
+ }
5236
5385
  // src/integrations/vercel.ts
5237
5386
  init_logger();
5238
- var logger13 = createLogger("Vercel");
5387
+ var logger14 = createLogger("Vercel");
5239
5388
  var VERCEL_TOOLS = [
5240
5389
  "vercel_list_projects",
5241
5390
  "vercel_get_project",
@@ -5278,16 +5427,16 @@ function vercelIntegration(config = {}) {
5278
5427
  tools: [...VERCEL_TOOLS],
5279
5428
  oauth,
5280
5429
  async onInit(_client) {
5281
- logger13.debug("Vercel integration initialized");
5430
+ logger14.debug("Vercel integration initialized");
5282
5431
  },
5283
5432
  async onAfterConnect(_client) {
5284
- logger13.debug("Vercel integration connected");
5433
+ logger14.debug("Vercel integration connected");
5285
5434
  }
5286
5435
  };
5287
5436
  }
5288
5437
  // src/integrations/zendesk.ts
5289
5438
  init_logger();
5290
- var logger14 = createLogger("Zendesk");
5439
+ var logger15 = createLogger("Zendesk");
5291
5440
  var ZENDESK_TOOLS = [
5292
5441
  "zendesk_list_tickets",
5293
5442
  "zendesk_get_ticket",
@@ -5336,16 +5485,16 @@ function zendeskIntegration(config = {}) {
5336
5485
  tools: [...ZENDESK_TOOLS],
5337
5486
  oauth,
5338
5487
  async onInit(_client) {
5339
- logger14.debug("Zendesk integration initialized");
5488
+ logger15.debug("Zendesk integration initialized");
5340
5489
  },
5341
5490
  async onAfterConnect(_client) {
5342
- logger14.debug("Zendesk integration connected");
5491
+ logger15.debug("Zendesk integration connected");
5343
5492
  }
5344
5493
  };
5345
5494
  }
5346
5495
  // src/integrations/stripe.ts
5347
5496
  init_logger();
5348
- var logger15 = createLogger("Stripe");
5497
+ var logger16 = createLogger("Stripe");
5349
5498
  var STRIPE_TOOLS = [
5350
5499
  "stripe_list_customers",
5351
5500
  "stripe_get_customer",
@@ -5401,16 +5550,16 @@ function stripeIntegration(config = {}) {
5401
5550
  tools: [...STRIPE_TOOLS],
5402
5551
  oauth,
5403
5552
  async onInit(_client) {
5404
- logger15.debug("Stripe integration initialized");
5553
+ logger16.debug("Stripe integration initialized");
5405
5554
  },
5406
5555
  async onAfterConnect(_client) {
5407
- logger15.debug("Stripe integration connected");
5556
+ logger16.debug("Stripe integration connected");
5408
5557
  }
5409
5558
  };
5410
5559
  }
5411
5560
  // src/integrations/gcal.ts
5412
5561
  init_logger();
5413
- var logger16 = createLogger("Google Calendar");
5562
+ var logger17 = createLogger("Google Calendar");
5414
5563
  var GCAL_TOOLS = [
5415
5564
  "gcal_list_calendars",
5416
5565
  "gcal_get_calendar",
@@ -5443,16 +5592,16 @@ function gcalIntegration(config = {}) {
5443
5592
  tools: [...GCAL_TOOLS],
5444
5593
  oauth,
5445
5594
  async onInit(_client) {
5446
- logger16.debug("Google Calendar integration initialized");
5595
+ logger17.debug("Google Calendar integration initialized");
5447
5596
  },
5448
5597
  async onAfterConnect(_client) {
5449
- logger16.debug("Google Calendar integration connected");
5598
+ logger17.debug("Google Calendar integration connected");
5450
5599
  }
5451
5600
  };
5452
5601
  }
5453
5602
  // src/integrations/outlook.ts
5454
5603
  init_logger();
5455
- var logger17 = createLogger("Outlook");
5604
+ var logger18 = createLogger("Outlook");
5456
5605
  var OUTLOOK_TOOLS = [
5457
5606
  "outlook_list_messages",
5458
5607
  "outlook_get_message",
@@ -5499,16 +5648,16 @@ function outlookIntegration(config = {}) {
5499
5648
  tools: [...OUTLOOK_TOOLS],
5500
5649
  oauth,
5501
5650
  async onInit(_client) {
5502
- logger17.debug("Outlook integration initialized");
5651
+ logger18.debug("Outlook integration initialized");
5503
5652
  },
5504
5653
  async onAfterConnect(_client) {
5505
- logger17.debug("Outlook integration connected");
5654
+ logger18.debug("Outlook integration connected");
5506
5655
  }
5507
5656
  };
5508
5657
  }
5509
5658
  // src/integrations/airtable.ts
5510
5659
  init_logger();
5511
- var logger18 = createLogger("Airtable");
5660
+ var logger19 = createLogger("Airtable");
5512
5661
  var AIRTABLE_TOOLS = [
5513
5662
  "airtable_list_bases",
5514
5663
  "airtable_get_base",
@@ -5554,16 +5703,16 @@ function airtableIntegration(config = {}) {
5554
5703
  tools: [...AIRTABLE_TOOLS],
5555
5704
  oauth,
5556
5705
  async onInit(_client) {
5557
- logger18.debug("Airtable integration initialized");
5706
+ logger19.debug("Airtable integration initialized");
5558
5707
  },
5559
5708
  async onAfterConnect(_client) {
5560
- logger18.debug("Airtable integration connected");
5709
+ logger19.debug("Airtable integration connected");
5561
5710
  }
5562
5711
  };
5563
5712
  }
5564
5713
  // src/integrations/todoist.ts
5565
5714
  init_logger();
5566
- var logger19 = createLogger("Todoist");
5715
+ var logger20 = createLogger("Todoist");
5567
5716
  var TODOIST_TOOLS = [
5568
5717
  "todoist_list_projects",
5569
5718
  "todoist_get_project",
@@ -5618,16 +5767,16 @@ function todoistIntegration(config = {}) {
5618
5767
  tools: [...TODOIST_TOOLS],
5619
5768
  oauth,
5620
5769
  async onInit(_client) {
5621
- logger19.debug("Todoist integration initialized");
5770
+ logger20.debug("Todoist integration initialized");
5622
5771
  },
5623
5772
  async onAfterConnect(_client) {
5624
- logger19.debug("Todoist integration connected");
5773
+ logger20.debug("Todoist integration connected");
5625
5774
  }
5626
5775
  };
5627
5776
  }
5628
5777
  // src/integrations/whatsapp.ts
5629
5778
  init_logger();
5630
- var logger20 = createLogger("WhatsApp");
5779
+ var logger21 = createLogger("WhatsApp");
5631
5780
  var WHATSAPP_TOOLS = [
5632
5781
  "whatsapp_send_message",
5633
5782
  "whatsapp_reply_message",
@@ -5673,16 +5822,16 @@ function whatsappIntegration(config = {}) {
5673
5822
  tools: [...WHATSAPP_TOOLS],
5674
5823
  oauth,
5675
5824
  async onInit(_client) {
5676
- logger20.debug("WhatsApp Business integration initialized");
5825
+ logger21.debug("WhatsApp Business integration initialized");
5677
5826
  },
5678
5827
  async onAfterConnect(_client) {
5679
- logger20.debug("WhatsApp Business integration connected");
5828
+ logger21.debug("WhatsApp Business integration connected");
5680
5829
  }
5681
5830
  };
5682
5831
  }
5683
5832
  // src/integrations/calcom.ts
5684
5833
  init_logger();
5685
- var logger21 = createLogger("Cal.com");
5834
+ var logger22 = createLogger("Cal.com");
5686
5835
  var CALCOM_TOOLS = [
5687
5836
  "calcom_list_bookings",
5688
5837
  "calcom_get_booking",
@@ -5758,16 +5907,16 @@ function calcomIntegration(config = {}) {
5758
5907
  tools: [...CALCOM_TOOLS],
5759
5908
  oauth,
5760
5909
  async onInit(_client) {
5761
- logger21.debug("Cal.com integration initialized");
5910
+ logger22.debug("Cal.com integration initialized");
5762
5911
  },
5763
5912
  async onAfterConnect(_client) {
5764
- logger21.debug("Cal.com integration connected");
5913
+ logger22.debug("Cal.com integration connected");
5765
5914
  }
5766
5915
  };
5767
5916
  }
5768
5917
  // src/integrations/ramp.ts
5769
5918
  init_logger();
5770
- var logger22 = createLogger("Ramp");
5919
+ var logger23 = createLogger("Ramp");
5771
5920
  var RAMP_TOOLS = [
5772
5921
  "ramp_list_transactions",
5773
5922
  "ramp_get_transaction",
@@ -5799,16 +5948,16 @@ function rampIntegration(config = {}) {
5799
5948
  tools: [...RAMP_TOOLS],
5800
5949
  oauth,
5801
5950
  async onInit(_client) {
5802
- logger22.debug("Ramp integration initialized");
5951
+ logger23.debug("Ramp integration initialized");
5803
5952
  },
5804
5953
  async onAfterConnect(_client) {
5805
- logger22.debug("Ramp integration connected");
5954
+ logger23.debug("Ramp integration connected");
5806
5955
  }
5807
5956
  };
5808
5957
  }
5809
5958
  // src/integrations/onedrive.ts
5810
5959
  init_logger();
5811
- var logger23 = createLogger("OneDrive");
5960
+ var logger24 = createLogger("OneDrive");
5812
5961
  var ONEDRIVE_TOOLS = [
5813
5962
  "onedrive_list_files",
5814
5963
  "onedrive_get_file",
@@ -5837,16 +5986,16 @@ function onedriveIntegration(config = {}) {
5837
5986
  tools: [...ONEDRIVE_TOOLS],
5838
5987
  oauth,
5839
5988
  async onInit(_client) {
5840
- logger23.debug("OneDrive integration initialized");
5989
+ logger24.debug("OneDrive integration initialized");
5841
5990
  },
5842
5991
  async onAfterConnect(_client) {
5843
- logger23.debug("OneDrive integration connected");
5992
+ logger24.debug("OneDrive integration connected");
5844
5993
  }
5845
5994
  };
5846
5995
  }
5847
5996
  // src/integrations/dropbox.ts
5848
5997
  init_logger();
5849
- var logger24 = createLogger("Dropbox");
5998
+ var logger25 = createLogger("Dropbox");
5850
5999
  var DROPBOX_TOOLS = [
5851
6000
  "dropbox_get_current_account",
5852
6001
  "dropbox_get_space_usage",
@@ -5885,16 +6034,16 @@ function dropboxIntegration(options = {}) {
5885
6034
  authType: "oauth",
5886
6035
  oauth,
5887
6036
  async onInit(_client) {
5888
- logger24.debug("Dropbox integration initialized");
6037
+ logger25.debug("Dropbox integration initialized");
5889
6038
  },
5890
6039
  async onAfterConnect(_client) {
5891
- logger24.debug("Dropbox integration connected");
6040
+ logger25.debug("Dropbox integration connected");
5892
6041
  }
5893
6042
  };
5894
6043
  }
5895
6044
  // src/integrations/word.ts
5896
6045
  init_logger();
5897
- var logger25 = createLogger("Word");
6046
+ var logger26 = createLogger("Word");
5898
6047
  var WORD_TOOLS = [
5899
6048
  "word_list",
5900
6049
  "word_get",
@@ -5920,16 +6069,16 @@ function wordIntegration(config = {}) {
5920
6069
  tools: [...WORD_TOOLS],
5921
6070
  oauth,
5922
6071
  async onInit(_client) {
5923
- logger25.debug("Word integration initialized");
6072
+ logger26.debug("Word integration initialized");
5924
6073
  },
5925
6074
  async onAfterConnect(_client) {
5926
- logger25.debug("Word integration connected");
6075
+ logger26.debug("Word integration connected");
5927
6076
  }
5928
6077
  };
5929
6078
  }
5930
6079
  // src/integrations/excel.ts
5931
6080
  init_logger();
5932
- var logger26 = createLogger("Excel");
6081
+ var logger27 = createLogger("Excel");
5933
6082
  var EXCEL_TOOLS = [
5934
6083
  "excel_list",
5935
6084
  "excel_get",
@@ -5965,16 +6114,16 @@ function excelIntegration(config = {}) {
5965
6114
  tools: [...EXCEL_TOOLS],
5966
6115
  oauth,
5967
6116
  async onInit(_client) {
5968
- logger26.debug("Excel integration initialized");
6117
+ logger27.debug("Excel integration initialized");
5969
6118
  },
5970
6119
  async onAfterConnect(_client) {
5971
- logger26.debug("Excel integration connected");
6120
+ logger27.debug("Excel integration connected");
5972
6121
  }
5973
6122
  };
5974
6123
  }
5975
6124
  // src/integrations/powerpoint.ts
5976
6125
  init_logger();
5977
- var logger27 = createLogger("PowerPoint");
6126
+ var logger28 = createLogger("PowerPoint");
5978
6127
  var POWERPOINT_TOOLS = [
5979
6128
  "powerpoint_list",
5980
6129
  "powerpoint_get",
@@ -6000,16 +6149,16 @@ function powerpointIntegration(config = {}) {
6000
6149
  tools: [...POWERPOINT_TOOLS],
6001
6150
  oauth,
6002
6151
  async onInit(_client) {
6003
- logger27.debug("PowerPoint integration initialized");
6152
+ logger28.debug("PowerPoint integration initialized");
6004
6153
  },
6005
6154
  async onAfterConnect(_client) {
6006
- logger27.debug("PowerPoint integration connected");
6155
+ logger28.debug("PowerPoint integration connected");
6007
6156
  }
6008
6157
  };
6009
6158
  }
6010
6159
  // src/integrations/gdocs.ts
6011
6160
  init_logger();
6012
- var logger28 = createLogger("Google Docs");
6161
+ var logger29 = createLogger("Google Docs");
6013
6162
  var GDOCS_TOOLS = [
6014
6163
  "gdocs_list",
6015
6164
  "gdocs_get",
@@ -6034,16 +6183,16 @@ function gdocsIntegration(config = {}) {
6034
6183
  tools: [...GDOCS_TOOLS],
6035
6184
  oauth,
6036
6185
  async onInit(_client) {
6037
- logger28.debug("Google Docs integration initialized");
6186
+ logger29.debug("Google Docs integration initialized");
6038
6187
  },
6039
6188
  async onAfterConnect(_client) {
6040
- logger28.debug("Google Docs integration connected");
6189
+ logger29.debug("Google Docs integration connected");
6041
6190
  }
6042
6191
  };
6043
6192
  }
6044
6193
  // src/integrations/gdrive.ts
6045
6194
  init_logger();
6046
- var logger29 = createLogger("Google Drive");
6195
+ var logger30 = createLogger("Google Drive");
6047
6196
  var GDRIVE_TOOLS = [
6048
6197
  "gdrive_list_files",
6049
6198
  "gdrive_get_file",
@@ -6077,16 +6226,16 @@ function gdriveIntegration(config = {}) {
6077
6226
  tools: [...GDRIVE_TOOLS],
6078
6227
  oauth,
6079
6228
  async onInit(_client) {
6080
- logger29.debug("Google Drive integration initialized");
6229
+ logger30.debug("Google Drive integration initialized");
6081
6230
  },
6082
6231
  async onAfterConnect(_client) {
6083
- logger29.debug("Google Drive integration connected");
6232
+ logger30.debug("Google Drive integration connected");
6084
6233
  }
6085
6234
  };
6086
6235
  }
6087
6236
  // src/integrations/gsheets.ts
6088
6237
  init_logger();
6089
- var logger30 = createLogger("Google Sheets");
6238
+ var logger31 = createLogger("Google Sheets");
6090
6239
  var GSHEETS_TOOLS = [
6091
6240
  "gsheets_list",
6092
6241
  "gsheets_get",
@@ -6114,16 +6263,16 @@ function gsheetsIntegration(config = {}) {
6114
6263
  tools: [...GSHEETS_TOOLS],
6115
6264
  oauth,
6116
6265
  async onInit(_client) {
6117
- logger30.debug("Google Sheets integration initialized");
6266
+ logger31.debug("Google Sheets integration initialized");
6118
6267
  },
6119
6268
  async onAfterConnect(_client) {
6120
- logger30.debug("Google Sheets integration connected");
6269
+ logger31.debug("Google Sheets integration connected");
6121
6270
  }
6122
6271
  };
6123
6272
  }
6124
6273
  // src/integrations/gslides.ts
6125
6274
  init_logger();
6126
- var logger31 = createLogger("Google Slides");
6275
+ var logger32 = createLogger("Google Slides");
6127
6276
  var GSLIDES_TOOLS = [
6128
6277
  "gslides_list",
6129
6278
  "gslides_get",
@@ -6150,16 +6299,16 @@ function gslidesIntegration(config = {}) {
6150
6299
  tools: [...GSLIDES_TOOLS],
6151
6300
  oauth,
6152
6301
  async onInit(_client) {
6153
- logger31.debug("Google Slides integration initialized");
6302
+ logger32.debug("Google Slides integration initialized");
6154
6303
  },
6155
6304
  async onAfterConnect(_client) {
6156
- logger31.debug("Google Slides integration connected");
6305
+ logger32.debug("Google Slides integration connected");
6157
6306
  }
6158
6307
  };
6159
6308
  }
6160
6309
  // src/integrations/polar.ts
6161
6310
  init_logger();
6162
- var logger32 = createLogger("Polar");
6311
+ var logger33 = createLogger("Polar");
6163
6312
  var POLAR_TOOLS = [
6164
6313
  "polar_list_products",
6165
6314
  "polar_get_product",
@@ -6216,16 +6365,16 @@ function polarIntegration(config = {}) {
6216
6365
  tools: [...POLAR_TOOLS],
6217
6366
  oauth,
6218
6367
  async onInit(_client) {
6219
- logger32.debug("Polar integration initialized");
6368
+ logger33.debug("Polar integration initialized");
6220
6369
  },
6221
6370
  async onAfterConnect(_client) {
6222
- logger32.debug("Polar integration connected");
6371
+ logger33.debug("Polar integration connected");
6223
6372
  }
6224
6373
  };
6225
6374
  }
6226
6375
  // src/integrations/figma.ts
6227
6376
  init_logger();
6228
- var logger33 = createLogger("Figma");
6377
+ var logger34 = createLogger("Figma");
6229
6378
  var FIGMA_TOOLS = [
6230
6379
  "figma_get_file",
6231
6380
  "figma_get_file_nodes",
@@ -6291,16 +6440,16 @@ function figmaIntegration(config = {}) {
6291
6440
  tools: [...FIGMA_TOOLS],
6292
6441
  oauth,
6293
6442
  async onInit(_client) {
6294
- logger33.debug("Figma integration initialized");
6443
+ logger34.debug("Figma integration initialized");
6295
6444
  },
6296
6445
  async onAfterConnect(_client) {
6297
- logger33.debug("Figma integration connected");
6446
+ logger34.debug("Figma integration connected");
6298
6447
  }
6299
6448
  };
6300
6449
  }
6301
6450
  // src/integrations/intercom.ts
6302
6451
  init_logger();
6303
- var logger34 = createLogger("Intercom");
6452
+ var logger35 = createLogger("Intercom");
6304
6453
  var INTERCOM_TOOLS = [
6305
6454
  "intercom_list_contacts",
6306
6455
  "intercom_get_contact",
@@ -6331,16 +6480,16 @@ function intercomIntegration(config = {}) {
6331
6480
  tools: [...INTERCOM_TOOLS],
6332
6481
  oauth,
6333
6482
  async onInit(_client) {
6334
- logger34.debug("Intercom integration initialized");
6483
+ logger35.debug("Intercom integration initialized");
6335
6484
  },
6336
6485
  async onAfterConnect(_client) {
6337
- logger34.debug("Intercom integration connected");
6486
+ logger35.debug("Intercom integration connected");
6338
6487
  }
6339
6488
  };
6340
6489
  }
6341
6490
  // src/integrations/hubspot.ts
6342
6491
  init_logger();
6343
- var logger35 = createLogger("HubSpot");
6492
+ var logger36 = createLogger("HubSpot");
6344
6493
  var HUBSPOT_TOOLS = [
6345
6494
  "hubspot_list_contacts",
6346
6495
  "hubspot_get_contact",
@@ -6390,16 +6539,16 @@ function hubspotIntegration(config = {}) {
6390
6539
  tools: [...HUBSPOT_TOOLS],
6391
6540
  oauth,
6392
6541
  async onInit(_client) {
6393
- logger35.debug("HubSpot integration initialized");
6542
+ logger36.debug("HubSpot integration initialized");
6394
6543
  },
6395
6544
  async onAfterConnect(_client) {
6396
- logger35.debug("HubSpot integration connected");
6545
+ logger36.debug("HubSpot integration connected");
6397
6546
  }
6398
6547
  };
6399
6548
  }
6400
6549
  // src/integrations/youtube.ts
6401
6550
  init_logger();
6402
- var logger36 = createLogger("YouTube");
6551
+ var logger37 = createLogger("YouTube");
6403
6552
  var YOUTUBE_TOOLS = [
6404
6553
  "youtube_search",
6405
6554
  "youtube_get_video",
@@ -6445,16 +6594,16 @@ function youtubeIntegration(config = {}) {
6445
6594
  tools: [...YOUTUBE_TOOLS],
6446
6595
  oauth,
6447
6596
  async onInit(_client) {
6448
- logger36.debug("YouTube integration initialized");
6597
+ logger37.debug("YouTube integration initialized");
6449
6598
  },
6450
6599
  async onAfterConnect(_client) {
6451
- logger36.debug("YouTube integration connected");
6600
+ logger37.debug("YouTube integration connected");
6452
6601
  }
6453
6602
  };
6454
6603
  }
6455
6604
  // src/integrations/cursor.ts
6456
6605
  init_logger();
6457
- var logger37 = createLogger("Cursor");
6606
+ var logger38 = createLogger("Cursor");
6458
6607
  var CURSOR_TOOLS = [
6459
6608
  "cursor_list_agents",
6460
6609
  "cursor_get_agent",
@@ -6474,10 +6623,105 @@ function cursorIntegration(_config = {}) {
6474
6623
  logoUrl: "https://wdvtnli2jn3texa6.public.blob.vercel-storage.com/cursor.jpeg",
6475
6624
  tools: [...CURSOR_TOOLS],
6476
6625
  async onInit(_client) {
6477
- logger37.debug("Cursor integration initialized");
6626
+ logger38.debug("Cursor integration initialized");
6627
+ },
6628
+ async onAfterConnect(_client) {
6629
+ logger38.debug("Cursor integration connected");
6630
+ }
6631
+ };
6632
+ }
6633
+ // src/integrations/posthog.ts
6634
+ init_logger();
6635
+ var logger39 = createLogger("PostHog");
6636
+ var DEFAULT_POSTHOG_BASE_URL = "https://us.posthog.com";
6637
+ var POSTHOG_SCOPES = [
6638
+ "openid",
6639
+ "profile",
6640
+ "email",
6641
+ "organization:read",
6642
+ "project:read",
6643
+ "user:read",
6644
+ "query:read",
6645
+ "insight:read",
6646
+ "dashboard:read",
6647
+ "feature_flag:read",
6648
+ "experiment:read",
6649
+ "annotation:read",
6650
+ "cohort:read",
6651
+ "person:read",
6652
+ "event_definition:read",
6653
+ "property_definition:read",
6654
+ "session_recording:read",
6655
+ "action:read"
6656
+ ];
6657
+ var POSTHOG_TOOLS = [
6658
+ "posthog_get_current_user",
6659
+ "posthog_list_organizations",
6660
+ "posthog_get_organization",
6661
+ "posthog_list_projects",
6662
+ "posthog_get_project",
6663
+ "posthog_run_hogql_query",
6664
+ "posthog_list_insights",
6665
+ "posthog_get_insight",
6666
+ "posthog_list_dashboards",
6667
+ "posthog_get_dashboard",
6668
+ "posthog_list_feature_flags",
6669
+ "posthog_get_feature_flag",
6670
+ "posthog_list_experiments",
6671
+ "posthog_get_experiment",
6672
+ "posthog_list_annotations",
6673
+ "posthog_get_annotation",
6674
+ "posthog_list_cohorts",
6675
+ "posthog_get_cohort",
6676
+ "posthog_list_event_definitions",
6677
+ "posthog_get_event_definition",
6678
+ "posthog_list_property_definitions",
6679
+ "posthog_get_property_definition",
6680
+ "posthog_list_persons",
6681
+ "posthog_get_person",
6682
+ "posthog_list_session_recordings",
6683
+ "posthog_get_session_recording"
6684
+ ];
6685
+ function normalizePostHogBaseUrl(baseUrl) {
6686
+ const value = (baseUrl || DEFAULT_POSTHOG_BASE_URL).trim().replace(/\/+$/, "");
6687
+ if (!value) {
6688
+ return DEFAULT_POSTHOG_BASE_URL;
6689
+ }
6690
+ return /^https?:\/\//i.test(value) ? value : `https://${value}`;
6691
+ }
6692
+ function posthogIntegration(config = {}) {
6693
+ const baseUrl = normalizePostHogBaseUrl(config.baseUrl);
6694
+ const oauth = {
6695
+ provider: "posthog",
6696
+ clientId: config.clientId ?? getEnv("POSTHOG_CLIENT_ID"),
6697
+ clientSecret: config.clientSecret ?? getEnv("POSTHOG_CLIENT_SECRET"),
6698
+ scopes: config.scopes ?? [...POSTHOG_SCOPES],
6699
+ optionalScopes: config.optionalScopes,
6700
+ redirectUri: config.redirectUri,
6701
+ config: {
6702
+ baseUrl,
6703
+ apiBaseUrl: baseUrl,
6704
+ authorization_endpoint: `${baseUrl}/oauth/authorize/`,
6705
+ token_endpoint: `${baseUrl}/oauth/token/`,
6706
+ token_auth_method: "client_secret_post",
6707
+ response_type: "code",
6708
+ grant_types_supported: ["authorization_code", "refresh_token"],
6709
+ code_challenge_method: "S256"
6710
+ }
6711
+ };
6712
+ return {
6713
+ id: "posthog",
6714
+ name: "PostHog",
6715
+ logoUrl: "https://wdvtnli2jn3texa6.public.blob.vercel-storage.com/posthog.png",
6716
+ description: "Read PostHog organizations, projects, insights, flags, and analytics data",
6717
+ category: "Analytics",
6718
+ tools: [...POSTHOG_TOOLS],
6719
+ oauth,
6720
+ async onInit(_client) {
6721
+ logger39.debug("PostHog integration initialized");
6478
6722
  },
6479
6723
  async onAfterConnect(_client) {
6480
- logger37.debug("Cursor integration connected");
6724
+ logger39.debug("PostHog integration connected");
6481
6725
  }
6482
6726
  };
6483
6727
  }
@@ -12753,7 +12997,7 @@ function convertJsonSchemaToGoogleSchema(jsonSchema, TypeEnum) {
12753
12997
  }
12754
12998
  // src/server.ts
12755
12999
  var SERVER_LOG_CONTEXT3 = "server";
12756
- var logger40 = createLogger("MCPServer", SERVER_LOG_CONTEXT3);
13000
+ var logger42 = createLogger("MCPServer", SERVER_LOG_CONTEXT3);
12757
13001
  var globalServerConfig = null;
12758
13002
  var globalMCPHandler = null;
12759
13003
  var codeVerifierStorage = new Map;
@@ -12859,7 +13103,7 @@ function createMCPServer(config) {
12859
13103
  if (integration.oauth) {
12860
13104
  const { clientId, clientSecret, redirectUri: integrationRedirectUri, config: oauthConfig } = integration.oauth;
12861
13105
  if (!clientId || !clientSecret) {
12862
- logger40.warn(`Warning: Integration "${integration.id}" is missing OAuth credentials. ` + `Provide clientId and clientSecret in the integration configuration.`);
13106
+ logger42.warn(`Warning: Integration "${integration.id}" is missing OAuth credentials. ` + `Provide clientId and clientSecret in the integration configuration.`);
12863
13107
  return integration;
12864
13108
  }
12865
13109
  const redirectUri = integrationRedirectUri || config.redirectUri || getDefaultRedirectUri();
@@ -13036,7 +13280,7 @@ function createMCPServer(config) {
13036
13280
  }
13037
13281
  return response2;
13038
13282
  } catch (error) {
13039
- logger40.error("[MCP Tool Call] Error:", error);
13283
+ logger42.error("[MCP Tool Call] Error:", error);
13040
13284
  return Response.json({ error: error.message || "Failed to execute tool call" }, { status: error.statusCode || 500 });
13041
13285
  }
13042
13286
  }
@@ -13085,7 +13329,7 @@ function createMCPServer(config) {
13085
13329
  });
13086
13330
  return Response.json(result, { status: result.success ? 200 : 500 });
13087
13331
  } catch (error) {
13088
- logger40.error("[Code Mode] Error:", error);
13332
+ logger42.error("[Code Mode] Error:", error);
13089
13333
  return Response.json({ error: error?.message || "Failed to execute code" }, { status: 500 });
13090
13334
  }
13091
13335
  }
@@ -13143,7 +13387,7 @@ function createMCPServer(config) {
13143
13387
  error: executionResult.error
13144
13388
  });
13145
13389
  } catch (error) {
13146
- logger40.error("[Trigger Notify] Error:", error);
13390
+ logger42.error("[Trigger Notify] Error:", error);
13147
13391
  return Response.json({ error: error.message || "Failed to execute trigger" }, { status: 500 });
13148
13392
  }
13149
13393
  }
@@ -13207,7 +13451,7 @@ function createMCPServer(config) {
13207
13451
  })
13208
13452
  });
13209
13453
  } catch (scheduleError) {
13210
- logger40.error("[Trigger] Failed to register with scheduler:", scheduleError);
13454
+ logger42.error("[Trigger] Failed to register with scheduler:", scheduleError);
13211
13455
  }
13212
13456
  return Response.json(created, { status: 201 });
13213
13457
  }
@@ -13242,7 +13486,7 @@ function createMCPServer(config) {
13242
13486
  body: JSON.stringify({ triggerId })
13243
13487
  });
13244
13488
  } catch (error) {
13245
- logger40.error("[Trigger] Failed to pause in scheduler:", error);
13489
+ logger42.error("[Trigger] Failed to pause in scheduler:", error);
13246
13490
  }
13247
13491
  return Response.json(updated);
13248
13492
  } else if (subAction === "resume" && method === "POST") {
@@ -13270,7 +13514,7 @@ function createMCPServer(config) {
13270
13514
  body: JSON.stringify({ triggerId })
13271
13515
  });
13272
13516
  } catch (error) {
13273
- logger40.error("[Trigger] Failed to resume in scheduler:", error);
13517
+ logger42.error("[Trigger] Failed to resume in scheduler:", error);
13274
13518
  }
13275
13519
  return Response.json(updated);
13276
13520
  } else if (subAction === "run" && method === "POST") {
@@ -13341,7 +13585,7 @@ function createMCPServer(config) {
13341
13585
  })
13342
13586
  });
13343
13587
  } catch (error) {
13344
- logger40.error("[Trigger] Failed to update scheduler:", error);
13588
+ logger42.error("[Trigger] Failed to update scheduler:", error);
13345
13589
  }
13346
13590
  }
13347
13591
  return Response.json(updated);
@@ -13358,14 +13602,14 @@ function createMCPServer(config) {
13358
13602
  body: JSON.stringify({ triggerId })
13359
13603
  });
13360
13604
  } catch (error) {
13361
- logger40.error("[Trigger] Failed to unregister from scheduler:", error);
13605
+ logger42.error("[Trigger] Failed to unregister from scheduler:", error);
13362
13606
  }
13363
13607
  return new Response(null, { status: 204 });
13364
13608
  }
13365
13609
  }
13366
13610
  return Response.json({ error: "Invalid trigger route or method" }, { status: 404 });
13367
13611
  } catch (error) {
13368
- logger40.error("[Trigger] Error:", error);
13612
+ logger42.error("[Trigger] Error:", error);
13369
13613
  return Response.json({ error: error.message || "Failed to process trigger request" }, { status: error.statusCode || 500 });
13370
13614
  }
13371
13615
  }
@@ -13391,11 +13635,11 @@ function createMCPServer(config) {
13391
13635
  const errorRedirectUrl = "/auth-error";
13392
13636
  if (error) {
13393
13637
  const errorMsg = errorDescription || error;
13394
- logger40.error("[OAuth Redirect] Error:", errorMsg);
13638
+ logger42.error("[OAuth Redirect] Error:", errorMsg);
13395
13639
  return Response.redirect(new URL(`${errorRedirectUrl}?error=${encodeURIComponent(errorMsg)}`, webRequest.url));
13396
13640
  }
13397
13641
  if (!code || !state) {
13398
- logger40.error("[OAuth Redirect] Missing code or state parameter");
13642
+ logger42.error("[OAuth Redirect] Missing code or state parameter");
13399
13643
  return Response.redirect(new URL(`${errorRedirectUrl}?error=${encodeURIComponent("Invalid OAuth callback")}`, webRequest.url));
13400
13644
  }
13401
13645
  let returnUrl = defaultRedirectUrl;
@@ -13472,7 +13716,7 @@ function createMCPServer(config) {
13472
13716
  frontendUrl.hash = `oauth_callback=${encodeURIComponent(JSON.stringify({ code, state, tokenData }))}`;
13473
13717
  return Response.redirect(frontendUrl);
13474
13718
  } catch (error2) {
13475
- logger40.error("[OAuth Backend Callback] Error:", error2);
13719
+ logger42.error("[OAuth Backend Callback] Error:", error2);
13476
13720
  return Response.redirect(new URL(`${errorRedirectUrl}?error=${encodeURIComponent(error2.message || "Failed to exchange token")}`, webRequest.url));
13477
13721
  }
13478
13722
  } else {
@@ -13768,7 +14012,9 @@ export {
13768
14012
  slackIntegration,
13769
14013
  sendWebResponse,
13770
14014
  rampIntegration,
14015
+ railwayIntegration,
13771
14016
  powerpointIntegration,
14017
+ posthogIntegration,
13772
14018
  polarIntegration,
13773
14019
  outlookIntegration,
13774
14020
  onedriveIntegration,