integrate-sdk 0.9.27-dev.1 → 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 +52 -34
- package/dist/adapters/solid-start.js +52 -34
- package/dist/adapters/svelte-kit.js +52 -34
- package/dist/index.js +231 -62
- package/dist/server.js +253 -83
- package/dist/src/client.d.ts +8 -0
- package/dist/src/client.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
|
@@ -2033,7 +2033,7 @@ async function deliverWebhook(webhook, payload, timeoutMs) {
|
|
|
2033
2033
|
signal: controller.signal
|
|
2034
2034
|
});
|
|
2035
2035
|
if (!response.ok) {
|
|
2036
|
-
|
|
2036
|
+
logger38.warn(`Webhook delivery to ${webhook.url} returned ${response.status}`);
|
|
2037
2037
|
}
|
|
2038
2038
|
} finally {
|
|
2039
2039
|
clearTimeout(timeout);
|
|
@@ -2046,14 +2046,14 @@ async function deliverWebhooks(webhooks, payload, timeoutMs) {
|
|
|
2046
2046
|
for (let i = 0;i < results.length; i++) {
|
|
2047
2047
|
const result = results[i];
|
|
2048
2048
|
if (result.status === "rejected") {
|
|
2049
|
-
|
|
2049
|
+
logger38.warn(`Webhook delivery to ${webhooks[i].url} failed:`, result.reason);
|
|
2050
2050
|
}
|
|
2051
2051
|
}
|
|
2052
2052
|
}
|
|
2053
|
-
var
|
|
2053
|
+
var logger38;
|
|
2054
2054
|
var init_webhooks = __esm(() => {
|
|
2055
2055
|
init_logger();
|
|
2056
|
-
|
|
2056
|
+
logger38 = createLogger("Webhooks", "server");
|
|
2057
2057
|
});
|
|
2058
2058
|
|
|
2059
2059
|
// src/triggers/types.ts
|
|
@@ -2073,13 +2073,13 @@ async function executeTrigger(trigger, config, context) {
|
|
|
2073
2073
|
while (stepIndex < MAX_TRIGGER_STEPS) {
|
|
2074
2074
|
const stepValidation = validateStepLimit(stepIndex, MAX_TRIGGER_STEPS);
|
|
2075
2075
|
if (!stepValidation.valid) {
|
|
2076
|
-
|
|
2076
|
+
logger39.error(`[Trigger ${trigger.id}] ${stepValidation.error}`);
|
|
2077
2077
|
break;
|
|
2078
2078
|
}
|
|
2079
2079
|
const providerToken = await config.getProviderToken(currentProvider, undefined, context);
|
|
2080
2080
|
if (!providerToken) {
|
|
2081
2081
|
const error = `No OAuth token available for provider '${currentProvider}'`;
|
|
2082
|
-
|
|
2082
|
+
logger39.error(`[Trigger ${trigger.id}] ${error}`);
|
|
2083
2083
|
steps.push({
|
|
2084
2084
|
stepIndex,
|
|
2085
2085
|
toolName: currentToolName,
|
|
@@ -2105,7 +2105,7 @@ async function executeTrigger(trigger, config, context) {
|
|
|
2105
2105
|
} catch (err) {
|
|
2106
2106
|
stepSuccess = false;
|
|
2107
2107
|
stepError = err.message || "Tool execution failed";
|
|
2108
|
-
|
|
2108
|
+
logger39.error(`[Trigger ${trigger.id}] Step ${stepIndex} failed:`, err);
|
|
2109
2109
|
}
|
|
2110
2110
|
if (stepSuccess && toolResult) {
|
|
2111
2111
|
if (toolResult.isError === true) {
|
|
@@ -2198,7 +2198,7 @@ async function executeTrigger(trigger, config, context) {
|
|
|
2198
2198
|
return { success: steps.every((s) => s.success), steps, error: stepError };
|
|
2199
2199
|
}
|
|
2200
2200
|
const limitError = `Trigger execution exceeded maximum of ${MAX_TRIGGER_STEPS} steps`;
|
|
2201
|
-
|
|
2201
|
+
logger39.error(`[Trigger ${trigger.id}] ${limitError}`);
|
|
2202
2202
|
await config.triggers.update(trigger.id, {
|
|
2203
2203
|
lastRunAt: new Date().toISOString(),
|
|
2204
2204
|
runCount: (trigger.runCount || 0) + 1,
|
|
@@ -2207,12 +2207,12 @@ async function executeTrigger(trigger, config, context) {
|
|
|
2207
2207
|
}, context);
|
|
2208
2208
|
return { success: false, steps, error: limitError };
|
|
2209
2209
|
}
|
|
2210
|
-
var
|
|
2210
|
+
var logger39;
|
|
2211
2211
|
var init_executor2 = __esm(() => {
|
|
2212
2212
|
init_logger();
|
|
2213
2213
|
init_utils();
|
|
2214
2214
|
init_webhooks();
|
|
2215
|
-
|
|
2215
|
+
logger39 = createLogger("TriggerExecutor", "server");
|
|
2216
2216
|
});
|
|
2217
2217
|
|
|
2218
2218
|
// src/protocol/jsonrpc.ts
|
|
@@ -3945,6 +3945,9 @@ class MCPClientBase {
|
|
|
3945
3945
|
async _callToolByName(name, args, options) {
|
|
3946
3946
|
return await this.callToolWithRetry(name, args, 0, options);
|
|
3947
3947
|
}
|
|
3948
|
+
async callTool(name, args, options) {
|
|
3949
|
+
return await this.callToolWithRetry(name, args, 0, options);
|
|
3950
|
+
}
|
|
3948
3951
|
async callServerTool(name, args) {
|
|
3949
3952
|
try {
|
|
3950
3953
|
const response = await this.callToolThroughHandler(name, args);
|
|
@@ -3955,35 +3958,38 @@ class MCPClientBase {
|
|
|
3955
3958
|
}
|
|
3956
3959
|
}
|
|
3957
3960
|
async callToolThroughHandler(name, args, provider, options) {
|
|
3961
|
+
const integrationHeaders = this.getHeadersForTool(name);
|
|
3958
3962
|
const transportHeaders = this.transport.headers || {};
|
|
3959
3963
|
const hasApiKey = !!transportHeaders["X-API-KEY"];
|
|
3960
3964
|
if (hasApiKey) {
|
|
3961
3965
|
await this.ensureConnected();
|
|
3966
|
+
const temporaryHeaders = { ...integrationHeaders };
|
|
3962
3967
|
if (provider) {
|
|
3963
3968
|
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
|
-
|
|
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);
|
|
3979
3990
|
}
|
|
3980
3991
|
}
|
|
3981
3992
|
}
|
|
3982
|
-
const result2 = await this.transport.sendRequest("tools/call", {
|
|
3983
|
-
name,
|
|
3984
|
-
arguments: args || {}
|
|
3985
|
-
});
|
|
3986
|
-
return result2;
|
|
3987
3993
|
}
|
|
3988
3994
|
const url = this.apiBaseUrl ? `${this.apiBaseUrl}${this.apiRouteBase}/mcp` : `${this.apiRouteBase}/mcp`;
|
|
3989
3995
|
const headers = {
|
|
@@ -3993,6 +3999,7 @@ class MCPClientBase {
|
|
|
3993
3999
|
if (integrationsHeader) {
|
|
3994
4000
|
headers["X-Integrations"] = integrationsHeader;
|
|
3995
4001
|
}
|
|
4002
|
+
Object.assign(headers, integrationHeaders);
|
|
3996
4003
|
if (provider) {
|
|
3997
4004
|
const tokenData = await this.oauthManager.getProviderToken(provider, undefined, options?.context);
|
|
3998
4005
|
if (tokenData) {
|
|
@@ -4082,6 +4089,14 @@ class MCPClientBase {
|
|
|
4082
4089
|
}
|
|
4083
4090
|
return;
|
|
4084
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
|
+
}
|
|
4085
4100
|
getTool(name) {
|
|
4086
4101
|
return this.availableTools.get(name);
|
|
4087
4102
|
}
|
|
@@ -5639,9 +5654,57 @@ function onedriveIntegration(config = {}) {
|
|
|
5639
5654
|
}
|
|
5640
5655
|
};
|
|
5641
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
|
+
}
|
|
5642
5705
|
// src/integrations/word.ts
|
|
5643
5706
|
init_logger();
|
|
5644
|
-
var
|
|
5707
|
+
var logger25 = createLogger("Word");
|
|
5645
5708
|
var WORD_TOOLS = [
|
|
5646
5709
|
"word_list",
|
|
5647
5710
|
"word_get",
|
|
@@ -5667,16 +5730,16 @@ function wordIntegration(config = {}) {
|
|
|
5667
5730
|
tools: [...WORD_TOOLS],
|
|
5668
5731
|
oauth,
|
|
5669
5732
|
async onInit(_client) {
|
|
5670
|
-
|
|
5733
|
+
logger25.debug("Word integration initialized");
|
|
5671
5734
|
},
|
|
5672
5735
|
async onAfterConnect(_client) {
|
|
5673
|
-
|
|
5736
|
+
logger25.debug("Word integration connected");
|
|
5674
5737
|
}
|
|
5675
5738
|
};
|
|
5676
5739
|
}
|
|
5677
5740
|
// src/integrations/excel.ts
|
|
5678
5741
|
init_logger();
|
|
5679
|
-
var
|
|
5742
|
+
var logger26 = createLogger("Excel");
|
|
5680
5743
|
var EXCEL_TOOLS = [
|
|
5681
5744
|
"excel_list",
|
|
5682
5745
|
"excel_get",
|
|
@@ -5712,16 +5775,16 @@ function excelIntegration(config = {}) {
|
|
|
5712
5775
|
tools: [...EXCEL_TOOLS],
|
|
5713
5776
|
oauth,
|
|
5714
5777
|
async onInit(_client) {
|
|
5715
|
-
|
|
5778
|
+
logger26.debug("Excel integration initialized");
|
|
5716
5779
|
},
|
|
5717
5780
|
async onAfterConnect(_client) {
|
|
5718
|
-
|
|
5781
|
+
logger26.debug("Excel integration connected");
|
|
5719
5782
|
}
|
|
5720
5783
|
};
|
|
5721
5784
|
}
|
|
5722
5785
|
// src/integrations/powerpoint.ts
|
|
5723
5786
|
init_logger();
|
|
5724
|
-
var
|
|
5787
|
+
var logger27 = createLogger("PowerPoint");
|
|
5725
5788
|
var POWERPOINT_TOOLS = [
|
|
5726
5789
|
"powerpoint_list",
|
|
5727
5790
|
"powerpoint_get",
|
|
@@ -5747,16 +5810,16 @@ function powerpointIntegration(config = {}) {
|
|
|
5747
5810
|
tools: [...POWERPOINT_TOOLS],
|
|
5748
5811
|
oauth,
|
|
5749
5812
|
async onInit(_client) {
|
|
5750
|
-
|
|
5813
|
+
logger27.debug("PowerPoint integration initialized");
|
|
5751
5814
|
},
|
|
5752
5815
|
async onAfterConnect(_client) {
|
|
5753
|
-
|
|
5816
|
+
logger27.debug("PowerPoint integration connected");
|
|
5754
5817
|
}
|
|
5755
5818
|
};
|
|
5756
5819
|
}
|
|
5757
5820
|
// src/integrations/gdocs.ts
|
|
5758
5821
|
init_logger();
|
|
5759
|
-
var
|
|
5822
|
+
var logger28 = createLogger("Google Docs");
|
|
5760
5823
|
var GDOCS_TOOLS = [
|
|
5761
5824
|
"gdocs_list",
|
|
5762
5825
|
"gdocs_get",
|
|
@@ -5781,16 +5844,16 @@ function gdocsIntegration(config = {}) {
|
|
|
5781
5844
|
tools: [...GDOCS_TOOLS],
|
|
5782
5845
|
oauth,
|
|
5783
5846
|
async onInit(_client) {
|
|
5784
|
-
|
|
5847
|
+
logger28.debug("Google Docs integration initialized");
|
|
5785
5848
|
},
|
|
5786
5849
|
async onAfterConnect(_client) {
|
|
5787
|
-
|
|
5850
|
+
logger28.debug("Google Docs integration connected");
|
|
5788
5851
|
}
|
|
5789
5852
|
};
|
|
5790
5853
|
}
|
|
5791
5854
|
// src/integrations/gdrive.ts
|
|
5792
5855
|
init_logger();
|
|
5793
|
-
var
|
|
5856
|
+
var logger29 = createLogger("Google Drive");
|
|
5794
5857
|
var GDRIVE_TOOLS = [
|
|
5795
5858
|
"gdrive_list_files",
|
|
5796
5859
|
"gdrive_get_file",
|
|
@@ -5824,16 +5887,16 @@ function gdriveIntegration(config = {}) {
|
|
|
5824
5887
|
tools: [...GDRIVE_TOOLS],
|
|
5825
5888
|
oauth,
|
|
5826
5889
|
async onInit(_client) {
|
|
5827
|
-
|
|
5890
|
+
logger29.debug("Google Drive integration initialized");
|
|
5828
5891
|
},
|
|
5829
5892
|
async onAfterConnect(_client) {
|
|
5830
|
-
|
|
5893
|
+
logger29.debug("Google Drive integration connected");
|
|
5831
5894
|
}
|
|
5832
5895
|
};
|
|
5833
5896
|
}
|
|
5834
5897
|
// src/integrations/gsheets.ts
|
|
5835
5898
|
init_logger();
|
|
5836
|
-
var
|
|
5899
|
+
var logger30 = createLogger("Google Sheets");
|
|
5837
5900
|
var GSHEETS_TOOLS = [
|
|
5838
5901
|
"gsheets_list",
|
|
5839
5902
|
"gsheets_get",
|
|
@@ -5861,16 +5924,16 @@ function gsheetsIntegration(config = {}) {
|
|
|
5861
5924
|
tools: [...GSHEETS_TOOLS],
|
|
5862
5925
|
oauth,
|
|
5863
5926
|
async onInit(_client) {
|
|
5864
|
-
|
|
5927
|
+
logger30.debug("Google Sheets integration initialized");
|
|
5865
5928
|
},
|
|
5866
5929
|
async onAfterConnect(_client) {
|
|
5867
|
-
|
|
5930
|
+
logger30.debug("Google Sheets integration connected");
|
|
5868
5931
|
}
|
|
5869
5932
|
};
|
|
5870
5933
|
}
|
|
5871
5934
|
// src/integrations/gslides.ts
|
|
5872
5935
|
init_logger();
|
|
5873
|
-
var
|
|
5936
|
+
var logger31 = createLogger("Google Slides");
|
|
5874
5937
|
var GSLIDES_TOOLS = [
|
|
5875
5938
|
"gslides_list",
|
|
5876
5939
|
"gslides_get",
|
|
@@ -5897,16 +5960,16 @@ function gslidesIntegration(config = {}) {
|
|
|
5897
5960
|
tools: [...GSLIDES_TOOLS],
|
|
5898
5961
|
oauth,
|
|
5899
5962
|
async onInit(_client) {
|
|
5900
|
-
|
|
5963
|
+
logger31.debug("Google Slides integration initialized");
|
|
5901
5964
|
},
|
|
5902
5965
|
async onAfterConnect(_client) {
|
|
5903
|
-
|
|
5966
|
+
logger31.debug("Google Slides integration connected");
|
|
5904
5967
|
}
|
|
5905
5968
|
};
|
|
5906
5969
|
}
|
|
5907
5970
|
// src/integrations/polar.ts
|
|
5908
5971
|
init_logger();
|
|
5909
|
-
var
|
|
5972
|
+
var logger32 = createLogger("Polar");
|
|
5910
5973
|
var POLAR_TOOLS = [
|
|
5911
5974
|
"polar_list_products",
|
|
5912
5975
|
"polar_get_product",
|
|
@@ -5963,16 +6026,16 @@ function polarIntegration(config = {}) {
|
|
|
5963
6026
|
tools: [...POLAR_TOOLS],
|
|
5964
6027
|
oauth,
|
|
5965
6028
|
async onInit(_client) {
|
|
5966
|
-
|
|
6029
|
+
logger32.debug("Polar integration initialized");
|
|
5967
6030
|
},
|
|
5968
6031
|
async onAfterConnect(_client) {
|
|
5969
|
-
|
|
6032
|
+
logger32.debug("Polar integration connected");
|
|
5970
6033
|
}
|
|
5971
6034
|
};
|
|
5972
6035
|
}
|
|
5973
6036
|
// src/integrations/figma.ts
|
|
5974
6037
|
init_logger();
|
|
5975
|
-
var
|
|
6038
|
+
var logger33 = createLogger("Figma");
|
|
5976
6039
|
var FIGMA_TOOLS = [
|
|
5977
6040
|
"figma_get_file",
|
|
5978
6041
|
"figma_get_file_nodes",
|
|
@@ -6038,16 +6101,16 @@ function figmaIntegration(config = {}) {
|
|
|
6038
6101
|
tools: [...FIGMA_TOOLS],
|
|
6039
6102
|
oauth,
|
|
6040
6103
|
async onInit(_client) {
|
|
6041
|
-
|
|
6104
|
+
logger33.debug("Figma integration initialized");
|
|
6042
6105
|
},
|
|
6043
6106
|
async onAfterConnect(_client) {
|
|
6044
|
-
|
|
6107
|
+
logger33.debug("Figma integration connected");
|
|
6045
6108
|
}
|
|
6046
6109
|
};
|
|
6047
6110
|
}
|
|
6048
6111
|
// src/integrations/intercom.ts
|
|
6049
6112
|
init_logger();
|
|
6050
|
-
var
|
|
6113
|
+
var logger34 = createLogger("Intercom");
|
|
6051
6114
|
var INTERCOM_TOOLS = [
|
|
6052
6115
|
"intercom_list_contacts",
|
|
6053
6116
|
"intercom_get_contact",
|
|
@@ -6078,16 +6141,16 @@ function intercomIntegration(config = {}) {
|
|
|
6078
6141
|
tools: [...INTERCOM_TOOLS],
|
|
6079
6142
|
oauth,
|
|
6080
6143
|
async onInit(_client) {
|
|
6081
|
-
|
|
6144
|
+
logger34.debug("Intercom integration initialized");
|
|
6082
6145
|
},
|
|
6083
6146
|
async onAfterConnect(_client) {
|
|
6084
|
-
|
|
6147
|
+
logger34.debug("Intercom integration connected");
|
|
6085
6148
|
}
|
|
6086
6149
|
};
|
|
6087
6150
|
}
|
|
6088
6151
|
// src/integrations/hubspot.ts
|
|
6089
6152
|
init_logger();
|
|
6090
|
-
var
|
|
6153
|
+
var logger35 = createLogger("HubSpot");
|
|
6091
6154
|
var HUBSPOT_TOOLS = [
|
|
6092
6155
|
"hubspot_list_contacts",
|
|
6093
6156
|
"hubspot_get_contact",
|
|
@@ -6137,16 +6200,16 @@ function hubspotIntegration(config = {}) {
|
|
|
6137
6200
|
tools: [...HUBSPOT_TOOLS],
|
|
6138
6201
|
oauth,
|
|
6139
6202
|
async onInit(_client) {
|
|
6140
|
-
|
|
6203
|
+
logger35.debug("HubSpot integration initialized");
|
|
6141
6204
|
},
|
|
6142
6205
|
async onAfterConnect(_client) {
|
|
6143
|
-
|
|
6206
|
+
logger35.debug("HubSpot integration connected");
|
|
6144
6207
|
}
|
|
6145
6208
|
};
|
|
6146
6209
|
}
|
|
6147
6210
|
// src/integrations/youtube.ts
|
|
6148
6211
|
init_logger();
|
|
6149
|
-
var
|
|
6212
|
+
var logger36 = createLogger("YouTube");
|
|
6150
6213
|
var YOUTUBE_TOOLS = [
|
|
6151
6214
|
"youtube_search",
|
|
6152
6215
|
"youtube_get_video",
|
|
@@ -6192,16 +6255,16 @@ function youtubeIntegration(config = {}) {
|
|
|
6192
6255
|
tools: [...YOUTUBE_TOOLS],
|
|
6193
6256
|
oauth,
|
|
6194
6257
|
async onInit(_client) {
|
|
6195
|
-
|
|
6258
|
+
logger36.debug("YouTube integration initialized");
|
|
6196
6259
|
},
|
|
6197
6260
|
async onAfterConnect(_client) {
|
|
6198
|
-
|
|
6261
|
+
logger36.debug("YouTube integration connected");
|
|
6199
6262
|
}
|
|
6200
6263
|
};
|
|
6201
6264
|
}
|
|
6202
6265
|
// src/integrations/cursor.ts
|
|
6203
6266
|
init_logger();
|
|
6204
|
-
var
|
|
6267
|
+
var logger37 = createLogger("Cursor");
|
|
6205
6268
|
var CURSOR_TOOLS = [
|
|
6206
6269
|
"cursor_list_agents",
|
|
6207
6270
|
"cursor_get_agent",
|
|
@@ -6221,10 +6284,114 @@ function cursorIntegration(_config = {}) {
|
|
|
6221
6284
|
logoUrl: "https://wdvtnli2jn3texa6.public.blob.vercel-storage.com/cursor.jpeg",
|
|
6222
6285
|
tools: [...CURSOR_TOOLS],
|
|
6223
6286
|
async onInit(_client) {
|
|
6224
|
-
|
|
6287
|
+
logger37.debug("Cursor integration initialized");
|
|
6225
6288
|
},
|
|
6226
6289
|
async onAfterConnect(_client) {
|
|
6227
|
-
|
|
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
|
+
};
|
|
6228
6395
|
}
|
|
6229
6396
|
};
|
|
6230
6397
|
}
|
|
@@ -12396,7 +12563,7 @@ function convertJsonSchemaToGoogleSchema(jsonSchema, TypeEnum) {
|
|
|
12396
12563
|
}
|
|
12397
12564
|
// src/server.ts
|
|
12398
12565
|
var SERVER_LOG_CONTEXT3 = "server";
|
|
12399
|
-
var
|
|
12566
|
+
var logger40 = createLogger("MCPServer", SERVER_LOG_CONTEXT3);
|
|
12400
12567
|
var globalServerConfig = null;
|
|
12401
12568
|
var globalMCPHandler = null;
|
|
12402
12569
|
var codeVerifierStorage = new Map;
|
|
@@ -12502,7 +12669,7 @@ function createMCPServer(config) {
|
|
|
12502
12669
|
if (integration.oauth) {
|
|
12503
12670
|
const { clientId, clientSecret, redirectUri: integrationRedirectUri, config: oauthConfig } = integration.oauth;
|
|
12504
12671
|
if (!clientId || !clientSecret) {
|
|
12505
|
-
|
|
12672
|
+
logger40.warn(`Warning: Integration "${integration.id}" is missing OAuth credentials. ` + `Provide clientId and clientSecret in the integration configuration.`);
|
|
12506
12673
|
return integration;
|
|
12507
12674
|
}
|
|
12508
12675
|
const redirectUri = integrationRedirectUri || config.redirectUri || getDefaultRedirectUri();
|
|
@@ -12679,7 +12846,7 @@ function createMCPServer(config) {
|
|
|
12679
12846
|
}
|
|
12680
12847
|
return response2;
|
|
12681
12848
|
} catch (error) {
|
|
12682
|
-
|
|
12849
|
+
logger40.error("[MCP Tool Call] Error:", error);
|
|
12683
12850
|
return Response.json({ error: error.message || "Failed to execute tool call" }, { status: error.statusCode || 500 });
|
|
12684
12851
|
}
|
|
12685
12852
|
}
|
|
@@ -12728,7 +12895,7 @@ function createMCPServer(config) {
|
|
|
12728
12895
|
});
|
|
12729
12896
|
return Response.json(result, { status: result.success ? 200 : 500 });
|
|
12730
12897
|
} catch (error) {
|
|
12731
|
-
|
|
12898
|
+
logger40.error("[Code Mode] Error:", error);
|
|
12732
12899
|
return Response.json({ error: error?.message || "Failed to execute code" }, { status: 500 });
|
|
12733
12900
|
}
|
|
12734
12901
|
}
|
|
@@ -12792,7 +12959,7 @@ function createMCPServer(config) {
|
|
|
12792
12959
|
error: executionResult.error
|
|
12793
12960
|
});
|
|
12794
12961
|
} catch (error) {
|
|
12795
|
-
|
|
12962
|
+
logger40.error("[Trigger Notify] Error:", error);
|
|
12796
12963
|
return Response.json({ error: error.message || "Failed to execute trigger" }, { status: 500 });
|
|
12797
12964
|
}
|
|
12798
12965
|
}
|
|
@@ -12856,7 +13023,7 @@ function createMCPServer(config) {
|
|
|
12856
13023
|
})
|
|
12857
13024
|
});
|
|
12858
13025
|
} catch (scheduleError) {
|
|
12859
|
-
|
|
13026
|
+
logger40.error("[Trigger] Failed to register with scheduler:", scheduleError);
|
|
12860
13027
|
}
|
|
12861
13028
|
return Response.json(created, { status: 201 });
|
|
12862
13029
|
}
|
|
@@ -12891,7 +13058,7 @@ function createMCPServer(config) {
|
|
|
12891
13058
|
body: JSON.stringify({ triggerId })
|
|
12892
13059
|
});
|
|
12893
13060
|
} catch (error) {
|
|
12894
|
-
|
|
13061
|
+
logger40.error("[Trigger] Failed to pause in scheduler:", error);
|
|
12895
13062
|
}
|
|
12896
13063
|
return Response.json(updated);
|
|
12897
13064
|
} else if (subAction === "resume" && method === "POST") {
|
|
@@ -12919,7 +13086,7 @@ function createMCPServer(config) {
|
|
|
12919
13086
|
body: JSON.stringify({ triggerId })
|
|
12920
13087
|
});
|
|
12921
13088
|
} catch (error) {
|
|
12922
|
-
|
|
13089
|
+
logger40.error("[Trigger] Failed to resume in scheduler:", error);
|
|
12923
13090
|
}
|
|
12924
13091
|
return Response.json(updated);
|
|
12925
13092
|
} else if (subAction === "run" && method === "POST") {
|
|
@@ -12990,7 +13157,7 @@ function createMCPServer(config) {
|
|
|
12990
13157
|
})
|
|
12991
13158
|
});
|
|
12992
13159
|
} catch (error) {
|
|
12993
|
-
|
|
13160
|
+
logger40.error("[Trigger] Failed to update scheduler:", error);
|
|
12994
13161
|
}
|
|
12995
13162
|
}
|
|
12996
13163
|
return Response.json(updated);
|
|
@@ -13007,14 +13174,14 @@ function createMCPServer(config) {
|
|
|
13007
13174
|
body: JSON.stringify({ triggerId })
|
|
13008
13175
|
});
|
|
13009
13176
|
} catch (error) {
|
|
13010
|
-
|
|
13177
|
+
logger40.error("[Trigger] Failed to unregister from scheduler:", error);
|
|
13011
13178
|
}
|
|
13012
13179
|
return new Response(null, { status: 204 });
|
|
13013
13180
|
}
|
|
13014
13181
|
}
|
|
13015
13182
|
return Response.json({ error: "Invalid trigger route or method" }, { status: 404 });
|
|
13016
13183
|
} catch (error) {
|
|
13017
|
-
|
|
13184
|
+
logger40.error("[Trigger] Error:", error);
|
|
13018
13185
|
return Response.json({ error: error.message || "Failed to process trigger request" }, { status: error.statusCode || 500 });
|
|
13019
13186
|
}
|
|
13020
13187
|
}
|
|
@@ -13040,11 +13207,11 @@ function createMCPServer(config) {
|
|
|
13040
13207
|
const errorRedirectUrl = "/auth-error";
|
|
13041
13208
|
if (error) {
|
|
13042
13209
|
const errorMsg = errorDescription || error;
|
|
13043
|
-
|
|
13210
|
+
logger40.error("[OAuth Redirect] Error:", errorMsg);
|
|
13044
13211
|
return Response.redirect(new URL(`${errorRedirectUrl}?error=${encodeURIComponent(errorMsg)}`, webRequest.url));
|
|
13045
13212
|
}
|
|
13046
13213
|
if (!code || !state) {
|
|
13047
|
-
|
|
13214
|
+
logger40.error("[OAuth Redirect] Missing code or state parameter");
|
|
13048
13215
|
return Response.redirect(new URL(`${errorRedirectUrl}?error=${encodeURIComponent("Invalid OAuth callback")}`, webRequest.url));
|
|
13049
13216
|
}
|
|
13050
13217
|
let returnUrl = defaultRedirectUrl;
|
|
@@ -13120,7 +13287,7 @@ function createMCPServer(config) {
|
|
|
13120
13287
|
frontendUrl.hash = `oauth_callback=${encodeURIComponent(JSON.stringify({ code, state, tokenData }))}`;
|
|
13121
13288
|
return Response.redirect(frontendUrl);
|
|
13122
13289
|
} catch (error2) {
|
|
13123
|
-
|
|
13290
|
+
logger40.error("[OAuth Backend Callback] Error:", error2);
|
|
13124
13291
|
return Response.redirect(new URL(`${errorRedirectUrl}?error=${encodeURIComponent(error2.message || "Failed to exchange token")}`, webRequest.url));
|
|
13125
13292
|
}
|
|
13126
13293
|
} else {
|
|
@@ -13421,6 +13588,7 @@ export {
|
|
|
13421
13588
|
outlookIntegration,
|
|
13422
13589
|
onedriveIntegration,
|
|
13423
13590
|
notionIntegration,
|
|
13591
|
+
mercuryIntegration,
|
|
13424
13592
|
linearIntegration,
|
|
13425
13593
|
intercomIntegration,
|
|
13426
13594
|
hubspotIntegration,
|
|
@@ -13428,6 +13596,7 @@ export {
|
|
|
13428
13596
|
handleAnthropicMessage,
|
|
13429
13597
|
gslidesIntegration,
|
|
13430
13598
|
gsheetsIntegration,
|
|
13599
|
+
granolaIntegration,
|
|
13431
13600
|
gmailIntegration,
|
|
13432
13601
|
githubIntegration,
|
|
13433
13602
|
getVercelAITools,
|
|
@@ -13445,6 +13614,7 @@ export {
|
|
|
13445
13614
|
executeSandboxCode,
|
|
13446
13615
|
executeGoogleFunctionCalls,
|
|
13447
13616
|
excelIntegration,
|
|
13617
|
+
dropboxIntegration,
|
|
13448
13618
|
cursorIntegration,
|
|
13449
13619
|
createTriggerTools,
|
|
13450
13620
|
createTanStackOAuthHandler,
|