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/index.js CHANGED
@@ -802,10 +802,12 @@ var MCPMethod;
802
802
 
803
803
  // src/integrations/library-metadata.ts
804
804
  var INTEGRATION_CATEGORY_ORDER = [
805
+ "Analytics",
805
806
  "Productivity",
806
807
  "Business",
807
808
  "Communication",
808
809
  "Engineering",
810
+ "Infrastructure",
809
811
  "Storage",
810
812
  "Other"
811
813
  ];
@@ -866,10 +868,18 @@ var INTEGRATION_LIBRARY_METADATA = {
866
868
  description: "Manage Polar products, orders, and subscriptions",
867
869
  category: "Business"
868
870
  },
871
+ posthog: {
872
+ description: "Read PostHog organizations, projects, insights, and feature flags",
873
+ category: "Analytics"
874
+ },
869
875
  ramp: {
870
876
  description: "Manage Ramp corporate cards, bills, and spend",
871
877
  category: "Business"
872
878
  },
879
+ railway: {
880
+ description: "Manage Railway workspaces, projects, services, deployments, variables, domains, and volumes",
881
+ category: "Infrastructure"
882
+ },
873
883
  slack: {
874
884
  description: "Send and manage Slack messages and channels",
875
885
  category: "Communication"
@@ -2340,6 +2350,9 @@ class MCPClientBase {
2340
2350
  if (integrationIds.includes("linear")) {
2341
2351
  this.linear = this.createIntegrationProxy("linear");
2342
2352
  }
2353
+ if (integrationIds.includes("railway")) {
2354
+ this.railway = this.createIntegrationProxy("railway");
2355
+ }
2343
2356
  if (integrationIds.includes("vercel")) {
2344
2357
  this.vercel = this.createIntegrationProxy("vercel");
2345
2358
  }
@@ -2370,6 +2383,9 @@ class MCPClientBase {
2370
2383
  if (integrationIds.includes("gslides")) {
2371
2384
  this.gslides = this.createIntegrationProxy("gslides");
2372
2385
  }
2386
+ if (integrationIds.includes("posthog")) {
2387
+ this.posthog = this.createIntegrationProxy("posthog");
2388
+ }
2373
2389
  this.server = this.createServerProxy();
2374
2390
  this.trigger = new TriggerClient({
2375
2391
  apiRouteBase: this.apiRouteBase,
@@ -3276,6 +3292,34 @@ async function clearClientCache() {
3276
3292
  // src/adapters/base-handler.ts
3277
3293
  var SERVER_LOG_CONTEXT = "server";
3278
3294
  var logger6 = createLogger("OAuthHandler", SERVER_LOG_CONTEXT);
3295
+ var OAUTH_CONFIG_FIELDS = new Set([
3296
+ "clientId",
3297
+ "clientSecret",
3298
+ "scopes",
3299
+ "optionalScopes",
3300
+ "redirectUri",
3301
+ "client_id",
3302
+ "client_secret",
3303
+ "scope",
3304
+ "optional_scope",
3305
+ "redirect_uri",
3306
+ "provider"
3307
+ ]);
3308
+ function getForwardableProviderConfig(config) {
3309
+ if (!config) {
3310
+ return {};
3311
+ }
3312
+ return Object.fromEntries(Object.entries(config).filter(([key, value]) => value !== undefined && value !== null && !OAUTH_CONFIG_FIELDS.has(key)).map(([key, value]) => [key, String(value)]));
3313
+ }
3314
+ function getStoredProviderConfig(config) {
3315
+ const baseUrl = config?.baseUrl || config?.apiBaseUrl;
3316
+ if (!baseUrl) {
3317
+ return;
3318
+ }
3319
+ return {
3320
+ baseUrl: String(baseUrl)
3321
+ };
3322
+ }
3279
3323
  var MCP_SERVER_URL2 = "https://mcp.integrate.dev/api/v1/mcp";
3280
3324
 
3281
3325
  class OAuthHandler {
@@ -3348,25 +3392,9 @@ class OAuthHandler {
3348
3392
  if (redirectUri) {
3349
3393
  url.searchParams.set("redirect_uri", redirectUri);
3350
3394
  }
3351
- const OAUTH_FIELDS = new Set([
3352
- "clientId",
3353
- "clientSecret",
3354
- "scopes",
3355
- "optionalScopes",
3356
- "redirectUri",
3357
- "client_id",
3358
- "client_secret",
3359
- "scope",
3360
- "optional_scope",
3361
- "redirect_uri",
3362
- "provider"
3363
- ]);
3364
- if (providerConfig.config) {
3365
- for (const [key, value] of Object.entries(providerConfig.config)) {
3366
- if (value !== undefined && value !== null && !OAUTH_FIELDS.has(key)) {
3367
- url.searchParams.set(key, String(value));
3368
- }
3369
- }
3395
+ const extraConfig = getForwardableProviderConfig(providerConfig.config);
3396
+ for (const [key, value] of Object.entries(extraConfig)) {
3397
+ url.searchParams.set(key, value);
3370
3398
  }
3371
3399
  const response = await fetch(url.toString(), {
3372
3400
  method: "GET",
@@ -3453,7 +3481,8 @@ class OAuthHandler {
3453
3481
  state: callbackRequest.state,
3454
3482
  client_id: providerConfig.clientId,
3455
3483
  client_secret: providerConfig.clientSecret,
3456
- redirect_uri: providerConfig.redirectUri
3484
+ redirect_uri: providerConfig.redirectUri,
3485
+ ...getForwardableProviderConfig(providerConfig.config)
3457
3486
  })
3458
3487
  });
3459
3488
  if (!response.ok) {
@@ -3471,7 +3500,8 @@ class OAuthHandler {
3471
3500
  tokenType: result.tokenType,
3472
3501
  expiresIn: result.expiresIn,
3473
3502
  expiresAt: result.expiresAt,
3474
- scopes: result.scopes ? result.scopes.flatMap((s) => s.split(" ").filter(Boolean)) : result.scopes
3503
+ scopes: result.scopes ? result.scopes.flatMap((s) => s.split(" ").filter(Boolean)) : result.scopes,
3504
+ providerConfig: getStoredProviderConfig(providerConfig.config)
3475
3505
  };
3476
3506
  const email = result.email || await fetchUserEmail(callbackRequest.provider, tokenData);
3477
3507
  if (email) {
@@ -3588,6 +3618,12 @@ class OAuthHandler {
3588
3618
  if (providerConfig.config?.subdomain) {
3589
3619
  body.subdomain = providerConfig.config.subdomain;
3590
3620
  }
3621
+ const extraConfig = getForwardableProviderConfig(providerConfig.config);
3622
+ for (const [key, value] of Object.entries(extraConfig)) {
3623
+ if (body[key] === undefined) {
3624
+ body[key] = value;
3625
+ }
3626
+ }
3591
3627
  const url = new URL("/oauth/refresh", this.serverUrl);
3592
3628
  const response = await fetch(url.toString(), {
3593
3629
  method: "POST",
@@ -3614,7 +3650,8 @@ class OAuthHandler {
3614
3650
  tokenType: result.tokenType,
3615
3651
  expiresIn: result.expiresIn,
3616
3652
  expiresAt: result.expiresAt,
3617
- scopes: result.scopes ? result.scopes.flatMap((s) => s.split(" ").filter(Boolean)) : result.scopes
3653
+ scopes: result.scopes ? result.scopes.flatMap((s) => s.split(" ").filter(Boolean)) : result.scopes,
3654
+ providerConfig: getStoredProviderConfig(providerConfig.config)
3618
3655
  };
3619
3656
  const email = result.email || await fetchUserEmail(refreshRequest.provider, tokenData);
3620
3657
  if (email) {
@@ -4358,8 +4395,121 @@ function linearIntegration(config = {}) {
4358
4395
  }
4359
4396
  };
4360
4397
  }
4398
+ // src/integrations/railway.ts
4399
+ var logger14 = createLogger("Railway");
4400
+ var RAILWAY_SCOPES = [
4401
+ "openid",
4402
+ "profile",
4403
+ "email",
4404
+ "workspace:admin",
4405
+ "project:member"
4406
+ ];
4407
+ var RAILWAY_TOOLS = [
4408
+ "railway_get_current_user",
4409
+ "railway_get_workspace",
4410
+ "railway_list_regions",
4411
+ "railway_list_projects",
4412
+ "railway_get_project",
4413
+ "railway_create_project",
4414
+ "railway_update_project",
4415
+ "railway_delete_project",
4416
+ "railway_transfer_project",
4417
+ "railway_list_project_members",
4418
+ "railway_list_environments",
4419
+ "railway_get_environment",
4420
+ "railway_create_environment",
4421
+ "railway_rename_environment",
4422
+ "railway_delete_environment",
4423
+ "railway_get_environment_logs",
4424
+ "railway_get_environment_staged_changes",
4425
+ "railway_commit_environment_staged_changes",
4426
+ "railway_get_service",
4427
+ "railway_get_service_instance",
4428
+ "railway_create_service",
4429
+ "railway_update_service",
4430
+ "railway_update_service_instance",
4431
+ "railway_connect_service",
4432
+ "railway_disconnect_service",
4433
+ "railway_deploy_service",
4434
+ "railway_redeploy_service",
4435
+ "railway_get_service_limits",
4436
+ "railway_delete_service",
4437
+ "railway_list_deployments",
4438
+ "railway_get_deployment",
4439
+ "railway_get_latest_active_deployment",
4440
+ "railway_get_deployment_build_logs",
4441
+ "railway_get_deployment_runtime_logs",
4442
+ "railway_get_deployment_http_logs",
4443
+ "railway_redeploy_deployment",
4444
+ "railway_restart_deployment",
4445
+ "railway_rollback_deployment",
4446
+ "railway_stop_deployment",
4447
+ "railway_cancel_deployment",
4448
+ "railway_remove_deployment",
4449
+ "railway_get_variables",
4450
+ "railway_get_unrendered_variables",
4451
+ "railway_upsert_variable",
4452
+ "railway_upsert_variables",
4453
+ "railway_delete_variable",
4454
+ "railway_get_rendered_variables",
4455
+ "railway_list_domains",
4456
+ "railway_create_service_domain",
4457
+ "railway_delete_service_domain",
4458
+ "railway_check_custom_domain_availability",
4459
+ "railway_create_custom_domain",
4460
+ "railway_get_custom_domain_status",
4461
+ "railway_update_custom_domain",
4462
+ "railway_delete_custom_domain",
4463
+ "railway_list_project_volumes",
4464
+ "railway_get_volume_instance",
4465
+ "railway_create_volume",
4466
+ "railway_update_volume",
4467
+ "railway_update_volume_instance",
4468
+ "railway_delete_volume",
4469
+ "railway_list_volume_backups",
4470
+ "railway_create_volume_backup",
4471
+ "railway_restore_volume_backup",
4472
+ "railway_lock_volume_backup",
4473
+ "railway_delete_volume_backup",
4474
+ "railway_list_volume_backup_schedules",
4475
+ "railway_list_tcp_proxies"
4476
+ ];
4477
+ function railwayIntegration(config = {}) {
4478
+ const oauth = {
4479
+ provider: "railway",
4480
+ clientId: config.clientId ?? getEnv("RAILWAY_CLIENT_ID"),
4481
+ clientSecret: config.clientSecret ?? getEnv("RAILWAY_CLIENT_SECRET"),
4482
+ scopes: config.scopes ?? [...RAILWAY_SCOPES],
4483
+ optionalScopes: config.optionalScopes,
4484
+ redirectUri: config.redirectUri,
4485
+ config: {
4486
+ authorization_endpoint: "https://backboard.railway.com/oauth/auth",
4487
+ token_endpoint: "https://backboard.railway.com/oauth/token",
4488
+ response_type: "code",
4489
+ grant_types_supported: ["authorization_code", "refresh_token"],
4490
+ code_challenge_method: "S256",
4491
+ apiBaseUrl: "https://backboard.railway.com/graphql/v2",
4492
+ ...config
4493
+ }
4494
+ };
4495
+ return {
4496
+ id: "railway",
4497
+ name: "Railway",
4498
+ logoUrl: "https://wdvtnli2jn3texa6.public.blob.vercel-storage.com/railway.png",
4499
+ description: "Manage Railway workspaces, projects, services, deployments, variables, domains, and volumes",
4500
+ category: "Infrastructure",
4501
+ tools: [...RAILWAY_TOOLS],
4502
+ oauth,
4503
+ async onInit(_client) {
4504
+ logger14.debug("Railway integration initialized");
4505
+ },
4506
+ async onAfterConnect(_client) {
4507
+ logger14.debug("Railway integration connected");
4508
+ }
4509
+ };
4510
+ }
4361
4511
  // src/integrations/vercel.ts
4362
- var logger14 = createLogger("Vercel");
4512
+ var logger15 = createLogger("Vercel");
4363
4513
  var VERCEL_TOOLS = [
4364
4514
  "vercel_list_projects",
4365
4515
  "vercel_get_project",
@@ -4402,15 +4552,15 @@ function vercelIntegration(config = {}) {
4402
4552
  tools: [...VERCEL_TOOLS],
4403
4553
  oauth,
4404
4554
  async onInit(_client) {
4405
- logger14.debug("Vercel integration initialized");
4555
+ logger15.debug("Vercel integration initialized");
4406
4556
  },
4407
4557
  async onAfterConnect(_client) {
4408
- logger14.debug("Vercel integration connected");
4558
+ logger15.debug("Vercel integration connected");
4409
4559
  }
4410
4560
  };
4411
4561
  }
4412
4562
  // src/integrations/zendesk.ts
4413
- var logger15 = createLogger("Zendesk");
4563
+ var logger16 = createLogger("Zendesk");
4414
4564
  var ZENDESK_TOOLS = [
4415
4565
  "zendesk_list_tickets",
4416
4566
  "zendesk_get_ticket",
@@ -4459,15 +4609,15 @@ function zendeskIntegration(config = {}) {
4459
4609
  tools: [...ZENDESK_TOOLS],
4460
4610
  oauth,
4461
4611
  async onInit(_client) {
4462
- logger15.debug("Zendesk integration initialized");
4612
+ logger16.debug("Zendesk integration initialized");
4463
4613
  },
4464
4614
  async onAfterConnect(_client) {
4465
- logger15.debug("Zendesk integration connected");
4615
+ logger16.debug("Zendesk integration connected");
4466
4616
  }
4467
4617
  };
4468
4618
  }
4469
4619
  // src/integrations/stripe.ts
4470
- var logger16 = createLogger("Stripe");
4620
+ var logger17 = createLogger("Stripe");
4471
4621
  var STRIPE_TOOLS = [
4472
4622
  "stripe_list_customers",
4473
4623
  "stripe_get_customer",
@@ -4523,15 +4673,15 @@ function stripeIntegration(config = {}) {
4523
4673
  tools: [...STRIPE_TOOLS],
4524
4674
  oauth,
4525
4675
  async onInit(_client) {
4526
- logger16.debug("Stripe integration initialized");
4676
+ logger17.debug("Stripe integration initialized");
4527
4677
  },
4528
4678
  async onAfterConnect(_client) {
4529
- logger16.debug("Stripe integration connected");
4679
+ logger17.debug("Stripe integration connected");
4530
4680
  }
4531
4681
  };
4532
4682
  }
4533
4683
  // src/integrations/gcal.ts
4534
- var logger17 = createLogger("Google Calendar");
4684
+ var logger18 = createLogger("Google Calendar");
4535
4685
  var GCAL_TOOLS = [
4536
4686
  "gcal_list_calendars",
4537
4687
  "gcal_get_calendar",
@@ -4564,15 +4714,15 @@ function gcalIntegration(config = {}) {
4564
4714
  tools: [...GCAL_TOOLS],
4565
4715
  oauth,
4566
4716
  async onInit(_client) {
4567
- logger17.debug("Google Calendar integration initialized");
4717
+ logger18.debug("Google Calendar integration initialized");
4568
4718
  },
4569
4719
  async onAfterConnect(_client) {
4570
- logger17.debug("Google Calendar integration connected");
4720
+ logger18.debug("Google Calendar integration connected");
4571
4721
  }
4572
4722
  };
4573
4723
  }
4574
4724
  // src/integrations/outlook.ts
4575
- var logger18 = createLogger("Outlook");
4725
+ var logger19 = createLogger("Outlook");
4576
4726
  var OUTLOOK_TOOLS = [
4577
4727
  "outlook_list_messages",
4578
4728
  "outlook_get_message",
@@ -4619,15 +4769,15 @@ function outlookIntegration(config = {}) {
4619
4769
  tools: [...OUTLOOK_TOOLS],
4620
4770
  oauth,
4621
4771
  async onInit(_client) {
4622
- logger18.debug("Outlook integration initialized");
4772
+ logger19.debug("Outlook integration initialized");
4623
4773
  },
4624
4774
  async onAfterConnect(_client) {
4625
- logger18.debug("Outlook integration connected");
4775
+ logger19.debug("Outlook integration connected");
4626
4776
  }
4627
4777
  };
4628
4778
  }
4629
4779
  // src/integrations/airtable.ts
4630
- var logger19 = createLogger("Airtable");
4780
+ var logger20 = createLogger("Airtable");
4631
4781
  var AIRTABLE_TOOLS = [
4632
4782
  "airtable_list_bases",
4633
4783
  "airtable_get_base",
@@ -4673,15 +4823,15 @@ function airtableIntegration(config = {}) {
4673
4823
  tools: [...AIRTABLE_TOOLS],
4674
4824
  oauth,
4675
4825
  async onInit(_client) {
4676
- logger19.debug("Airtable integration initialized");
4826
+ logger20.debug("Airtable integration initialized");
4677
4827
  },
4678
4828
  async onAfterConnect(_client) {
4679
- logger19.debug("Airtable integration connected");
4829
+ logger20.debug("Airtable integration connected");
4680
4830
  }
4681
4831
  };
4682
4832
  }
4683
4833
  // src/integrations/todoist.ts
4684
- var logger20 = createLogger("Todoist");
4834
+ var logger21 = createLogger("Todoist");
4685
4835
  var TODOIST_TOOLS = [
4686
4836
  "todoist_list_projects",
4687
4837
  "todoist_get_project",
@@ -4736,15 +4886,15 @@ function todoistIntegration(config = {}) {
4736
4886
  tools: [...TODOIST_TOOLS],
4737
4887
  oauth,
4738
4888
  async onInit(_client) {
4739
- logger20.debug("Todoist integration initialized");
4889
+ logger21.debug("Todoist integration initialized");
4740
4890
  },
4741
4891
  async onAfterConnect(_client) {
4742
- logger20.debug("Todoist integration connected");
4892
+ logger21.debug("Todoist integration connected");
4743
4893
  }
4744
4894
  };
4745
4895
  }
4746
4896
  // src/integrations/whatsapp.ts
4747
- var logger21 = createLogger("WhatsApp");
4897
+ var logger22 = createLogger("WhatsApp");
4748
4898
  var WHATSAPP_TOOLS = [
4749
4899
  "whatsapp_send_message",
4750
4900
  "whatsapp_reply_message",
@@ -4790,15 +4940,15 @@ function whatsappIntegration(config = {}) {
4790
4940
  tools: [...WHATSAPP_TOOLS],
4791
4941
  oauth,
4792
4942
  async onInit(_client) {
4793
- logger21.debug("WhatsApp Business integration initialized");
4943
+ logger22.debug("WhatsApp Business integration initialized");
4794
4944
  },
4795
4945
  async onAfterConnect(_client) {
4796
- logger21.debug("WhatsApp Business integration connected");
4946
+ logger22.debug("WhatsApp Business integration connected");
4797
4947
  }
4798
4948
  };
4799
4949
  }
4800
4950
  // src/integrations/calcom.ts
4801
- var logger22 = createLogger("Cal.com");
4951
+ var logger23 = createLogger("Cal.com");
4802
4952
  var CALCOM_TOOLS = [
4803
4953
  "calcom_list_bookings",
4804
4954
  "calcom_get_booking",
@@ -4874,15 +5024,15 @@ function calcomIntegration(config = {}) {
4874
5024
  tools: [...CALCOM_TOOLS],
4875
5025
  oauth,
4876
5026
  async onInit(_client) {
4877
- logger22.debug("Cal.com integration initialized");
5027
+ logger23.debug("Cal.com integration initialized");
4878
5028
  },
4879
5029
  async onAfterConnect(_client) {
4880
- logger22.debug("Cal.com integration connected");
5030
+ logger23.debug("Cal.com integration connected");
4881
5031
  }
4882
5032
  };
4883
5033
  }
4884
5034
  // src/integrations/ramp.ts
4885
- var logger23 = createLogger("Ramp");
5035
+ var logger24 = createLogger("Ramp");
4886
5036
  var RAMP_TOOLS = [
4887
5037
  "ramp_list_transactions",
4888
5038
  "ramp_get_transaction",
@@ -4914,15 +5064,15 @@ function rampIntegration(config = {}) {
4914
5064
  tools: [...RAMP_TOOLS],
4915
5065
  oauth,
4916
5066
  async onInit(_client) {
4917
- logger23.debug("Ramp integration initialized");
5067
+ logger24.debug("Ramp integration initialized");
4918
5068
  },
4919
5069
  async onAfterConnect(_client) {
4920
- logger23.debug("Ramp integration connected");
5070
+ logger24.debug("Ramp integration connected");
4921
5071
  }
4922
5072
  };
4923
5073
  }
4924
5074
  // src/integrations/onedrive.ts
4925
- var logger24 = createLogger("OneDrive");
5075
+ var logger25 = createLogger("OneDrive");
4926
5076
  var ONEDRIVE_TOOLS = [
4927
5077
  "onedrive_list_files",
4928
5078
  "onedrive_get_file",
@@ -4951,15 +5101,15 @@ function onedriveIntegration(config = {}) {
4951
5101
  tools: [...ONEDRIVE_TOOLS],
4952
5102
  oauth,
4953
5103
  async onInit(_client) {
4954
- logger24.debug("OneDrive integration initialized");
5104
+ logger25.debug("OneDrive integration initialized");
4955
5105
  },
4956
5106
  async onAfterConnect(_client) {
4957
- logger24.debug("OneDrive integration connected");
5107
+ logger25.debug("OneDrive integration connected");
4958
5108
  }
4959
5109
  };
4960
5110
  }
4961
5111
  // src/integrations/dropbox.ts
4962
- var logger25 = createLogger("Dropbox");
5112
+ var logger26 = createLogger("Dropbox");
4963
5113
  var DROPBOX_TOOLS = [
4964
5114
  "dropbox_get_current_account",
4965
5115
  "dropbox_get_space_usage",
@@ -4998,15 +5148,15 @@ function dropboxIntegration(options = {}) {
4998
5148
  authType: "oauth",
4999
5149
  oauth,
5000
5150
  async onInit(_client) {
5001
- logger25.debug("Dropbox integration initialized");
5151
+ logger26.debug("Dropbox integration initialized");
5002
5152
  },
5003
5153
  async onAfterConnect(_client) {
5004
- logger25.debug("Dropbox integration connected");
5154
+ logger26.debug("Dropbox integration connected");
5005
5155
  }
5006
5156
  };
5007
5157
  }
5008
5158
  // src/integrations/gdocs.ts
5009
- var logger26 = createLogger("Google Docs");
5159
+ var logger27 = createLogger("Google Docs");
5010
5160
  var GDOCS_TOOLS = [
5011
5161
  "gdocs_list",
5012
5162
  "gdocs_get",
@@ -5031,15 +5181,15 @@ function gdocsIntegration(config = {}) {
5031
5181
  tools: [...GDOCS_TOOLS],
5032
5182
  oauth,
5033
5183
  async onInit(_client) {
5034
- logger26.debug("Google Docs integration initialized");
5184
+ logger27.debug("Google Docs integration initialized");
5035
5185
  },
5036
5186
  async onAfterConnect(_client) {
5037
- logger26.debug("Google Docs integration connected");
5187
+ logger27.debug("Google Docs integration connected");
5038
5188
  }
5039
5189
  };
5040
5190
  }
5041
5191
  // src/integrations/gsheets.ts
5042
- var logger27 = createLogger("Google Sheets");
5192
+ var logger28 = createLogger("Google Sheets");
5043
5193
  var GSHEETS_TOOLS = [
5044
5194
  "gsheets_list",
5045
5195
  "gsheets_get",
@@ -5067,15 +5217,15 @@ function gsheetsIntegration(config = {}) {
5067
5217
  tools: [...GSHEETS_TOOLS],
5068
5218
  oauth,
5069
5219
  async onInit(_client) {
5070
- logger27.debug("Google Sheets integration initialized");
5220
+ logger28.debug("Google Sheets integration initialized");
5071
5221
  },
5072
5222
  async onAfterConnect(_client) {
5073
- logger27.debug("Google Sheets integration connected");
5223
+ logger28.debug("Google Sheets integration connected");
5074
5224
  }
5075
5225
  };
5076
5226
  }
5077
5227
  // src/integrations/gslides.ts
5078
- var logger28 = createLogger("Google Slides");
5228
+ var logger29 = createLogger("Google Slides");
5079
5229
  var GSLIDES_TOOLS = [
5080
5230
  "gslides_list",
5081
5231
  "gslides_get",
@@ -5102,15 +5252,15 @@ function gslidesIntegration(config = {}) {
5102
5252
  tools: [...GSLIDES_TOOLS],
5103
5253
  oauth,
5104
5254
  async onInit(_client) {
5105
- logger28.debug("Google Slides integration initialized");
5255
+ logger29.debug("Google Slides integration initialized");
5106
5256
  },
5107
5257
  async onAfterConnect(_client) {
5108
- logger28.debug("Google Slides integration connected");
5258
+ logger29.debug("Google Slides integration connected");
5109
5259
  }
5110
5260
  };
5111
5261
  }
5112
5262
  // src/integrations/polar.ts
5113
- var logger29 = createLogger("Polar");
5263
+ var logger30 = createLogger("Polar");
5114
5264
  var POLAR_TOOLS = [
5115
5265
  "polar_list_products",
5116
5266
  "polar_get_product",
@@ -5167,15 +5317,15 @@ function polarIntegration(config = {}) {
5167
5317
  tools: [...POLAR_TOOLS],
5168
5318
  oauth,
5169
5319
  async onInit(_client) {
5170
- logger29.debug("Polar integration initialized");
5320
+ logger30.debug("Polar integration initialized");
5171
5321
  },
5172
5322
  async onAfterConnect(_client) {
5173
- logger29.debug("Polar integration connected");
5323
+ logger30.debug("Polar integration connected");
5174
5324
  }
5175
5325
  };
5176
5326
  }
5177
5327
  // src/integrations/figma.ts
5178
- var logger30 = createLogger("Figma");
5328
+ var logger31 = createLogger("Figma");
5179
5329
  var FIGMA_TOOLS = [
5180
5330
  "figma_get_file",
5181
5331
  "figma_get_file_nodes",
@@ -5241,15 +5391,15 @@ function figmaIntegration(config = {}) {
5241
5391
  tools: [...FIGMA_TOOLS],
5242
5392
  oauth,
5243
5393
  async onInit(_client) {
5244
- logger30.debug("Figma integration initialized");
5394
+ logger31.debug("Figma integration initialized");
5245
5395
  },
5246
5396
  async onAfterConnect(_client) {
5247
- logger30.debug("Figma integration connected");
5397
+ logger31.debug("Figma integration connected");
5248
5398
  }
5249
5399
  };
5250
5400
  }
5251
5401
  // src/integrations/intercom.ts
5252
- var logger31 = createLogger("Intercom");
5402
+ var logger32 = createLogger("Intercom");
5253
5403
  var INTERCOM_TOOLS = [
5254
5404
  "intercom_list_contacts",
5255
5405
  "intercom_get_contact",
@@ -5280,15 +5430,15 @@ function intercomIntegration(config = {}) {
5280
5430
  tools: [...INTERCOM_TOOLS],
5281
5431
  oauth,
5282
5432
  async onInit(_client) {
5283
- logger31.debug("Intercom integration initialized");
5433
+ logger32.debug("Intercom integration initialized");
5284
5434
  },
5285
5435
  async onAfterConnect(_client) {
5286
- logger31.debug("Intercom integration connected");
5436
+ logger32.debug("Intercom integration connected");
5287
5437
  }
5288
5438
  };
5289
5439
  }
5290
5440
  // src/integrations/hubspot.ts
5291
- var logger32 = createLogger("HubSpot");
5441
+ var logger33 = createLogger("HubSpot");
5292
5442
  var HUBSPOT_TOOLS = [
5293
5443
  "hubspot_list_contacts",
5294
5444
  "hubspot_get_contact",
@@ -5338,15 +5488,15 @@ function hubspotIntegration(config = {}) {
5338
5488
  tools: [...HUBSPOT_TOOLS],
5339
5489
  oauth,
5340
5490
  async onInit(_client) {
5341
- logger32.debug("HubSpot integration initialized");
5491
+ logger33.debug("HubSpot integration initialized");
5342
5492
  },
5343
5493
  async onAfterConnect(_client) {
5344
- logger32.debug("HubSpot integration connected");
5494
+ logger33.debug("HubSpot integration connected");
5345
5495
  }
5346
5496
  };
5347
5497
  }
5348
5498
  // src/integrations/youtube.ts
5349
- var logger33 = createLogger("YouTube");
5499
+ var logger34 = createLogger("YouTube");
5350
5500
  var YOUTUBE_TOOLS = [
5351
5501
  "youtube_search",
5352
5502
  "youtube_get_video",
@@ -5392,15 +5542,15 @@ function youtubeIntegration(config = {}) {
5392
5542
  tools: [...YOUTUBE_TOOLS],
5393
5543
  oauth,
5394
5544
  async onInit(_client) {
5395
- logger33.debug("YouTube integration initialized");
5545
+ logger34.debug("YouTube integration initialized");
5396
5546
  },
5397
5547
  async onAfterConnect(_client) {
5398
- logger33.debug("YouTube integration connected");
5548
+ logger34.debug("YouTube integration connected");
5399
5549
  }
5400
5550
  };
5401
5551
  }
5402
5552
  // src/integrations/cursor.ts
5403
- var logger34 = createLogger("Cursor");
5553
+ var logger35 = createLogger("Cursor");
5404
5554
  var CURSOR_TOOLS = [
5405
5555
  "cursor_list_agents",
5406
5556
  "cursor_get_agent",
@@ -5420,10 +5570,104 @@ function cursorIntegration(_config = {}) {
5420
5570
  logoUrl: "https://wdvtnli2jn3texa6.public.blob.vercel-storage.com/cursor.jpeg",
5421
5571
  tools: [...CURSOR_TOOLS],
5422
5572
  async onInit(_client) {
5423
- logger34.debug("Cursor integration initialized");
5573
+ logger35.debug("Cursor integration initialized");
5574
+ },
5575
+ async onAfterConnect(_client) {
5576
+ logger35.debug("Cursor integration connected");
5577
+ }
5578
+ };
5579
+ }
5580
+ // src/integrations/posthog.ts
5581
+ var logger36 = createLogger("PostHog");
5582
+ var DEFAULT_POSTHOG_BASE_URL = "https://us.posthog.com";
5583
+ var POSTHOG_SCOPES = [
5584
+ "openid",
5585
+ "profile",
5586
+ "email",
5587
+ "organization:read",
5588
+ "project:read",
5589
+ "user:read",
5590
+ "query:read",
5591
+ "insight:read",
5592
+ "dashboard:read",
5593
+ "feature_flag:read",
5594
+ "experiment:read",
5595
+ "annotation:read",
5596
+ "cohort:read",
5597
+ "person:read",
5598
+ "event_definition:read",
5599
+ "property_definition:read",
5600
+ "session_recording:read",
5601
+ "action:read"
5602
+ ];
5603
+ var POSTHOG_TOOLS = [
5604
+ "posthog_get_current_user",
5605
+ "posthog_list_organizations",
5606
+ "posthog_get_organization",
5607
+ "posthog_list_projects",
5608
+ "posthog_get_project",
5609
+ "posthog_run_hogql_query",
5610
+ "posthog_list_insights",
5611
+ "posthog_get_insight",
5612
+ "posthog_list_dashboards",
5613
+ "posthog_get_dashboard",
5614
+ "posthog_list_feature_flags",
5615
+ "posthog_get_feature_flag",
5616
+ "posthog_list_experiments",
5617
+ "posthog_get_experiment",
5618
+ "posthog_list_annotations",
5619
+ "posthog_get_annotation",
5620
+ "posthog_list_cohorts",
5621
+ "posthog_get_cohort",
5622
+ "posthog_list_event_definitions",
5623
+ "posthog_get_event_definition",
5624
+ "posthog_list_property_definitions",
5625
+ "posthog_get_property_definition",
5626
+ "posthog_list_persons",
5627
+ "posthog_get_person",
5628
+ "posthog_list_session_recordings",
5629
+ "posthog_get_session_recording"
5630
+ ];
5631
+ function normalizePostHogBaseUrl(baseUrl) {
5632
+ const value = (baseUrl || DEFAULT_POSTHOG_BASE_URL).trim().replace(/\/+$/, "");
5633
+ if (!value) {
5634
+ return DEFAULT_POSTHOG_BASE_URL;
5635
+ }
5636
+ return /^https?:\/\//i.test(value) ? value : `https://${value}`;
5637
+ }
5638
+ function posthogIntegration(config = {}) {
5639
+ const baseUrl = normalizePostHogBaseUrl(config.baseUrl);
5640
+ const oauth = {
5641
+ provider: "posthog",
5642
+ clientId: config.clientId ?? getEnv("POSTHOG_CLIENT_ID"),
5643
+ clientSecret: config.clientSecret ?? getEnv("POSTHOG_CLIENT_SECRET"),
5644
+ scopes: config.scopes ?? [...POSTHOG_SCOPES],
5645
+ optionalScopes: config.optionalScopes,
5646
+ redirectUri: config.redirectUri,
5647
+ config: {
5648
+ baseUrl,
5649
+ apiBaseUrl: baseUrl,
5650
+ authorization_endpoint: `${baseUrl}/oauth/authorize/`,
5651
+ token_endpoint: `${baseUrl}/oauth/token/`,
5652
+ token_auth_method: "client_secret_post",
5653
+ response_type: "code",
5654
+ grant_types_supported: ["authorization_code", "refresh_token"],
5655
+ code_challenge_method: "S256"
5656
+ }
5657
+ };
5658
+ return {
5659
+ id: "posthog",
5660
+ name: "PostHog",
5661
+ logoUrl: "https://wdvtnli2jn3texa6.public.blob.vercel-storage.com/posthog.png",
5662
+ description: "Read PostHog organizations, projects, insights, flags, and analytics data",
5663
+ category: "Analytics",
5664
+ tools: [...POSTHOG_TOOLS],
5665
+ oauth,
5666
+ async onInit(_client) {
5667
+ logger36.debug("PostHog integration initialized");
5424
5668
  },
5425
5669
  async onAfterConnect(_client) {
5426
- logger34.debug("Cursor integration connected");
5670
+ logger36.debug("PostHog integration connected");
5427
5671
  }
5428
5672
  };
5429
5673
  }
@@ -5545,7 +5789,7 @@ function validateStepLimit(stepIndex, maxSteps) {
5545
5789
  return { valid: true };
5546
5790
  }
5547
5791
  // src/triggers/webhooks.ts
5548
- var logger35 = createLogger("Webhooks", "server");
5792
+ var logger37 = createLogger("Webhooks", "server");
5549
5793
  async function signPayload(payload, secret) {
5550
5794
  const encoder = new TextEncoder;
5551
5795
  const data = encoder.encode(JSON.stringify(payload));
@@ -5571,7 +5815,7 @@ async function deliverWebhook(webhook, payload, timeoutMs) {
5571
5815
  signal: controller.signal
5572
5816
  });
5573
5817
  if (!response.ok) {
5574
- logger35.warn(`Webhook delivery to ${webhook.url} returned ${response.status}`);
5818
+ logger37.warn(`Webhook delivery to ${webhook.url} returned ${response.status}`);
5575
5819
  }
5576
5820
  } finally {
5577
5821
  clearTimeout(timeout);
@@ -5584,7 +5828,7 @@ async function deliverWebhooks(webhooks, payload, timeoutMs) {
5584
5828
  for (let i = 0;i < results.length; i++) {
5585
5829
  const result = results[i];
5586
5830
  if (result.status === "rejected") {
5587
- logger35.warn(`Webhook delivery to ${webhooks[i].url} failed:`, result.reason);
5831
+ logger37.warn(`Webhook delivery to ${webhooks[i].url} failed:`, result.reason);
5588
5832
  }
5589
5833
  }
5590
5834
  }
@@ -5621,7 +5865,7 @@ function createSimpleIntegration(config) {
5621
5865
  };
5622
5866
  }
5623
5867
  // src/integrations/word.ts
5624
- var logger36 = createLogger("Word");
5868
+ var logger38 = createLogger("Word");
5625
5869
  var WORD_TOOLS = [
5626
5870
  "word_list",
5627
5871
  "word_get",
@@ -5647,16 +5891,16 @@ function wordIntegration(config = {}) {
5647
5891
  tools: [...WORD_TOOLS],
5648
5892
  oauth,
5649
5893
  async onInit(_client) {
5650
- logger36.debug("Word integration initialized");
5894
+ logger38.debug("Word integration initialized");
5651
5895
  },
5652
5896
  async onAfterConnect(_client) {
5653
- logger36.debug("Word integration connected");
5897
+ logger38.debug("Word integration connected");
5654
5898
  }
5655
5899
  };
5656
5900
  }
5657
5901
 
5658
5902
  // src/integrations/excel.ts
5659
- var logger37 = createLogger("Excel");
5903
+ var logger39 = createLogger("Excel");
5660
5904
  var EXCEL_TOOLS = [
5661
5905
  "excel_list",
5662
5906
  "excel_get",
@@ -5692,16 +5936,16 @@ function excelIntegration(config = {}) {
5692
5936
  tools: [...EXCEL_TOOLS],
5693
5937
  oauth,
5694
5938
  async onInit(_client) {
5695
- logger37.debug("Excel integration initialized");
5939
+ logger39.debug("Excel integration initialized");
5696
5940
  },
5697
5941
  async onAfterConnect(_client) {
5698
- logger37.debug("Excel integration connected");
5942
+ logger39.debug("Excel integration connected");
5699
5943
  }
5700
5944
  };
5701
5945
  }
5702
5946
 
5703
5947
  // src/integrations/powerpoint.ts
5704
- var logger38 = createLogger("PowerPoint");
5948
+ var logger40 = createLogger("PowerPoint");
5705
5949
  var POWERPOINT_TOOLS = [
5706
5950
  "powerpoint_list",
5707
5951
  "powerpoint_get",
@@ -5727,16 +5971,16 @@ function powerpointIntegration(config = {}) {
5727
5971
  tools: [...POWERPOINT_TOOLS],
5728
5972
  oauth,
5729
5973
  async onInit(_client) {
5730
- logger38.debug("PowerPoint integration initialized");
5974
+ logger40.debug("PowerPoint integration initialized");
5731
5975
  },
5732
5976
  async onAfterConnect(_client) {
5733
- logger38.debug("PowerPoint integration connected");
5977
+ logger40.debug("PowerPoint integration connected");
5734
5978
  }
5735
5979
  };
5736
5980
  }
5737
5981
 
5738
5982
  // src/integrations/gdrive.ts
5739
- var logger39 = createLogger("Google Drive");
5983
+ var logger41 = createLogger("Google Drive");
5740
5984
  var GDRIVE_TOOLS = [
5741
5985
  "gdrive_list_files",
5742
5986
  "gdrive_get_file",
@@ -5770,10 +6014,10 @@ function gdriveIntegration(config = {}) {
5770
6014
  tools: [...GDRIVE_TOOLS],
5771
6015
  oauth,
5772
6016
  async onInit(_client) {
5773
- logger39.debug("Google Drive integration initialized");
6017
+ logger41.debug("Google Drive integration initialized");
5774
6018
  },
5775
6019
  async onAfterConnect(_client) {
5776
- logger39.debug("Google Drive integration connected");
6020
+ logger41.debug("Google Drive integration connected");
5777
6021
  }
5778
6022
  };
5779
6023
  }
@@ -5809,7 +6053,8 @@ var client = createMCPClient({
5809
6053
  intercomIntegration(),
5810
6054
  hubspotIntegration(),
5811
6055
  youtubeIntegration(),
5812
- cursorIntegration()
6056
+ cursorIntegration(),
6057
+ posthogIntegration()
5813
6058
  ],
5814
6059
  useServerConfig: true
5815
6060
  });
@@ -5826,6 +6071,8 @@ export {
5826
6071
  slackIntegration,
5827
6072
  sendCallbackToOpener,
5828
6073
  rampIntegration,
6074
+ railwayIntegration,
6075
+ posthogIntegration,
5829
6076
  polarIntegration,
5830
6077
  parseState,
5831
6078
  parseServerError,