integrate-sdk 0.9.27-dev.0 → 0.9.27-dev.2
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/index.js +84 -34
- package/dist/adapters/solid-start.js +84 -34
- package/dist/adapters/svelte-kit.js +84 -34
- package/dist/ai/anthropic.js +27 -1
- package/dist/ai/google.js +27 -1
- package/dist/ai/index.js +27 -1
- package/dist/ai/openai.js +27 -1
- package/dist/ai/vercel-ai.js +27 -1
- package/dist/code-mode/executor.js +27 -1
- package/dist/code-mode/index.js +27 -1
- package/dist/code-mode/runtime-stub.d.ts +1 -1
- package/dist/code-mode/runtime-stub.d.ts.map +1 -1
- package/dist/code-mode/runtime-stub.js +27 -1
- package/dist/code-mode/tool-builder.js +27 -1
- package/dist/index.js +263 -62
- package/dist/server.js +312 -84
- package/dist/src/client.d.ts +8 -0
- package/dist/src/client.d.ts.map +1 -1
- package/dist/src/code-mode/runtime-stub.d.ts +1 -1
- package/dist/src/code-mode/runtime-stub.d.ts.map +1 -1
- package/dist/src/index.d.ts +6 -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/mercury.d.ts +14 -0
- package/dist/src/integrations/mercury.d.ts.map +1 -0
- package/dist/src/integrations/types.d.ts +4 -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
|
@@ -1552,6 +1552,32 @@ function camelToSnake(str) {
|
|
|
1552
1552
|
return str.replace(/[A-Z]/g, (letter) => '_' + letter.toLowerCase());
|
|
1553
1553
|
}
|
|
1554
1554
|
|
|
1555
|
+
const NON_TOOL_PROPERTIES = new Set([
|
|
1556
|
+
// Promise assimilation and object inspection should not become MCP calls.
|
|
1557
|
+
'then',
|
|
1558
|
+
'catch',
|
|
1559
|
+
'finally',
|
|
1560
|
+
'constructor',
|
|
1561
|
+
'prototype',
|
|
1562
|
+
'toString',
|
|
1563
|
+
'valueOf',
|
|
1564
|
+
'toJSON',
|
|
1565
|
+
'inspect',
|
|
1566
|
+
'hasOwnProperty',
|
|
1567
|
+
'isPrototypeOf',
|
|
1568
|
+
'propertyIsEnumerable',
|
|
1569
|
+
'__proto__',
|
|
1570
|
+
'__defineGetter__',
|
|
1571
|
+
'__defineSetter__',
|
|
1572
|
+
'__lookupGetter__',
|
|
1573
|
+
'__lookupSetter__',
|
|
1574
|
+
'__esModule',
|
|
1575
|
+
]);
|
|
1576
|
+
|
|
1577
|
+
function isToolProperty(property) {
|
|
1578
|
+
return typeof property === 'string' && !NON_TOOL_PROPERTIES.has(property);
|
|
1579
|
+
}
|
|
1580
|
+
|
|
1555
1581
|
async function callTool(toolName, args) {
|
|
1556
1582
|
const headers = {
|
|
1557
1583
|
'Content-Type': 'application/json',
|
|
@@ -1599,7 +1625,7 @@ async function callTool(toolName, args) {
|
|
|
1599
1625
|
function createIntegrationProxy(integrationId) {
|
|
1600
1626
|
return new Proxy({}, {
|
|
1601
1627
|
get(_target, methodName) {
|
|
1602
|
-
if (
|
|
1628
|
+
if (!isToolProperty(methodName)) return undefined;
|
|
1603
1629
|
return (args) => {
|
|
1604
1630
|
const alreadyFull = methodName.startsWith(integrationId + '_') || methodName.startsWith('___');
|
|
1605
1631
|
const toolName = alreadyFull ? methodName : integrationId + '_' + camelToSnake(methodName);
|
|
@@ -2007,7 +2033,7 @@ async function deliverWebhook(webhook, payload, timeoutMs) {
|
|
|
2007
2033
|
signal: controller.signal
|
|
2008
2034
|
});
|
|
2009
2035
|
if (!response.ok) {
|
|
2010
|
-
|
|
2036
|
+
logger38.warn(`Webhook delivery to ${webhook.url} returned ${response.status}`);
|
|
2011
2037
|
}
|
|
2012
2038
|
} finally {
|
|
2013
2039
|
clearTimeout(timeout);
|
|
@@ -2020,14 +2046,14 @@ async function deliverWebhooks(webhooks, payload, timeoutMs) {
|
|
|
2020
2046
|
for (let i = 0;i < results.length; i++) {
|
|
2021
2047
|
const result = results[i];
|
|
2022
2048
|
if (result.status === "rejected") {
|
|
2023
|
-
|
|
2049
|
+
logger38.warn(`Webhook delivery to ${webhooks[i].url} failed:`, result.reason);
|
|
2024
2050
|
}
|
|
2025
2051
|
}
|
|
2026
2052
|
}
|
|
2027
|
-
var
|
|
2053
|
+
var logger38;
|
|
2028
2054
|
var init_webhooks = __esm(() => {
|
|
2029
2055
|
init_logger();
|
|
2030
|
-
|
|
2056
|
+
logger38 = createLogger("Webhooks", "server");
|
|
2031
2057
|
});
|
|
2032
2058
|
|
|
2033
2059
|
// src/triggers/types.ts
|
|
@@ -2047,13 +2073,13 @@ async function executeTrigger(trigger, config, context) {
|
|
|
2047
2073
|
while (stepIndex < MAX_TRIGGER_STEPS) {
|
|
2048
2074
|
const stepValidation = validateStepLimit(stepIndex, MAX_TRIGGER_STEPS);
|
|
2049
2075
|
if (!stepValidation.valid) {
|
|
2050
|
-
|
|
2076
|
+
logger39.error(`[Trigger ${trigger.id}] ${stepValidation.error}`);
|
|
2051
2077
|
break;
|
|
2052
2078
|
}
|
|
2053
2079
|
const providerToken = await config.getProviderToken(currentProvider, undefined, context);
|
|
2054
2080
|
if (!providerToken) {
|
|
2055
2081
|
const error = `No OAuth token available for provider '${currentProvider}'`;
|
|
2056
|
-
|
|
2082
|
+
logger39.error(`[Trigger ${trigger.id}] ${error}`);
|
|
2057
2083
|
steps.push({
|
|
2058
2084
|
stepIndex,
|
|
2059
2085
|
toolName: currentToolName,
|
|
@@ -2079,7 +2105,7 @@ async function executeTrigger(trigger, config, context) {
|
|
|
2079
2105
|
} catch (err) {
|
|
2080
2106
|
stepSuccess = false;
|
|
2081
2107
|
stepError = err.message || "Tool execution failed";
|
|
2082
|
-
|
|
2108
|
+
logger39.error(`[Trigger ${trigger.id}] Step ${stepIndex} failed:`, err);
|
|
2083
2109
|
}
|
|
2084
2110
|
if (stepSuccess && toolResult) {
|
|
2085
2111
|
if (toolResult.isError === true) {
|
|
@@ -2172,7 +2198,7 @@ async function executeTrigger(trigger, config, context) {
|
|
|
2172
2198
|
return { success: steps.every((s) => s.success), steps, error: stepError };
|
|
2173
2199
|
}
|
|
2174
2200
|
const limitError = `Trigger execution exceeded maximum of ${MAX_TRIGGER_STEPS} steps`;
|
|
2175
|
-
|
|
2201
|
+
logger39.error(`[Trigger ${trigger.id}] ${limitError}`);
|
|
2176
2202
|
await config.triggers.update(trigger.id, {
|
|
2177
2203
|
lastRunAt: new Date().toISOString(),
|
|
2178
2204
|
runCount: (trigger.runCount || 0) + 1,
|
|
@@ -2181,12 +2207,12 @@ async function executeTrigger(trigger, config, context) {
|
|
|
2181
2207
|
}, context);
|
|
2182
2208
|
return { success: false, steps, error: limitError };
|
|
2183
2209
|
}
|
|
2184
|
-
var
|
|
2210
|
+
var logger39;
|
|
2185
2211
|
var init_executor2 = __esm(() => {
|
|
2186
2212
|
init_logger();
|
|
2187
2213
|
init_utils();
|
|
2188
2214
|
init_webhooks();
|
|
2189
|
-
|
|
2215
|
+
logger39 = createLogger("TriggerExecutor", "server");
|
|
2190
2216
|
});
|
|
2191
2217
|
|
|
2192
2218
|
// src/protocol/jsonrpc.ts
|
|
@@ -3432,6 +3458,34 @@ class OAuthManager {
|
|
|
3432
3458
|
|
|
3433
3459
|
// src/client.ts
|
|
3434
3460
|
var CLIENT_LOG_CONTEXT = "client";
|
|
3461
|
+
var NON_TOOL_PROXY_PROPERTIES = new Set([
|
|
3462
|
+
"then",
|
|
3463
|
+
"catch",
|
|
3464
|
+
"finally",
|
|
3465
|
+
"constructor",
|
|
3466
|
+
"prototype",
|
|
3467
|
+
"toString",
|
|
3468
|
+
"valueOf",
|
|
3469
|
+
"toJSON",
|
|
3470
|
+
"inspect",
|
|
3471
|
+
"hasOwnProperty",
|
|
3472
|
+
"isPrototypeOf",
|
|
3473
|
+
"propertyIsEnumerable",
|
|
3474
|
+
"__proto__",
|
|
3475
|
+
"__defineGetter__",
|
|
3476
|
+
"__defineSetter__",
|
|
3477
|
+
"__lookupGetter__",
|
|
3478
|
+
"__lookupSetter__",
|
|
3479
|
+
"__esModule",
|
|
3480
|
+
Symbol.toStringTag,
|
|
3481
|
+
Symbol.toPrimitive,
|
|
3482
|
+
Symbol.iterator,
|
|
3483
|
+
Symbol.asyncIterator,
|
|
3484
|
+
Symbol.for("nodejs.util.inspect.custom")
|
|
3485
|
+
]);
|
|
3486
|
+
function isToolProxyProperty(property) {
|
|
3487
|
+
return typeof property === "string" && !NON_TOOL_PROXY_PROPERTIES.has(property);
|
|
3488
|
+
}
|
|
3435
3489
|
|
|
3436
3490
|
class SimpleEventEmitter {
|
|
3437
3491
|
handlers = new Map;
|
|
@@ -3654,6 +3708,8 @@ class MCPClientBase {
|
|
|
3654
3708
|
}
|
|
3655
3709
|
return new Proxy({}, {
|
|
3656
3710
|
get: (_target, methodName) => {
|
|
3711
|
+
if (!isToolProxyProperty(methodName))
|
|
3712
|
+
return;
|
|
3657
3713
|
return async (args, options) => {
|
|
3658
3714
|
const toolName = methodToToolName(methodName, integrationId);
|
|
3659
3715
|
return await this.callToolWithRetry(toolName, args, 0, options);
|
|
@@ -3667,6 +3723,8 @@ class MCPClientBase {
|
|
|
3667
3723
|
createServerProxy() {
|
|
3668
3724
|
return new Proxy({}, {
|
|
3669
3725
|
get: (_target, methodName) => {
|
|
3726
|
+
if (!isToolProxyProperty(methodName))
|
|
3727
|
+
return;
|
|
3670
3728
|
if (methodName === "listConfiguredIntegrations") {
|
|
3671
3729
|
return async (options) => {
|
|
3672
3730
|
const transportHeaders = this.transport.headers || {};
|
|
@@ -3887,6 +3945,9 @@ class MCPClientBase {
|
|
|
3887
3945
|
async _callToolByName(name, args, options) {
|
|
3888
3946
|
return await this.callToolWithRetry(name, args, 0, options);
|
|
3889
3947
|
}
|
|
3948
|
+
async callTool(name, args, options) {
|
|
3949
|
+
return await this.callToolWithRetry(name, args, 0, options);
|
|
3950
|
+
}
|
|
3890
3951
|
async callServerTool(name, args) {
|
|
3891
3952
|
try {
|
|
3892
3953
|
const response = await this.callToolThroughHandler(name, args);
|
|
@@ -3897,35 +3958,38 @@ class MCPClientBase {
|
|
|
3897
3958
|
}
|
|
3898
3959
|
}
|
|
3899
3960
|
async callToolThroughHandler(name, args, provider, options) {
|
|
3961
|
+
const integrationHeaders = this.getHeadersForTool(name);
|
|
3900
3962
|
const transportHeaders = this.transport.headers || {};
|
|
3901
3963
|
const hasApiKey = !!transportHeaders["X-API-KEY"];
|
|
3902
3964
|
if (hasApiKey) {
|
|
3903
3965
|
await this.ensureConnected();
|
|
3966
|
+
const temporaryHeaders = { ...integrationHeaders };
|
|
3904
3967
|
if (provider) {
|
|
3905
3968
|
const tokenData = await this.oauthManager.getProviderToken(provider, undefined, options?.context);
|
|
3906
|
-
if (tokenData
|
|
3907
|
-
|
|
3908
|
-
|
|
3909
|
-
|
|
3910
|
-
|
|
3911
|
-
|
|
3912
|
-
|
|
3913
|
-
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
|
|
3917
|
-
|
|
3918
|
-
|
|
3919
|
-
|
|
3920
|
-
|
|
3969
|
+
if (tokenData) {
|
|
3970
|
+
temporaryHeaders["Authorization"] = `Bearer ${tokenData.accessToken}`;
|
|
3971
|
+
}
|
|
3972
|
+
}
|
|
3973
|
+
const previousHeaders = new Map;
|
|
3974
|
+
for (const [key, value] of Object.entries(temporaryHeaders)) {
|
|
3975
|
+
previousHeaders.set(key, transportHeaders[key]);
|
|
3976
|
+
this.transport.setHeader(key, value);
|
|
3977
|
+
}
|
|
3978
|
+
try {
|
|
3979
|
+
const result2 = await this.transport.sendRequest("tools/call", {
|
|
3980
|
+
name,
|
|
3981
|
+
arguments: args || {}
|
|
3982
|
+
});
|
|
3983
|
+
return result2;
|
|
3984
|
+
} finally {
|
|
3985
|
+
for (const [key, previousValue] of previousHeaders.entries()) {
|
|
3986
|
+
if (previousValue !== undefined) {
|
|
3987
|
+
this.transport.setHeader(key, previousValue);
|
|
3988
|
+
} else {
|
|
3989
|
+
this.transport.removeHeader(key);
|
|
3921
3990
|
}
|
|
3922
3991
|
}
|
|
3923
3992
|
}
|
|
3924
|
-
const result2 = await this.transport.sendRequest("tools/call", {
|
|
3925
|
-
name,
|
|
3926
|
-
arguments: args || {}
|
|
3927
|
-
});
|
|
3928
|
-
return result2;
|
|
3929
3993
|
}
|
|
3930
3994
|
const url = this.apiBaseUrl ? `${this.apiBaseUrl}${this.apiRouteBase}/mcp` : `${this.apiRouteBase}/mcp`;
|
|
3931
3995
|
const headers = {
|
|
@@ -3935,6 +3999,7 @@ class MCPClientBase {
|
|
|
3935
3999
|
if (integrationsHeader) {
|
|
3936
4000
|
headers["X-Integrations"] = integrationsHeader;
|
|
3937
4001
|
}
|
|
4002
|
+
Object.assign(headers, integrationHeaders);
|
|
3938
4003
|
if (provider) {
|
|
3939
4004
|
const tokenData = await this.oauthManager.getProviderToken(provider, undefined, options?.context);
|
|
3940
4005
|
if (tokenData) {
|
|
@@ -4024,6 +4089,14 @@ class MCPClientBase {
|
|
|
4024
4089
|
}
|
|
4025
4090
|
return;
|
|
4026
4091
|
}
|
|
4092
|
+
getHeadersForTool(toolName) {
|
|
4093
|
+
for (const integration of this.integrations) {
|
|
4094
|
+
if (integration.tools.includes(toolName) && integration.getHeaders) {
|
|
4095
|
+
return integration.getHeaders();
|
|
4096
|
+
}
|
|
4097
|
+
}
|
|
4098
|
+
return {};
|
|
4099
|
+
}
|
|
4027
4100
|
getTool(name) {
|
|
4028
4101
|
return this.availableTools.get(name);
|
|
4029
4102
|
}
|
|
@@ -5581,9 +5654,57 @@ function onedriveIntegration(config = {}) {
|
|
|
5581
5654
|
}
|
|
5582
5655
|
};
|
|
5583
5656
|
}
|
|
5657
|
+
// src/integrations/dropbox.ts
|
|
5658
|
+
init_logger();
|
|
5659
|
+
var logger24 = createLogger("Dropbox");
|
|
5660
|
+
var DROPBOX_TOOLS = [
|
|
5661
|
+
"dropbox_get_current_account",
|
|
5662
|
+
"dropbox_get_space_usage",
|
|
5663
|
+
"dropbox_list_folder",
|
|
5664
|
+
"dropbox_list_folder_continue",
|
|
5665
|
+
"dropbox_get_metadata",
|
|
5666
|
+
"dropbox_search_files",
|
|
5667
|
+
"dropbox_create_folder",
|
|
5668
|
+
"dropbox_delete_path",
|
|
5669
|
+
"dropbox_move_path",
|
|
5670
|
+
"dropbox_copy_path",
|
|
5671
|
+
"dropbox_upload_text_file",
|
|
5672
|
+
"dropbox_download_file",
|
|
5673
|
+
"dropbox_get_temporary_link",
|
|
5674
|
+
"dropbox_create_shared_link",
|
|
5675
|
+
"dropbox_list_shared_links",
|
|
5676
|
+
"dropbox_revoke_shared_link"
|
|
5677
|
+
];
|
|
5678
|
+
function dropboxIntegration(options = {}) {
|
|
5679
|
+
if (options.scopes !== undefined && (!Array.isArray(options.scopes) || options.scopes.some((scope) => typeof scope !== "string"))) {
|
|
5680
|
+
throw new Error("dropboxIntegration scopes must be an array of strings");
|
|
5681
|
+
}
|
|
5682
|
+
const oauth = {
|
|
5683
|
+
provider: "dropbox",
|
|
5684
|
+
clientId: options.clientId ?? getEnv("DROPBOX_CLIENT_ID"),
|
|
5685
|
+
clientSecret: options.clientSecret ?? getEnv("DROPBOX_CLIENT_SECRET"),
|
|
5686
|
+
scopes: options.scopes,
|
|
5687
|
+
optionalScopes: options.optionalScopes,
|
|
5688
|
+
redirectUri: options.redirectUri,
|
|
5689
|
+
config: options
|
|
5690
|
+
};
|
|
5691
|
+
return {
|
|
5692
|
+
id: "dropbox",
|
|
5693
|
+
name: "Dropbox",
|
|
5694
|
+
tools: [...DROPBOX_TOOLS],
|
|
5695
|
+
authType: "oauth",
|
|
5696
|
+
oauth,
|
|
5697
|
+
async onInit(_client) {
|
|
5698
|
+
logger24.debug("Dropbox integration initialized");
|
|
5699
|
+
},
|
|
5700
|
+
async onAfterConnect(_client) {
|
|
5701
|
+
logger24.debug("Dropbox integration connected");
|
|
5702
|
+
}
|
|
5703
|
+
};
|
|
5704
|
+
}
|
|
5584
5705
|
// src/integrations/word.ts
|
|
5585
5706
|
init_logger();
|
|
5586
|
-
var
|
|
5707
|
+
var logger25 = createLogger("Word");
|
|
5587
5708
|
var WORD_TOOLS = [
|
|
5588
5709
|
"word_list",
|
|
5589
5710
|
"word_get",
|
|
@@ -5609,16 +5730,16 @@ function wordIntegration(config = {}) {
|
|
|
5609
5730
|
tools: [...WORD_TOOLS],
|
|
5610
5731
|
oauth,
|
|
5611
5732
|
async onInit(_client) {
|
|
5612
|
-
|
|
5733
|
+
logger25.debug("Word integration initialized");
|
|
5613
5734
|
},
|
|
5614
5735
|
async onAfterConnect(_client) {
|
|
5615
|
-
|
|
5736
|
+
logger25.debug("Word integration connected");
|
|
5616
5737
|
}
|
|
5617
5738
|
};
|
|
5618
5739
|
}
|
|
5619
5740
|
// src/integrations/excel.ts
|
|
5620
5741
|
init_logger();
|
|
5621
|
-
var
|
|
5742
|
+
var logger26 = createLogger("Excel");
|
|
5622
5743
|
var EXCEL_TOOLS = [
|
|
5623
5744
|
"excel_list",
|
|
5624
5745
|
"excel_get",
|
|
@@ -5654,16 +5775,16 @@ function excelIntegration(config = {}) {
|
|
|
5654
5775
|
tools: [...EXCEL_TOOLS],
|
|
5655
5776
|
oauth,
|
|
5656
5777
|
async onInit(_client) {
|
|
5657
|
-
|
|
5778
|
+
logger26.debug("Excel integration initialized");
|
|
5658
5779
|
},
|
|
5659
5780
|
async onAfterConnect(_client) {
|
|
5660
|
-
|
|
5781
|
+
logger26.debug("Excel integration connected");
|
|
5661
5782
|
}
|
|
5662
5783
|
};
|
|
5663
5784
|
}
|
|
5664
5785
|
// src/integrations/powerpoint.ts
|
|
5665
5786
|
init_logger();
|
|
5666
|
-
var
|
|
5787
|
+
var logger27 = createLogger("PowerPoint");
|
|
5667
5788
|
var POWERPOINT_TOOLS = [
|
|
5668
5789
|
"powerpoint_list",
|
|
5669
5790
|
"powerpoint_get",
|
|
@@ -5689,16 +5810,16 @@ function powerpointIntegration(config = {}) {
|
|
|
5689
5810
|
tools: [...POWERPOINT_TOOLS],
|
|
5690
5811
|
oauth,
|
|
5691
5812
|
async onInit(_client) {
|
|
5692
|
-
|
|
5813
|
+
logger27.debug("PowerPoint integration initialized");
|
|
5693
5814
|
},
|
|
5694
5815
|
async onAfterConnect(_client) {
|
|
5695
|
-
|
|
5816
|
+
logger27.debug("PowerPoint integration connected");
|
|
5696
5817
|
}
|
|
5697
5818
|
};
|
|
5698
5819
|
}
|
|
5699
5820
|
// src/integrations/gdocs.ts
|
|
5700
5821
|
init_logger();
|
|
5701
|
-
var
|
|
5822
|
+
var logger28 = createLogger("Google Docs");
|
|
5702
5823
|
var GDOCS_TOOLS = [
|
|
5703
5824
|
"gdocs_list",
|
|
5704
5825
|
"gdocs_get",
|
|
@@ -5723,16 +5844,16 @@ function gdocsIntegration(config = {}) {
|
|
|
5723
5844
|
tools: [...GDOCS_TOOLS],
|
|
5724
5845
|
oauth,
|
|
5725
5846
|
async onInit(_client) {
|
|
5726
|
-
|
|
5847
|
+
logger28.debug("Google Docs integration initialized");
|
|
5727
5848
|
},
|
|
5728
5849
|
async onAfterConnect(_client) {
|
|
5729
|
-
|
|
5850
|
+
logger28.debug("Google Docs integration connected");
|
|
5730
5851
|
}
|
|
5731
5852
|
};
|
|
5732
5853
|
}
|
|
5733
5854
|
// src/integrations/gdrive.ts
|
|
5734
5855
|
init_logger();
|
|
5735
|
-
var
|
|
5856
|
+
var logger29 = createLogger("Google Drive");
|
|
5736
5857
|
var GDRIVE_TOOLS = [
|
|
5737
5858
|
"gdrive_list_files",
|
|
5738
5859
|
"gdrive_get_file",
|
|
@@ -5766,16 +5887,16 @@ function gdriveIntegration(config = {}) {
|
|
|
5766
5887
|
tools: [...GDRIVE_TOOLS],
|
|
5767
5888
|
oauth,
|
|
5768
5889
|
async onInit(_client) {
|
|
5769
|
-
|
|
5890
|
+
logger29.debug("Google Drive integration initialized");
|
|
5770
5891
|
},
|
|
5771
5892
|
async onAfterConnect(_client) {
|
|
5772
|
-
|
|
5893
|
+
logger29.debug("Google Drive integration connected");
|
|
5773
5894
|
}
|
|
5774
5895
|
};
|
|
5775
5896
|
}
|
|
5776
5897
|
// src/integrations/gsheets.ts
|
|
5777
5898
|
init_logger();
|
|
5778
|
-
var
|
|
5899
|
+
var logger30 = createLogger("Google Sheets");
|
|
5779
5900
|
var GSHEETS_TOOLS = [
|
|
5780
5901
|
"gsheets_list",
|
|
5781
5902
|
"gsheets_get",
|
|
@@ -5803,16 +5924,16 @@ function gsheetsIntegration(config = {}) {
|
|
|
5803
5924
|
tools: [...GSHEETS_TOOLS],
|
|
5804
5925
|
oauth,
|
|
5805
5926
|
async onInit(_client) {
|
|
5806
|
-
|
|
5927
|
+
logger30.debug("Google Sheets integration initialized");
|
|
5807
5928
|
},
|
|
5808
5929
|
async onAfterConnect(_client) {
|
|
5809
|
-
|
|
5930
|
+
logger30.debug("Google Sheets integration connected");
|
|
5810
5931
|
}
|
|
5811
5932
|
};
|
|
5812
5933
|
}
|
|
5813
5934
|
// src/integrations/gslides.ts
|
|
5814
5935
|
init_logger();
|
|
5815
|
-
var
|
|
5936
|
+
var logger31 = createLogger("Google Slides");
|
|
5816
5937
|
var GSLIDES_TOOLS = [
|
|
5817
5938
|
"gslides_list",
|
|
5818
5939
|
"gslides_get",
|
|
@@ -5839,16 +5960,16 @@ function gslidesIntegration(config = {}) {
|
|
|
5839
5960
|
tools: [...GSLIDES_TOOLS],
|
|
5840
5961
|
oauth,
|
|
5841
5962
|
async onInit(_client) {
|
|
5842
|
-
|
|
5963
|
+
logger31.debug("Google Slides integration initialized");
|
|
5843
5964
|
},
|
|
5844
5965
|
async onAfterConnect(_client) {
|
|
5845
|
-
|
|
5966
|
+
logger31.debug("Google Slides integration connected");
|
|
5846
5967
|
}
|
|
5847
5968
|
};
|
|
5848
5969
|
}
|
|
5849
5970
|
// src/integrations/polar.ts
|
|
5850
5971
|
init_logger();
|
|
5851
|
-
var
|
|
5972
|
+
var logger32 = createLogger("Polar");
|
|
5852
5973
|
var POLAR_TOOLS = [
|
|
5853
5974
|
"polar_list_products",
|
|
5854
5975
|
"polar_get_product",
|
|
@@ -5905,16 +6026,16 @@ function polarIntegration(config = {}) {
|
|
|
5905
6026
|
tools: [...POLAR_TOOLS],
|
|
5906
6027
|
oauth,
|
|
5907
6028
|
async onInit(_client) {
|
|
5908
|
-
|
|
6029
|
+
logger32.debug("Polar integration initialized");
|
|
5909
6030
|
},
|
|
5910
6031
|
async onAfterConnect(_client) {
|
|
5911
|
-
|
|
6032
|
+
logger32.debug("Polar integration connected");
|
|
5912
6033
|
}
|
|
5913
6034
|
};
|
|
5914
6035
|
}
|
|
5915
6036
|
// src/integrations/figma.ts
|
|
5916
6037
|
init_logger();
|
|
5917
|
-
var
|
|
6038
|
+
var logger33 = createLogger("Figma");
|
|
5918
6039
|
var FIGMA_TOOLS = [
|
|
5919
6040
|
"figma_get_file",
|
|
5920
6041
|
"figma_get_file_nodes",
|
|
@@ -5980,16 +6101,16 @@ function figmaIntegration(config = {}) {
|
|
|
5980
6101
|
tools: [...FIGMA_TOOLS],
|
|
5981
6102
|
oauth,
|
|
5982
6103
|
async onInit(_client) {
|
|
5983
|
-
|
|
6104
|
+
logger33.debug("Figma integration initialized");
|
|
5984
6105
|
},
|
|
5985
6106
|
async onAfterConnect(_client) {
|
|
5986
|
-
|
|
6107
|
+
logger33.debug("Figma integration connected");
|
|
5987
6108
|
}
|
|
5988
6109
|
};
|
|
5989
6110
|
}
|
|
5990
6111
|
// src/integrations/intercom.ts
|
|
5991
6112
|
init_logger();
|
|
5992
|
-
var
|
|
6113
|
+
var logger34 = createLogger("Intercom");
|
|
5993
6114
|
var INTERCOM_TOOLS = [
|
|
5994
6115
|
"intercom_list_contacts",
|
|
5995
6116
|
"intercom_get_contact",
|
|
@@ -6020,16 +6141,16 @@ function intercomIntegration(config = {}) {
|
|
|
6020
6141
|
tools: [...INTERCOM_TOOLS],
|
|
6021
6142
|
oauth,
|
|
6022
6143
|
async onInit(_client) {
|
|
6023
|
-
|
|
6144
|
+
logger34.debug("Intercom integration initialized");
|
|
6024
6145
|
},
|
|
6025
6146
|
async onAfterConnect(_client) {
|
|
6026
|
-
|
|
6147
|
+
logger34.debug("Intercom integration connected");
|
|
6027
6148
|
}
|
|
6028
6149
|
};
|
|
6029
6150
|
}
|
|
6030
6151
|
// src/integrations/hubspot.ts
|
|
6031
6152
|
init_logger();
|
|
6032
|
-
var
|
|
6153
|
+
var logger35 = createLogger("HubSpot");
|
|
6033
6154
|
var HUBSPOT_TOOLS = [
|
|
6034
6155
|
"hubspot_list_contacts",
|
|
6035
6156
|
"hubspot_get_contact",
|
|
@@ -6079,16 +6200,16 @@ function hubspotIntegration(config = {}) {
|
|
|
6079
6200
|
tools: [...HUBSPOT_TOOLS],
|
|
6080
6201
|
oauth,
|
|
6081
6202
|
async onInit(_client) {
|
|
6082
|
-
|
|
6203
|
+
logger35.debug("HubSpot integration initialized");
|
|
6083
6204
|
},
|
|
6084
6205
|
async onAfterConnect(_client) {
|
|
6085
|
-
|
|
6206
|
+
logger35.debug("HubSpot integration connected");
|
|
6086
6207
|
}
|
|
6087
6208
|
};
|
|
6088
6209
|
}
|
|
6089
6210
|
// src/integrations/youtube.ts
|
|
6090
6211
|
init_logger();
|
|
6091
|
-
var
|
|
6212
|
+
var logger36 = createLogger("YouTube");
|
|
6092
6213
|
var YOUTUBE_TOOLS = [
|
|
6093
6214
|
"youtube_search",
|
|
6094
6215
|
"youtube_get_video",
|
|
@@ -6134,16 +6255,16 @@ function youtubeIntegration(config = {}) {
|
|
|
6134
6255
|
tools: [...YOUTUBE_TOOLS],
|
|
6135
6256
|
oauth,
|
|
6136
6257
|
async onInit(_client) {
|
|
6137
|
-
|
|
6258
|
+
logger36.debug("YouTube integration initialized");
|
|
6138
6259
|
},
|
|
6139
6260
|
async onAfterConnect(_client) {
|
|
6140
|
-
|
|
6261
|
+
logger36.debug("YouTube integration connected");
|
|
6141
6262
|
}
|
|
6142
6263
|
};
|
|
6143
6264
|
}
|
|
6144
6265
|
// src/integrations/cursor.ts
|
|
6145
6266
|
init_logger();
|
|
6146
|
-
var
|
|
6267
|
+
var logger37 = createLogger("Cursor");
|
|
6147
6268
|
var CURSOR_TOOLS = [
|
|
6148
6269
|
"cursor_list_agents",
|
|
6149
6270
|
"cursor_get_agent",
|
|
@@ -6163,10 +6284,114 @@ function cursorIntegration(_config = {}) {
|
|
|
6163
6284
|
logoUrl: "https://wdvtnli2jn3texa6.public.blob.vercel-storage.com/cursor.jpeg",
|
|
6164
6285
|
tools: [...CURSOR_TOOLS],
|
|
6165
6286
|
async onInit(_client) {
|
|
6166
|
-
|
|
6287
|
+
logger37.debug("Cursor integration initialized");
|
|
6167
6288
|
},
|
|
6168
6289
|
async onAfterConnect(_client) {
|
|
6169
|
-
|
|
6290
|
+
logger37.debug("Cursor integration connected");
|
|
6291
|
+
}
|
|
6292
|
+
};
|
|
6293
|
+
}
|
|
6294
|
+
// src/integrations/granola.ts
|
|
6295
|
+
var GRANOLA_TOOLS = [
|
|
6296
|
+
"granola_list_notes",
|
|
6297
|
+
"granola_get_note",
|
|
6298
|
+
"granola_list_folders"
|
|
6299
|
+
];
|
|
6300
|
+
function granolaIntegration(options) {
|
|
6301
|
+
if (!options.apiKey) {
|
|
6302
|
+
throw new Error("granolaIntegration requires an apiKey");
|
|
6303
|
+
}
|
|
6304
|
+
return {
|
|
6305
|
+
id: "granola",
|
|
6306
|
+
name: "Granola",
|
|
6307
|
+
tools: [...GRANOLA_TOOLS],
|
|
6308
|
+
authType: "apiKey",
|
|
6309
|
+
getHeaders() {
|
|
6310
|
+
return {
|
|
6311
|
+
Authorization: `Bearer ${options.apiKey}`
|
|
6312
|
+
};
|
|
6313
|
+
}
|
|
6314
|
+
};
|
|
6315
|
+
}
|
|
6316
|
+
// src/integrations/mercury.ts
|
|
6317
|
+
var MERCURY_TOOLS = [
|
|
6318
|
+
"mercury_get_organization",
|
|
6319
|
+
"mercury_list_accounts",
|
|
6320
|
+
"mercury_get_account",
|
|
6321
|
+
"mercury_get_account_cards",
|
|
6322
|
+
"mercury_list_account_transactions",
|
|
6323
|
+
"mercury_get_account_transaction",
|
|
6324
|
+
"mercury_list_account_statements",
|
|
6325
|
+
"mercury_download_statement_pdf",
|
|
6326
|
+
"mercury_list_transactions",
|
|
6327
|
+
"mercury_get_transaction",
|
|
6328
|
+
"mercury_update_transaction",
|
|
6329
|
+
"mercury_upload_transaction_attachment",
|
|
6330
|
+
"mercury_list_cards",
|
|
6331
|
+
"mercury_get_card",
|
|
6332
|
+
"mercury_create_card",
|
|
6333
|
+
"mercury_update_card",
|
|
6334
|
+
"mercury_freeze_card",
|
|
6335
|
+
"mercury_unfreeze_card",
|
|
6336
|
+
"mercury_cancel_card",
|
|
6337
|
+
"mercury_list_categories",
|
|
6338
|
+
"mercury_create_category",
|
|
6339
|
+
"mercury_update_category",
|
|
6340
|
+
"mercury_list_credit_accounts",
|
|
6341
|
+
"mercury_list_users",
|
|
6342
|
+
"mercury_get_user",
|
|
6343
|
+
"mercury_list_recipients",
|
|
6344
|
+
"mercury_get_recipient",
|
|
6345
|
+
"mercury_create_recipient",
|
|
6346
|
+
"mercury_update_recipient",
|
|
6347
|
+
"mercury_list_recipient_attachments",
|
|
6348
|
+
"mercury_upload_recipient_attachment",
|
|
6349
|
+
"mercury_list_customers",
|
|
6350
|
+
"mercury_get_customer",
|
|
6351
|
+
"mercury_create_customer",
|
|
6352
|
+
"mercury_update_customer",
|
|
6353
|
+
"mercury_delete_customer",
|
|
6354
|
+
"mercury_list_invoices",
|
|
6355
|
+
"mercury_get_invoice",
|
|
6356
|
+
"mercury_create_invoice",
|
|
6357
|
+
"mercury_update_invoice",
|
|
6358
|
+
"mercury_cancel_invoice",
|
|
6359
|
+
"mercury_list_invoice_attachments",
|
|
6360
|
+
"mercury_get_attachment",
|
|
6361
|
+
"mercury_download_invoice_pdf",
|
|
6362
|
+
"mercury_list_treasury_accounts",
|
|
6363
|
+
"mercury_list_treasury_transactions",
|
|
6364
|
+
"mercury_list_treasury_statements",
|
|
6365
|
+
"mercury_list_events",
|
|
6366
|
+
"mercury_get_event",
|
|
6367
|
+
"mercury_list_send_money_requests",
|
|
6368
|
+
"mercury_get_send_money_request",
|
|
6369
|
+
"mercury_list_safe_requests",
|
|
6370
|
+
"mercury_get_safe_request",
|
|
6371
|
+
"mercury_download_safe_request_document",
|
|
6372
|
+
"mercury_list_webhooks",
|
|
6373
|
+
"mercury_get_webhook",
|
|
6374
|
+
"mercury_create_webhook",
|
|
6375
|
+
"mercury_update_webhook",
|
|
6376
|
+
"mercury_delete_webhook",
|
|
6377
|
+
"mercury_verify_webhook",
|
|
6378
|
+
"mercury_create_internal_transfer",
|
|
6379
|
+
"mercury_send_money",
|
|
6380
|
+
"mercury_request_send_money"
|
|
6381
|
+
];
|
|
6382
|
+
function mercuryIntegration(options) {
|
|
6383
|
+
if (!options.apiKey) {
|
|
6384
|
+
throw new Error("mercuryIntegration requires an apiKey");
|
|
6385
|
+
}
|
|
6386
|
+
return {
|
|
6387
|
+
id: "mercury",
|
|
6388
|
+
name: "Mercury",
|
|
6389
|
+
tools: [...MERCURY_TOOLS],
|
|
6390
|
+
authType: "apiKey",
|
|
6391
|
+
getHeaders() {
|
|
6392
|
+
return {
|
|
6393
|
+
Authorization: `Bearer ${options.apiKey}`
|
|
6394
|
+
};
|
|
6170
6395
|
}
|
|
6171
6396
|
};
|
|
6172
6397
|
}
|
|
@@ -12338,7 +12563,7 @@ function convertJsonSchemaToGoogleSchema(jsonSchema, TypeEnum) {
|
|
|
12338
12563
|
}
|
|
12339
12564
|
// src/server.ts
|
|
12340
12565
|
var SERVER_LOG_CONTEXT3 = "server";
|
|
12341
|
-
var
|
|
12566
|
+
var logger40 = createLogger("MCPServer", SERVER_LOG_CONTEXT3);
|
|
12342
12567
|
var globalServerConfig = null;
|
|
12343
12568
|
var globalMCPHandler = null;
|
|
12344
12569
|
var codeVerifierStorage = new Map;
|
|
@@ -12444,7 +12669,7 @@ function createMCPServer(config) {
|
|
|
12444
12669
|
if (integration.oauth) {
|
|
12445
12670
|
const { clientId, clientSecret, redirectUri: integrationRedirectUri, config: oauthConfig } = integration.oauth;
|
|
12446
12671
|
if (!clientId || !clientSecret) {
|
|
12447
|
-
|
|
12672
|
+
logger40.warn(`Warning: Integration "${integration.id}" is missing OAuth credentials. ` + `Provide clientId and clientSecret in the integration configuration.`);
|
|
12448
12673
|
return integration;
|
|
12449
12674
|
}
|
|
12450
12675
|
const redirectUri = integrationRedirectUri || config.redirectUri || getDefaultRedirectUri();
|
|
@@ -12621,7 +12846,7 @@ function createMCPServer(config) {
|
|
|
12621
12846
|
}
|
|
12622
12847
|
return response2;
|
|
12623
12848
|
} catch (error) {
|
|
12624
|
-
|
|
12849
|
+
logger40.error("[MCP Tool Call] Error:", error);
|
|
12625
12850
|
return Response.json({ error: error.message || "Failed to execute tool call" }, { status: error.statusCode || 500 });
|
|
12626
12851
|
}
|
|
12627
12852
|
}
|
|
@@ -12670,7 +12895,7 @@ function createMCPServer(config) {
|
|
|
12670
12895
|
});
|
|
12671
12896
|
return Response.json(result, { status: result.success ? 200 : 500 });
|
|
12672
12897
|
} catch (error) {
|
|
12673
|
-
|
|
12898
|
+
logger40.error("[Code Mode] Error:", error);
|
|
12674
12899
|
return Response.json({ error: error?.message || "Failed to execute code" }, { status: 500 });
|
|
12675
12900
|
}
|
|
12676
12901
|
}
|
|
@@ -12734,7 +12959,7 @@ function createMCPServer(config) {
|
|
|
12734
12959
|
error: executionResult.error
|
|
12735
12960
|
});
|
|
12736
12961
|
} catch (error) {
|
|
12737
|
-
|
|
12962
|
+
logger40.error("[Trigger Notify] Error:", error);
|
|
12738
12963
|
return Response.json({ error: error.message || "Failed to execute trigger" }, { status: 500 });
|
|
12739
12964
|
}
|
|
12740
12965
|
}
|
|
@@ -12798,7 +13023,7 @@ function createMCPServer(config) {
|
|
|
12798
13023
|
})
|
|
12799
13024
|
});
|
|
12800
13025
|
} catch (scheduleError) {
|
|
12801
|
-
|
|
13026
|
+
logger40.error("[Trigger] Failed to register with scheduler:", scheduleError);
|
|
12802
13027
|
}
|
|
12803
13028
|
return Response.json(created, { status: 201 });
|
|
12804
13029
|
}
|
|
@@ -12833,7 +13058,7 @@ function createMCPServer(config) {
|
|
|
12833
13058
|
body: JSON.stringify({ triggerId })
|
|
12834
13059
|
});
|
|
12835
13060
|
} catch (error) {
|
|
12836
|
-
|
|
13061
|
+
logger40.error("[Trigger] Failed to pause in scheduler:", error);
|
|
12837
13062
|
}
|
|
12838
13063
|
return Response.json(updated);
|
|
12839
13064
|
} else if (subAction === "resume" && method === "POST") {
|
|
@@ -12861,7 +13086,7 @@ function createMCPServer(config) {
|
|
|
12861
13086
|
body: JSON.stringify({ triggerId })
|
|
12862
13087
|
});
|
|
12863
13088
|
} catch (error) {
|
|
12864
|
-
|
|
13089
|
+
logger40.error("[Trigger] Failed to resume in scheduler:", error);
|
|
12865
13090
|
}
|
|
12866
13091
|
return Response.json(updated);
|
|
12867
13092
|
} else if (subAction === "run" && method === "POST") {
|
|
@@ -12932,7 +13157,7 @@ function createMCPServer(config) {
|
|
|
12932
13157
|
})
|
|
12933
13158
|
});
|
|
12934
13159
|
} catch (error) {
|
|
12935
|
-
|
|
13160
|
+
logger40.error("[Trigger] Failed to update scheduler:", error);
|
|
12936
13161
|
}
|
|
12937
13162
|
}
|
|
12938
13163
|
return Response.json(updated);
|
|
@@ -12949,14 +13174,14 @@ function createMCPServer(config) {
|
|
|
12949
13174
|
body: JSON.stringify({ triggerId })
|
|
12950
13175
|
});
|
|
12951
13176
|
} catch (error) {
|
|
12952
|
-
|
|
13177
|
+
logger40.error("[Trigger] Failed to unregister from scheduler:", error);
|
|
12953
13178
|
}
|
|
12954
13179
|
return new Response(null, { status: 204 });
|
|
12955
13180
|
}
|
|
12956
13181
|
}
|
|
12957
13182
|
return Response.json({ error: "Invalid trigger route or method" }, { status: 404 });
|
|
12958
13183
|
} catch (error) {
|
|
12959
|
-
|
|
13184
|
+
logger40.error("[Trigger] Error:", error);
|
|
12960
13185
|
return Response.json({ error: error.message || "Failed to process trigger request" }, { status: error.statusCode || 500 });
|
|
12961
13186
|
}
|
|
12962
13187
|
}
|
|
@@ -12982,11 +13207,11 @@ function createMCPServer(config) {
|
|
|
12982
13207
|
const errorRedirectUrl = "/auth-error";
|
|
12983
13208
|
if (error) {
|
|
12984
13209
|
const errorMsg = errorDescription || error;
|
|
12985
|
-
|
|
13210
|
+
logger40.error("[OAuth Redirect] Error:", errorMsg);
|
|
12986
13211
|
return Response.redirect(new URL(`${errorRedirectUrl}?error=${encodeURIComponent(errorMsg)}`, webRequest.url));
|
|
12987
13212
|
}
|
|
12988
13213
|
if (!code || !state) {
|
|
12989
|
-
|
|
13214
|
+
logger40.error("[OAuth Redirect] Missing code or state parameter");
|
|
12990
13215
|
return Response.redirect(new URL(`${errorRedirectUrl}?error=${encodeURIComponent("Invalid OAuth callback")}`, webRequest.url));
|
|
12991
13216
|
}
|
|
12992
13217
|
let returnUrl = defaultRedirectUrl;
|
|
@@ -13062,7 +13287,7 @@ function createMCPServer(config) {
|
|
|
13062
13287
|
frontendUrl.hash = `oauth_callback=${encodeURIComponent(JSON.stringify({ code, state, tokenData }))}`;
|
|
13063
13288
|
return Response.redirect(frontendUrl);
|
|
13064
13289
|
} catch (error2) {
|
|
13065
|
-
|
|
13290
|
+
logger40.error("[OAuth Backend Callback] Error:", error2);
|
|
13066
13291
|
return Response.redirect(new URL(`${errorRedirectUrl}?error=${encodeURIComponent(error2.message || "Failed to exchange token")}`, webRequest.url));
|
|
13067
13292
|
}
|
|
13068
13293
|
} else {
|
|
@@ -13363,6 +13588,7 @@ export {
|
|
|
13363
13588
|
outlookIntegration,
|
|
13364
13589
|
onedriveIntegration,
|
|
13365
13590
|
notionIntegration,
|
|
13591
|
+
mercuryIntegration,
|
|
13366
13592
|
linearIntegration,
|
|
13367
13593
|
intercomIntegration,
|
|
13368
13594
|
hubspotIntegration,
|
|
@@ -13370,6 +13596,7 @@ export {
|
|
|
13370
13596
|
handleAnthropicMessage,
|
|
13371
13597
|
gslidesIntegration,
|
|
13372
13598
|
gsheetsIntegration,
|
|
13599
|
+
granolaIntegration,
|
|
13373
13600
|
gmailIntegration,
|
|
13374
13601
|
githubIntegration,
|
|
13375
13602
|
getVercelAITools,
|
|
@@ -13387,6 +13614,7 @@ export {
|
|
|
13387
13614
|
executeSandboxCode,
|
|
13388
13615
|
executeGoogleFunctionCalls,
|
|
13389
13616
|
excelIntegration,
|
|
13617
|
+
dropboxIntegration,
|
|
13390
13618
|
cursorIntegration,
|
|
13391
13619
|
createTriggerTools,
|
|
13392
13620
|
createTanStackOAuthHandler,
|