integrate-sdk 0.8.53-dev.0 → 0.8.55-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/auto-routes.d.ts.map +1 -1
- package/dist/adapters/auto-routes.js +92 -33
- package/dist/adapters/base-handler.d.ts.map +1 -1
- package/dist/adapters/index.js +90 -32
- package/dist/adapters/nextjs-oauth-redirect.d.ts.map +1 -1
- package/dist/adapters/nextjs-oauth-redirect.js +16 -11
- package/dist/adapters/nextjs.d.ts.map +1 -1
- package/dist/adapters/nextjs.js +90 -32
- package/dist/adapters/node.js +90 -32
- package/dist/adapters/svelte-kit.js +90 -32
- package/dist/adapters/tanstack-start.js +90 -32
- package/dist/ai/anthropic.d.ts.map +1 -1
- package/dist/ai/anthropic.js +1 -2
- package/dist/ai/google.d.ts.map +1 -1
- package/dist/ai/google.js +1 -2
- package/dist/ai/index.js +4 -8
- package/dist/ai/openai.d.ts.map +1 -1
- package/dist/ai/openai.js +1 -2
- package/dist/ai/trigger-tools.d.ts +4 -4
- package/dist/ai/vercel-ai.d.ts.map +1 -1
- package/dist/ai/vercel-ai.js +1 -2
- package/dist/index.js +93 -34
- package/dist/oauth.js +92 -33
- package/dist/react.js +14 -10
- package/dist/server.js +90 -32
- package/dist/src/adapters/auto-routes.d.ts.map +1 -1
- package/dist/src/adapters/base-handler.d.ts.map +1 -1
- package/dist/src/adapters/nextjs-oauth-redirect.d.ts.map +1 -1
- package/dist/src/adapters/nextjs.d.ts.map +1 -1
- package/dist/src/ai/anthropic.d.ts.map +1 -1
- package/dist/src/ai/google.d.ts.map +1 -1
- package/dist/src/ai/openai.d.ts.map +1 -1
- package/dist/src/ai/trigger-tools.d.ts +4 -4
- package/dist/src/ai/vercel-ai.d.ts.map +1 -1
- package/dist/src/client.d.ts +25 -0
- package/dist/src/client.d.ts.map +1 -1
- package/dist/src/integrations/server-client.d.ts +10 -2
- package/dist/src/integrations/server-client.d.ts.map +1 -1
- package/dist/src/protocol/messages.d.ts +18 -6
- package/dist/src/protocol/messages.d.ts.map +1 -1
- package/dist/src/server.d.ts.map +1 -1
- package/dist/src/utils/logger.d.ts +17 -6
- package/dist/src/utils/logger.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auto-routes.d.ts","sourceRoot":"","sources":["../../../src/adapters/auto-routes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAgB,KAAK,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"auto-routes.d.ts","sourceRoot":"","sources":["../../../src/adapters/auto-routes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAgB,KAAK,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAe1E;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,kBAAkB,GAAG,IAAI,CAErE;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,kBAAkB,GAAG,IAAI,CAEhE;AAED;;;;;;;;;;;;;;;;;GAiBG;AAkBH;;;GAGG;AACH,wBAAsB,IAAI,CACxB,GAAG,EAAE,GAAG,EACR,OAAO,CAAC,EAAE;IAAE,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,GACvC,OAAO,CAAC,GAAG,CAAC,CA+Dd;AAED;;;GAGG;AACH,wBAAsB,GAAG,CACvB,GAAG,EAAE,GAAG,EACR,OAAO,CAAC,EAAE;IAAE,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,GACvC,OAAO,CAAC,GAAG,CAAC,CAoCd"}
|
|
@@ -11,39 +11,43 @@ var __export = (target, all) => {
|
|
|
11
11
|
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
12
12
|
|
|
13
13
|
// ../utils/logger.ts
|
|
14
|
-
function shouldLog(level) {
|
|
15
|
-
return logLevelHierarchy[level] <= logLevelHierarchy[
|
|
14
|
+
function shouldLog(level, context) {
|
|
15
|
+
return logLevelHierarchy[level] <= logLevelHierarchy[contextLogLevels[context]];
|
|
16
16
|
}
|
|
17
|
-
function setLogLevel(level) {
|
|
18
|
-
|
|
17
|
+
function setLogLevel(level, context = "client") {
|
|
18
|
+
contextLogLevels[context] = level;
|
|
19
19
|
}
|
|
20
|
-
function createLogger(namespace) {
|
|
20
|
+
function createLogger(namespace, context = "client") {
|
|
21
21
|
const prefix = `[${namespace}]`;
|
|
22
22
|
return {
|
|
23
23
|
debug: (...args) => {
|
|
24
|
-
if (shouldLog("debug")) {
|
|
24
|
+
if (shouldLog("debug", context)) {
|
|
25
25
|
console.log(prefix, ...args);
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
28
|
info: (...args) => {
|
|
29
|
-
if (shouldLog("info")) {
|
|
29
|
+
if (shouldLog("info", context)) {
|
|
30
30
|
console.log(prefix, ...args);
|
|
31
31
|
}
|
|
32
32
|
},
|
|
33
33
|
warn: (...args) => {
|
|
34
|
-
if (shouldLog("warn")) {
|
|
34
|
+
if (shouldLog("warn", context)) {
|
|
35
35
|
console.warn(prefix, ...args);
|
|
36
36
|
}
|
|
37
37
|
},
|
|
38
38
|
error: (...args) => {
|
|
39
|
-
if (shouldLog("error")) {
|
|
39
|
+
if (shouldLog("error", context)) {
|
|
40
40
|
console.error(prefix, ...args);
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
};
|
|
44
44
|
}
|
|
45
|
-
var
|
|
45
|
+
var contextLogLevels, logLevelHierarchy;
|
|
46
46
|
var init_logger = __esm(() => {
|
|
47
|
+
contextLogLevels = {
|
|
48
|
+
client: "error",
|
|
49
|
+
server: "error"
|
|
50
|
+
};
|
|
47
51
|
logLevelHierarchy = {
|
|
48
52
|
none: 0,
|
|
49
53
|
error: 1,
|
|
@@ -2201,6 +2205,69 @@ class MCPClientBase {
|
|
|
2201
2205
|
getEnabledTools() {
|
|
2202
2206
|
return Array.from(this.availableTools.values()).filter((tool) => this.enabledToolNames.has(tool.name));
|
|
2203
2207
|
}
|
|
2208
|
+
async getEnabledToolsAsync() {
|
|
2209
|
+
if (this.isConnected() && this.availableTools.size > 0) {
|
|
2210
|
+
return this.getEnabledTools();
|
|
2211
|
+
}
|
|
2212
|
+
if (this.availableTools.size > 0) {
|
|
2213
|
+
return this.getEnabledTools();
|
|
2214
|
+
}
|
|
2215
|
+
const tools = [];
|
|
2216
|
+
const integrationIds = new Set;
|
|
2217
|
+
for (const integration of this.integrations) {
|
|
2218
|
+
integrationIds.add(integration.id);
|
|
2219
|
+
}
|
|
2220
|
+
const { parallelWithLimit: parallelWithLimit2 } = await Promise.resolve().then(() => exports_concurrency);
|
|
2221
|
+
const integrationToolsResults = await parallelWithLimit2(Array.from(integrationIds), async (integrationId) => {
|
|
2222
|
+
try {
|
|
2223
|
+
const response = await this.callServerToolInternal("list_tools_by_integration", {
|
|
2224
|
+
integration: integrationId
|
|
2225
|
+
});
|
|
2226
|
+
const integrationTools = [];
|
|
2227
|
+
if (response.content && Array.isArray(response.content)) {
|
|
2228
|
+
for (const item of response.content) {
|
|
2229
|
+
if (item.type === "text" && item.text) {
|
|
2230
|
+
try {
|
|
2231
|
+
const parsed = JSON.parse(item.text);
|
|
2232
|
+
if (Array.isArray(parsed)) {
|
|
2233
|
+
for (const tool of parsed) {
|
|
2234
|
+
if (tool.name && tool.inputSchema) {
|
|
2235
|
+
integrationTools.push({
|
|
2236
|
+
name: tool.name,
|
|
2237
|
+
description: tool.description,
|
|
2238
|
+
inputSchema: tool.inputSchema
|
|
2239
|
+
});
|
|
2240
|
+
}
|
|
2241
|
+
}
|
|
2242
|
+
} else if (parsed.tools && Array.isArray(parsed.tools)) {
|
|
2243
|
+
for (const tool of parsed.tools) {
|
|
2244
|
+
if (tool.name && tool.inputSchema) {
|
|
2245
|
+
integrationTools.push({
|
|
2246
|
+
name: tool.name,
|
|
2247
|
+
description: tool.description,
|
|
2248
|
+
inputSchema: tool.inputSchema
|
|
2249
|
+
});
|
|
2250
|
+
}
|
|
2251
|
+
}
|
|
2252
|
+
}
|
|
2253
|
+
} catch {}
|
|
2254
|
+
}
|
|
2255
|
+
}
|
|
2256
|
+
}
|
|
2257
|
+
return integrationTools;
|
|
2258
|
+
} catch (error) {
|
|
2259
|
+
logger5.error(`Failed to fetch tools for integration ${integrationId}:`, error);
|
|
2260
|
+
return [];
|
|
2261
|
+
}
|
|
2262
|
+
}, 3);
|
|
2263
|
+
for (const integrationTools of integrationToolsResults) {
|
|
2264
|
+
tools.push(...integrationTools);
|
|
2265
|
+
}
|
|
2266
|
+
for (const tool of tools) {
|
|
2267
|
+
this.availableTools.set(tool.name, tool);
|
|
2268
|
+
}
|
|
2269
|
+
return tools.filter((tool) => this.enabledToolNames.has(tool.name));
|
|
2270
|
+
}
|
|
2204
2271
|
getOAuthConfig(integrationId) {
|
|
2205
2272
|
const integration = this.integrations.find((p) => p.id === integrationId);
|
|
2206
2273
|
return integration?.oauth;
|
|
@@ -2445,14 +2512,14 @@ class MCPClientBase {
|
|
|
2445
2512
|
return success;
|
|
2446
2513
|
}
|
|
2447
2514
|
}
|
|
2448
|
-
var MCP_SERVER_URL = "https://mcp.integrate.dev/api/v1/mcp", logger5, clientCache, cleanupClients;
|
|
2515
|
+
var CLIENT_LOG_CONTEXT = "client", MCP_SERVER_URL = "https://mcp.integrate.dev/api/v1/mcp", logger5, clientCache, cleanupClients;
|
|
2449
2516
|
var init_client = __esm(() => {
|
|
2450
2517
|
init_http_session();
|
|
2451
2518
|
init_messages();
|
|
2452
2519
|
init_errors();
|
|
2453
2520
|
init_logger();
|
|
2454
2521
|
init_manager();
|
|
2455
|
-
logger5 = createLogger("MCPClient");
|
|
2522
|
+
logger5 = createLogger("MCPClient", CLIENT_LOG_CONTEXT);
|
|
2456
2523
|
clientCache = new Map;
|
|
2457
2524
|
cleanupClients = new Set;
|
|
2458
2525
|
});
|
|
@@ -7723,11 +7790,6 @@ async function executeToolWithToken(client, toolName, args, options) {
|
|
|
7723
7790
|
const result = await client._callToolByName(toolName, args);
|
|
7724
7791
|
return result;
|
|
7725
7792
|
}
|
|
7726
|
-
async function ensureClientConnected(client) {
|
|
7727
|
-
if (!client.isConnected()) {
|
|
7728
|
-
await client.connect();
|
|
7729
|
-
}
|
|
7730
|
-
}
|
|
7731
7793
|
var init_utils = __esm(() => {
|
|
7732
7794
|
init_zod();
|
|
7733
7795
|
});
|
|
@@ -7970,7 +8032,6 @@ function convertMCPToolToVercelAI(mcpTool, client, options) {
|
|
|
7970
8032
|
};
|
|
7971
8033
|
}
|
|
7972
8034
|
async function getVercelAITools(client, options) {
|
|
7973
|
-
await ensureClientConnected(client);
|
|
7974
8035
|
let providerTokens = options?.providerTokens;
|
|
7975
8036
|
if (!providerTokens) {
|
|
7976
8037
|
try {
|
|
@@ -7978,7 +8039,7 @@ async function getVercelAITools(client, options) {
|
|
|
7978
8039
|
} catch {}
|
|
7979
8040
|
}
|
|
7980
8041
|
const finalOptions = providerTokens ? { ...options, providerTokens } : options;
|
|
7981
|
-
const mcpTools = client.
|
|
8042
|
+
const mcpTools = await client.getEnabledToolsAsync();
|
|
7982
8043
|
const vercelTools = {};
|
|
7983
8044
|
for (const mcpTool of mcpTools) {
|
|
7984
8045
|
vercelTools[mcpTool.name] = convertMCPToolToVercelAI(mcpTool, client, finalOptions);
|
|
@@ -9411,7 +9472,6 @@ function convertMCPToolToOpenAI(mcpTool, _client, options) {
|
|
|
9411
9472
|
};
|
|
9412
9473
|
}
|
|
9413
9474
|
async function getOpenAITools(client, options) {
|
|
9414
|
-
await ensureClientConnected(client);
|
|
9415
9475
|
let providerTokens = options?.providerTokens;
|
|
9416
9476
|
if (!providerTokens) {
|
|
9417
9477
|
try {
|
|
@@ -9419,7 +9479,7 @@ async function getOpenAITools(client, options) {
|
|
|
9419
9479
|
} catch {}
|
|
9420
9480
|
}
|
|
9421
9481
|
const finalOptions = providerTokens ? { ...options, providerTokens } : options;
|
|
9422
|
-
const mcpTools = client.
|
|
9482
|
+
const mcpTools = await client.getEnabledToolsAsync();
|
|
9423
9483
|
const openaiTools = mcpTools.map((mcpTool) => convertMCPToolToOpenAI(mcpTool, client, finalOptions));
|
|
9424
9484
|
const triggerConfig = client.__triggerConfig;
|
|
9425
9485
|
if (triggerConfig) {
|
|
@@ -9543,7 +9603,6 @@ async function handleAnthropicToolCalls(client, messageContent, options) {
|
|
|
9543
9603
|
return toolResults;
|
|
9544
9604
|
}
|
|
9545
9605
|
async function getAnthropicTools(client, options) {
|
|
9546
|
-
await ensureClientConnected(client);
|
|
9547
9606
|
let providerTokens = options?.providerTokens;
|
|
9548
9607
|
if (!providerTokens) {
|
|
9549
9608
|
try {
|
|
@@ -9551,7 +9610,7 @@ async function getAnthropicTools(client, options) {
|
|
|
9551
9610
|
} catch {}
|
|
9552
9611
|
}
|
|
9553
9612
|
const finalOptions = providerTokens ? { ...options, providerTokens } : options;
|
|
9554
|
-
const mcpTools = client.
|
|
9613
|
+
const mcpTools = await client.getEnabledToolsAsync();
|
|
9555
9614
|
const anthropicTools = mcpTools.map((mcpTool) => convertMCPToolToAnthropic(mcpTool, client, finalOptions));
|
|
9556
9615
|
const triggerConfig = client.__triggerConfig;
|
|
9557
9616
|
if (triggerConfig) {
|
|
@@ -9698,7 +9757,6 @@ async function executeGoogleFunctionCalls(client, functionCalls, options) {
|
|
|
9698
9757
|
return results;
|
|
9699
9758
|
}
|
|
9700
9759
|
async function getGoogleTools(client, options) {
|
|
9701
|
-
await ensureClientConnected(client);
|
|
9702
9760
|
let providerTokens = options?.providerTokens;
|
|
9703
9761
|
if (!providerTokens) {
|
|
9704
9762
|
try {
|
|
@@ -9706,7 +9764,7 @@ async function getGoogleTools(client, options) {
|
|
|
9706
9764
|
} catch {}
|
|
9707
9765
|
}
|
|
9708
9766
|
const finalOptions = providerTokens ? { ...options, providerTokens } : options;
|
|
9709
|
-
const mcpTools = client.
|
|
9767
|
+
const mcpTools = await client.getEnabledToolsAsync();
|
|
9710
9768
|
const googleTools = await Promise.all(mcpTools.map((mcpTool) => convertMCPToolToGoogle(mcpTool, client, finalOptions)));
|
|
9711
9769
|
const triggerConfig = client.__triggerConfig;
|
|
9712
9770
|
if (triggerConfig) {
|
|
@@ -9881,7 +9939,7 @@ function getDefaultRedirectUri() {
|
|
|
9881
9939
|
return "http://localhost:3000/api/integrate/oauth/callback";
|
|
9882
9940
|
}
|
|
9883
9941
|
function createMCPServer(config) {
|
|
9884
|
-
setLogLevel(config.debug ? "debug" : "error");
|
|
9942
|
+
setLogLevel(config.debug ? "debug" : "error", SERVER_LOG_CONTEXT);
|
|
9885
9943
|
if (typeof window !== "undefined") {
|
|
9886
9944
|
throw new Error("createMCPServer() should only be called on the server-side. " + "Use createMCPClient() for client-side code.");
|
|
9887
9945
|
}
|
|
@@ -10650,7 +10708,7 @@ function toSvelteKitHandler(clientOrHandlerOrOptions, _redirectOptions) {
|
|
|
10650
10708
|
}
|
|
10651
10709
|
};
|
|
10652
10710
|
}
|
|
10653
|
-
var logger29, globalServerConfig = null, codeVerifierStorage, POST = async (req, context) => {
|
|
10711
|
+
var SERVER_LOG_CONTEXT = "server", logger29, globalServerConfig = null, codeVerifierStorage, POST = async (req, context) => {
|
|
10654
10712
|
if (!globalServerConfig) {
|
|
10655
10713
|
return Response.json({ error: "OAuth not configured. Call createMCPServer() in your server initialization file first." }, { status: 500 });
|
|
10656
10714
|
}
|
|
@@ -10698,7 +10756,7 @@ var init_server = __esm(() => {
|
|
|
10698
10756
|
init_anthropic();
|
|
10699
10757
|
init_google();
|
|
10700
10758
|
init_ai();
|
|
10701
|
-
logger29 = createLogger("MCPServer");
|
|
10759
|
+
logger29 = createLogger("MCPServer", SERVER_LOG_CONTEXT);
|
|
10702
10760
|
codeVerifierStorage = new Map;
|
|
10703
10761
|
});
|
|
10704
10762
|
|
|
@@ -11261,10 +11319,10 @@ class OAuthHandler {
|
|
|
11261
11319
|
return jsonRpcResponse.result;
|
|
11262
11320
|
}
|
|
11263
11321
|
}
|
|
11264
|
-
var logger30, MCP_SERVER_URL2 = "https://mcp.integrate.dev/api/v1/mcp";
|
|
11322
|
+
var SERVER_LOG_CONTEXT2 = "server", logger30, MCP_SERVER_URL2 = "https://mcp.integrate.dev/api/v1/mcp";
|
|
11265
11323
|
var init_base_handler = __esm(() => {
|
|
11266
11324
|
init_logger();
|
|
11267
|
-
logger30 = createLogger("OAuthHandler");
|
|
11325
|
+
logger30 = createLogger("OAuthHandler", SERVER_LOG_CONTEXT2);
|
|
11268
11326
|
});
|
|
11269
11327
|
|
|
11270
11328
|
// nextjs.ts
|
|
@@ -11469,17 +11527,18 @@ function createNextOAuthHandler(config) {
|
|
|
11469
11527
|
};
|
|
11470
11528
|
return handlers;
|
|
11471
11529
|
}
|
|
11472
|
-
var logger31;
|
|
11530
|
+
var SERVER_LOG_CONTEXT3 = "server", logger31;
|
|
11473
11531
|
var init_nextjs = __esm(() => {
|
|
11474
11532
|
init_base_handler();
|
|
11475
11533
|
init_logger();
|
|
11476
|
-
logger31 = createLogger("NextJSOAuth");
|
|
11534
|
+
logger31 = createLogger("NextJSOAuth", SERVER_LOG_CONTEXT3);
|
|
11477
11535
|
});
|
|
11478
11536
|
|
|
11479
11537
|
// auto-routes.ts
|
|
11480
11538
|
init_base_handler();
|
|
11481
11539
|
init_logger();
|
|
11482
|
-
var
|
|
11540
|
+
var SERVER_LOG_CONTEXT4 = "server";
|
|
11541
|
+
var logger32 = createLogger("AutoRoutes", SERVER_LOG_CONTEXT4);
|
|
11483
11542
|
var globalOAuthConfig = null;
|
|
11484
11543
|
function setGlobalOAuthConfig(config) {
|
|
11485
11544
|
globalOAuthConfig = config;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base-handler.d.ts","sourceRoot":"","sources":["../../../src/adapters/base-handler.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,KAAK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;;;;;;OASG;IACG,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IA4BlF;;;;;;;;;;;OAWG;IACG,gBAAgB,CAAC,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,kBAAkB,CAAC;IA4D1H;;;;;;;;;;;;;;OAcG;IACG,cAAc,CAClB,OAAO,EAAE,eAAe,EACxB,UAAU,EAAE,MAAM,GAAG,IAAI,EACzB,kBAAkB,CAAC,EAAE,MAAM,GAAG,IAAI,GACjC,OAAO,CAAC,gBAAgB,CAAC;CAuD7B"}
|
package/dist/adapters/index.js
CHANGED
|
@@ -11,39 +11,43 @@ var __export = (target, all) => {
|
|
|
11
11
|
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
12
12
|
|
|
13
13
|
// ../utils/logger.ts
|
|
14
|
-
function shouldLog(level) {
|
|
15
|
-
return logLevelHierarchy[level] <= logLevelHierarchy[
|
|
14
|
+
function shouldLog(level, context) {
|
|
15
|
+
return logLevelHierarchy[level] <= logLevelHierarchy[contextLogLevels[context]];
|
|
16
16
|
}
|
|
17
|
-
function setLogLevel(level) {
|
|
18
|
-
|
|
17
|
+
function setLogLevel(level, context = "client") {
|
|
18
|
+
contextLogLevels[context] = level;
|
|
19
19
|
}
|
|
20
|
-
function createLogger(namespace) {
|
|
20
|
+
function createLogger(namespace, context = "client") {
|
|
21
21
|
const prefix = `[${namespace}]`;
|
|
22
22
|
return {
|
|
23
23
|
debug: (...args) => {
|
|
24
|
-
if (shouldLog("debug")) {
|
|
24
|
+
if (shouldLog("debug", context)) {
|
|
25
25
|
console.log(prefix, ...args);
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
28
|
info: (...args) => {
|
|
29
|
-
if (shouldLog("info")) {
|
|
29
|
+
if (shouldLog("info", context)) {
|
|
30
30
|
console.log(prefix, ...args);
|
|
31
31
|
}
|
|
32
32
|
},
|
|
33
33
|
warn: (...args) => {
|
|
34
|
-
if (shouldLog("warn")) {
|
|
34
|
+
if (shouldLog("warn", context)) {
|
|
35
35
|
console.warn(prefix, ...args);
|
|
36
36
|
}
|
|
37
37
|
},
|
|
38
38
|
error: (...args) => {
|
|
39
|
-
if (shouldLog("error")) {
|
|
39
|
+
if (shouldLog("error", context)) {
|
|
40
40
|
console.error(prefix, ...args);
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
};
|
|
44
44
|
}
|
|
45
|
-
var
|
|
45
|
+
var contextLogLevels, logLevelHierarchy;
|
|
46
46
|
var init_logger = __esm(() => {
|
|
47
|
+
contextLogLevels = {
|
|
48
|
+
client: "error",
|
|
49
|
+
server: "error"
|
|
50
|
+
};
|
|
47
51
|
logLevelHierarchy = {
|
|
48
52
|
none: 0,
|
|
49
53
|
error: 1,
|
|
@@ -2201,6 +2205,69 @@ class MCPClientBase {
|
|
|
2201
2205
|
getEnabledTools() {
|
|
2202
2206
|
return Array.from(this.availableTools.values()).filter((tool) => this.enabledToolNames.has(tool.name));
|
|
2203
2207
|
}
|
|
2208
|
+
async getEnabledToolsAsync() {
|
|
2209
|
+
if (this.isConnected() && this.availableTools.size > 0) {
|
|
2210
|
+
return this.getEnabledTools();
|
|
2211
|
+
}
|
|
2212
|
+
if (this.availableTools.size > 0) {
|
|
2213
|
+
return this.getEnabledTools();
|
|
2214
|
+
}
|
|
2215
|
+
const tools = [];
|
|
2216
|
+
const integrationIds = new Set;
|
|
2217
|
+
for (const integration of this.integrations) {
|
|
2218
|
+
integrationIds.add(integration.id);
|
|
2219
|
+
}
|
|
2220
|
+
const { parallelWithLimit: parallelWithLimit2 } = await Promise.resolve().then(() => exports_concurrency);
|
|
2221
|
+
const integrationToolsResults = await parallelWithLimit2(Array.from(integrationIds), async (integrationId) => {
|
|
2222
|
+
try {
|
|
2223
|
+
const response = await this.callServerToolInternal("list_tools_by_integration", {
|
|
2224
|
+
integration: integrationId
|
|
2225
|
+
});
|
|
2226
|
+
const integrationTools = [];
|
|
2227
|
+
if (response.content && Array.isArray(response.content)) {
|
|
2228
|
+
for (const item of response.content) {
|
|
2229
|
+
if (item.type === "text" && item.text) {
|
|
2230
|
+
try {
|
|
2231
|
+
const parsed = JSON.parse(item.text);
|
|
2232
|
+
if (Array.isArray(parsed)) {
|
|
2233
|
+
for (const tool of parsed) {
|
|
2234
|
+
if (tool.name && tool.inputSchema) {
|
|
2235
|
+
integrationTools.push({
|
|
2236
|
+
name: tool.name,
|
|
2237
|
+
description: tool.description,
|
|
2238
|
+
inputSchema: tool.inputSchema
|
|
2239
|
+
});
|
|
2240
|
+
}
|
|
2241
|
+
}
|
|
2242
|
+
} else if (parsed.tools && Array.isArray(parsed.tools)) {
|
|
2243
|
+
for (const tool of parsed.tools) {
|
|
2244
|
+
if (tool.name && tool.inputSchema) {
|
|
2245
|
+
integrationTools.push({
|
|
2246
|
+
name: tool.name,
|
|
2247
|
+
description: tool.description,
|
|
2248
|
+
inputSchema: tool.inputSchema
|
|
2249
|
+
});
|
|
2250
|
+
}
|
|
2251
|
+
}
|
|
2252
|
+
}
|
|
2253
|
+
} catch {}
|
|
2254
|
+
}
|
|
2255
|
+
}
|
|
2256
|
+
}
|
|
2257
|
+
return integrationTools;
|
|
2258
|
+
} catch (error) {
|
|
2259
|
+
logger5.error(`Failed to fetch tools for integration ${integrationId}:`, error);
|
|
2260
|
+
return [];
|
|
2261
|
+
}
|
|
2262
|
+
}, 3);
|
|
2263
|
+
for (const integrationTools of integrationToolsResults) {
|
|
2264
|
+
tools.push(...integrationTools);
|
|
2265
|
+
}
|
|
2266
|
+
for (const tool of tools) {
|
|
2267
|
+
this.availableTools.set(tool.name, tool);
|
|
2268
|
+
}
|
|
2269
|
+
return tools.filter((tool) => this.enabledToolNames.has(tool.name));
|
|
2270
|
+
}
|
|
2204
2271
|
getOAuthConfig(integrationId) {
|
|
2205
2272
|
const integration = this.integrations.find((p) => p.id === integrationId);
|
|
2206
2273
|
return integration?.oauth;
|
|
@@ -2445,14 +2512,14 @@ class MCPClientBase {
|
|
|
2445
2512
|
return success;
|
|
2446
2513
|
}
|
|
2447
2514
|
}
|
|
2448
|
-
var MCP_SERVER_URL = "https://mcp.integrate.dev/api/v1/mcp", logger5, clientCache, cleanupClients;
|
|
2515
|
+
var CLIENT_LOG_CONTEXT = "client", MCP_SERVER_URL = "https://mcp.integrate.dev/api/v1/mcp", logger5, clientCache, cleanupClients;
|
|
2449
2516
|
var init_client = __esm(() => {
|
|
2450
2517
|
init_http_session();
|
|
2451
2518
|
init_messages();
|
|
2452
2519
|
init_errors();
|
|
2453
2520
|
init_logger();
|
|
2454
2521
|
init_manager();
|
|
2455
|
-
logger5 = createLogger("MCPClient");
|
|
2522
|
+
logger5 = createLogger("MCPClient", CLIENT_LOG_CONTEXT);
|
|
2456
2523
|
clientCache = new Map;
|
|
2457
2524
|
cleanupClients = new Set;
|
|
2458
2525
|
});
|
|
@@ -7723,11 +7790,6 @@ async function executeToolWithToken(client, toolName, args, options) {
|
|
|
7723
7790
|
const result = await client._callToolByName(toolName, args);
|
|
7724
7791
|
return result;
|
|
7725
7792
|
}
|
|
7726
|
-
async function ensureClientConnected(client) {
|
|
7727
|
-
if (!client.isConnected()) {
|
|
7728
|
-
await client.connect();
|
|
7729
|
-
}
|
|
7730
|
-
}
|
|
7731
7793
|
var init_utils = __esm(() => {
|
|
7732
7794
|
init_zod();
|
|
7733
7795
|
});
|
|
@@ -7970,7 +8032,6 @@ function convertMCPToolToVercelAI(mcpTool, client, options) {
|
|
|
7970
8032
|
};
|
|
7971
8033
|
}
|
|
7972
8034
|
async function getVercelAITools(client, options) {
|
|
7973
|
-
await ensureClientConnected(client);
|
|
7974
8035
|
let providerTokens = options?.providerTokens;
|
|
7975
8036
|
if (!providerTokens) {
|
|
7976
8037
|
try {
|
|
@@ -7978,7 +8039,7 @@ async function getVercelAITools(client, options) {
|
|
|
7978
8039
|
} catch {}
|
|
7979
8040
|
}
|
|
7980
8041
|
const finalOptions = providerTokens ? { ...options, providerTokens } : options;
|
|
7981
|
-
const mcpTools = client.
|
|
8042
|
+
const mcpTools = await client.getEnabledToolsAsync();
|
|
7982
8043
|
const vercelTools = {};
|
|
7983
8044
|
for (const mcpTool of mcpTools) {
|
|
7984
8045
|
vercelTools[mcpTool.name] = convertMCPToolToVercelAI(mcpTool, client, finalOptions);
|
|
@@ -9411,7 +9472,6 @@ function convertMCPToolToOpenAI(mcpTool, _client, options) {
|
|
|
9411
9472
|
};
|
|
9412
9473
|
}
|
|
9413
9474
|
async function getOpenAITools(client, options) {
|
|
9414
|
-
await ensureClientConnected(client);
|
|
9415
9475
|
let providerTokens = options?.providerTokens;
|
|
9416
9476
|
if (!providerTokens) {
|
|
9417
9477
|
try {
|
|
@@ -9419,7 +9479,7 @@ async function getOpenAITools(client, options) {
|
|
|
9419
9479
|
} catch {}
|
|
9420
9480
|
}
|
|
9421
9481
|
const finalOptions = providerTokens ? { ...options, providerTokens } : options;
|
|
9422
|
-
const mcpTools = client.
|
|
9482
|
+
const mcpTools = await client.getEnabledToolsAsync();
|
|
9423
9483
|
const openaiTools = mcpTools.map((mcpTool) => convertMCPToolToOpenAI(mcpTool, client, finalOptions));
|
|
9424
9484
|
const triggerConfig = client.__triggerConfig;
|
|
9425
9485
|
if (triggerConfig) {
|
|
@@ -9543,7 +9603,6 @@ async function handleAnthropicToolCalls(client, messageContent, options) {
|
|
|
9543
9603
|
return toolResults;
|
|
9544
9604
|
}
|
|
9545
9605
|
async function getAnthropicTools(client, options) {
|
|
9546
|
-
await ensureClientConnected(client);
|
|
9547
9606
|
let providerTokens = options?.providerTokens;
|
|
9548
9607
|
if (!providerTokens) {
|
|
9549
9608
|
try {
|
|
@@ -9551,7 +9610,7 @@ async function getAnthropicTools(client, options) {
|
|
|
9551
9610
|
} catch {}
|
|
9552
9611
|
}
|
|
9553
9612
|
const finalOptions = providerTokens ? { ...options, providerTokens } : options;
|
|
9554
|
-
const mcpTools = client.
|
|
9613
|
+
const mcpTools = await client.getEnabledToolsAsync();
|
|
9555
9614
|
const anthropicTools = mcpTools.map((mcpTool) => convertMCPToolToAnthropic(mcpTool, client, finalOptions));
|
|
9556
9615
|
const triggerConfig = client.__triggerConfig;
|
|
9557
9616
|
if (triggerConfig) {
|
|
@@ -9698,7 +9757,6 @@ async function executeGoogleFunctionCalls(client, functionCalls, options) {
|
|
|
9698
9757
|
return results;
|
|
9699
9758
|
}
|
|
9700
9759
|
async function getGoogleTools(client, options) {
|
|
9701
|
-
await ensureClientConnected(client);
|
|
9702
9760
|
let providerTokens = options?.providerTokens;
|
|
9703
9761
|
if (!providerTokens) {
|
|
9704
9762
|
try {
|
|
@@ -9706,7 +9764,7 @@ async function getGoogleTools(client, options) {
|
|
|
9706
9764
|
} catch {}
|
|
9707
9765
|
}
|
|
9708
9766
|
const finalOptions = providerTokens ? { ...options, providerTokens } : options;
|
|
9709
|
-
const mcpTools = client.
|
|
9767
|
+
const mcpTools = await client.getEnabledToolsAsync();
|
|
9710
9768
|
const googleTools = await Promise.all(mcpTools.map((mcpTool) => convertMCPToolToGoogle(mcpTool, client, finalOptions)));
|
|
9711
9769
|
const triggerConfig = client.__triggerConfig;
|
|
9712
9770
|
if (triggerConfig) {
|
|
@@ -9881,7 +9939,7 @@ function getDefaultRedirectUri() {
|
|
|
9881
9939
|
return "http://localhost:3000/api/integrate/oauth/callback";
|
|
9882
9940
|
}
|
|
9883
9941
|
function createMCPServer(config) {
|
|
9884
|
-
setLogLevel(config.debug ? "debug" : "error");
|
|
9942
|
+
setLogLevel(config.debug ? "debug" : "error", SERVER_LOG_CONTEXT);
|
|
9885
9943
|
if (typeof window !== "undefined") {
|
|
9886
9944
|
throw new Error("createMCPServer() should only be called on the server-side. " + "Use createMCPClient() for client-side code.");
|
|
9887
9945
|
}
|
|
@@ -10650,7 +10708,7 @@ function toSvelteKitHandler(clientOrHandlerOrOptions, _redirectOptions) {
|
|
|
10650
10708
|
}
|
|
10651
10709
|
};
|
|
10652
10710
|
}
|
|
10653
|
-
var logger29, globalServerConfig = null, codeVerifierStorage, POST = async (req, context) => {
|
|
10711
|
+
var SERVER_LOG_CONTEXT = "server", logger29, globalServerConfig = null, codeVerifierStorage, POST = async (req, context) => {
|
|
10654
10712
|
if (!globalServerConfig) {
|
|
10655
10713
|
return Response.json({ error: "OAuth not configured. Call createMCPServer() in your server initialization file first." }, { status: 500 });
|
|
10656
10714
|
}
|
|
@@ -10698,7 +10756,7 @@ var init_server = __esm(() => {
|
|
|
10698
10756
|
init_anthropic();
|
|
10699
10757
|
init_google();
|
|
10700
10758
|
init_ai();
|
|
10701
|
-
logger29 = createLogger("MCPServer");
|
|
10759
|
+
logger29 = createLogger("MCPServer", SERVER_LOG_CONTEXT);
|
|
10702
10760
|
codeVerifierStorage = new Map;
|
|
10703
10761
|
});
|
|
10704
10762
|
|
|
@@ -11261,10 +11319,10 @@ class OAuthHandler {
|
|
|
11261
11319
|
return jsonRpcResponse.result;
|
|
11262
11320
|
}
|
|
11263
11321
|
}
|
|
11264
|
-
var logger30, MCP_SERVER_URL2 = "https://mcp.integrate.dev/api/v1/mcp";
|
|
11322
|
+
var SERVER_LOG_CONTEXT2 = "server", logger30, MCP_SERVER_URL2 = "https://mcp.integrate.dev/api/v1/mcp";
|
|
11265
11323
|
var init_base_handler = __esm(() => {
|
|
11266
11324
|
init_logger();
|
|
11267
|
-
logger30 = createLogger("OAuthHandler");
|
|
11325
|
+
logger30 = createLogger("OAuthHandler", SERVER_LOG_CONTEXT2);
|
|
11268
11326
|
});
|
|
11269
11327
|
|
|
11270
11328
|
// nextjs.ts
|
|
@@ -11469,11 +11527,11 @@ function createNextOAuthHandler(config) {
|
|
|
11469
11527
|
};
|
|
11470
11528
|
return handlers;
|
|
11471
11529
|
}
|
|
11472
|
-
var logger31;
|
|
11530
|
+
var SERVER_LOG_CONTEXT3 = "server", logger31;
|
|
11473
11531
|
var init_nextjs = __esm(() => {
|
|
11474
11532
|
init_base_handler();
|
|
11475
11533
|
init_logger();
|
|
11476
|
-
logger31 = createLogger("NextJSOAuth");
|
|
11534
|
+
logger31 = createLogger("NextJSOAuth", SERVER_LOG_CONTEXT3);
|
|
11477
11535
|
});
|
|
11478
11536
|
|
|
11479
11537
|
// solid-start.ts
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nextjs-oauth-redirect.d.ts","sourceRoot":"","sources":["../../../src/adapters/nextjs-oauth-redirect.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"nextjs-oauth-redirect.d.ts","sourceRoot":"","sources":["../../../src/adapters/nextjs-oauth-redirect.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAYH,KAAK,WAAW,GAAG,GAAG,CAAC;AACvB,KAAK,YAAY,GAAG,GAAG,CAAC;AAExB,MAAM,WAAW,mBAAmB;IAClC,6DAA6D;IAC7D,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,iEAAiE;IACjE,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,0BAA0B,CAAC,MAAM,CAAC,EAAE,mBAAmB,IAI3C,KAAK,WAAW,KAAG,OAAO,CAAC,YAAY,CAAC,CA8DnE"}
|
|
@@ -107,39 +107,43 @@ function base64UrlDecode(str) {
|
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
// ../utils/logger.ts
|
|
110
|
-
function shouldLog(level) {
|
|
111
|
-
return logLevelHierarchy[level] <= logLevelHierarchy[
|
|
110
|
+
function shouldLog(level, context) {
|
|
111
|
+
return logLevelHierarchy[level] <= logLevelHierarchy[contextLogLevels[context]];
|
|
112
112
|
}
|
|
113
|
-
function setLogLevel(level) {
|
|
114
|
-
|
|
113
|
+
function setLogLevel(level, context = "client") {
|
|
114
|
+
contextLogLevels[context] = level;
|
|
115
115
|
}
|
|
116
|
-
function createLogger(namespace) {
|
|
116
|
+
function createLogger(namespace, context = "client") {
|
|
117
117
|
const prefix = `[${namespace}]`;
|
|
118
118
|
return {
|
|
119
119
|
debug: (...args) => {
|
|
120
|
-
if (shouldLog("debug")) {
|
|
120
|
+
if (shouldLog("debug", context)) {
|
|
121
121
|
console.log(prefix, ...args);
|
|
122
122
|
}
|
|
123
123
|
},
|
|
124
124
|
info: (...args) => {
|
|
125
|
-
if (shouldLog("info")) {
|
|
125
|
+
if (shouldLog("info", context)) {
|
|
126
126
|
console.log(prefix, ...args);
|
|
127
127
|
}
|
|
128
128
|
},
|
|
129
129
|
warn: (...args) => {
|
|
130
|
-
if (shouldLog("warn")) {
|
|
130
|
+
if (shouldLog("warn", context)) {
|
|
131
131
|
console.warn(prefix, ...args);
|
|
132
132
|
}
|
|
133
133
|
},
|
|
134
134
|
error: (...args) => {
|
|
135
|
-
if (shouldLog("error")) {
|
|
135
|
+
if (shouldLog("error", context)) {
|
|
136
136
|
console.error(prefix, ...args);
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
139
|
};
|
|
140
140
|
}
|
|
141
|
-
var
|
|
141
|
+
var contextLogLevels, logLevelHierarchy;
|
|
142
142
|
var init_logger = __esm(() => {
|
|
143
|
+
contextLogLevels = {
|
|
144
|
+
client: "error",
|
|
145
|
+
server: "error"
|
|
146
|
+
};
|
|
143
147
|
logLevelHierarchy = {
|
|
144
148
|
none: 0,
|
|
145
149
|
error: 1,
|
|
@@ -151,7 +155,8 @@ var init_logger = __esm(() => {
|
|
|
151
155
|
|
|
152
156
|
// nextjs-oauth-redirect.ts
|
|
153
157
|
init_logger();
|
|
154
|
-
var
|
|
158
|
+
var SERVER_LOG_CONTEXT = "server";
|
|
159
|
+
var logger = createLogger("OAuthRedirect", SERVER_LOG_CONTEXT);
|
|
155
160
|
function createOAuthRedirectHandler(config) {
|
|
156
161
|
const defaultRedirectUrl = config?.redirectUrl || "/";
|
|
157
162
|
const errorRedirectUrl = config?.errorRedirectUrl || "/auth-error";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nextjs.d.ts","sourceRoot":"","sources":["../../../src/adapters/nextjs.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAgB,KAAK,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"nextjs.d.ts","sourceRoot":"","sources":["../../../src/adapters/nextjs.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAgB,KAAK,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAU1E,KAAK,WAAW,GAAG,GAAG,CAAC;AACvB,KAAK,YAAY,GAAG,GAAG,CAAC;AAExB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,kBAAkB;IAI7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAwCG;mBACkB,WAAW,GAAG,OAAO,CAAC,YAAY,CAAC;IA4BxD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAyCG;kBACiB,WAAW,GAAG,OAAO,CAAC,YAAY,CAAC;IA4BvD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAoCG;gBACe,WAAW,GAAG,OAAO,CAAC,YAAY,CAAC;IAsCrD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAuCG;oBACmB,WAAW,GAAG,OAAO,CAAC,YAAY,CAAC;IAyCzD;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;;QAGC;;WAEG;kBAEI,WAAW,WACP;YAAE,MAAM,EAAE;gBAAE,MAAM,EAAE,MAAM,CAAA;aAAE,GAAG,OAAO,CAAC;gBAAE,MAAM,EAAE,MAAM,CAAA;aAAE,CAAC,CAAA;SAAE,GACpE,OAAO,CAAC,YAAY,CAAC;QA2BxB;;WAEG;iBAEI,WAAW,WACP;YAAE,MAAM,EAAE;gBAAE,MAAM,E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