integrate-sdk 0.9.27-dev.2 → 0.9.28-dev.1

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
@@ -800,6 +800,182 @@ var MCPMethod;
800
800
  MCPMethod2["PROMPTS_GET"] = "prompts/get";
801
801
  })(MCPMethod ||= {});
802
802
 
803
+ // src/integrations/library-metadata.ts
804
+ var INTEGRATION_CATEGORY_ORDER = [
805
+ "Productivity",
806
+ "Business",
807
+ "Communication",
808
+ "Engineering",
809
+ "Storage",
810
+ "Other"
811
+ ];
812
+ var INTEGRATION_LIBRARY_METADATA = {
813
+ airtable: {
814
+ description: "Manage Airtable bases, tables, and records",
815
+ category: "Business"
816
+ },
817
+ calcom: {
818
+ description: "Manage Cal.com bookings and schedules",
819
+ category: "Productivity"
820
+ },
821
+ cursor: {
822
+ description: "Manage Cursor Cloud Agents and background tasks",
823
+ category: "Engineering"
824
+ },
825
+ figma: {
826
+ description: "Access Figma files, comments, and components",
827
+ category: "Engineering"
828
+ },
829
+ github: {
830
+ description: "Manage GitHub repos, issues, and pull requests",
831
+ category: "Engineering"
832
+ },
833
+ gmail: {
834
+ description: "Send, read, and search Gmail messages",
835
+ category: "Communication"
836
+ },
837
+ gcal: {
838
+ description: "Manage Google Calendar events and schedules",
839
+ category: "Productivity"
840
+ },
841
+ hubspot: {
842
+ description: "Manage HubSpot contacts, deals, and tickets",
843
+ category: "Business"
844
+ },
845
+ intercom: {
846
+ description: "Manage Intercom contacts and conversations",
847
+ category: "Business"
848
+ },
849
+ linear: {
850
+ description: "Manage Linear issues, projects, and cycles",
851
+ category: "Engineering"
852
+ },
853
+ notion: {
854
+ description: "Manage Notion pages and databases",
855
+ category: "Productivity"
856
+ },
857
+ onedrive: {
858
+ description: "Manage OneDrive files, folders, and sharing",
859
+ category: "Storage"
860
+ },
861
+ outlook: {
862
+ description: "Manage Outlook mail, calendars, and contacts",
863
+ category: "Communication"
864
+ },
865
+ polar: {
866
+ description: "Manage Polar products, orders, and subscriptions",
867
+ category: "Business"
868
+ },
869
+ ramp: {
870
+ description: "Manage Ramp corporate cards, bills, and spend",
871
+ category: "Business"
872
+ },
873
+ slack: {
874
+ description: "Send and manage Slack messages and channels",
875
+ category: "Communication"
876
+ },
877
+ stripe: {
878
+ description: "Manage Stripe customers, payments, and subscriptions",
879
+ category: "Business"
880
+ },
881
+ todoist: {
882
+ description: "Manage Todoist tasks, projects, and labels",
883
+ category: "Productivity"
884
+ },
885
+ gslides: {
886
+ description: "Create and update Google Slides presentations",
887
+ category: "Productivity"
888
+ },
889
+ gsheets: {
890
+ description: "Read and update Google Sheets spreadsheets",
891
+ category: "Productivity"
892
+ },
893
+ gdocs: {
894
+ description: "Create and edit Google Docs documents",
895
+ category: "Productivity"
896
+ },
897
+ gdrive: {
898
+ description: "Manage Google Drive files, folders, and sharing",
899
+ category: "Storage"
900
+ },
901
+ vercel: {
902
+ description: "Manage Vercel projects, deployments, and domains",
903
+ category: "Engineering"
904
+ },
905
+ whatsapp: {
906
+ description: "Send WhatsApp messages and templates",
907
+ category: "Communication"
908
+ },
909
+ youtube: {
910
+ description: "Search and access YouTube videos and channels",
911
+ category: "Communication"
912
+ },
913
+ powerpoint: {
914
+ description: "Manage PowerPoint presentations and sharing",
915
+ category: "Productivity"
916
+ },
917
+ excel: {
918
+ description: "Manage Excel workbooks, worksheets, and tables",
919
+ category: "Productivity"
920
+ },
921
+ word: {
922
+ description: "Manage Word documents and sharing",
923
+ category: "Productivity"
924
+ },
925
+ dropbox: {
926
+ description: "Manage Dropbox files, folders, and sharing",
927
+ category: "Storage"
928
+ },
929
+ granola: {
930
+ description: "List and read Granola meeting notes and folders",
931
+ category: "Productivity"
932
+ },
933
+ mercury: {
934
+ description: "Manage Mercury bank accounts, cards, and transactions",
935
+ category: "Business"
936
+ },
937
+ zendesk: {
938
+ description: "Manage Zendesk tickets, users, and help center content",
939
+ category: "Business"
940
+ }
941
+ };
942
+ function integrationLibraryPresentationFields(integration) {
943
+ const id = typeof integration["id"] === "string" ? integration["id"] : String(integration["id"] ?? "");
944
+ const fromCatalog = id ? INTEGRATION_LIBRARY_METADATA[id] : undefined;
945
+ const explicitDescription = integration["description"];
946
+ const explicitCategory = integration["category"];
947
+ const description = typeof explicitDescription === "string" && explicitDescription.trim().length > 0 ? explicitDescription.trim() : fromCatalog?.description;
948
+ const category = typeof explicitCategory === "string" && explicitCategory.trim().length > 0 ? explicitCategory.trim() : fromCatalog?.category;
949
+ const out = {};
950
+ if (description)
951
+ out.description = description;
952
+ if (category)
953
+ out.category = category;
954
+ return out;
955
+ }
956
+
957
+ // src/integrations/integration-summary.ts
958
+ function toConfiguredIntegrationSummary(integration) {
959
+ const row = integration;
960
+ const pres = integrationLibraryPresentationFields(row);
961
+ return {
962
+ id: integration.id,
963
+ name: row.name || integration.id,
964
+ logoUrl: row.logoUrl,
965
+ tools: integration.tools,
966
+ hasOAuth: !!integration.oauth,
967
+ scopes: integration.oauth?.scopes,
968
+ provider: integration.oauth?.provider,
969
+ ...pres
970
+ };
971
+ }
972
+ function toConfiguredIntegrationWithToolMetadata(integration, toolMetadata) {
973
+ return {
974
+ ...toConfiguredIntegrationSummary(integration),
975
+ toolMetadata
976
+ };
977
+ }
978
+
803
979
  // src/client.ts
