integrate-sdk 0.9.27-dev.1 → 0.9.28-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/README.md +82 -0
- package/dist/adapters/auto-routes.js +177 -8
- package/dist/adapters/base-handler.d.ts +4 -2
- package/dist/adapters/base-handler.d.ts.map +1 -1
- package/dist/adapters/base-handler.js +177 -8
- package/dist/adapters/index.js +245 -81
- package/dist/adapters/nextjs.js +177 -8
- package/dist/adapters/solid-start.js +245 -81
- package/dist/adapters/svelte-kit.js +245 -81
- package/dist/index.js +422 -109
- package/dist/oauth.js +177 -8
- package/dist/server.js +449 -138
- package/dist/src/adapters/base-handler.d.ts +4 -2
- package/dist/src/adapters/base-handler.d.ts.map +1 -1
- package/dist/src/client.d.ts +8 -0
- package/dist/src/client.d.ts.map +1 -1
- package/dist/src/index.d.ts +8 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/integrations/dropbox.d.ts +22 -0
- package/dist/src/integrations/dropbox.d.ts.map +1 -0
- package/dist/src/integrations/granola.d.ts +14 -0
- package/dist/src/integrations/granola.d.ts.map +1 -0
- package/dist/src/integrations/integration-summary.d.ts +24 -0
- package/dist/src/integrations/integration-summary.d.ts.map +1 -0
- package/dist/src/integrations/library-metadata.d.ts +26 -0
- package/dist/src/integrations/library-metadata.d.ts.map +1 -0
- package/dist/src/integrations/mercury.d.ts +14 -0
- package/dist/src/integrations/mercury.d.ts.map +1 -0
- package/dist/src/integrations/server-client.d.ts +4 -0
- package/dist/src/integrations/server-client.d.ts.map +1 -1
- package/dist/src/integrations/types.d.ts +12 -0
- package/dist/src/integrations/types.d.ts.map +1 -1
- package/dist/src/server.d.ts +3 -0
- package/dist/src/server.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/server.js
CHANGED
|
@@ -74,6 +74,180 @@ var init_logger = __esm(() => {
|
|
|
74
74
|
};
|
|
75
75
|
});
|
|
76
76
|
|
|
77
|
+
// src/integrations/library-metadata.ts
|
|
78
|
+
function integrationLibraryPresentationFields(integration) {
|
|
79
|
+
const id = typeof integration["id"] === "string" ? integration["id"] : String(integration["id"] ?? "");
|
|
80
|
+
const fromCatalog = id ? INTEGRATION_LIBRARY_METADATA[id] : undefined;
|
|
81
|
+
const explicitDescription = integration["description"];
|
|
82
|
+
const explicitCategory = integration["category"];
|
|
83
|
+
const description = typeof explicitDescription === "string" && explicitDescription.trim().length > 0 ? explicitDescription.trim() : fromCatalog?.description;
|
|
84
|
+
const category = typeof explicitCategory === "string" && explicitCategory.trim().length > 0 ? explicitCategory.trim() : fromCatalog?.category;
|
|
85
|
+
const out = {};
|
|
86
|
+
if (description)
|
|
87
|
+
out.description = description;
|
|
88
|
+
if (category)
|
|
89
|
+
out.category = category;
|
|
90
|
+
return out;
|
|
91
|
+
}
|
|
92
|
+
var INTEGRATION_LIBRARY_METADATA;
|
|
93
|
+
var init_library_metadata = __esm(() => {
|
|
94
|
+
INTEGRATION_LIBRARY_METADATA = {
|
|
95
|
+
airtable: {
|
|
96
|
+
description: "Manage Airtable bases, tables, and records",
|
|
97
|
+
category: "Business"
|
|
98
|
+
},
|
|
99
|
+
calcom: {
|
|
100
|
+
description: "Manage Cal.com bookings and schedules",
|
|
101
|
+
category: "Productivity"
|
|
102
|
+
},
|
|
103
|
+
cursor: {
|
|
104
|
+
description: "Manage Cursor Cloud Agents and background tasks",
|
|
105
|
+
category: "Engineering"
|
|
106
|
+
},
|
|
107
|
+
figma: {
|
|
108
|
+
description: "Access Figma files, comments, and components",
|
|
109
|
+
category: "Engineering"
|
|
110
|
+
},
|
|
111
|
+
github: {
|
|
112
|
+
description: "Manage GitHub repos, issues, and pull requests",
|
|
113
|
+
category: "Engineering"
|
|
114
|
+
},
|
|
115
|
+
gmail: {
|
|
116
|
+
description: "Send, read, and search Gmail messages",
|
|
117
|
+
category: "Communication"
|
|
118
|
+
},
|
|
119
|
+
gcal: {
|
|
120
|
+
description: "Manage Google Calendar events and schedules",
|
|
121
|
+
category: "Productivity"
|
|
122
|
+
},
|
|
123
|
+
hubspot: {
|
|
124
|
+
description: "Manage HubSpot contacts, deals, and tickets",
|
|
125
|
+
category: "Business"
|
|
126
|
+
},
|
|
127
|
+
intercom: {
|
|
128
|
+
description: "Manage Intercom contacts and conversations",
|
|
129
|
+
category: "Business"
|
|
130
|
+
},
|
|
131
|
+
linear: {
|
|
132
|
+
description: "Manage Linear issues, projects, and cycles",
|
|
133
|
+
category: "Engineering"
|
|
134
|
+
},
|
|
135
|
+
notion: {
|
|
136
|
+
description: "Manage Notion pages and databases",
|
|
137
|
+
category: "Productivity"
|
|
138
|
+
},
|
|
139
|
+
onedrive: {
|
|
140
|
+
description: "Manage OneDrive files, folders, and sharing",
|
|
141
|
+
category: "Storage"
|
|
142
|
+
},
|
|
143
|
+
outlook: {
|
|
144
|
+
description: "Manage Outlook mail, calendars, and contacts",
|
|
145
|
+
category: "Communication"
|
|
146
|
+
},
|
|
147
|
+
polar: {
|
|
148
|
+
description: "Manage Polar products, orders, and subscriptions",
|
|
149
|
+
category: "Business"
|
|
150
|
+
},
|
|
151
|
+
ramp: {
|
|
152
|
+
description: "Manage Ramp corporate cards, bills, and spend",
|
|
153
|
+
category: "Business"
|
|
154
|
+
},
|
|
155
|
+
slack: {
|
|
156
|
+
description: "Send and manage Slack messages and channels",
|
|
157
|
+
category: "Communication"
|
|
158
|
+
},
|
|
159
|
+
stripe: {
|
|
160
|
+
description: "Manage Stripe customers, payments, and subscriptions",
|
|
161
|
+
category: "Business"
|
|
162
|
+
},
|
|
163
|
+
todoist: {
|
|
164
|
+
description: "Manage Todoist tasks, projects, and labels",
|
|
165
|
+
category: "Productivity"
|
|
166
|
+
},
|
|
167
|
+
gslides: {
|
|
168
|
+
description: "Create and update Google Slides presentations",
|
|
169
|
+
category: "Productivity"
|
|
170
|
+
},
|
|
171
|
+
gsheets: {
|
|
172
|
+
description: "Read and update Google Sheets spreadsheets",
|
|
173
|
+
category: "Productivity"
|
|
174
|
+
},
|
|
175
|
+
gdocs: {
|
|
176
|
+
description: "Create and edit Google Docs documents",
|
|
177
|
+
category: "Productivity"
|
|
178
|
+
},
|
|
179
|
+
gdrive: {
|
|
180
|
+
description: "Manage Google Drive files, folders, and sharing",
|
|
181
|
+
category: "Storage"
|
|
182
|
+
},
|
|
183
|
+
vercel: {
|
|
184
|
+
description: "Manage Vercel projects, deployments, and domains",
|
|
185
|
+
category: "Engineering"
|
|
186
|
+
},
|
|
187
|
+
whatsapp: {
|
|
188
|
+
description: "Send WhatsApp messages and templates",
|
|
189
|
+
category: "Communication"
|
|
190
|
+
},
|
|
191
|
+
youtube: {
|
|
192
|
+
description: "Search and access YouTube videos and channels",
|
|
193
|
+
category: "Communication"
|
|
194
|
+
},
|
|
195
|
+
powerpoint: {
|
|
196
|
+
description: "Manage PowerPoint presentations and sharing",
|
|
197
|
+
category: "Productivity"
|
|
198
|
+
},
|
|
199
|
+
excel: {
|
|
200
|
+
description: "Manage Excel workbooks, worksheets, and tables",
|
|
201
|
+
category: "Productivity"
|
|
202
|
+
},
|
|
203
|
+
word: {
|
|
204
|
+
description: "Manage Word documents and sharing",
|
|
205
|
+
category: "Productivity"
|
|
206
|
+
},
|
|
207
|
+
dropbox: {
|
|
208
|
+
description: "Manage Dropbox files, folders, and sharing",
|
|
209
|
+
category: "Storage"
|
|
210
|
+
},
|
|
211
|
+
granola: {
|
|
212
|
+
description: "List and read Granola meeting notes and folders",
|
|
213
|
+
category: "Productivity"
|
|
214
|
+
},
|
|
215
|
+
mercury: {
|
|
216
|
+
description: "Manage Mercury bank accounts, cards, and transactions",
|
|
217
|
+
category: "Business"
|
|
218
|
+
},
|
|
219
|
+
zendesk: {
|
|
220
|
+
description: "Manage Zendesk tickets, users, and help center content",
|
|
221
|
+
category: "Business"
|
|
222
|
+
}
|
|
223
|
+
};
|
|
224
|
+
});
|
|
225
|
+
|
|
226
|
+
// src/integrations/integration-summary.ts
|
|
227
|
+
function toConfiguredIntegrationSummary(integration) {
|
|
228
|
+
const row = integration;
|
|
229
|
+
const pres = integrationLibraryPresentationFields(row);
|
|
230
|
+
return {
|
|
231
|
+
id: integration.id,
|
|
232
|
+
name: row.name || integration.id,
|
|
233
|
+
logoUrl: row.logoUrl,
|
|
234
|
+
tools: integration.tools,
|
|
235
|
+
hasOAuth: !!integration.oauth,
|
|
236
|
+
scopes: integration.oauth?.scopes,
|
|
237
|
+
provider: integration.oauth?.provider,
|
|
238
|
+
...pres
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
function toConfiguredIntegrationWithToolMetadata(integration, toolMetadata) {
|
|
242
|
+
return {
|
|
243
|
+
...toConfiguredIntegrationSummary(integration),
|
|
244
|
+
toolMetadata
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
var init_integration_summary = __esm(() => {
|
|
248
|
+
init_library_metadata();
|
|
249
|
+
});
|
|
250
|
+
|
|
77
251
|
// src/errors.ts
|
|
78
252
|
var exports_errors = {};
|
|
79
253
|
__export(exports_errors, {
|
|
@@ -748,14 +922,8 @@ class OAuthHandler {
|
|
|
748
922
|
const integrations = this.config.integrations || [];
|
|
749
923
|
return {
|
|
750
924
|
integrations: integrations.map((integration) => ({
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
logoUrl: integration.logoUrl,
|
|
754
|
-
tools: integration.tools,
|
|
755
|
-
hasOAuth: !!integration.oauth,
|
|
756
|
-
scopes: integration.oauth?.scopes,
|
|
757
|
-
optionalScopes: integration.oauth?.optionalScopes,
|
|
758
|
-
provider: integration.oauth?.provider
|
|
925
|
+
...toConfiguredIntegrationSummary(integration),
|
|
926
|
+
optionalScopes: integration.oauth?.optionalScopes
|
|
759
927
|
}))
|
|
760
928
|
};
|
|
761
929
|
}
|
|
@@ -1142,6 +1310,7 @@ class OAuthHandler {
|
|
|
1142
1310
|
}
|
|
1143
1311
|
var SERVER_LOG_CONTEXT = "server", logger6, MCP_SERVER_URL2 = "https://mcp.integrate.dev/api/v1/mcp";
|
|
1144
1312
|
var init_base_handler = __esm(() => {
|
|
1313
|
+
init_integration_summary();
|
|
1145
1314
|
init_email_fetcher();
|
|
1146
1315
|
init_logger();
|
|
1147
1316
|
logger6 = createLogger("OAuthHandler", SERVER_LOG_CONTEXT);
|
|
@@ -2033,7 +2202,7 @@ async function deliverWebhook(webhook, payload, timeoutMs) {
|
|
|
2033
2202
|
signal: controller.signal
|
|
2034
2203
|
});
|
|
2035
2204
|
if (!response.ok) {
|
|
2036
|
-
|
|
2205
|
+
logger38.warn(`Webhook delivery to ${webhook.url} returned ${response.status}`);
|
|
2037
2206
|
}
|
|
2038
2207
|
} finally {
|
|
2039
2208
|
clearTimeout(timeout);
|
|
@@ -2046,14 +2215,14 @@ async function deliverWebhooks(webhooks, payload, timeoutMs) {
|
|
|
2046
2215
|
for (let i = 0;i < results.length; i++) {
|
|
2047
2216
|
const result = results[i];
|
|
2048
2217
|
if (result.status === "rejected") {
|
|
2049
|
-
|
|
2218
|
+
logger38.warn(`Webhook delivery to ${webhooks[i].url} failed:`, result.reason);
|
|
2050
2219
|
}
|
|
2051
2220
|
}
|
|
2052
2221
|
}
|
|
2053
|
-
var
|
|
2222
|
+
var logger38;
|
|
2054
2223
|
var init_webhooks = __esm(() => {
|
|
2055
2224
|
init_logger();
|
|
2056
|
-
|
|
2225
|
+
logger38 = createLogger("Webhooks", "server");
|
|
2057
2226
|
});
|
|
2058
2227
|
|
|
2059
2228
|
// src/triggers/types.ts
|
|
@@ -2073,13 +2242,13 @@ async function executeTrigger(trigger, config, context) {
|
|
|
2073
2242
|
while (stepIndex < MAX_TRIGGER_STEPS) {
|
|
2074
2243
|
const stepValidation = validateStepLimit(stepIndex, MAX_TRIGGER_STEPS);
|
|
2075
2244
|
if (!stepValidation.valid) {
|
|
2076
|
-
|
|
2245
|
+
logger39.error(`[Trigger ${trigger.id}] ${stepValidation.error}`);
|
|
2077
2246
|
break;
|
|
2078
2247
|
}
|
|
2079
2248
|
const providerToken = await config.getProviderToken(currentProvider, undefined, context);
|
|
2080
2249
|
if (!providerToken) {
|
|
2081
2250
|
const error = `No OAuth token available for provider '${currentProvider}'`;
|
|
2082
|
-
|
|
2251
|
+
logger39.error(`[Trigger ${trigger.id}] ${error}`);
|
|
2083
2252
|
steps.push({
|
|
2084
2253
|
stepIndex,
|
|
2085
2254
|
toolName: currentToolName,
|
|
@@ -2105,7 +2274,7 @@ async function executeTrigger(trigger, config, context) {
|
|
|
2105
2274
|
} catch (err) {
|
|
2106
2275
|
stepSuccess = false;
|
|
2107
2276
|
stepError = err.message || "Tool execution failed";
|
|
2108
|
-
|
|
2277
|
+
logger39.error(`[Trigger ${trigger.id}] Step ${stepIndex} failed:`, err);
|
|
2109
2278
|
}
|
|
2110
2279
|
if (stepSuccess && toolResult) {
|
|
2111
2280
|
if (toolResult.isError === true) {
|
|
@@ -2198,7 +2367,7 @@ async function executeTrigger(trigger, config, context) {
|
|
|
2198
2367
|
return { success: steps.every((s) => s.success), steps, error: stepError };
|
|
2199
2368
|
}
|
|
2200
2369
|
const limitError = `Trigger execution exceeded maximum of ${MAX_TRIGGER_STEPS} steps`;
|
|
2201
|
-
|
|
2370
|
+
logger39.error(`[Trigger ${trigger.id}] ${limitError}`);
|
|
2202
2371
|
await config.triggers.update(trigger.id, {
|
|
2203
2372
|
lastRunAt: new Date().toISOString(),
|
|
2204
2373
|
runCount: (trigger.runCount || 0) + 1,
|
|
@@ -2207,12 +2376,12 @@ async function executeTrigger(trigger, config, context) {
|
|
|
2207
2376
|
}, context);
|
|
2208
2377
|
return { success: false, steps, error: limitError };
|
|
2209
2378
|
}
|
|
2210
|
-
var
|
|
2379
|
+
var logger39;
|
|
2211
2380
|
var init_executor2 = __esm(() => {
|
|
2212
2381
|
init_logger();
|
|
2213
2382
|
init_utils();
|
|
2214
2383
|
init_webhooks();
|
|
2215
|
-
|
|
2384
|
+
logger39 = createLogger("TriggerExecutor", "server");
|
|
2216
2385
|
});
|
|
2217
2386
|
|
|
2218
2387
|
// src/protocol/jsonrpc.ts
|
|
@@ -2417,6 +2586,8 @@ class HttpSessionTransport {
|
|
|
2417
2586
|
}
|
|
2418
2587
|
|
|
2419
2588
|
// src/client.ts
|
|
2589
|
+
init_integration_summary();
|
|
2590
|
+
init_library_metadata();
|
|
2420
2591
|
init_errors();
|
|
2421
2592
|
init_logger();
|
|
2422
2593
|
|
|
@@ -3732,31 +3903,14 @@ class MCPClientBase {
|
|
|
3732
3903
|
const serverConfig = this.__oauthConfig;
|
|
3733
3904
|
const localIntegrations = serverConfig?.integrations || this.__configuredIntegrations;
|
|
3734
3905
|
const formatLocalIntegrations = (integrations) => ({
|
|
3735
|
-
integrations: integrations.map((integration) => (
|
|
3736
|
-
id: integration.id,
|
|
3737
|
-
name: integration.name || integration.id,
|
|
3738
|
-
logoUrl: integration.logoUrl,
|
|
3739
|
-
tools: integration.tools,
|
|
3740
|
-
hasOAuth: !!integration.oauth,
|
|
3741
|
-
scopes: integration.oauth?.scopes,
|
|
3742
|
-
provider: integration.oauth?.provider
|
|
3743
|
-
}))
|
|
3906
|
+
integrations: integrations.map((integration) => toConfiguredIntegrationSummary(integration))
|
|
3744
3907
|
});
|
|
3745
3908
|
if (hasApiKey || !this.__useServerConfig) {
|
|
3746
3909
|
if (options?.includeToolMetadata && hasApiKey) {
|
|
3747
3910
|
await this.ensureConnected();
|
|
3748
3911
|
const integrationsWithMetadata = localIntegrations.map((integration) => {
|
|
3749
3912
|
const toolMetadata = integration.tools.map((toolName) => this.availableTools.get(toolName)).filter((tool) => !!tool);
|
|
3750
|
-
return
|
|
3751
|
-
id: integration.id,
|
|
3752
|
-
name: integration.name || integration.id,
|
|
3753
|
-
logoUrl: integration.logoUrl,
|
|
3754
|
-
tools: integration.tools,
|
|
3755
|
-
hasOAuth: !!integration.oauth,
|
|
3756
|
-
scopes: integration.oauth?.scopes,
|
|
3757
|
-
provider: integration.oauth?.provider,
|
|
3758
|
-
toolMetadata
|
|
3759
|
-
};
|
|
3913
|
+
return toConfiguredIntegrationWithToolMetadata(integration, toolMetadata);
|
|
3760
3914
|
});
|
|
3761
3915
|
return { integrations: integrationsWithMetadata };
|
|
3762
3916
|
}
|
|
@@ -3782,28 +3936,10 @@ class MCPClientBase {
|
|
|
3782
3936
|
}
|
|
3783
3937
|
}
|
|
3784
3938
|
}
|
|
3785
|
-
return
|
|
3786
|
-
id: integration.id,
|
|
3787
|
-
name: integration.name || integration.id,
|
|
3788
|
-
logoUrl: integration.logoUrl,
|
|
3789
|
-
tools: integration.tools,
|
|
3790
|
-
hasOAuth: !!integration.oauth,
|
|
3791
|
-
scopes: integration.oauth?.scopes,
|
|
3792
|
-
provider: integration.oauth?.provider,
|
|
3793
|
-
toolMetadata
|
|
3794
|
-
};
|
|
3939
|
+
return toConfiguredIntegrationWithToolMetadata(integration, toolMetadata);
|
|
3795
3940
|
} catch (error) {
|
|
3796
3941
|
logger5.error(`Failed to fetch tool metadata for ${integration.id}:`, error);
|
|
3797
|
-
return
|
|
3798
|
-
id: integration.id,
|
|
3799
|
-
name: integration.name || integration.id,
|
|
3800
|
-
logoUrl: integration.logoUrl,
|
|
3801
|
-
tools: integration.tools,
|
|
3802
|
-
hasOAuth: !!integration.oauth,
|
|
3803
|
-
scopes: integration.oauth?.scopes,
|
|
3804
|
-
provider: integration.oauth?.provider,
|
|
3805
|
-
toolMetadata: []
|
|
3806
|
-
};
|
|
3942
|
+
return toConfiguredIntegrationWithToolMetadata(integration, []);
|
|
3807
3943
|
}
|
|
3808
3944
|
}, 3);
|
|
3809
3945
|
return { integrations: integrationsWithMetadata };
|
|
@@ -3823,6 +3959,12 @@ class MCPClientBase {
|
|
|
3823
3959
|
return formatLocalIntegrations(localIntegrations);
|
|
3824
3960
|
}
|
|
3825
3961
|
const result = await response.json();
|
|
3962
|
+
if (result.integrations && Array.isArray(result.integrations)) {
|
|
3963
|
+
result.integrations = result.integrations.map((row) => ({
|
|
3964
|
+
...row,
|
|
3965
|
+
...integrationLibraryPresentationFields(row)
|
|
3966
|
+
}));
|
|
3967
|
+
}
|
|
3826
3968
|
if (options?.includeToolMetadata && result.integrations) {
|
|
3827
3969
|
const { parallelWithLimit: parallelWithLimit2 } = await Promise.resolve().then(() => exports_concurrency);
|
|
3828
3970
|
const integrationsWithMetadata = await parallelWithLimit2(result.integrations, async (integration) => {
|
|
@@ -3847,12 +3989,14 @@ class MCPClientBase {
|
|
|
3847
3989
|
}
|
|
3848
3990
|
return {
|
|
3849
3991
|
...integration,
|
|
3992
|
+
...integrationLibraryPresentationFields(integration),
|
|
3850
3993
|
toolMetadata
|
|
3851
3994
|
};
|
|
3852
3995
|
} catch (error) {
|
|
3853
3996
|
logger5.error(`Failed to fetch tool metadata for ${integration.id}:`, error);
|
|
3854
3997
|
return {
|
|
3855
3998
|
...integration,
|
|
3999
|
+
...integrationLibraryPresentationFields(integration),
|
|
3856
4000
|
toolMetadata: []
|
|
3857
4001
|
};
|
|
3858
4002
|
}
|
|
@@ -3945,6 +4089,9 @@ class MCPClientBase {
|
|
|
3945
4089
|
async _callToolByName(name, args, options) {
|
|
3946
4090
|
return await this.callToolWithRetry(name, args, 0, options);
|
|
3947
4091
|
}
|
|
4092
|
+
async callTool(name, args, options) {
|
|
4093
|
+
return await this.callToolWithRetry(name, args, 0, options);
|
|
4094
|
+
}
|
|
3948
4095
|
async callServerTool(name, args) {
|
|
3949
4096
|
try {
|
|
3950
4097
|
const response = await this.callToolThroughHandler(name, args);
|
|
@@ -3955,35 +4102,38 @@ class MCPClientBase {
|
|
|
3955
4102
|
}
|
|
3956
4103
|
}
|
|
3957
4104
|
async callToolThroughHandler(name, args, provider, options) {
|
|
4105
|
+
const integrationHeaders = this.getHeadersForTool(name);
|
|
3958
4106
|
const transportHeaders = this.transport.headers || {};
|
|
3959
4107
|
const hasApiKey = !!transportHeaders["X-API-KEY"];
|
|
3960
4108
|
if (hasApiKey) {
|
|
3961
4109
|
await this.ensureConnected();
|
|
4110
|
+
const temporaryHeaders = { ...integrationHeaders };
|
|
3962
4111
|
if (provider) {
|
|
3963
4112
|
const tokenData = await this.oauthManager.getProviderToken(provider, undefined, options?.context);
|
|
3964
|
-
if (tokenData
|
|
3965
|
-
|
|
3966
|
-
|
|
3967
|
-
|
|
3968
|
-
|
|
3969
|
-
|
|
3970
|
-
|
|
3971
|
-
|
|
3972
|
-
|
|
3973
|
-
|
|
3974
|
-
|
|
3975
|
-
|
|
3976
|
-
|
|
3977
|
-
|
|
3978
|
-
|
|
4113
|
+
if (tokenData) {
|
|
4114
|
+
temporaryHeaders["Authorization"] = `Bearer ${tokenData.accessToken}`;
|
|
4115
|
+
}
|
|
4116
|
+
}
|
|
4117
|
+
const previousHeaders = new Map;
|
|
4118
|
+
for (const [key, value] of Object.entries(temporaryHeaders)) {
|
|
4119
|
+
previousHeaders.set(key, transportHeaders[key]);
|
|
4120
|
+
this.transport.setHeader(key, value);
|
|
4121
|
+
}
|
|
4122
|
+
try {
|
|
4123
|
+
const result2 = await this.transport.sendRequest("tools/call", {
|
|
4124
|
+
name,
|
|
4125
|
+
arguments: args || {}
|
|
4126
|
+
});
|
|
4127
|
+
return result2;
|
|
4128
|
+
} finally {
|
|
4129
|
+
for (const [key, previousValue] of previousHeaders.entries()) {
|
|
4130
|
+
if (previousValue !== undefined) {
|
|
4131
|
+
this.transport.setHeader(key, previousValue);
|
|
4132
|
+
} else {
|
|
4133
|
+
this.transport.removeHeader(key);
|
|
3979
4134
|
}
|
|
3980
4135
|
}
|
|
3981
4136
|
}
|
|
3982
|
-
const result2 = await this.transport.sendRequest("tools/call", {
|
|
3983
|
-
name,
|
|
3984
|
-
arguments: args || {}
|
|
3985
|
-
});
|
|
3986
|
-
return result2;
|
|
3987
4137
|
}
|
|
3988
4138
|
const url = this.apiBaseUrl ? `${this.apiBaseUrl}${this.apiRouteBase}/mcp` : `${this.apiRouteBase}/mcp`;
|
|
3989
4139
|
const headers = {
|
|
@@ -3993,6 +4143,7 @@ class MCPClientBase {
|
|
|
3993
4143
|
if (integrationsHeader) {
|
|
3994
4144
|
headers["X-Integrations"] = integrationsHeader;
|
|
3995
4145
|
}
|
|
4146
|
+
Object.assign(headers, integrationHeaders);
|
|
3996
4147
|
if (provider) {
|
|
3997
4148
|
const tokenData = await this.oauthManager.getProviderToken(provider, undefined, options?.context);
|
|
3998
4149
|
if (tokenData) {
|
|
@@ -4082,6 +4233,14 @@ class MCPClientBase {
|
|
|
4082
4233
|
}
|
|
4083
4234
|
return;
|
|
4084
4235
|
}
|
|
4236
|
+
getHeadersForTool(toolName) {
|
|
4237
|
+
for (const integration of this.integrations) {
|
|
4238
|
+
if (integration.tools.includes(toolName) && integration.getHeaders) {
|
|
4239
|
+
return integration.getHeaders();
|
|
4240
|
+
}
|
|
4241
|
+
}
|
|
4242
|
+
return {};
|
|
4243
|
+
}
|
|
4085
4244
|
getTool(name) {
|
|
4086
4245
|
return this.availableTools.get(name);
|
|
4087
4246
|
}
|
|
@@ -4412,6 +4571,9 @@ class MCPClientBase {
|
|
|
4412
4571
|
}
|
|
4413
4572
|
}
|
|
4414
4573
|
|
|
4574
|
+
// src/server.ts
|
|
4575
|
+
init_integration_summary();
|
|
4576
|
+
|
|
4415
4577
|
// src/adapters/nextjs.ts
|
|
4416
4578
|
init_base_handler();
|
|
4417
4579
|
init_logger();
|
|
@@ -5639,9 +5801,57 @@ function onedriveIntegration(config = {}) {
|
|
|
5639
5801
|
}
|
|
5640
5802
|
};
|
|
5641
5803
|
}
|
|
5804
|
+
// src/integrations/dropbox.ts
|
|
5805
|
+
init_logger();
|
|
5806
|
+
var logger24 = createLogger("Dropbox");
|
|
5807
|
+
var DROPBOX_TOOLS = [
|
|
5808
|
+
"dropbox_get_current_account",
|
|
5809
|
+
"dropbox_get_space_usage",
|
|
5810
|
+
"dropbox_list_folder",
|
|
5811
|
+
"dropbox_list_folder_continue",
|
|
5812
|
+
"dropbox_get_metadata",
|
|
5813
|
+
"dropbox_search_files",
|
|
5814
|
+
"dropbox_create_folder",
|
|
5815
|
+
"dropbox_delete_path",
|
|
5816
|
+
"dropbox_move_path",
|
|
5817
|
+
"dropbox_copy_path",
|
|
5818
|
+
"dropbox_upload_text_file",
|
|
5819
|
+
"dropbox_download_file",
|
|
5820
|
+
"dropbox_get_temporary_link",
|
|
5821
|
+
"dropbox_create_shared_link",
|
|
5822
|
+
"dropbox_list_shared_links",
|
|
5823
|
+
"dropbox_revoke_shared_link"
|
|
5824
|
+
];
|
|
5825
|
+
function dropboxIntegration(options = {}) {
|
|
5826
|
+
if (options.scopes !== undefined && (!Array.isArray(options.scopes) || options.scopes.some((scope) => typeof scope !== "string"))) {
|
|
5827
|
+
throw new Error("dropboxIntegration scopes must be an array of strings");
|
|
5828
|
+
}
|
|
5829
|
+
const oauth = {
|
|
5830
|
+
provider: "dropbox",
|
|
5831
|
+
clientId: options.clientId ?? getEnv("DROPBOX_CLIENT_ID"),
|
|
5832
|
+
clientSecret: options.clientSecret ?? getEnv("DROPBOX_CLIENT_SECRET"),
|
|
5833
|
+
scopes: options.scopes,
|
|
5834
|
+
optionalScopes: options.optionalScopes,
|
|
5835
|
+
redirectUri: options.redirectUri,
|
|
5836
|
+
config: options
|
|
5837
|
+
};
|
|
5838
|
+
return {
|
|
5839
|
+
id: "dropbox",
|
|
5840
|
+
name: "Dropbox",
|
|
5841
|
+
tools: [...DROPBOX_TOOLS],
|
|
5842
|
+
authType: "oauth",
|
|
5843
|
+
oauth,
|
|
5844
|
+
async onInit(_client) {
|
|
5845
|
+
logger24.debug("Dropbox integration initialized");
|
|
5846
|
+
},
|
|
5847
|
+
async onAfterConnect(_client) {
|
|
5848
|
+
logger24.debug("Dropbox integration connected");
|
|
5849
|
+
}
|
|
5850
|
+
};
|
|
5851
|
+
}
|
|
5642
5852
|
// src/integrations/word.ts
|
|
5643
5853
|
init_logger();
|
|
5644
|
-
var
|
|
5854
|
+
var logger25 = createLogger("Word");
|
|
5645
5855
|
var WORD_TOOLS = [
|
|
5646
5856
|
"word_list",
|
|
5647
5857
|
"word_get",
|
|
@@ -5667,16 +5877,16 @@ function wordIntegration(config = {}) {
|
|
|
5667
5877
|
tools: [...WORD_TOOLS],
|
|
5668
5878
|
oauth,
|
|
5669
5879
|
async onInit(_client) {
|
|
5670
|
-
|
|
5880
|
+
logger25.debug("Word integration initialized");
|
|
5671
5881
|
},
|
|
5672
5882
|
async onAfterConnect(_client) {
|
|
5673
|
-
|
|
5883
|
+
logger25.debug("Word integration connected");
|
|
5674
5884
|
}
|
|
5675
5885
|
};
|
|
5676
5886
|
}
|
|
5677
5887
|
// src/integrations/excel.ts
|
|
5678
5888
|
init_logger();
|
|
5679
|
-
var
|
|
5889
|
+
var logger26 = createLogger("Excel");
|
|
5680
5890
|
var EXCEL_TOOLS = [
|
|
5681
5891
|
"excel_list",
|
|
5682
5892
|
"excel_get",
|
|
@@ -5712,16 +5922,16 @@ function excelIntegration(config = {}) {
|
|
|
5712
5922
|
tools: [...EXCEL_TOOLS],
|
|
5713
5923
|
oauth,
|
|
5714
5924
|
async onInit(_client) {
|
|
5715
|
-
|
|
5925
|
+
logger26.debug("Excel integration initialized");
|
|
5716
5926
|
},
|
|
5717
5927
|
async onAfterConnect(_client) {
|
|
5718
|
-
|
|
5928
|
+
logger26.debug("Excel integration connected");
|
|
5719
5929
|
}
|
|
5720
5930
|
};
|
|
5721
5931
|
}
|
|
5722
5932
|
// src/integrations/powerpoint.ts
|
|
5723
5933
|
init_logger();
|
|
5724
|
-
var
|
|
5934
|
+
var logger27 = createLogger("PowerPoint");
|
|
5725
5935
|
var POWERPOINT_TOOLS = [
|
|
5726
5936
|
"powerpoint_list",
|
|
5727
5937
|
"powerpoint_get",
|
|
@@ -5747,16 +5957,16 @@ function powerpointIntegration(config = {}) {
|
|
|
5747
5957
|
tools: [...POWERPOINT_TOOLS],
|
|
5748
5958
|
oauth,
|
|
5749
5959
|
async onInit(_client) {
|
|
5750
|
-
|
|
5960
|
+
logger27.debug("PowerPoint integration initialized");
|
|
5751
5961
|
},
|
|
5752
5962
|
async onAfterConnect(_client) {
|
|
5753
|
-
|
|
5963
|
+
logger27.debug("PowerPoint integration connected");
|
|
5754
5964
|
}
|
|
5755
5965
|
};
|
|
5756
5966
|
}
|
|
5757
5967
|
// src/integrations/gdocs.ts
|
|
5758
5968
|
init_logger();
|
|
5759
|
-
var
|
|
5969
|
+
var logger28 = createLogger("Google Docs");
|
|
5760
5970
|
var GDOCS_TOOLS = [
|
|
5761
5971
|
"gdocs_list",
|
|
5762
5972
|
"gdocs_get",
|
|
@@ -5781,16 +5991,16 @@ function gdocsIntegration(config = {}) {
|
|
|
5781
5991
|
tools: [...GDOCS_TOOLS],
|
|
5782
5992
|
oauth,
|
|
5783
5993
|
async onInit(_client) {
|
|
5784
|
-
|
|
5994
|
+
logger28.debug("Google Docs integration initialized");
|
|
5785
5995
|
},
|
|
5786
5996
|
async onAfterConnect(_client) {
|
|
5787
|
-
|
|
5997
|
+
logger28.debug("Google Docs integration connected");
|
|
5788
5998
|
}
|
|
5789
5999
|
};
|
|
5790
6000
|
}
|
|
5791
6001
|
// src/integrations/gdrive.ts
|
|
5792
6002
|
init_logger();
|
|
5793
|
-
var
|
|
6003
|
+
var logger29 = createLogger("Google Drive");
|
|
5794
6004
|
var GDRIVE_TOOLS = [
|
|
5795
6005
|
"gdrive_list_files",
|
|
5796
6006
|
"gdrive_get_file",
|
|
@@ -5824,16 +6034,16 @@ function gdriveIntegration(config = {}) {
|
|
|
5824
6034
|
tools: [...GDRIVE_TOOLS],
|
|
5825
6035
|
oauth,
|
|
5826
6036
|
async onInit(_client) {
|
|
5827
|
-
|
|
6037
|
+
logger29.debug("Google Drive integration initialized");
|
|
5828
6038
|
},
|
|
5829
6039
|
async onAfterConnect(_client) {
|
|
5830
|
-
|
|
6040
|
+
logger29.debug("Google Drive integration connected");
|
|
5831
6041
|
}
|
|
5832
6042
|
};
|
|
5833
6043
|
}
|
|
5834
6044
|
// src/integrations/gsheets.ts
|
|
5835
6045
|
init_logger();
|
|
5836
|
-
var
|
|
6046
|
+
var logger30 = createLogger("Google Sheets");
|
|
5837
6047
|
var GSHEETS_TOOLS = [
|
|
5838
6048
|
"gsheets_list",
|
|
5839
6049
|
"gsheets_get",
|
|
@@ -5861,16 +6071,16 @@ function gsheetsIntegration(config = {}) {
|
|
|
5861
6071
|
tools: [...GSHEETS_TOOLS],
|
|
5862
6072
|
oauth,
|
|
5863
6073
|
async onInit(_client) {
|
|
5864
|
-
|
|
6074
|
+
logger30.debug("Google Sheets integration initialized");
|
|
5865
6075
|
},
|
|
5866
6076
|
async onAfterConnect(_client) {
|
|
5867
|
-
|
|
6077
|
+
logger30.debug("Google Sheets integration connected");
|
|
5868
6078
|
}
|
|
5869
6079
|
};
|
|
5870
6080
|
}
|
|
5871
6081
|
// src/integrations/gslides.ts
|
|
5872
6082
|
init_logger();
|
|
5873
|
-
var
|
|
6083
|
+
var logger31 = createLogger("Google Slides");
|
|
5874
6084
|
var GSLIDES_TOOLS = [
|
|
5875
6085
|
"gslides_list",
|
|
5876
6086
|
"gslides_get",
|
|
@@ -5897,16 +6107,16 @@ function gslidesIntegration(config = {}) {
|
|
|
5897
6107
|
tools: [...GSLIDES_TOOLS],
|
|
5898
6108
|
oauth,
|
|
5899
6109
|
async onInit(_client) {
|
|
5900
|
-
|
|
6110
|
+
logger31.debug("Google Slides integration initialized");
|
|
5901
6111
|
},
|
|
5902
6112
|
async onAfterConnect(_client) {
|
|
5903
|
-
|
|
6113
|
+
logger31.debug("Google Slides integration connected");
|
|
5904
6114
|
}
|
|
5905
6115
|
};
|
|
5906
6116
|
}
|
|
5907
6117
|
// src/integrations/polar.ts
|
|
5908
6118
|
init_logger();
|
|
5909
|
-
var
|
|
6119
|
+
var logger32 = createLogger("Polar");
|
|
5910
6120
|
var POLAR_TOOLS = [
|
|
5911
6121
|
"polar_list_products",
|
|
5912
6122
|
"polar_get_product",
|
|
@@ -5963,16 +6173,16 @@ function polarIntegration(config = {}) {
|
|
|
5963
6173
|
tools: [...POLAR_TOOLS],
|
|
5964
6174
|
oauth,
|
|
5965
6175
|
async onInit(_client) {
|
|
5966
|
-
|
|
6176
|
+
logger32.debug("Polar integration initialized");
|
|
5967
6177
|
},
|
|
5968
6178
|
async onAfterConnect(_client) {
|
|
5969
|
-
|
|
6179
|
+
logger32.debug("Polar integration connected");
|
|
5970
6180
|
}
|
|
5971
6181
|
};
|
|
5972
6182
|
}
|
|
5973
6183
|
// src/integrations/figma.ts
|
|
5974
6184
|
init_logger();
|
|
5975
|
-
var
|
|
6185
|
+
var logger33 = createLogger("Figma");
|
|
5976
6186
|
var FIGMA_TOOLS = [
|
|
5977
6187
|
"figma_get_file",
|
|
5978
6188
|
"figma_get_file_nodes",
|
|
@@ -6038,16 +6248,16 @@ function figmaIntegration(config = {}) {
|
|
|
6038
6248
|
tools: [...FIGMA_TOOLS],
|
|
6039
6249
|
oauth,
|
|
6040
6250
|
async onInit(_client) {
|
|
6041
|
-
|
|
6251
|
+
logger33.debug("Figma integration initialized");
|
|
6042
6252
|
},
|
|
6043
6253
|
async onAfterConnect(_client) {
|
|
6044
|
-
|
|
6254
|
+
logger33.debug("Figma integration connected");
|
|
6045
6255
|
}
|
|
6046
6256
|
};
|
|
6047
6257
|
}
|
|
6048
6258
|
// src/integrations/intercom.ts
|
|
6049
6259
|
init_logger();
|
|
6050
|
-
var
|
|
6260
|
+
var logger34 = createLogger("Intercom");
|
|
6051
6261
|
var INTERCOM_TOOLS = [
|
|
6052
6262
|
"intercom_list_contacts",
|
|
6053
6263
|
"intercom_get_contact",
|
|
@@ -6078,16 +6288,16 @@ function intercomIntegration(config = {}) {
|
|
|
6078
6288
|
tools: [...INTERCOM_TOOLS],
|
|
6079
6289
|
oauth,
|
|
6080
6290
|
async onInit(_client) {
|
|
6081
|
-
|
|
6291
|
+
logger34.debug("Intercom integration initialized");
|
|
6082
6292
|
},
|
|
6083
6293
|
async onAfterConnect(_client) {
|
|
6084
|
-
|
|
6294
|
+
logger34.debug("Intercom integration connected");
|
|
6085
6295
|
}
|
|
6086
6296
|
};
|
|
6087
6297
|
}
|
|
6088
6298
|
// src/integrations/hubspot.ts
|
|
6089
6299
|
init_logger();
|
|
6090
|
-
var
|
|
6300
|
+
var logger35 = createLogger("HubSpot");
|
|
6091
6301
|
var HUBSPOT_TOOLS = [
|
|
6092
6302
|
"hubspot_list_contacts",
|
|
6093
6303
|
"hubspot_get_contact",
|
|
@@ -6137,16 +6347,16 @@ function hubspotIntegration(config = {}) {
|
|
|
6137
6347
|
tools: [...HUBSPOT_TOOLS],
|
|
6138
6348
|
oauth,
|
|
6139
6349
|
async onInit(_client) {
|
|
6140
|
-
|
|
6350
|
+
logger35.debug("HubSpot integration initialized");
|
|
6141
6351
|
},
|
|
6142
6352
|
async onAfterConnect(_client) {
|
|
6143
|
-
|
|
6353
|
+
logger35.debug("HubSpot integration connected");
|
|
6144
6354
|
}
|
|
6145
6355
|
};
|
|
6146
6356
|
}
|
|
6147
6357
|
// src/integrations/youtube.ts
|
|
6148
6358
|
init_logger();
|
|
6149
|
-
var
|
|
6359
|
+
var logger36 = createLogger("YouTube");
|
|
6150
6360
|
var YOUTUBE_TOOLS = [
|
|
6151
6361
|
"youtube_search",
|
|
6152
6362
|
"youtube_get_video",
|
|
@@ -6192,16 +6402,16 @@ function youtubeIntegration(config = {}) {
|
|
|
6192
6402
|
tools: [...YOUTUBE_TOOLS],
|
|
6193
6403
|
oauth,
|
|
6194
6404
|
async onInit(_client) {
|
|
6195
|
-
|
|
6405
|
+
logger36.debug("YouTube integration initialized");
|
|
6196
6406
|
},
|
|
6197
6407
|
async onAfterConnect(_client) {
|
|
6198
|
-
|
|
6408
|
+
logger36.debug("YouTube integration connected");
|
|
6199
6409
|
}
|
|
6200
6410
|
};
|
|
6201
6411
|
}
|
|
6202
6412
|
// src/integrations/cursor.ts
|
|
6203
6413
|
init_logger();
|
|
6204
|
-
var
|
|
6414
|
+
var logger37 = createLogger("Cursor");
|
|
6205
6415
|
var CURSOR_TOOLS = [
|
|
6206
6416
|
"cursor_list_agents",
|
|
6207
6417
|
"cursor_get_agent",
|
|
@@ -6221,10 +6431,114 @@ function cursorIntegration(_config = {}) {
|
|
|
6221
6431
|
logoUrl: "https://wdvtnli2jn3texa6.public.blob.vercel-storage.com/cursor.jpeg",
|
|
6222
6432
|
tools: [...CURSOR_TOOLS],
|
|
6223
6433
|
async onInit(_client) {
|
|
6224
|
-
|
|
6434
|
+
logger37.debug("Cursor integration initialized");
|
|
6225
6435
|
},
|
|
6226
6436
|
async onAfterConnect(_client) {
|
|
6227
|
-
|
|
6437
|
+
logger37.debug("Cursor integration connected");
|
|
6438
|
+
}
|
|
6439
|
+
};
|
|
6440
|
+
}
|
|
6441
|
+
// src/integrations/granola.ts
|
|
6442
|
+
var GRANOLA_TOOLS = [
|
|
6443
|
+
"granola_list_notes",
|
|
6444
|
+
"granola_get_note",
|
|
6445
|
+
"granola_list_folders"
|
|
6446
|
+
];
|
|
6447
|
+
function granolaIntegration(options) {
|
|
6448
|
+
if (!options.apiKey) {
|
|
6449
|
+
throw new Error("granolaIntegration requires an apiKey");
|
|
6450
|
+
}
|
|
6451
|
+
return {
|
|
6452
|
+
id: "granola",
|
|
6453
|
+
name: "Granola",
|
|
6454
|
+
tools: [...GRANOLA_TOOLS],
|
|
6455
|
+
authType: "apiKey",
|
|
6456
|
+
getHeaders() {
|
|
6457
|
+
return {
|
|
6458
|
+
Authorization: `Bearer ${options.apiKey}`
|
|
6459
|
+
};
|
|
6460
|
+
}
|
|
6461
|
+
};
|
|
6462
|
+
}
|
|
6463
|
+
// src/integrations/mercury.ts
|
|
6464
|
+
var MERCURY_TOOLS = [
|
|
6465
|
+
"mercury_get_organization",
|
|
6466
|
+
"mercury_list_accounts",
|
|
6467
|
+
"mercury_get_account",
|
|
6468
|
+
"mercury_get_account_cards",
|
|
6469
|
+
"mercury_list_account_transactions",
|
|
6470
|
+
"mercury_get_account_transaction",
|
|
6471
|
+
"mercury_list_account_statements",
|
|
6472
|
+
"mercury_download_statement_pdf",
|
|
6473
|
+
"mercury_list_transactions",
|
|
6474
|
+
"mercury_get_transaction",
|
|
6475
|
+
"mercury_update_transaction",
|
|
6476
|
+
"mercury_upload_transaction_attachment",
|
|
6477
|
+
"mercury_list_cards",
|
|
6478
|
+
"mercury_get_card",
|
|
6479
|
+
"mercury_create_card",
|
|
6480
|
+
"mercury_update_card",
|
|
6481
|
+
"mercury_freeze_card",
|
|
6482
|
+
"mercury_unfreeze_card",
|
|
6483
|
+
"mercury_cancel_card",
|
|
6484
|
+
"mercury_list_categories",
|
|
6485
|
+
"mercury_create_category",
|
|
6486
|
+
"mercury_update_category",
|
|
6487
|
+
"mercury_list_credit_accounts",
|
|
6488
|
+
"mercury_list_users",
|
|
6489
|
+
"mercury_get_user",
|
|
6490
|
+
"mercury_list_recipients",
|
|
6491
|
+
"mercury_get_recipient",
|
|
6492
|
+
"mercury_create_recipient",
|
|
6493
|
+
"mercury_update_recipient",
|
|
6494
|
+
"mercury_list_recipient_attachments",
|
|
6495
|
+
"mercury_upload_recipient_attachment",
|
|
6496
|
+
"mercury_list_customers",
|
|
6497
|
+
"mercury_get_customer",
|
|
6498
|
+
"mercury_create_customer",
|
|
6499
|
+
"mercury_update_customer",
|
|
6500
|
+
"mercury_delete_customer",
|
|
6501
|
+
"mercury_list_invoices",
|
|
6502
|
+
"mercury_get_invoice",
|
|
6503
|
+
"mercury_create_invoice",
|
|
6504
|
+
"mercury_update_invoice",
|
|
6505
|
+
"mercury_cancel_invoice",
|
|
6506
|
+
"mercury_list_invoice_attachments",
|
|
6507
|
+
"mercury_get_attachment",
|
|
6508
|
+
"mercury_download_invoice_pdf",
|
|
6509
|
+
"mercury_list_treasury_accounts",
|
|
6510
|
+
"mercury_list_treasury_transactions",
|
|
6511
|
+
"mercury_list_treasury_statements",
|
|
6512
|
+
"mercury_list_events",
|
|
6513
|
+
"mercury_get_event",
|
|
6514
|
+
"mercury_list_send_money_requests",
|
|
6515
|
+
"mercury_get_send_money_request",
|
|
6516
|
+
"mercury_list_safe_requests",
|
|
6517
|
+
"mercury_get_safe_request",
|
|
6518
|
+
"mercury_download_safe_request_document",
|
|
6519
|
+
"mercury_list_webhooks",
|
|
6520
|
+
"mercury_get_webhook",
|
|
6521
|
+
"mercury_create_webhook",
|
|
6522
|
+
"mercury_update_webhook",
|
|
6523
|
+
"mercury_delete_webhook",
|
|
6524
|
+
"mercury_verify_webhook",
|
|
6525
|
+
"mercury_create_internal_transfer",
|
|
6526
|
+
"mercury_send_money",
|
|
6527
|
+
"mercury_request_send_money"
|
|
6528
|
+
];
|
|
6529
|
+
function mercuryIntegration(options) {
|
|
6530
|
+
if (!options.apiKey) {
|
|
6531
|
+
throw new Error("mercuryIntegration requires an apiKey");
|
|
6532
|
+
}
|
|
6533
|
+
return {
|
|
6534
|
+
id: "mercury",
|
|
6535
|
+
name: "Mercury",
|
|
6536
|
+
tools: [...MERCURY_TOOLS],
|
|
6537
|
+
authType: "apiKey",
|
|
6538
|
+
getHeaders() {
|
|
6539
|
+
return {
|
|
6540
|
+
Authorization: `Bearer ${options.apiKey}`
|
|
6541
|
+
};
|
|
6228
6542
|
}
|
|
6229
6543
|
};
|
|
6230
6544
|
}
|
|
@@ -12396,7 +12710,7 @@ function convertJsonSchemaToGoogleSchema(jsonSchema, TypeEnum) {
|
|
|
12396
12710
|
}
|
|
12397
12711
|
// src/server.ts
|
|
12398
12712
|
var SERVER_LOG_CONTEXT3 = "server";
|
|
12399
|
-
var
|
|
12713
|
+
var logger40 = createLogger("MCPServer", SERVER_LOG_CONTEXT3);
|
|
12400
12714
|
var globalServerConfig = null;
|
|
12401
12715
|
var globalMCPHandler = null;
|
|
12402
12716
|
var codeVerifierStorage = new Map;
|
|
@@ -12502,7 +12816,7 @@ function createMCPServer(config) {
|
|
|
12502
12816
|
if (integration.oauth) {
|
|
12503
12817
|
const { clientId, clientSecret, redirectUri: integrationRedirectUri, config: oauthConfig } = integration.oauth;
|
|
12504
12818
|
if (!clientId || !clientSecret) {
|
|
12505
|
-
|
|
12819
|
+
logger40.warn(`Warning: Integration "${integration.id}" is missing OAuth credentials. ` + `Provide clientId and clientSecret in the integration configuration.`);
|
|
12506
12820
|
return integration;
|
|
12507
12821
|
}
|
|
12508
12822
|
const redirectUri = integrationRedirectUri || config.redirectUri || getDefaultRedirectUri();
|
|
@@ -12679,7 +12993,7 @@ function createMCPServer(config) {
|
|
|
12679
12993
|
}
|
|
12680
12994
|
return response2;
|
|
12681
12995
|
} catch (error) {
|
|
12682
|
-
|
|
12996
|
+
logger40.error("[MCP Tool Call] Error:", error);
|
|
12683
12997
|
return Response.json({ error: error.message || "Failed to execute tool call" }, { status: error.statusCode || 500 });
|
|
12684
12998
|
}
|
|
12685
12999
|
}
|
|
@@ -12728,20 +13042,14 @@ function createMCPServer(config) {
|
|
|
12728
13042
|
});
|
|
12729
13043
|
return Response.json(result, { status: result.success ? 200 : 500 });
|
|
12730
13044
|
} catch (error) {
|
|
12731
|
-
|
|
13045
|
+
logger40.error("[Code Mode] Error:", error);
|
|
12732
13046
|
return Response.json({ error: error?.message || "Failed to execute code" }, { status: 500 });
|
|
12733
13047
|
}
|
|
12734
13048
|
}
|
|
12735
13049
|
if (action === "integrations" && method === "GET") {
|
|
12736
13050
|
const integrations = updatedIntegrations.map((integration) => ({
|
|
12737
|
-
|
|
12738
|
-
|
|
12739
|
-
logoUrl: integration.logoUrl,
|
|
12740
|
-
tools: integration.tools,
|
|
12741
|
-
hasOAuth: !!integration.oauth,
|
|
12742
|
-
scopes: integration.oauth?.scopes,
|
|
12743
|
-
optionalScopes: integration.oauth?.optionalScopes,
|
|
12744
|
-
provider: integration.oauth?.provider
|
|
13051
|
+
...toConfiguredIntegrationSummary(integration),
|
|
13052
|
+
optionalScopes: integration.oauth?.optionalScopes
|
|
12745
13053
|
}));
|
|
12746
13054
|
return Response.json({ integrations });
|
|
12747
13055
|
}
|
|
@@ -12792,7 +13100,7 @@ function createMCPServer(config) {
|
|
|
12792
13100
|
error: executionResult.error
|
|
12793
13101
|
});
|
|
12794
13102
|
} catch (error) {
|
|
12795
|
-
|
|
13103
|
+
logger40.error("[Trigger Notify] Error:", error);
|
|
12796
13104
|
return Response.json({ error: error.message || "Failed to execute trigger" }, { status: 500 });
|
|
12797
13105
|
}
|
|
12798
13106
|
}
|
|
@@ -12856,7 +13164,7 @@ function createMCPServer(config) {
|
|
|
12856
13164
|
})
|
|
12857
13165
|
});
|
|
12858
13166
|
} catch (scheduleError) {
|
|
12859
|
-
|
|
13167
|
+
logger40.error("[Trigger] Failed to register with scheduler:", scheduleError);
|
|
12860
13168
|
}
|
|
12861
13169
|
return Response.json(created, { status: 201 });
|
|
12862
13170
|
}
|
|
@@ -12891,7 +13199,7 @@ function createMCPServer(config) {
|
|
|
12891
13199
|
body: JSON.stringify({ triggerId })
|
|
12892
13200
|
});
|
|
12893
13201
|
} catch (error) {
|
|
12894
|
-
|
|
13202
|
+
logger40.error("[Trigger] Failed to pause in scheduler:", error);
|
|
12895
13203
|
}
|
|
12896
13204
|
return Response.json(updated);
|
|
12897
13205
|
} else if (subAction === "resume" && method === "POST") {
|
|
@@ -12919,7 +13227,7 @@ function createMCPServer(config) {
|
|
|
12919
13227
|
body: JSON.stringify({ triggerId })
|
|
12920
13228
|
});
|
|
12921
13229
|
} catch (error) {
|
|
12922
|
-
|
|
13230
|
+
logger40.error("[Trigger] Failed to resume in scheduler:", error);
|
|
12923
13231
|
}
|
|
12924
13232
|
return Response.json(updated);
|
|
12925
13233
|
} else if (subAction === "run" && method === "POST") {
|
|
@@ -12990,7 +13298,7 @@ function createMCPServer(config) {
|
|
|
12990
13298
|
})
|
|
12991
13299
|
});
|
|
12992
13300
|
} catch (error) {
|
|
12993
|
-
|
|
13301
|
+
logger40.error("[Trigger] Failed to update scheduler:", error);
|
|
12994
13302
|
}
|
|
12995
13303
|
}
|
|
12996
13304
|
return Response.json(updated);
|
|
@@ -13007,14 +13315,14 @@ function createMCPServer(config) {
|
|
|
13007
13315
|
body: JSON.stringify({ triggerId })
|
|
13008
13316
|
});
|
|
13009
13317
|
} catch (error) {
|
|
13010
|
-
|
|
13318
|
+
logger40.error("[Trigger] Failed to unregister from scheduler:", error);
|
|
13011
13319
|
}
|
|
13012
13320
|
return new Response(null, { status: 204 });
|
|
13013
13321
|
}
|
|
13014
13322
|
}
|
|
13015
13323
|
return Response.json({ error: "Invalid trigger route or method" }, { status: 404 });
|
|
13016
13324
|
} catch (error) {
|
|
13017
|
-
|
|
13325
|
+
logger40.error("[Trigger] Error:", error);
|
|
13018
13326
|
return Response.json({ error: error.message || "Failed to process trigger request" }, { status: error.statusCode || 500 });
|
|
13019
13327
|
}
|
|
13020
13328
|
}
|
|
@@ -13040,11 +13348,11 @@ function createMCPServer(config) {
|
|
|
13040
13348
|
const errorRedirectUrl = "/auth-error";
|
|
13041
13349
|
if (error) {
|
|
13042
13350
|
const errorMsg = errorDescription || error;
|
|
13043
|
-
|
|
13351
|
+
logger40.error("[OAuth Redirect] Error:", errorMsg);
|
|
13044
13352
|
return Response.redirect(new URL(`${errorRedirectUrl}?error=${encodeURIComponent(errorMsg)}`, webRequest.url));
|
|
13045
13353
|
}
|
|
13046
13354
|
if (!code || !state) {
|
|
13047
|
-
|
|
13355
|
+
logger40.error("[OAuth Redirect] Missing code or state parameter");
|
|
13048
13356
|
return Response.redirect(new URL(`${errorRedirectUrl}?error=${encodeURIComponent("Invalid OAuth callback")}`, webRequest.url));
|
|
13049
13357
|
}
|
|
13050
13358
|
let returnUrl = defaultRedirectUrl;
|
|
@@ -13120,7 +13428,7 @@ function createMCPServer(config) {
|
|
|
13120
13428
|
frontendUrl.hash = `oauth_callback=${encodeURIComponent(JSON.stringify({ code, state, tokenData }))}`;
|
|
13121
13429
|
return Response.redirect(frontendUrl);
|
|
13122
13430
|
} catch (error2) {
|
|
13123
|
-
|
|
13431
|
+
logger40.error("[OAuth Backend Callback] Error:", error2);
|
|
13124
13432
|
return Response.redirect(new URL(`${errorRedirectUrl}?error=${encodeURIComponent(error2.message || "Failed to exchange token")}`, webRequest.url));
|
|
13125
13433
|
}
|
|
13126
13434
|
} else {
|
|
@@ -13421,6 +13729,7 @@ export {
|
|
|
13421
13729
|
outlookIntegration,
|
|
13422
13730
|
onedriveIntegration,
|
|
13423
13731
|
notionIntegration,
|
|
13732
|
+
mercuryIntegration,
|
|
13424
13733
|
linearIntegration,
|
|
13425
13734
|
intercomIntegration,
|
|
13426
13735
|
hubspotIntegration,
|
|
@@ -13428,6 +13737,7 @@ export {
|
|
|
13428
13737
|
handleAnthropicMessage,
|
|
13429
13738
|
gslidesIntegration,
|
|
13430
13739
|
gsheetsIntegration,
|
|
13740
|
+
granolaIntegration,
|
|
13431
13741
|
gmailIntegration,
|
|
13432
13742
|
githubIntegration,
|
|
13433
13743
|
getVercelAITools,
|
|
@@ -13445,6 +13755,7 @@ export {
|
|
|
13445
13755
|
executeSandboxCode,
|
|
13446
13756
|
executeGoogleFunctionCalls,
|
|
13447
13757
|
excelIntegration,
|
|
13758
|
+
dropboxIntegration,
|
|
13448
13759
|
cursorIntegration,
|
|
13449
13760
|
createTriggerTools,
|
|
13450
13761
|
createTanStackOAuthHandler,
|