integrate-sdk 0.9.25 → 0.9.26-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/dist/adapters/index.js +28 -10
- package/dist/adapters/solid-start.js +28 -10
- package/dist/adapters/svelte-kit.js +28 -10
- package/dist/ai/anthropic.js +11 -1
- package/dist/ai/google.js +11 -1
- package/dist/ai/index.js +11 -1
- package/dist/ai/openai.js +11 -1
- package/dist/ai/vercel-ai.js +11 -1
- package/dist/code-mode/executor.js +5 -1
- package/dist/code-mode/index.js +11 -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 +5 -1
- package/dist/code-mode/tool-builder.d.ts.map +1 -1
- package/dist/code-mode/tool-builder.js +11 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +197 -10
- package/dist/server.js +292 -64
- 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/code-mode/tool-builder.d.ts.map +1 -1
- package/dist/src/integrations/excel-client.d.ts +284 -0
- package/dist/src/integrations/excel-client.d.ts.map +1 -0
- package/dist/src/integrations/excel.d.ts +22 -0
- package/dist/src/integrations/excel.d.ts.map +1 -0
- package/dist/src/integrations/gdrive-client.d.ts +264 -0
- package/dist/src/integrations/gdrive-client.d.ts.map +1 -0
- package/dist/src/integrations/gdrive.d.ts +22 -0
- package/dist/src/integrations/gdrive.d.ts.map +1 -0
- package/dist/src/integrations/onedrive-client.d.ts +47 -250
- package/dist/src/integrations/onedrive-client.d.ts.map +1 -1
- package/dist/src/integrations/onedrive.d.ts +1 -1
- package/dist/src/integrations/onedrive.d.ts.map +1 -1
- package/dist/src/integrations/powerpoint-client.d.ts +99 -0
- package/dist/src/integrations/powerpoint-client.d.ts.map +1 -0
- package/dist/src/integrations/powerpoint.d.ts +22 -0
- package/dist/src/integrations/powerpoint.d.ts.map +1 -0
- package/dist/src/integrations/whatsapp-client.d.ts +406 -211
- package/dist/src/integrations/whatsapp-client.d.ts.map +1 -1
- package/dist/src/integrations/whatsapp.d.ts +1 -1
- package/dist/src/integrations/whatsapp.d.ts.map +1 -1
- package/dist/src/integrations/word-client.d.ts +99 -0
- package/dist/src/integrations/word-client.d.ts.map +1 -0
- package/dist/src/integrations/word.d.ts +22 -0
- package/dist/src/integrations/word.d.ts.map +1 -0
- package/dist/src/integrations/youtube-client.d.ts +292 -283
- package/dist/src/integrations/youtube-client.d.ts.map +1 -1
- package/dist/src/integrations/youtube.d.ts +2 -2
- package/dist/src/integrations/youtube.d.ts.map +1 -1
- package/dist/src/server.d.ts +4 -0
- package/dist/src/server.d.ts.map +1 -1
- package/index.ts +8 -0
- package/package.json +1 -1
package/dist/server.js
CHANGED
|
@@ -1600,7 +1600,11 @@ function createIntegrationProxy(integrationId) {
|
|
|
1600
1600
|
return new Proxy({}, {
|
|
1601
1601
|
get(_target, methodName) {
|
|
1602
1602
|
if (typeof methodName !== 'string') return undefined;
|
|
1603
|
-
return (args) =>
|
|
1603
|
+
return (args) => {
|
|
1604
|
+
const alreadyFull = methodName.startsWith(integrationId + '_') || methodName.startsWith('___');
|
|
1605
|
+
const toolName = alreadyFull ? methodName : integrationId + '_' + camelToSnake(methodName);
|
|
1606
|
+
return callTool(toolName, args);
|
|
1607
|
+
};
|
|
1604
1608
|
},
|
|
1605
1609
|
});
|
|
1606
1610
|
}
|
|
@@ -1963,6 +1967,12 @@ var init_tool_builder = __esm(() => {
|
|
|
1963
1967
|
"Each method returns `ToolResult { content: [{ type, text? }], isError? }` — parse `result.content[0].text` as JSON.",
|
|
1964
1968
|
"Only `client`, `callTool`, `fetch`, `console`, `JSON` are available (no npm imports).",
|
|
1965
1969
|
"",
|
|
1970
|
+
"IMPORTANT — method naming rules (violations cause -32602 'tool not found'):",
|
|
1971
|
+
" • Always use camelCase method names: `client.github.getFileContents(args)` ✓",
|
|
1972
|
+
" • NEVER use the full tool ID as the method key: `client.github['github_get_file_contents']` ✗ (produces double prefix)",
|
|
1973
|
+
" • NEVER use snake_case method names: `client.github['get_file_contents']` ✗",
|
|
1974
|
+
" • If you use `callTool` directly, pass the exact tool name as listed (e.g. `callTool('github_get_file_contents', args)`) — do NOT add the integration prefix again.",
|
|
1975
|
+
"",
|
|
1966
1976
|
"Call `get_integration_types` with an integration name to get full parameter types before writing code.",
|
|
1967
1977
|
"",
|
|
1968
1978
|
"Available methods:"
|
|
@@ -1997,7 +2007,7 @@ async function deliverWebhook(webhook, payload, timeoutMs) {
|
|
|
1997
2007
|
signal: controller.signal
|
|
1998
2008
|
});
|
|
1999
2009
|
if (!response.ok) {
|
|
2000
|
-
|
|
2010
|
+
logger37.warn(`Webhook delivery to ${webhook.url} returned ${response.status}`);
|
|
2001
2011
|
}
|
|
2002
2012
|
} finally {
|
|
2003
2013
|
clearTimeout(timeout);
|
|
@@ -2010,14 +2020,14 @@ async function deliverWebhooks(webhooks, payload, timeoutMs) {
|
|
|
2010
2020
|
for (let i = 0;i < results.length; i++) {
|
|
2011
2021
|
const result = results[i];
|
|
2012
2022
|
if (result.status === "rejected") {
|
|
2013
|
-
|
|
2023
|
+
logger37.warn(`Webhook delivery to ${webhooks[i].url} failed:`, result.reason);
|
|
2014
2024
|
}
|
|
2015
2025
|
}
|
|
2016
2026
|
}
|
|
2017
|
-
var
|
|
2027
|
+
var logger37;
|
|
2018
2028
|
var init_webhooks = __esm(() => {
|
|
2019
2029
|
init_logger();
|
|
2020
|
-
|
|
2030
|
+
logger37 = createLogger("Webhooks", "server");
|
|
2021
2031
|
});
|
|
2022
2032
|
|
|
2023
2033
|
// src/triggers/types.ts
|
|
@@ -2037,13 +2047,13 @@ async function executeTrigger(trigger, config, context) {
|
|
|
2037
2047
|
while (stepIndex < MAX_TRIGGER_STEPS) {
|
|
2038
2048
|
const stepValidation = validateStepLimit(stepIndex, MAX_TRIGGER_STEPS);
|
|
2039
2049
|
if (!stepValidation.valid) {
|
|
2040
|
-
|
|
2050
|
+
logger38.error(`[Trigger ${trigger.id}] ${stepValidation.error}`);
|
|
2041
2051
|
break;
|
|
2042
2052
|
}
|
|
2043
2053
|
const providerToken = await config.getProviderToken(currentProvider, undefined, context);
|
|
2044
2054
|
if (!providerToken) {
|
|
2045
2055
|
const error = `No OAuth token available for provider '${currentProvider}'`;
|
|
2046
|
-
|
|
2056
|
+
logger38.error(`[Trigger ${trigger.id}] ${error}`);
|
|
2047
2057
|
steps.push({
|
|
2048
2058
|
stepIndex,
|
|
2049
2059
|
toolName: currentToolName,
|
|
@@ -2069,7 +2079,7 @@ async function executeTrigger(trigger, config, context) {
|
|
|
2069
2079
|
} catch (err) {
|
|
2070
2080
|
stepSuccess = false;
|
|
2071
2081
|
stepError = err.message || "Tool execution failed";
|
|
2072
|
-
|
|
2082
|
+
logger38.error(`[Trigger ${trigger.id}] Step ${stepIndex} failed:`, err);
|
|
2073
2083
|
}
|
|
2074
2084
|
if (stepSuccess && toolResult) {
|
|
2075
2085
|
if (toolResult.isError === true) {
|
|
@@ -2162,7 +2172,7 @@ async function executeTrigger(trigger, config, context) {
|
|
|
2162
2172
|
return { success: steps.every((s) => s.success), steps, error: stepError };
|
|
2163
2173
|
}
|
|
2164
2174
|
const limitError = `Trigger execution exceeded maximum of ${MAX_TRIGGER_STEPS} steps`;
|
|
2165
|
-
|
|
2175
|
+
logger38.error(`[Trigger ${trigger.id}] ${limitError}`);
|
|
2166
2176
|
await config.triggers.update(trigger.id, {
|
|
2167
2177
|
lastRunAt: new Date().toISOString(),
|
|
2168
2178
|
runCount: (trigger.runCount || 0) + 1,
|
|
@@ -2171,12 +2181,12 @@ async function executeTrigger(trigger, config, context) {
|
|
|
2171
2181
|
}, context);
|
|
2172
2182
|
return { success: false, steps, error: limitError };
|
|
2173
2183
|
}
|
|
2174
|
-
var
|
|
2184
|
+
var logger38;
|
|
2175
2185
|
var init_executor2 = __esm(() => {
|
|
2176
2186
|
init_logger();
|
|
2177
2187
|
init_utils();
|
|
2178
2188
|
init_webhooks();
|
|
2179
|
-
|
|
2189
|
+
logger38 = createLogger("TriggerExecutor", "server");
|
|
2180
2190
|
});
|
|
2181
2191
|
|
|
2182
2192
|
// src/protocol/jsonrpc.ts
|
|
@@ -5347,13 +5357,28 @@ init_logger();
|
|
|
5347
5357
|
var logger20 = createLogger("WhatsApp");
|
|
5348
5358
|
var WHATSAPP_TOOLS = [
|
|
5349
5359
|
"whatsapp_send_message",
|
|
5360
|
+
"whatsapp_reply_message",
|
|
5350
5361
|
"whatsapp_send_template",
|
|
5351
5362
|
"whatsapp_send_media",
|
|
5363
|
+
"whatsapp_send_reaction",
|
|
5364
|
+
"whatsapp_send_location",
|
|
5365
|
+
"whatsapp_send_contact",
|
|
5366
|
+
"whatsapp_send_interactive_buttons",
|
|
5367
|
+
"whatsapp_send_interactive_list",
|
|
5368
|
+
"whatsapp_mark_read",
|
|
5369
|
+
"whatsapp_get_media_url",
|
|
5370
|
+
"whatsapp_delete_media",
|
|
5352
5371
|
"whatsapp_list_templates",
|
|
5372
|
+
"whatsapp_get_template",
|
|
5373
|
+
"whatsapp_create_template",
|
|
5374
|
+
"whatsapp_delete_template",
|
|
5353
5375
|
"whatsapp_get_phone_numbers",
|
|
5376
|
+
"whatsapp_get_phone_number",
|
|
5377
|
+
"whatsapp_get_profile",
|
|
5378
|
+
"whatsapp_update_profile",
|
|
5354
5379
|
"whatsapp_get_message_status",
|
|
5355
|
-
"
|
|
5356
|
-
"
|
|
5380
|
+
"whatsapp_create_qr_code",
|
|
5381
|
+
"whatsapp_list_qr_codes"
|
|
5357
5382
|
];
|
|
5358
5383
|
function whatsappIntegration(config = {}) {
|
|
5359
5384
|
const oauth = {
|
|
@@ -5518,12 +5543,7 @@ var ONEDRIVE_TOOLS = [
|
|
|
5518
5543
|
"onedrive_upload_file",
|
|
5519
5544
|
"onedrive_delete_file",
|
|
5520
5545
|
"onedrive_search_files",
|
|
5521
|
-
"onedrive_share_file"
|
|
5522
|
-
"onedrive_word_get_content",
|
|
5523
|
-
"onedrive_excel_get_worksheets",
|
|
5524
|
-
"onedrive_excel_get_range",
|
|
5525
|
-
"onedrive_excel_update_range",
|
|
5526
|
-
"onedrive_powerpoint_get_slides"
|
|
5546
|
+
"onedrive_share_file"
|
|
5527
5547
|
];
|
|
5528
5548
|
function onedriveIntegration(config = {}) {
|
|
5529
5549
|
const oauth = {
|
|
@@ -5551,9 +5571,124 @@ function onedriveIntegration(config = {}) {
|
|
|
5551
5571
|
}
|
|
5552
5572
|
};
|
|
5553
5573
|
}
|
|
5574
|
+
// src/integrations/word.ts
|
|
5575
|
+
init_logger();
|
|
5576
|
+
var logger24 = createLogger("Word");
|
|
5577
|
+
var WORD_TOOLS = [
|
|
5578
|
+
"word_list",
|
|
5579
|
+
"word_get",
|
|
5580
|
+
"word_create",
|
|
5581
|
+
"word_copy",
|
|
5582
|
+
"word_delete",
|
|
5583
|
+
"word_share"
|
|
5584
|
+
];
|
|
5585
|
+
function wordIntegration(config = {}) {
|
|
5586
|
+
const oauth = {
|
|
5587
|
+
provider: "word",
|
|
5588
|
+
clientId: config.clientId ?? getEnv("WORD_CLIENT_ID"),
|
|
5589
|
+
clientSecret: config.clientSecret ?? getEnv("WORD_CLIENT_SECRET"),
|
|
5590
|
+
scopes: config.scopes,
|
|
5591
|
+
optionalScopes: config.optionalScopes,
|
|
5592
|
+
redirectUri: config.redirectUri,
|
|
5593
|
+
config
|
|
5594
|
+
};
|
|
5595
|
+
return {
|
|
5596
|
+
id: "word",
|
|
5597
|
+
name: "Word",
|
|
5598
|
+
logoUrl: "https://wdvtnli2jn3texa6.public.blob.vercel-storage.com/word.png",
|
|
5599
|
+
tools: [...WORD_TOOLS],
|
|
5600
|
+
oauth,
|
|
5601
|
+
async onInit(_client) {
|
|
5602
|
+
logger24.debug("Word integration initialized");
|
|
5603
|
+
},
|
|
5604
|
+
async onAfterConnect(_client) {
|
|
5605
|
+
logger24.debug("Word integration connected");
|
|
5606
|
+
}
|
|
5607
|
+
};
|
|
5608
|
+
}
|
|
5609
|
+
// src/integrations/excel.ts
|
|
5610
|
+
init_logger();
|
|
5611
|
+
var logger25 = createLogger("Excel");
|
|
5612
|
+
var EXCEL_TOOLS = [
|
|
5613
|
+
"excel_list",
|
|
5614
|
+
"excel_get",
|
|
5615
|
+
"excel_create",
|
|
5616
|
+
"excel_delete",
|
|
5617
|
+
"excel_share",
|
|
5618
|
+
"excel_list_worksheets",
|
|
5619
|
+
"excel_add_worksheet",
|
|
5620
|
+
"excel_delete_worksheet",
|
|
5621
|
+
"excel_get_range",
|
|
5622
|
+
"excel_update_range",
|
|
5623
|
+
"excel_clear_range",
|
|
5624
|
+
"excel_get_used_range",
|
|
5625
|
+
"excel_list_tables",
|
|
5626
|
+
"excel_create_table",
|
|
5627
|
+
"excel_get_table_rows",
|
|
5628
|
+
"excel_add_table_rows"
|
|
5629
|
+
];
|
|
5630
|
+
function excelIntegration(config = {}) {
|
|
5631
|
+
const oauth = {
|
|
5632
|
+
provider: "excel",
|
|
5633
|
+
clientId: config.clientId ?? getEnv("EXCEL_CLIENT_ID"),
|
|
5634
|
+
clientSecret: config.clientSecret ?? getEnv("EXCEL_CLIENT_SECRET"),
|
|
5635
|
+
scopes: config.scopes,
|
|
5636
|
+
optionalScopes: config.optionalScopes,
|
|
5637
|
+
redirectUri: config.redirectUri,
|
|
5638
|
+
config
|
|
5639
|
+
};
|
|
5640
|
+
return {
|
|
5641
|
+
id: "excel",
|
|
5642
|
+
name: "Excel",
|
|
5643
|
+
logoUrl: "https://wdvtnli2jn3texa6.public.blob.vercel-storage.com/excel.png",
|
|
5644
|
+
tools: [...EXCEL_TOOLS],
|
|
5645
|
+
oauth,
|
|
5646
|
+
async onInit(_client) {
|
|
5647
|
+
logger25.debug("Excel integration initialized");
|
|
5648
|
+
},
|
|
5649
|
+
async onAfterConnect(_client) {
|
|
5650
|
+
logger25.debug("Excel integration connected");
|
|
5651
|
+
}
|
|
5652
|
+
};
|
|
5653
|
+
}
|
|
5654
|
+
// src/integrations/powerpoint.ts
|
|
5655
|
+
init_logger();
|
|
5656
|
+
var logger26 = createLogger("PowerPoint");
|
|
5657
|
+
var POWERPOINT_TOOLS = [
|
|
5658
|
+
"powerpoint_list",
|
|
5659
|
+
"powerpoint_get",
|
|
5660
|
+
"powerpoint_create",
|
|
5661
|
+
"powerpoint_copy",
|
|
5662
|
+
"powerpoint_delete",
|
|
5663
|
+
"powerpoint_share"
|
|
5664
|
+
];
|
|
5665
|
+
function powerpointIntegration(config = {}) {
|
|
5666
|
+
const oauth = {
|
|
5667
|
+
provider: "powerpoint",
|
|
5668
|
+
clientId: config.clientId ?? getEnv("POWERPOINT_CLIENT_ID"),
|
|
5669
|
+
clientSecret: config.clientSecret ?? getEnv("POWERPOINT_CLIENT_SECRET"),
|
|
5670
|
+
scopes: config.scopes,
|
|
5671
|
+
optionalScopes: config.optionalScopes,
|
|
5672
|
+
redirectUri: config.redirectUri,
|
|
5673
|
+
config
|
|
5674
|
+
};
|
|
5675
|
+
return {
|
|
5676
|
+
id: "powerpoint",
|
|
5677
|
+
name: "PowerPoint",
|
|
5678
|
+
logoUrl: "https://wdvtnli2jn3texa6.public.blob.vercel-storage.com/powerpoint.png",
|
|
5679
|
+
tools: [...POWERPOINT_TOOLS],
|
|
5680
|
+
oauth,
|
|
5681
|
+
async onInit(_client) {
|
|
5682
|
+
logger26.debug("PowerPoint integration initialized");
|
|
5683
|
+
},
|
|
5684
|
+
async onAfterConnect(_client) {
|
|
5685
|
+
logger26.debug("PowerPoint integration connected");
|
|
5686
|
+
}
|
|
5687
|
+
};
|
|
5688
|
+
}
|
|
5554
5689
|
// src/integrations/gdocs.ts
|
|
5555
5690
|
init_logger();
|
|
5556
|
-
var
|
|
5691
|
+
var logger27 = createLogger("Google Docs");
|
|
5557
5692
|
var GDOCS_TOOLS = [
|
|
5558
5693
|
"gdocs_list",
|
|
5559
5694
|
"gdocs_get",
|
|
@@ -5578,16 +5713,59 @@ function gdocsIntegration(config = {}) {
|
|
|
5578
5713
|
tools: [...GDOCS_TOOLS],
|
|
5579
5714
|
oauth,
|
|
5580
5715
|
async onInit(_client) {
|
|
5581
|
-
|
|
5716
|
+
logger27.debug("Google Docs integration initialized");
|
|
5582
5717
|
},
|
|
5583
5718
|
async onAfterConnect(_client) {
|
|
5584
|
-
|
|
5719
|
+
logger27.debug("Google Docs integration connected");
|
|
5720
|
+
}
|
|
5721
|
+
};
|
|
5722
|
+
}
|
|
5723
|
+
// src/integrations/gdrive.ts
|
|
5724
|
+
init_logger();
|
|
5725
|
+
var logger28 = createLogger("Google Drive");
|
|
5726
|
+
var GDRIVE_TOOLS = [
|
|
5727
|
+
"gdrive_list_files",
|
|
5728
|
+
"gdrive_get_file",
|
|
5729
|
+
"gdrive_create_folder",
|
|
5730
|
+
"gdrive_rename_file",
|
|
5731
|
+
"gdrive_move_file",
|
|
5732
|
+
"gdrive_copy_file",
|
|
5733
|
+
"gdrive_delete_file",
|
|
5734
|
+
"gdrive_trash_file",
|
|
5735
|
+
"gdrive_upload_text_file",
|
|
5736
|
+
"gdrive_download_file",
|
|
5737
|
+
"gdrive_list_permissions",
|
|
5738
|
+
"gdrive_share_file",
|
|
5739
|
+
"gdrive_remove_permission",
|
|
5740
|
+
"gdrive_get_about"
|
|
5741
|
+
];
|
|
5742
|
+
function gdriveIntegration(config = {}) {
|
|
5743
|
+
const oauth = {
|
|
5744
|
+
provider: "gdrive",
|
|
5745
|
+
clientId: config.clientId ?? getEnv("GDRIVE_CLIENT_ID"),
|
|
5746
|
+
clientSecret: config.clientSecret ?? getEnv("GDRIVE_CLIENT_SECRET"),
|
|
5747
|
+
scopes: config.scopes,
|
|
5748
|
+
optionalScopes: config.optionalScopes,
|
|
5749
|
+
redirectUri: config.redirectUri,
|
|
5750
|
+
config
|
|
5751
|
+
};
|
|
5752
|
+
return {
|
|
5753
|
+
id: "gdrive",
|
|
5754
|
+
name: "Google Drive",
|
|
5755
|
+
logoUrl: "https://wdvtnli2jn3texa6.public.blob.vercel-storage.com/google_drive.png",
|
|
5756
|
+
tools: [...GDRIVE_TOOLS],
|
|
5757
|
+
oauth,
|
|
5758
|
+
async onInit(_client) {
|
|
5759
|
+
logger28.debug("Google Drive integration initialized");
|
|
5760
|
+
},
|
|
5761
|
+
async onAfterConnect(_client) {
|
|
5762
|
+
logger28.debug("Google Drive integration connected");
|
|
5585
5763
|
}
|
|
5586
5764
|
};
|
|
5587
5765
|
}
|
|
5588
5766
|
// src/integrations/gsheets.ts
|
|
5589
5767
|
init_logger();
|
|
5590
|
-
var
|
|
5768
|
+
var logger29 = createLogger("Google Sheets");
|
|
5591
5769
|
var GSHEETS_TOOLS = [
|
|
5592
5770
|
"gsheets_list",
|
|
5593
5771
|
"gsheets_get",
|
|
@@ -5615,16 +5793,16 @@ function gsheetsIntegration(config = {}) {
|
|
|
5615
5793
|
tools: [...GSHEETS_TOOLS],
|
|
5616
5794
|
oauth,
|
|
5617
5795
|
async onInit(_client) {
|
|
5618
|
-
|
|
5796
|
+
logger29.debug("Google Sheets integration initialized");
|
|
5619
5797
|
},
|
|
5620
5798
|
async onAfterConnect(_client) {
|
|
5621
|
-
|
|
5799
|
+
logger29.debug("Google Sheets integration connected");
|
|
5622
5800
|
}
|
|
5623
5801
|
};
|
|
5624
5802
|
}
|
|
5625
5803
|
// src/integrations/gslides.ts
|
|
5626
5804
|
init_logger();
|
|
5627
|
-
var
|
|
5805
|
+
var logger30 = createLogger("Google Slides");
|
|
5628
5806
|
var GSLIDES_TOOLS = [
|
|
5629
5807
|
"gslides_list",
|
|
5630
5808
|
"gslides_get",
|
|
@@ -5651,16 +5829,16 @@ function gslidesIntegration(config = {}) {
|
|
|
5651
5829
|
tools: [...GSLIDES_TOOLS],
|
|
5652
5830
|
oauth,
|
|
5653
5831
|
async onInit(_client) {
|
|
5654
|
-
|
|
5832
|
+
logger30.debug("Google Slides integration initialized");
|
|
5655
5833
|
},
|
|
5656
5834
|
async onAfterConnect(_client) {
|
|
5657
|
-
|
|
5835
|
+
logger30.debug("Google Slides integration connected");
|
|
5658
5836
|
}
|
|
5659
5837
|
};
|
|
5660
5838
|
}
|
|
5661
5839
|
// src/integrations/polar.ts
|
|
5662
5840
|
init_logger();
|
|
5663
|
-
var
|
|
5841
|
+
var logger31 = createLogger("Polar");
|
|
5664
5842
|
var POLAR_TOOLS = [
|
|
5665
5843
|
"polar_list_products",
|
|
5666
5844
|
"polar_get_product",
|
|
@@ -5717,16 +5895,16 @@ function polarIntegration(config = {}) {
|
|
|
5717
5895
|
tools: [...POLAR_TOOLS],
|
|
5718
5896
|
oauth,
|
|
5719
5897
|
async onInit(_client) {
|
|
5720
|
-
|
|
5898
|
+
logger31.debug("Polar integration initialized");
|
|
5721
5899
|
},
|
|
5722
5900
|
async onAfterConnect(_client) {
|
|
5723
|
-
|
|
5901
|
+
logger31.debug("Polar integration connected");
|
|
5724
5902
|
}
|
|
5725
5903
|
};
|
|
5726
5904
|
}
|
|
5727
5905
|
// src/integrations/figma.ts
|
|
5728
5906
|
init_logger();
|
|
5729
|
-
var
|
|
5907
|
+
var logger32 = createLogger("Figma");
|
|
5730
5908
|
var FIGMA_TOOLS = [
|
|
5731
5909
|
"figma_get_file",
|
|
5732
5910
|
"figma_get_file_nodes",
|
|
@@ -5792,16 +5970,16 @@ function figmaIntegration(config = {}) {
|
|
|
5792
5970
|
tools: [...FIGMA_TOOLS],
|
|
5793
5971
|
oauth,
|
|
5794
5972
|
async onInit(_client) {
|
|
5795
|
-
|
|
5973
|
+
logger32.debug("Figma integration initialized");
|
|
5796
5974
|
},
|
|
5797
5975
|
async onAfterConnect(_client) {
|
|
5798
|
-
|
|
5976
|
+
logger32.debug("Figma integration connected");
|
|
5799
5977
|
}
|
|
5800
5978
|
};
|
|
5801
5979
|
}
|
|
5802
5980
|
// src/integrations/intercom.ts
|
|
5803
5981
|
init_logger();
|
|
5804
|
-
var
|
|
5982
|
+
var logger33 = createLogger("Intercom");
|
|
5805
5983
|
var INTERCOM_TOOLS = [
|
|
5806
5984
|
"intercom_list_contacts",
|
|
5807
5985
|
"intercom_get_contact",
|
|
@@ -5832,16 +6010,16 @@ function intercomIntegration(config = {}) {
|
|
|
5832
6010
|
tools: [...INTERCOM_TOOLS],
|
|
5833
6011
|
oauth,
|
|
5834
6012
|
async onInit(_client) {
|
|
5835
|
-
|
|
6013
|
+
logger33.debug("Intercom integration initialized");
|
|
5836
6014
|
},
|
|
5837
6015
|
async onAfterConnect(_client) {
|
|
5838
|
-
|
|
6016
|
+
logger33.debug("Intercom integration connected");
|
|
5839
6017
|
}
|
|
5840
6018
|
};
|
|
5841
6019
|
}
|
|
5842
6020
|
// src/integrations/hubspot.ts
|
|
5843
6021
|
init_logger();
|
|
5844
|
-
var
|
|
6022
|
+
var logger34 = createLogger("HubSpot");
|
|
5845
6023
|
var HUBSPOT_TOOLS = [
|
|
5846
6024
|
"hubspot_list_contacts",
|
|
5847
6025
|
"hubspot_get_contact",
|
|
@@ -5891,26 +6069,41 @@ function hubspotIntegration(config = {}) {
|
|
|
5891
6069
|
tools: [...HUBSPOT_TOOLS],
|
|
5892
6070
|
oauth,
|
|
5893
6071
|
async onInit(_client) {
|
|
5894
|
-
|
|
6072
|
+
logger34.debug("HubSpot integration initialized");
|
|
5895
6073
|
},
|
|
5896
6074
|
async onAfterConnect(_client) {
|
|
5897
|
-
|
|
6075
|
+
logger34.debug("HubSpot integration connected");
|
|
5898
6076
|
}
|
|
5899
6077
|
};
|
|
5900
6078
|
}
|
|
5901
6079
|
// src/integrations/youtube.ts
|
|
5902
6080
|
init_logger();
|
|
5903
|
-
var
|
|
6081
|
+
var logger35 = createLogger("YouTube");
|
|
5904
6082
|
var YOUTUBE_TOOLS = [
|
|
5905
6083
|
"youtube_search",
|
|
5906
6084
|
"youtube_get_video",
|
|
6085
|
+
"youtube_get_my_channel",
|
|
6086
|
+
"youtube_get_channel",
|
|
6087
|
+
"youtube_list_my_videos",
|
|
6088
|
+
"youtube_get_video_rating",
|
|
5907
6089
|
"youtube_list_playlists",
|
|
5908
6090
|
"youtube_get_playlist",
|
|
5909
6091
|
"youtube_list_playlist_items",
|
|
5910
|
-
"youtube_get_channel",
|
|
5911
6092
|
"youtube_list_subscriptions",
|
|
5912
6093
|
"youtube_list_comments",
|
|
5913
|
-
"
|
|
6094
|
+
"youtube_list_comment_replies",
|
|
6095
|
+
"youtube_get_captions",
|
|
6096
|
+
"youtube_rate_video",
|
|
6097
|
+
"youtube_subscribe",
|
|
6098
|
+
"youtube_unsubscribe",
|
|
6099
|
+
"youtube_add_comment",
|
|
6100
|
+
"youtube_reply_to_comment",
|
|
6101
|
+
"youtube_create_playlist",
|
|
6102
|
+
"youtube_update_playlist",
|
|
6103
|
+
"youtube_delete_playlist",
|
|
6104
|
+
"youtube_add_to_playlist",
|
|
6105
|
+
"youtube_remove_from_playlist",
|
|
6106
|
+
"youtube_update_video"
|
|
5914
6107
|
];
|
|
5915
6108
|
function youtubeIntegration(config = {}) {
|
|
5916
6109
|
const oauth = {
|
|
@@ -5931,16 +6124,16 @@ function youtubeIntegration(config = {}) {
|
|
|
5931
6124
|
tools: [...YOUTUBE_TOOLS],
|
|
5932
6125
|
oauth,
|
|
5933
6126
|
async onInit(_client) {
|
|
5934
|
-
|
|
6127
|
+
logger35.debug("YouTube integration initialized");
|
|
5935
6128
|
},
|
|
5936
6129
|
async onAfterConnect(_client) {
|
|
5937
|
-
|
|
6130
|
+
logger35.debug("YouTube integration connected");
|
|
5938
6131
|
}
|
|
5939
6132
|
};
|
|
5940
6133
|
}
|
|
5941
6134
|
// src/integrations/cursor.ts
|
|
5942
6135
|
init_logger();
|
|
5943
|
-
var
|
|
6136
|
+
var logger36 = createLogger("Cursor");
|
|
5944
6137
|
var CURSOR_TOOLS = [
|
|
5945
6138
|
"cursor_list_agents",
|
|
5946
6139
|
"cursor_get_agent",
|
|
@@ -5960,10 +6153,10 @@ function cursorIntegration(_config = {}) {
|
|
|
5960
6153
|
logoUrl: "https://wdvtnli2jn3texa6.public.blob.vercel-storage.com/cursor.jpeg",
|
|
5961
6154
|
tools: [...CURSOR_TOOLS],
|
|
5962
6155
|
async onInit(_client) {
|
|
5963
|
-
|
|
6156
|
+
logger36.debug("Cursor integration initialized");
|
|
5964
6157
|
},
|
|
5965
6158
|
async onAfterConnect(_client) {
|
|
5966
|
-
|
|
6159
|
+
logger36.debug("Cursor integration connected");
|
|
5967
6160
|
}
|
|
5968
6161
|
};
|
|
5969
6162
|
}
|
|
@@ -12135,7 +12328,7 @@ function convertJsonSchemaToGoogleSchema(jsonSchema, TypeEnum) {
|
|
|
12135
12328
|
}
|
|
12136
12329
|
// src/server.ts
|
|
12137
12330
|
var SERVER_LOG_CONTEXT3 = "server";
|
|
12138
|
-
var
|
|
12331
|
+
var logger39 = createLogger("MCPServer", SERVER_LOG_CONTEXT3);
|
|
12139
12332
|
var globalServerConfig = null;
|
|
12140
12333
|
var globalMCPHandler = null;
|
|
12141
12334
|
var codeVerifierStorage = new Map;
|
|
@@ -12151,6 +12344,33 @@ function resolveProviderFromToolName(toolName, candidates) {
|
|
|
12151
12344
|
}
|
|
12152
12345
|
return best;
|
|
12153
12346
|
}
|
|
12347
|
+
var TOOL_ALIASES = {
|
|
12348
|
+
github_list_repo_contents: "github_get_file_contents",
|
|
12349
|
+
gdrive_list: "gdrive_list_files",
|
|
12350
|
+
gdrive_get: "gdrive_get_file",
|
|
12351
|
+
gdrive_delete: "gdrive_delete_file",
|
|
12352
|
+
gdrive_trash: "gdrive_trash_file",
|
|
12353
|
+
gdrive_upload: "gdrive_upload_text_file",
|
|
12354
|
+
gdrive_download: "gdrive_download_file"
|
|
12355
|
+
};
|
|
12356
|
+
function normalizeToolName(toolName, candidates) {
|
|
12357
|
+
if (TOOL_ALIASES[toolName])
|
|
12358
|
+
return TOOL_ALIASES[toolName];
|
|
12359
|
+
const tripleIdx = toolName.indexOf("___");
|
|
12360
|
+
if (tripleIdx > 0) {
|
|
12361
|
+
const prefix = toolName.slice(0, tripleIdx);
|
|
12362
|
+
if (candidates.some((c) => c === prefix)) {
|
|
12363
|
+
return toolName.slice(tripleIdx);
|
|
12364
|
+
}
|
|
12365
|
+
}
|
|
12366
|
+
for (const candidate of candidates) {
|
|
12367
|
+
const doublePrefix = `${candidate}_${candidate}_`;
|
|
12368
|
+
if (toolName.startsWith(doublePrefix)) {
|
|
12369
|
+
return `${candidate}_${toolName.slice(doublePrefix.length)}`;
|
|
12370
|
+
}
|
|
12371
|
+
}
|
|
12372
|
+
return toolName;
|
|
12373
|
+
}
|
|
12154
12374
|
var unauthenticatedCodeModeWarnings = new Set;
|
|
12155
12375
|
function warnUnauthenticatedCodeModeCallback(details) {
|
|
12156
12376
|
if (unauthenticatedCodeModeWarnings.has(details.toolName))
|
|
@@ -12214,7 +12434,7 @@ function createMCPServer(config) {
|
|
|
12214
12434
|
if (integration.oauth) {
|
|
12215
12435
|
const { clientId, clientSecret, redirectUri: integrationRedirectUri, config: oauthConfig } = integration.oauth;
|
|
12216
12436
|
if (!clientId || !clientSecret) {
|
|
12217
|
-
|
|
12437
|
+
logger39.warn(`Warning: Integration "${integration.id}" is missing OAuth credentials. ` + `Provide clientId and clientSecret in the integration configuration.`);
|
|
12218
12438
|
return integration;
|
|
12219
12439
|
}
|
|
12220
12440
|
const redirectUri = integrationRedirectUri || config.redirectUri || getDefaultRedirectUri();
|
|
@@ -12329,14 +12549,18 @@ function createMCPServer(config) {
|
|
|
12329
12549
|
}
|
|
12330
12550
|
if (action === "mcp" && method === "POST") {
|
|
12331
12551
|
try {
|
|
12332
|
-
|
|
12552
|
+
let body = await webRequest.json();
|
|
12333
12553
|
let authHeader = webRequest.headers.get("authorization");
|
|
12334
12554
|
const integrationsHeader = webRequest.headers.get("x-integrations");
|
|
12335
12555
|
const codeModeHeader = webRequest.headers.get("x-integrate-code-mode");
|
|
12336
12556
|
const contextHeader = webRequest.headers.get("x-integrate-context");
|
|
12337
12557
|
const callbackApiKey = webRequest.headers.get("x-integrate-api-key");
|
|
12338
12558
|
const tokensHeader = webRequest.headers.get("x-integrate-tokens");
|
|
12339
|
-
const
|
|
12559
|
+
const integrationCandidates = integrationsHeader ? integrationsHeader.split(",").map((s) => s.trim()).filter(Boolean) : (config.integrations ?? []).map((i) => i.id).filter(Boolean);
|
|
12560
|
+
const rawToolName = typeof body?.name === "string" ? body.name : "";
|
|
12561
|
+
const toolName = rawToolName ? normalizeToolName(rawToolName, integrationCandidates) : rawToolName;
|
|
12562
|
+
if (toolName !== rawToolName)
|
|
12563
|
+
body = { ...body, name: toolName };
|
|
12340
12564
|
let tokensResolvedProvider = null;
|
|
12341
12565
|
if (codeModeHeader === "1" && tokensHeader && toolName) {
|
|
12342
12566
|
try {
|
|
@@ -12387,7 +12611,7 @@ function createMCPServer(config) {
|
|
|
12387
12611
|
}
|
|
12388
12612
|
return response2;
|
|
12389
12613
|
} catch (error) {
|
|
12390
|
-
|
|
12614
|
+
logger39.error("[MCP Tool Call] Error:", error);
|
|
12391
12615
|
return Response.json({ error: error.message || "Failed to execute tool call" }, { status: error.statusCode || 500 });
|
|
12392
12616
|
}
|
|
12393
12617
|
}
|
|
@@ -12436,7 +12660,7 @@ function createMCPServer(config) {
|
|
|
12436
12660
|
});
|
|
12437
12661
|
return Response.json(result, { status: result.success ? 200 : 500 });
|
|
12438
12662
|
} catch (error) {
|
|
12439
|
-
|
|
12663
|
+
logger39.error("[Code Mode] Error:", error);
|
|
12440
12664
|
return Response.json({ error: error?.message || "Failed to execute code" }, { status: 500 });
|
|
12441
12665
|
}
|
|
12442
12666
|
}
|
|
@@ -12500,7 +12724,7 @@ function createMCPServer(config) {
|
|
|
12500
12724
|
error: executionResult.error
|
|
12501
12725
|
});
|
|
12502
12726
|
} catch (error) {
|
|
12503
|
-
|
|
12727
|
+
logger39.error("[Trigger Notify] Error:", error);
|
|
12504
12728
|
return Response.json({ error: error.message || "Failed to execute trigger" }, { status: 500 });
|
|
12505
12729
|
}
|
|
12506
12730
|
}
|
|
@@ -12564,7 +12788,7 @@ function createMCPServer(config) {
|
|
|
12564
12788
|
})
|
|
12565
12789
|
});
|
|
12566
12790
|
} catch (scheduleError) {
|
|
12567
|
-
|
|
12791
|
+
logger39.error("[Trigger] Failed to register with scheduler:", scheduleError);
|
|
12568
12792
|
}
|
|
12569
12793
|
return Response.json(created, { status: 201 });
|
|
12570
12794
|
}
|
|
@@ -12599,7 +12823,7 @@ function createMCPServer(config) {
|
|
|
12599
12823
|
body: JSON.stringify({ triggerId })
|
|
12600
12824
|
});
|
|
12601
12825
|
} catch (error) {
|
|
12602
|
-
|
|
12826
|
+
logger39.error("[Trigger] Failed to pause in scheduler:", error);
|
|
12603
12827
|
}
|
|
12604
12828
|
return Response.json(updated);
|
|
12605
12829
|
} else if (subAction === "resume" && method === "POST") {
|
|
@@ -12627,7 +12851,7 @@ function createMCPServer(config) {
|
|
|
12627
12851
|
body: JSON.stringify({ triggerId })
|
|
12628
12852
|
});
|
|
12629
12853
|
} catch (error) {
|
|
12630
|
-
|
|
12854
|
+
logger39.error("[Trigger] Failed to resume in scheduler:", error);
|
|
12631
12855
|
}
|
|
12632
12856
|
return Response.json(updated);
|
|
12633
12857
|
} else if (subAction === "run" && method === "POST") {
|
|
@@ -12698,7 +12922,7 @@ function createMCPServer(config) {
|
|
|
12698
12922
|
})
|
|
12699
12923
|
});
|
|
12700
12924
|
} catch (error) {
|
|
12701
|
-
|
|
12925
|
+
logger39.error("[Trigger] Failed to update scheduler:", error);
|
|
12702
12926
|
}
|
|
12703
12927
|
}
|
|
12704
12928
|
return Response.json(updated);
|
|
@@ -12715,14 +12939,14 @@ function createMCPServer(config) {
|
|
|
12715
12939
|
body: JSON.stringify({ triggerId })
|
|
12716
12940
|
});
|
|
12717
12941
|
} catch (error) {
|
|
12718
|
-
|
|
12942
|
+
logger39.error("[Trigger] Failed to unregister from scheduler:", error);
|
|
12719
12943
|
}
|
|
12720
12944
|
return new Response(null, { status: 204 });
|
|
12721
12945
|
}
|
|
12722
12946
|
}
|
|
12723
12947
|
return Response.json({ error: "Invalid trigger route or method" }, { status: 404 });
|
|
12724
12948
|
} catch (error) {
|
|
12725
|
-
|
|
12949
|
+
logger39.error("[Trigger] Error:", error);
|
|
12726
12950
|
return Response.json({ error: error.message || "Failed to process trigger request" }, { status: error.statusCode || 500 });
|
|
12727
12951
|
}
|
|
12728
12952
|
}
|
|
@@ -12748,11 +12972,11 @@ function createMCPServer(config) {
|
|
|
12748
12972
|
const errorRedirectUrl = "/auth-error";
|
|
12749
12973
|
if (error) {
|
|
12750
12974
|
const errorMsg = errorDescription || error;
|
|
12751
|
-
|
|
12975
|
+
logger39.error("[OAuth Redirect] Error:", errorMsg);
|
|
12752
12976
|
return Response.redirect(new URL(`${errorRedirectUrl}?error=${encodeURIComponent(errorMsg)}`, webRequest.url));
|
|
12753
12977
|
}
|
|
12754
12978
|
if (!code || !state) {
|
|
12755
|
-
|
|
12979
|
+
logger39.error("[OAuth Redirect] Missing code or state parameter");
|
|
12756
12980
|
return Response.redirect(new URL(`${errorRedirectUrl}?error=${encodeURIComponent("Invalid OAuth callback")}`, webRequest.url));
|
|
12757
12981
|
}
|
|
12758
12982
|
let returnUrl = defaultRedirectUrl;
|
|
@@ -12828,7 +13052,7 @@ function createMCPServer(config) {
|
|
|
12828
13052
|
frontendUrl.hash = `oauth_callback=${encodeURIComponent(JSON.stringify({ code, state, tokenData }))}`;
|
|
12829
13053
|
return Response.redirect(frontendUrl);
|
|
12830
13054
|
} catch (error2) {
|
|
12831
|
-
|
|
13055
|
+
logger39.error("[OAuth Backend Callback] Error:", error2);
|
|
12832
13056
|
return Response.redirect(new URL(`${errorRedirectUrl}?error=${encodeURIComponent(error2.message || "Failed to exchange token")}`, webRequest.url));
|
|
12833
13057
|
}
|
|
12834
13058
|
} else {
|
|
@@ -13109,6 +13333,7 @@ init_tool_builder();
|
|
|
13109
13333
|
export {
|
|
13110
13334
|
zendeskIntegration,
|
|
13111
13335
|
youtubeIntegration,
|
|
13336
|
+
wordIntegration,
|
|
13112
13337
|
whatsappIntegration,
|
|
13113
13338
|
vercelIntegration,
|
|
13114
13339
|
todoistIntegration,
|
|
@@ -13123,6 +13348,7 @@ export {
|
|
|
13123
13348
|
slackIntegration,
|
|
13124
13349
|
sendWebResponse,
|
|
13125
13350
|
rampIntegration,
|
|
13351
|
+
powerpointIntegration,
|
|
13126
13352
|
polarIntegration,
|
|
13127
13353
|
outlookIntegration,
|
|
13128
13354
|
onedriveIntegration,
|
|
@@ -13143,12 +13369,14 @@ export {
|
|
|
13143
13369
|
getAnthropicTools,
|
|
13144
13370
|
genericOAuthIntegration,
|
|
13145
13371
|
generateCodeModeTypes,
|
|
13372
|
+
gdriveIntegration,
|
|
13146
13373
|
gdocsIntegration,
|
|
13147
13374
|
gcalIntegration,
|
|
13148
13375
|
fromNodeHeaders,
|
|
13149
13376
|
figmaIntegration,
|
|
13150
13377
|
executeSandboxCode,
|
|
13151
13378
|
executeGoogleFunctionCalls,
|
|
13379
|
+
excelIntegration,
|
|
13152
13380
|
cursorIntegration,
|
|
13153
13381
|
createTriggerTools,
|
|
13154
13382
|
createTanStackOAuthHandler,
|