804
980
  init_errors();
805
981
 
@@ -1429,6 +1605,7 @@ class OAuthManager {
1429
1605
  }
1430
1606
  const provider = tokenData.provider || pendingAuth.provider;
1431
1607
  const tokenDataToStore = {
1608
+ sessionToken: tokenData.sessionToken,
1432
1609
  accessToken: tokenData.accessToken,
1433
1610
  refreshToken: tokenData.refreshToken,
1434
1611
  tokenType: tokenData.tokenType,
@@ -1470,6 +1647,7 @@ class OAuthManager {
1470
1647
  try {
1471
1648
  const response = await this.exchangeCodeForToken(pendingAuth.provider, code, pendingAuth.codeVerifier, state);
1472
1649
  const tokenData = {
1650
+ sessionToken: response.sessionToken,
1473
1651
  accessToken: response.accessToken,
1474
1652
  refreshToken: response.refreshToken,
1475
1653
  tokenType: response.tokenType,
@@ -2043,6 +2221,7 @@ class MCPClientBase {
2043
2221
  authState = new Map;
2044
2222
  oauthManager;
2045
2223
  eventEmitter = new SimpleEventEmitter;
2224
+ sessionToken;
2046
2225
  apiRouteBase;
2047
2226
  apiBaseUrl;
2048
2227
  databaseDetected = false;
@@ -2087,6 +2266,7 @@ class MCPClientBase {
2087
2266
  setProviderToken: config.setProviderToken,
2088
2267
  removeProviderToken: config.removeProviderToken
2089
2268
  });
2269
+ this.setSessionToken(config.sessionToken || this.loadSessionTokenFromStorage());
2090
2270
  for (const integration of this.integrations) {
2091
2271
  for (const toolName of integration.tools) {
2092
2272
  this.enabledToolNames.add(toolName);
@@ -2109,6 +2289,9 @@ class MCPClientBase {
2109
2289
  const provider = integration.oauth.provider;
2110
2290
  try {
2111
2291
  const tokenData = await this.oauthManager.getProviderToken(provider);
2292
+ if (tokenData?.sessionToken && !this.sessionToken) {
2293
+ this.setSessionToken(tokenData.sessionToken);
2294
+ }
2112
2295
  const currentState = this.authState.get(provider);
2113
2296
  if (currentState && !currentState.authenticated && !currentState.lastError) {
2114
2297
  this.authState.set(provider, { authenticated: !!tokenData });
@@ -2133,6 +2316,9 @@ class MCPClientBase {
2133
2316
  const provider = integration.oauth.provider;
2134
2317
  const tokenData = this.oauthManager.getProviderTokenFromCache(provider);
2135
2318
  if (tokenData) {
2319
+ if (tokenData.sessionToken && !this.sessionToken) {
2320
+ this.setSessionToken(tokenData.sessionToken);
2321
+ }
2136
2322
  this.authState.set(provider, { authenticated: true });
2137
2323
  }
2138
2324
  }
@@ -2238,31 +2424,14 @@ class MCPClientBase {
2238
2424
  const serverConfig = this.__oauthConfig;
2239
2425
  const localIntegrations = serverConfig?.integrations || this.__configuredIntegrations;
2240
2426
  const formatLocalIntegrations = (integrations) => ({
2241
- integrations: integrations.map((integration) => ({
2242
- id: integration.id,
2243
- name: integration.name || integration.id,
2244
- logoUrl: integration.logoUrl,
2245
- tools: integration.tools,
2246
- hasOAuth: !!integration.oauth,
2247
- scopes: integration.oauth?.scopes,
2248
- provider: integration.oauth?.provider
2249
- }))
2427
+ integrations: integrations.map((integration) => toConfiguredIntegrationSummary(integration))
2250
2428
  });
2251
2429
  if (hasApiKey || !this.__useServerConfig) {
2252
2430
  if (options?.includeToolMetadata && hasApiKey) {
2253
2431
  await this.ensureConnected();
2254
2432
  const integrationsWithMetadata = localIntegrations.map((integration) => {
2255
2433
  const toolMetadata = integration.tools.map((toolName) => this.availableTools.get(toolName)).filter((tool) => !!tool);
2256
- return {
2257
- id: integration.id,
2258
- name: integration.name || integration.id,
2259
- logoUrl: integration.logoUrl,
2260
- tools: integration.tools,
2261
- hasOAuth: !!integration.oauth,
2262
- scopes: integration.oauth?.scopes,
2263
- provider: integration.oauth?.provider,
2264
- toolMetadata
2265
- };
2434
+ return toConfiguredIntegrationWithToolMetadata(integration, toolMetadata);
2266
2435
  });
2267
2436
  return { integrations: integrationsWithMetadata };
2268
2437
  }
@@ -2288,28 +2457,10 @@ class MCPClientBase {
2288
2457
  }
2289
2458
  }
2290
2459
  }
2291
- return {
2292
- id: integration.id,
2293
- name: integration.name || integration.id,
2294
- logoUrl: integration.logoUrl,
2295
- tools: integration.tools,
2296
- hasOAuth: !!integration.oauth,
2297
- scopes: integration.oauth?.scopes,
2298
- provider: integration.oauth?.provider,
2299
- toolMetadata
2300
- };
2460
+ return toConfiguredIntegrationWithToolMetadata(integration, toolMetadata);
2301
2461
  } catch (error) {
2302
2462
  logger5.error(`Failed to fetch tool metadata for ${integration.id}:`, error);
2303
- return {
2304
- id: integration.id,
2305
- name: integration.name || integration.id,
2306
- logoUrl: integration.logoUrl,
2307
- tools: integration.tools,
2308
- hasOAuth: !!integration.oauth,
2309
- scopes: integration.oauth?.scopes,
2310
- provider: integration.oauth?.provider,
2311
- toolMetadata: []
2312
- };
2463
+ return toConfiguredIntegrationWithToolMetadata(integration, []);
2313
2464
  }
2314
2465
  }, 3);
2315
2466
  return { integrations: integrationsWithMetadata };
@@ -2329,6 +2480,12 @@ class MCPClientBase {
2329
2480
  return formatLocalIntegrations(localIntegrations);
2330
2481
  }
2331
2482
  const result = await response.json();
2483
+ if (result.integrations && Array.isArray(result.integrations)) {
2484
+ result.integrations = result.integrations.map((row) => ({
2485
+ ...row,
2486
+ ...integrationLibraryPresentationFields(row)
2487
+ }));
2488
+ }
2332
2489
  if (options?.includeToolMetadata && result.integrations) {
2333
2490
  const { parallelWithLimit: parallelWithLimit2 } = await Promise.resolve().then(() => exports_concurrency);
2334
2491
  const integrationsWithMetadata = await parallelWithLimit2(result.integrations, async (integration) => {
@@ -2353,12 +2510,14 @@ class MCPClientBase {
2353
2510
  }
2354
2511
  return {
2355
2512
  ...integration,
2513
+ ...integrationLibraryPresentationFields(integration),
2356
2514
  toolMetadata
2357
2515
  };
2358
2516
  } catch (error) {
2359
2517
  logger5.error(`Failed to fetch tool metadata for ${integration.id}:`, error);
2360
2518
  return {
2361
2519
  ...integration,
2520
+ ...integrationLibraryPresentationFields(integration),
2362
2521
  toolMetadata: []
2363
2522
  };
2364
2523
  }
@@ -2501,17 +2660,15 @@ class MCPClientBase {
2501
2660
  const headers = {
2502
2661
  "Content-Type": "application/json"
2503
2662
  };
2663
+ if (this.sessionToken) {
2664
+ headers["Authorization"] = `Bearer ${this.sessionToken}`;
2665
+ headers["X-Session-Token"] = this.sessionToken;
2666
+ }
2504
2667
  const integrationsHeader = this.getIntegrationHeaderValue();
2505
2668
  if (integrationsHeader) {
2506
2669
  headers["X-Integrations"] = integrationsHeader;
2507
2670
  }
2508
2671
  Object.assign(headers, integrationHeaders);
2509
- if (provider) {
2510
- const tokenData = await this.oauthManager.getProviderToken(provider, undefined, options?.context);
2511
- if (tokenData) {
2512
- headers["Authorization"] = `Bearer ${tokenData.accessToken}`;
2513
- }
2514
- }
2515
2672
  const response = await fetch(url, {
2516
2673
  method: "POST",
2517
2674
  headers,
@@ -2710,7 +2867,35 @@ class MCPClientBase {
2710
2867
  off(event, handler) {
2711
2868
  this.eventEmitter.off(event, handler);
2712
2869
  }
2870
+ loadSessionTokenFromStorage() {
2871
+ if (typeof window === "undefined" || !window.sessionStorage) {
2872
+ return;
2873
+ }
2874
+ try {
2875
+ return window.sessionStorage.getItem("integrate_session_token") || undefined;
2876
+ } catch {
2877
+ return;
2878
+ }
2879
+ }
2880
+ setSessionToken(sessionToken) {
2881
+ this.sessionToken = sessionToken;
2882
+ if (sessionToken) {
2883
+ this.transport.setHeader("X-Session-Token", sessionToken);
2884
+ } else {
2885
+ this.transport.removeHeader("X-Session-Token");
2886
+ }
2887
+ if (typeof window !== "undefined" && window.sessionStorage) {
2888
+ try {
2889
+ if (sessionToken) {
2890
+ window.sessionStorage.setItem("integrate_session_token", sessionToken);
2891
+ } else {
2892
+ window.sessionStorage.removeItem("integrate_session_token");
2893
+ }
2894
+ } catch {}
2895
+ }
2896
+ }
2713
2897
  clearSessionToken() {
2898
+ this.setSessionToken(undefined);
2714
2899
  this.oauthManager.clearAllProviderTokens();
2715
2900
  for (const integration of this.integrations) {
2716
2901
  if (integration.oauth) {
@@ -2852,6 +3037,7 @@ class MCPClientBase {
2852
3037
  if (tokenData) {
2853
3038
  this.eventEmitter.emit("auth:complete", {
2854
3039
  provider,
3040
+ sessionToken: tokenData.sessionToken || this.sessionToken,
2855
3041
  accessToken: tokenData.accessToken,
2856
3042
  expiresAt: tokenData.expiresAt
2857
3043
  });
@@ -2867,6 +3053,7 @@ class MCPClientBase {
2867
3053
  if (tokenData) {
2868
3054
  this.eventEmitter.emit("auth:complete", {
2869
3055
  provider,
3056
+ sessionToken: tokenData.sessionToken || this.sessionToken,
2870
3057
  accessToken: tokenData.accessToken,
2871
3058
  expiresAt: tokenData.expiresAt
2872
3059
  });
@@ -2880,9 +3067,13 @@ class MCPClientBase {
2880
3067
  async handleOAuthCallback(params) {
2881
3068
  try {
2882
3069
  const result = params.tokenData ? await this.oauthManager.handleCallbackWithToken(params.code, params.state, params.tokenData) : await this.oauthManager.handleCallback(params.code, params.state);
3070
+ if (result.sessionToken) {
3071
+ this.setSessionToken(result.sessionToken);
3072
+ }
2883
3073
  this.authState.set(result.provider, { authenticated: true });
2884
3074
  this.eventEmitter.emit("auth:complete", {
2885
3075
  provider: result.provider,
3076
+ sessionToken: result.sessionToken || this.sessionToken,
2886
3077
  accessToken: result.accessToken,
2887
3078
  expiresAt: result.expiresAt
2888
3079
  });
@@ -3103,14 +3294,8 @@ class OAuthHandler {
3103
3294
  const integrations = this.config.integrations || [];
3104
3295
  return {
3105
3296
  integrations: integrations.map((integration) => ({
3106
- id: integration.id,
3107
- name: integration.name || integration.id,
3108
- logoUrl: integration.logoUrl,
3109
- tools: integration.tools,
3110
- hasOAuth: !!integration.oauth,
3111
- scopes: integration.oauth?.scopes,
3112
- optionalScopes: integration.oauth?.optionalScopes,
3113
- provider: integration.oauth?.provider
3297
+ ...toConfiguredIntegrationSummary(integration),
3298
+ optionalScopes: integration.oauth?.optionalScopes
3114
3299
  }))
3115
3300
  };
3116
3301
  }
@@ -3280,6 +3465,7 @@ class OAuthHandler {
3280
3465
  if (this.config.setProviderToken) {
3281
3466
  try {
3282
3467
  const tokenData = {
3468
+ sessionToken: result.sessionToken,
3283
3469
  accessToken: result.accessToken,
3284
3470
  refreshToken: result.refreshToken,
3285
3471
  tokenType: result.tokenType,
@@ -3635,7 +3821,7 @@ function createNextOAuthHandler(config) {
3635
3821
  const codeModeHeader = req.headers.get("x-integrate-code-mode");
3636
3822
  const tokensHeader = req.headers.get("x-integrate-tokens");
3637
3823
  const toolName = typeof body?.name === "string" ? body.name : "";
3638
- if (codeModeHeader === "1" && tokensHeader && toolName) {
3824
+ if (codeModeHeader === "1" && !authHeader && tokensHeader && toolName) {
3639
3825
  try {
3640
3826
  const tokens = JSON.parse(tokensHeader);
3641
3827
  let best = null;
@@ -5690,6 +5876,7 @@ export {
5690
5876
  MCPClientBase,
5691
5877
  MAX_TRIGGER_STEPS,
5692
5878
  IntegrateSDKError,
5879
+ INTEGRATION_CATEGORY_ORDER,
5693
5880
  HttpSessionTransport,
5694
5881
  ConnectionError,
5695
5882
  AuthorizationError,
package/dist/oauth.js CHANGED
@@ -27,6 +27,180 @@ var __export = (target, all) => {
27
27
  var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
28
28
  var __require = /* @__PURE__ */ createRequire(import.meta.url);
29
29
 
30
+ // src/integrations/library-metadata.ts
31
+ function integrationLibraryPresentationFields(integration) {
32
+ const id = typeof integration["id"] === "string" ? integration["id"] : String(integration["id"] ?? "");
33
+ const fromCatalog = id ? INTEGRATION_LIBRARY_METADATA[id] : undefined;
34
+ const explicitDescription = integration["description"];
35
+ const explicitCategory = integration["category"];
36
+ const description = typeof explicitDescription === "string" && explicitDescription.trim().length > 0 ? explicitDescription.trim() : fromCatalog?.description;
37
+ const category = typeof explicitCategory === "string" && explicitCategory.trim().length > 0 ? explicitCategory.trim() : fromCatalog?.category;
38
+ const out = {};
39
+ if (description)
40
+ out.description = description;
41
+ if (category)
42
+ out.category = category;
43
+ return out;
44
+ }
45
+ var INTEGRATION_LIBRARY_METADATA;
46
+ var init_library_metadata = __esm(() => {
47
+ INTEGRATION_LIBRARY_METADATA = {
48
+ airtable: {
49
+ description: "Manage Airtable bases, tables, and records",
50
+ category: "Business"
51
+ },
52
+ calcom: {
53
+ description: "Manage Cal.com bookings and schedules",
54
+ category: "Productivity"
55
+ },
56
+ cursor: {
57
+ description: "Manage Cursor Cloud Agents and background tasks",
58
+ category: "Engineering"
59
+ },
60
+ figma: {
61
+ description: "Access Figma files, comments, and components",
62
+ category: "Engineering"
63
+ },
64
+ github: {
65
+ description: "Manage GitHub repos, issues, and pull requests",
66
+ category: "Engineering"
67
+ },
68
+ gmail: {
69
+ description: "Send, read, and search Gmail messages",
70
+ category: "Communication"
71
+ },
72
+ gcal: {
73
+ description: "Manage Google Calendar events and schedules",
74
+ category: "Productivity"
75
+ },
76
+ hubspot: {
77
+ description: "Manage HubSpot contacts, deals, and tickets",
78
+ category: "Business"
79
+ },
80
+ intercom: {
81
+ description: "Manage Intercom contacts and conversations",
82
+ category: "Business"
83
+ },
84
+ linear: {
85
+ description: "Manage Linear issues, projects, and cycles",
86
+ category: "Engineering"
87
+ },
88
+ notion: {
89
+ description: "Manage Notion pages and databases",
90
+ category: "Productivity"
91
+ },
92
+ onedrive: {
93
+ description: "Manage OneDrive files, folders, and sharing",
94
+ category: "Storage"
95
+ },
96
+ outlook: {
97
+ description: "Manage Outlook mail, calendars, and contacts",
98
+ category: "Communication"
99
+ },
100
+ polar: {
101
+ description: "Manage Polar products, orders, and subscriptions",
102
+ category: "Business"
103
+ },
104
+ ramp: {
105
+ description: "Manage Ramp corporate cards, bills, and spend",
106
+ category: "Business"
107
+ },
108
+ slack: {
109
+ description: "Send and manage Slack messages and channels",
110
+ category: "Communication"
111
+ },
112
+ stripe: {
113
+ description: "Manage Stripe customers, payments, and subscriptions",
114
+ category: "Business"
115
+ },
116
+ todoist: {
117
+ description: "Manage Todoist tasks, projects, and labels",
118
+ category: "Productivity"
119
+ },
120
+ gslides: {
121
+ description: "Create and update Google Slides presentations",
122
+ category: "Productivity"
123
+ },
124
+ gsheets: {
125
+ description: "Read and update Google Sheets spreadsheets",
126
+ category: "Productivity"
127
+ },
128
+ gdocs: {
129
+ description: "Create and edit Google Docs documents",
130
+ category: "Productivity"
131
+ },
132
+ gdrive: {
133
+ description: "Manage Google Drive files, folders, and sharing",
134
+ category: "Storage"
135
+ },
136
+ vercel: {
137
+ description: "Manage Vercel projects, deployments, and domains",
138
+ category: "Engineering"
139
+ },
140
+ whatsapp: {
141
+ description: "Send WhatsApp messages and templates",
142
+ category: "Communication"
143
+ },
144
+ youtube: {
145
+ description: "Search and access YouTube videos and channels",
146
+ category: "Communication"
147
+ },
148
+ powerpoint: {
149
+ description: "Manage PowerPoint presentations and sharing",
150
+ category: "Productivity"
151
+ },
152
+ excel: {
153
+ description: "Manage Excel workbooks, worksheets, and tables",
154
+ category: "Productivity"
155
+ },
156
+ word: {
157
+ description: "Manage Word documents and sharing",
158
+ category: "Productivity"
159
+ },
160
+ dropbox: {
161
+ description: "Manage Dropbox files, folders, and sharing",
162
+ category: "Storage"
163
+ },
164
+ granola: {
165
+ description: "List and read Granola meeting notes and folders",
166
+ category: "Productivity"
167
+ },
168
+ mercury: {
169
+ description: "Manage Mercury bank accounts, cards, and transactions",
170
+ category: "Business"
171
+ },
172
+ zendesk: {
173
+ description: "Manage Zendesk tickets, users, and help center content",
174
+ category: "Business"
175
+ }
176
+ };
177
+ });
178
+
179
+ // src/integrations/integration-summary.ts
180
+ function toConfiguredIntegrationSummary(integration) {
181
+ const row = integration;
182
+ const pres = integrationLibraryPresentationFields(row);
183
+ return {
184
+ id: integration.id,
185
+ name: row.name || integration.id,
186
+ logoUrl: row.logoUrl,
187
+ tools: integration.tools,
188
+ hasOAuth: !!integration.oauth,
189
+ scopes: integration.oauth?.scopes,
190
+ provider: integration.oauth?.provider,
191
+ ...pres
192
+ };
193
+ }
194
+ function toConfiguredIntegrationWithToolMetadata(integration, toolMetadata) {
195
+ return {
196
+ ...toConfiguredIntegrationSummary(integration),
197
+ toolMetadata
198
+ };
199
+ }
200
+ var init_integration_summary = __esm(() => {
201
+ init_library_metadata();
202
+ });
203
+
30
204
  // src/utils/logger.ts
31
205
  function shouldLog(level, context) {
32
206
  return logLevelHierarchy[level] <= logLevelHierarchy[contextLogLevels[context]];
@@ -472,14 +646,8 @@ class OAuthHandler {
472
646
  const integrations = this.config.integrations || [];
473
647
  return {
474
648
  integrations: integrations.map((integration) => ({
475
- id: integration.id,
476
- name: integration.name || integration.id,
477
- logoUrl: integration.logoUrl,
478
- tools: integration.tools,
479
- hasOAuth: !!integration.oauth,
480
- scopes: integration.oauth?.scopes,
481
- optionalScopes: integration.oauth?.optionalScopes,
482
- provider: integration.oauth?.provider
649
+ ...toConfiguredIntegrationSummary(integration),
650
+ optionalScopes: integration.oauth?.optionalScopes
483
651
  }))
484
652
  };
485
653
  }
@@ -649,6 +817,7 @@ class OAuthHandler {
649
817
  if (this.config.setProviderToken) {
650
818
  try {
651
819
  const tokenData = {
820
+ sessionToken: result.sessionToken,
652
821
  accessToken: result.accessToken,
653
822
  refreshToken: result.refreshToken,
654
823
  tokenType: result.tokenType,
@@ -866,6 +1035,7 @@ class OAuthHandler {
866
1035
  }
867
1036
  var SERVER_LOG_CONTEXT = "server", logger2, MCP_SERVER_URL = "https://mcp.integrate.dev/api/v1/mcp";
868
1037
  var init_base_handler = __esm(() => {
1038
+ init_integration_summary();
869
1039
  init_email_fetcher();
870
1040
  init_logger();
871
1041
  logger2 = createLogger("OAuthHandler", SERVER_LOG_CONTEXT);