integrate-sdk 0.8.50-dev.0 → 0.8.53-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.
@@ -1700,6 +1700,7 @@ class MCPClientBase {
1700
1700
  apiBaseUrl;
1701
1701
  databaseDetected = false;
1702
1702
  __configuredIntegrations;
1703
+ __useServerConfig;
1703
1704
  oauthCallbackPromise;
1704
1705
  server;
1705
1706
  trigger;
@@ -1726,6 +1727,7 @@ class MCPClientBase {
1726
1727
  return integration;
1727
1728
  });
1728
1729
  this.__configuredIntegrations = this.integrations;
1730
+ this.__useServerConfig = config.useServerConfig ?? false;
1729
1731
  this.clientInfo = config.clientInfo || {
1730
1732
  name: "integrate-sdk",
1731
1733
  version: "0.1.0"
@@ -1869,60 +1871,12 @@ class MCPClientBase {
1869
1871
  get: (_target, methodName) => {
1870
1872
  if (methodName === "listConfiguredIntegrations") {
1871
1873
  return async (options) => {
1874
+ const transportHeaders = this.transport.headers || {};
1875
+ const hasApiKey = !!transportHeaders["X-API-KEY"];
1872
1876
  const serverConfig = this.__oauthConfig;
1873
- const configuredIntegrations = serverConfig?.integrations || this.__configuredIntegrations;
1874
- if (options?.includeToolMetadata) {
1875
- const { parallelWithLimit: parallelWithLimit2 } = await Promise.resolve().then(() => exports_concurrency);
1876
- const integrationsWithMetadata = await parallelWithLimit2(configuredIntegrations, async (integration) => {
1877
- try {
1878
- const response = await this.callServerToolInternal("list_tools_by_integration", {
1879
- integration: integration.id
1880
- });
1881
- let toolMetadata = [];
1882
- if (response.content && Array.isArray(response.content)) {
1883
- for (const item of response.content) {
1884
- if (item.type === "text" && item.text) {
1885
- try {
1886
- const parsed = JSON.parse(item.text);
1887
- if (Array.isArray(parsed)) {
1888
- toolMetadata = parsed;
1889
- } else if (parsed.tools && Array.isArray(parsed.tools)) {
1890
- toolMetadata = parsed.tools;
1891
- }
1892
- } catch {}
1893
- }
1894
- }
1895
- }
1896
- return {
1897
- id: integration.id,
1898
- name: integration.name || integration.id,
1899
- logoUrl: integration.logoUrl,
1900
- tools: integration.tools,
1901
- hasOAuth: !!integration.oauth,
1902
- scopes: integration.oauth?.scopes,
1903
- provider: integration.oauth?.provider,
1904
- toolMetadata
1905
- };
1906
- } catch (error) {
1907
- logger5.error(`Failed to fetch tool metadata for ${integration.id}:`, error);
1908
- return {
1909
- id: integration.id,
1910
- name: integration.name || integration.id,
1911
- logoUrl: integration.logoUrl,
1912
- tools: integration.tools,
1913
- hasOAuth: !!integration.oauth,
1914
- scopes: integration.oauth?.scopes,
1915
- provider: integration.oauth?.provider,
1916
- toolMetadata: []
1917
- };
1918
- }
1919
- }, 3);
1920
- return {
1921
- integrations: integrationsWithMetadata
1922
- };
1923
- }
1924
- return {
1925
- integrations: configuredIntegrations.map((integration) => ({
1877
+ const localIntegrations = serverConfig?.integrations || this.__configuredIntegrations;
1878
+ const formatLocalIntegrations = (integrations) => ({
1879
+ integrations: integrations.map((integration) => ({
1926
1880
  id: integration.id,
1927
1881
  name: integration.name || integration.id,
1928
1882
  logoUrl: integration.logoUrl,
@@ -1931,7 +1885,114 @@ class MCPClientBase {
1931
1885
  scopes: integration.oauth?.scopes,
1932
1886
  provider: integration.oauth?.provider
1933
1887
  }))
1934
- };
1888
+ });
1889
+ if (hasApiKey || !this.__useServerConfig) {
1890
+ if (options?.includeToolMetadata) {
1891
+ const { parallelWithLimit: parallelWithLimit2 } = await Promise.resolve().then(() => exports_concurrency);
1892
+ const integrationsWithMetadata = await parallelWithLimit2(localIntegrations, async (integration) => {
1893
+ try {
1894
+ const response = await this.callServerToolInternal("list_tools_by_integration", {
1895
+ integration: integration.id
1896
+ });
1897
+ let toolMetadata = [];
1898
+ if (response.content && Array.isArray(response.content)) {
1899
+ for (const item of response.content) {
1900
+ if (item.type === "text" && item.text) {
1901
+ try {
1902
+ const parsed = JSON.parse(item.text);
1903
+ if (Array.isArray(parsed)) {
1904
+ toolMetadata = parsed;
1905
+ } else if (parsed.tools && Array.isArray(parsed.tools)) {
1906
+ toolMetadata = parsed.tools;
1907
+ }
1908
+ } catch {}
1909
+ }
1910
+ }
1911
+ }
1912
+ return {
1913
+ id: integration.id,
1914
+ name: integration.name || integration.id,
1915
+ logoUrl: integration.logoUrl,
1916
+ tools: integration.tools,
1917
+ hasOAuth: !!integration.oauth,
1918
+ scopes: integration.oauth?.scopes,
1919
+ provider: integration.oauth?.provider,
1920
+ toolMetadata
1921
+ };
1922
+ } catch (error) {
1923
+ logger5.error(`Failed to fetch tool metadata for ${integration.id}:`, error);
1924
+ return {
1925
+ id: integration.id,
1926
+ name: integration.name || integration.id,
1927
+ logoUrl: integration.logoUrl,
1928
+ tools: integration.tools,
1929
+ hasOAuth: !!integration.oauth,
1930
+ scopes: integration.oauth?.scopes,
1931
+ provider: integration.oauth?.provider,
1932
+ toolMetadata: []
1933
+ };
1934
+ }
1935
+ }, 3);
1936
+ return {
1937
+ integrations: integrationsWithMetadata
1938
+ };
1939
+ }
1940
+ return formatLocalIntegrations(localIntegrations);
1941
+ }
1942
+ const url = this.apiBaseUrl ? `${this.apiBaseUrl}${this.apiRouteBase}/integrations` : `${this.apiRouteBase}/integrations`;
1943
+ try {
1944
+ const response = await fetch(url, {
1945
+ method: "GET",
1946
+ headers: {
1947
+ "Content-Type": "application/json"
1948
+ }
1949
+ });
1950
+ if (!response.ok) {
1951
+ logger5.error("Failed to fetch integrations from server, falling back to local config");
1952
+ return formatLocalIntegrations(localIntegrations);
1953
+ }
1954
+ const result = await response.json();
1955
+ if (options?.includeToolMetadata && result.integrations) {
1956
+ const { parallelWithLimit: parallelWithLimit2 } = await Promise.resolve().then(() => exports_concurrency);
1957
+ const integrationsWithMetadata = await parallelWithLimit2(result.integrations, async (integration) => {
1958
+ try {
1959
+ const metadataResponse = await this.callServerToolInternal("list_tools_by_integration", {
1960
+ integration: integration.id
1961
+ });
1962
+ let toolMetadata = [];
1963
+ if (metadataResponse.content && Array.isArray(metadataResponse.content)) {
1964
+ for (const item of metadataResponse.content) {
1965
+ if (item.type === "text" && item.text) {
1966
+ try {
1967
+ const parsed = JSON.parse(item.text);
1968
+ if (Array.isArray(parsed)) {
1969
+ toolMetadata = parsed;
1970
+ } else if (parsed.tools && Array.isArray(parsed.tools)) {
1971
+ toolMetadata = parsed.tools;
1972
+ }
1973
+ } catch {}
1974
+ }
1975
+ }
1976
+ }
1977
+ return {
1978
+ ...integration,
1979
+ toolMetadata
1980
+ };
1981
+ } catch (error) {
1982
+ logger5.error(`Failed to fetch tool metadata for ${integration.id}:`, error);
1983
+ return {
1984
+ ...integration,
1985
+ toolMetadata: []
1986
+ };
1987
+ }
1988
+ }, 3);
1989
+ return { integrations: integrationsWithMetadata };
1990
+ }
1991
+ return result;
1992
+ } catch (error) {
1993
+ logger5.error("Failed to fetch integrations from server, falling back to local config:", error);
1994
+ return formatLocalIntegrations(localIntegrations);
1995
+ }
1935
1996
  };
1936
1997
  }
1937
1998
  return async (args, options) => {
@@ -2476,7 +2537,7 @@ function githubIntegration(config = {}) {
2476
2537
  return {
2477
2538
  id: "github",
2478
2539
  name: "GitHub",
2479
- logoUrl: "https://cdn.simpleicons.org/github",
2540
+ logoUrl: "https://wdvtnli2jn3texa6.public.blob.vercel-storage.com/github.png",
2480
2541
  tools: [...GITHUB_TOOLS],
2481
2542
  oauth,
2482
2543
  async onInit(_client) {
@@ -2531,7 +2592,7 @@ function gmailIntegration(config = {}) {
2531
2592
  return {
2532
2593
  id: "gmail",
2533
2594
  name: "Gmail",
2534
- logoUrl: "https://cdn.simpleicons.org/gmail",
2595
+ logoUrl: "https://wdvtnli2jn3texa6.public.blob.vercel-storage.com/gmail.jpeg",
2535
2596
  tools: [...GMAIL_TOOLS],
2536
2597
  oauth,
2537
2598
  async onInit(_client) {
@@ -2572,7 +2633,7 @@ function notionIntegration(config = {}) {
2572
2633
  return {
2573
2634
  id: "notion",
2574
2635
  name: "Notion",
2575
- logoUrl: "https://cdn.simpleicons.org/notion",
2636
+ logoUrl: "https://wdvtnli2jn3texa6.public.blob.vercel-storage.com/notion.jpeg",
2576
2637
  tools: [...NOTION_TOOLS],
2577
2638
  oauth,
2578
2639
  async onInit(_client) {
@@ -2608,7 +2669,7 @@ function slackIntegration(config = {}) {
2608
2669
  return {
2609
2670
  id: "slack",
2610
2671
  name: "Slack",
2611
- logoUrl: "https://cdn.simpleicons.org/slack",
2672
+ logoUrl: "https://wdvtnli2jn3texa6.public.blob.vercel-storage.com/slack.jpeg",
2612
2673
  tools: [...SLACK_TOOLS],
2613
2674
  oauth,
2614
2675
  async onInit(_client) {
@@ -2651,7 +2712,7 @@ function linearIntegration(config = {}) {
2651
2712
  return {
2652
2713
  id: "linear",
2653
2714
  name: "Linear",
2654
- logoUrl: "https://cdn.simpleicons.org/linear",
2715
+ logoUrl: "https://wdvtnli2jn3texa6.public.blob.vercel-storage.com/linear.jpeg",
2655
2716
  tools: [...LINEAR_TOOLS],
2656
2717
  oauth,
2657
2718
  async onInit(_client) {
@@ -2694,7 +2755,7 @@ function vercelIntegration(config = {}) {
2694
2755
  return {
2695
2756
  id: "vercel",
2696
2757
  name: "Vercel",
2697
- logoUrl: "https://cdn.simpleicons.org/vercel",
2758
+ logoUrl: "https://wdvtnli2jn3texa6.public.blob.vercel-storage.com/vercel.png",
2698
2759
  tools: [...VERCEL_TOOLS],
2699
2760
  oauth,
2700
2761
  async onInit(_client) {
@@ -2738,7 +2799,7 @@ function zendeskIntegration(config = {}) {
2738
2799
  return {
2739
2800
  id: "zendesk",
2740
2801
  name: "Zendesk",
2741
- logoUrl: "https://cdn.simpleicons.org/zendesk",
2802
+ logoUrl: "https://wdvtnli2jn3texa6.public.blob.vercel-storage.com/zendesk.jpeg",
2742
2803
  tools: [...ZENDESK_TOOLS],
2743
2804
  oauth,
2744
2805
  async onInit(_client) {
@@ -2781,7 +2842,7 @@ function stripeIntegration(config = {}) {
2781
2842
  return {
2782
2843
  id: "stripe",
2783
2844
  name: "Stripe",
2784
- logoUrl: "https://cdn.simpleicons.org/stripe",
2845
+ logoUrl: "https://wdvtnli2jn3texa6.public.blob.vercel-storage.com/stripe.jpeg",
2785
2846
  tools: [...STRIPE_TOOLS],
2786
2847
  oauth,
2787
2848
  async onInit(_client) {
@@ -2824,7 +2885,7 @@ function gcalIntegration(config = {}) {
2824
2885
  return {
2825
2886
  id: "gcal",
2826
2887
  name: "Google Calendar",
2827
- logoUrl: "https://cdn.simpleicons.org/googlecalendar",
2888
+ logoUrl: "https://wdvtnli2jn3texa6.public.blob.vercel-storage.com/google_calendar.webp",
2828
2889
  tools: [...GCAL_TOOLS],
2829
2890
  oauth,
2830
2891
  async onInit(_client) {
@@ -2867,7 +2928,7 @@ function outlookIntegration(config = {}) {
2867
2928
  return {
2868
2929
  id: "outlook",
2869
2930
  name: "Outlook",
2870
- logoUrl: "https://cdn.simpleicons.org/microsoftoutlook",
2931
+ logoUrl: "https://wdvtnli2jn3texa6.public.blob.vercel-storage.com/outlook.png",
2871
2932
  tools: [...OUTLOOK_TOOLS],
2872
2933
  oauth,
2873
2934
  async onInit(_client) {
@@ -2910,7 +2971,7 @@ function airtableIntegration(config = {}) {
2910
2971
  return {
2911
2972
  id: "airtable",
2912
2973
  name: "Airtable",
2913
- logoUrl: "https://cdn.simpleicons.org/airtable",
2974
+ logoUrl: "https://wdvtnli2jn3texa6.public.blob.vercel-storage.com/airtable.jpeg",
2914
2975
  tools: [...AIRTABLE_TOOLS],
2915
2976
  oauth,
2916
2977
  async onInit(_client) {
@@ -2953,7 +3014,7 @@ function todoistIntegration(config = {}) {
2953
3014
  return {
2954
3015
  id: "todoist",
2955
3016
  name: "Todoist",
2956
- logoUrl: "https://cdn.simpleicons.org/todoist",
3017
+ logoUrl: "https://wdvtnli2jn3texa6.public.blob.vercel-storage.com/todoist.png",
2957
3018
  tools: [...TODOIST_TOOLS],
2958
3019
  oauth,
2959
3020
  async onInit(_client) {
@@ -2997,7 +3058,7 @@ function whatsappIntegration(config = {}) {
2997
3058
  return {
2998
3059
  id: "whatsapp",
2999
3060
  name: "WhatsApp Business",
3000
- logoUrl: "https://cdn.simpleicons.org/whatsapp",
3061
+ logoUrl: "https://wdvtnli2jn3texa6.public.blob.vercel-storage.com/whatsapp.png",
3001
3062
  tools: [...WHATSAPP_TOOLS],
3002
3063
  oauth,
3003
3064
  async onInit(_client) {
@@ -3040,7 +3101,7 @@ function calcomIntegration(config = {}) {
3040
3101
  return {
3041
3102
  id: "calcom",
3042
3103
  name: "Cal.com",
3043
- logoUrl: "https://cdn.simpleicons.org/calendly",
3104
+ logoUrl: "https://wdvtnli2jn3texa6.public.blob.vercel-storage.com/calcom.jpeg",
3044
3105
  tools: [...CALCOM_TOOLS],
3045
3106
  oauth,
3046
3107
  async onInit(_client) {
@@ -3084,7 +3145,7 @@ function rampIntegration(config = {}) {
3084
3145
  return {
3085
3146
  id: "ramp",
3086
3147
  name: "Ramp",
3087
- logoUrl: "https://cdn.simpleicons.org/ramp",
3148
+ logoUrl: "https://wdvtnli2jn3texa6.public.blob.vercel-storage.com/ramp.jpeg",
3088
3149
  tools: [...RAMP_TOOLS],
3089
3150
  oauth,
3090
3151
  async onInit(_client) {
@@ -3127,7 +3188,7 @@ function onedriveIntegration(config = {}) {
3127
3188
  return {
3128
3189
  id: "onedrive",
3129
3190
  name: "OneDrive",
3130
- logoUrl: "https://cdn.simpleicons.org/onedrive",
3191
+ logoUrl: "https://wdvtnli2jn3texa6.public.blob.vercel-storage.com/onedrive.webp",
3131
3192
  tools: [...ONEDRIVE_TOOLS],
3132
3193
  oauth,
3133
3194
  async onInit(_client) {
@@ -3178,7 +3239,7 @@ function gworkspaceIntegration(config = {}) {
3178
3239
  return {
3179
3240
  id: "gworkspace",
3180
3241
  name: "Google Workspace",
3181
- logoUrl: "https://cdn.simpleicons.org/google",
3242
+ logoUrl: "https://wdvtnli2jn3texa6.public.blob.vercel-storage.com/google_workspace.jpeg",
3182
3243
  tools: [...GWORKSPACE_TOOLS],
3183
3244
  oauth,
3184
3245
  async onInit(_client) {
@@ -3225,7 +3286,7 @@ function polarIntegration(config = {}) {
3225
3286
  return {
3226
3287
  id: "polar",
3227
3288
  name: "Polar",
3228
- logoUrl: "https://cdn.simpleicons.org/polar",
3289
+ logoUrl: "https://wdvtnli2jn3texa6.public.blob.vercel-storage.com/polar.png",
3229
3290
  tools: [...POLAR_TOOLS],
3230
3291
  oauth,
3231
3292
  async onInit(_client) {
@@ -3268,7 +3329,7 @@ function figmaIntegration(config = {}) {
3268
3329
  return {
3269
3330
  id: "figma",
3270
3331
  name: "Figma",
3271
- logoUrl: "https://cdn.simpleicons.org/figma",
3332
+ logoUrl: "https://wdvtnli2jn3texa6.public.blob.vercel-storage.com/figma.png",
3272
3333
  tools: [...FIGMA_TOOLS],
3273
3334
  oauth,
3274
3335
  async onInit(_client) {
@@ -3311,7 +3372,7 @@ function intercomIntegration(config = {}) {
3311
3372
  return {
3312
3373
  id: "intercom",
3313
3374
  name: "Intercom",
3314
- logoUrl: "https://cdn.simpleicons.org/intercom",
3375
+ logoUrl: "https://wdvtnli2jn3texa6.public.blob.vercel-storage.com/intercom.png",
3315
3376
  tools: [...INTERCOM_TOOLS],
3316
3377
  oauth,
3317
3378
  async onInit(_client) {
@@ -3362,7 +3423,7 @@ function hubspotIntegration(config = {}) {
3362
3423
  return {
3363
3424
  id: "hubspot",
3364
3425
  name: "HubSpot",
3365
- logoUrl: "https://cdn.simpleicons.org/hubspot",
3426
+ logoUrl: "https://wdvtnli2jn3texa6.public.blob.vercel-storage.com/hubspot.jpeg",
3366
3427
  tools: [...HUBSPOT_TOOLS],
3367
3428
  oauth,
3368
3429
  async onInit(_client) {
@@ -3408,7 +3469,7 @@ function youtubeIntegration(config = {}) {
3408
3469
  return {
3409
3470
  id: "youtube",
3410
3471
  name: "YouTube",
3411
- logoUrl: "https://cdn.simpleicons.org/youtube",
3472
+ logoUrl: "https://wdvtnli2jn3texa6.public.blob.vercel-storage.com/youtube.jpeg",
3412
3473
  tools: [...YOUTUBE_TOOLS],
3413
3474
  oauth,
3414
3475
  async onInit(_client) {
@@ -3441,7 +3502,7 @@ function cursorIntegration(_config = {}) {
3441
3502
  return {
3442
3503
  id: "cursor",
3443
3504
  name: "Cursor",
3444
- logoUrl: "https://cdn.simpleicons.org/cursor",
3505
+ logoUrl: "https://wdvtnli2jn3texa6.public.blob.vercel-storage.com/cursor.jpeg",
3445
3506
  tools: [...CURSOR_TOOLS],
3446
3507
  async onInit(_client) {
3447
3508
  logger28.debug("Cursor integration initialized");
@@ -9964,6 +10025,18 @@ function createMCPServer(config) {
9964
10025
  return Response.json({ error: error.message || "Failed to execute tool call" }, { status: error.statusCode || 500 });
9965
10026
  }
9966
10027
  }
10028
+ if (action === "integrations" && method === "GET") {
10029
+ const integrations = updatedIntegrations.map((integration) => ({
10030
+ id: integration.id,
10031
+ name: integration.name || integration.id,
10032
+ logoUrl: integration.logoUrl,
10033
+ tools: integration.tools,
10034
+ hasOAuth: !!integration.oauth,
10035
+ scopes: integration.oauth?.scopes,
10036
+ provider: integration.oauth?.provider
10037
+ }));
10038
+ return Response.json({ integrations });
10039
+ }
9967
10040
  if (segments.length >= 1 && segments[0] === "triggers") {
9968
10041
  if (!config.triggers) {
9969
10042
  return Response.json({ error: "Triggers not configured. Add triggers callbacks to createMCPServer config." }, { status: 501 });