@agiflowai/one-mcp 0.3.17 → 0.3.19
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/cli.cjs +6 -4
- package/dist/cli.mjs +6 -4
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +6 -1
- package/dist/index.d.mts +6 -1
- package/dist/index.mjs +1 -1
- package/dist/{src-B8Rb84GQ.cjs → src-BXzji7SM.cjs} +20 -6
- package/dist/{src-D5YMjGgs.mjs → src-QphCJFbi.mjs} +20 -6
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
const require_src = require('./src-
|
|
2
|
+
const require_src = require('./src-BXzji7SM.cjs');
|
|
3
3
|
let node_fs_promises = require("node:fs/promises");
|
|
4
4
|
let node_fs = require("node:fs");
|
|
5
5
|
let node_crypto = require("node:crypto");
|
|
@@ -1132,7 +1132,7 @@ const describeToolsCommand = new commander.Command("describe-tools").description
|
|
|
1132
1132
|
/**
|
|
1133
1133
|
* Execute an MCP tool with arguments
|
|
1134
1134
|
*/
|
|
1135
|
-
const useToolCommand = new commander.Command("use-tool").description("Execute an MCP tool with arguments").argument("<toolName>", "Tool name to execute").option("-c, --config <path>", "Path to MCP server configuration file").option("-s, --server <name>", "Server name (required if tool exists on multiple servers)").option("-a, --args <json>", "Tool arguments as JSON string", "{}").option("-j, --json", "Output as JSON", false).action(async (toolName, options) => {
|
|
1135
|
+
const useToolCommand = new commander.Command("use-tool").description("Execute an MCP tool with arguments").argument("<toolName>", "Tool name to execute").option("-c, --config <path>", "Path to MCP server configuration file").option("-s, --server <name>", "Server name (required if tool exists on multiple servers)").option("-a, --args <json>", "Tool arguments as JSON string", "{}").option("-t, --timeout <ms>", "Request timeout in milliseconds for tool execution (default: 60000)", parseInt).option("-j, --json", "Output as JSON", false).action(async (toolName, options) => {
|
|
1136
1136
|
try {
|
|
1137
1137
|
const configFilePath = options.config || require_src.findConfigFile();
|
|
1138
1138
|
if (!configFilePath) {
|
|
@@ -1170,7 +1170,8 @@ const useToolCommand = new commander.Command("use-tool").description("Execute an
|
|
|
1170
1170
|
}
|
|
1171
1171
|
try {
|
|
1172
1172
|
if (!options.json) console.error(`Executing ${toolName} on ${options.server}...`);
|
|
1173
|
-
const
|
|
1173
|
+
const requestOptions = options.timeout ? { timeout: options.timeout } : void 0;
|
|
1174
|
+
const result = await client$1.callTool(toolName, toolArgs, requestOptions);
|
|
1174
1175
|
if (options.json) console.log(JSON.stringify(result, null, 2));
|
|
1175
1176
|
else {
|
|
1176
1177
|
console.log("\nResult:");
|
|
@@ -1255,7 +1256,8 @@ const useToolCommand = new commander.Command("use-tool").description("Execute an
|
|
|
1255
1256
|
}
|
|
1256
1257
|
try {
|
|
1257
1258
|
if (!options.json) console.error(`Executing ${toolName} on ${targetServer}...`);
|
|
1258
|
-
const
|
|
1259
|
+
const requestOpts = options.timeout ? { timeout: options.timeout } : void 0;
|
|
1260
|
+
const result = await client.callTool(toolName, toolArgs, requestOpts);
|
|
1259
1261
|
if (options.json) console.log(JSON.stringify(result, null, 2));
|
|
1260
1262
|
else {
|
|
1261
1263
|
console.log("\nResult:");
|
package/dist/cli.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { _ as DefinitionsCacheService, a as SseTransportHandler, b as ConfigFetcherService, c as createServer, d as version, g as McpClientManagerService, h as SkillService, i as StdioTransportHandler, l as createSessionServer, n as RuntimeStateService, o as HttpTransportHandler, p as SearchListToolsTool, r as StdioHttpTransportHandler, s as TRANSPORT_MODE, t as StopServerService, u as initializeSharedServices, v as generateServerId, y as findConfigFile } from "./src-
|
|
2
|
+
import { _ as DefinitionsCacheService, a as SseTransportHandler, b as ConfigFetcherService, c as createServer, d as version, g as McpClientManagerService, h as SkillService, i as StdioTransportHandler, l as createSessionServer, n as RuntimeStateService, o as HttpTransportHandler, p as SearchListToolsTool, r as StdioHttpTransportHandler, s as TRANSPORT_MODE, t as StopServerService, u as initializeSharedServices, v as generateServerId, y as findConfigFile } from "./src-QphCJFbi.mjs";
|
|
3
3
|
import { access, writeFile } from "node:fs/promises";
|
|
4
4
|
import { constants } from "node:fs";
|
|
5
5
|
import { randomUUID } from "node:crypto";
|
|
@@ -1132,7 +1132,7 @@ const describeToolsCommand = new Command("describe-tools").description("Describe
|
|
|
1132
1132
|
/**
|
|
1133
1133
|
* Execute an MCP tool with arguments
|
|
1134
1134
|
*/
|
|
1135
|
-
const useToolCommand = new Command("use-tool").description("Execute an MCP tool with arguments").argument("<toolName>", "Tool name to execute").option("-c, --config <path>", "Path to MCP server configuration file").option("-s, --server <name>", "Server name (required if tool exists on multiple servers)").option("-a, --args <json>", "Tool arguments as JSON string", "{}").option("-j, --json", "Output as JSON", false).action(async (toolName, options) => {
|
|
1135
|
+
const useToolCommand = new Command("use-tool").description("Execute an MCP tool with arguments").argument("<toolName>", "Tool name to execute").option("-c, --config <path>", "Path to MCP server configuration file").option("-s, --server <name>", "Server name (required if tool exists on multiple servers)").option("-a, --args <json>", "Tool arguments as JSON string", "{}").option("-t, --timeout <ms>", "Request timeout in milliseconds for tool execution (default: 60000)", parseInt).option("-j, --json", "Output as JSON", false).action(async (toolName, options) => {
|
|
1136
1136
|
try {
|
|
1137
1137
|
const configFilePath = options.config || findConfigFile();
|
|
1138
1138
|
if (!configFilePath) {
|
|
@@ -1170,7 +1170,8 @@ const useToolCommand = new Command("use-tool").description("Execute an MCP tool
|
|
|
1170
1170
|
}
|
|
1171
1171
|
try {
|
|
1172
1172
|
if (!options.json) console.error(`Executing ${toolName} on ${options.server}...`);
|
|
1173
|
-
const
|
|
1173
|
+
const requestOptions = options.timeout ? { timeout: options.timeout } : void 0;
|
|
1174
|
+
const result = await client$1.callTool(toolName, toolArgs, requestOptions);
|
|
1174
1175
|
if (options.json) console.log(JSON.stringify(result, null, 2));
|
|
1175
1176
|
else {
|
|
1176
1177
|
console.log("\nResult:");
|
|
@@ -1255,7 +1256,8 @@ const useToolCommand = new Command("use-tool").description("Execute an MCP tool
|
|
|
1255
1256
|
}
|
|
1256
1257
|
try {
|
|
1257
1258
|
if (!options.json) console.error(`Executing ${toolName} on ${targetServer}...`);
|
|
1258
|
-
const
|
|
1259
|
+
const requestOpts = options.timeout ? { timeout: options.timeout } : void 0;
|
|
1260
|
+
const result = await client.callTool(toolName, toolArgs, requestOpts);
|
|
1259
1261
|
if (options.json) console.log(JSON.stringify(result, null, 2));
|
|
1260
1262
|
else {
|
|
1261
1263
|
console.log("\nResult:");
|
package/dist/index.cjs
CHANGED
package/dist/index.d.cts
CHANGED
|
@@ -221,6 +221,8 @@ interface McpServerConfig {
|
|
|
221
221
|
transport: McpServerTransportType;
|
|
222
222
|
config: McpServerTransportConfig;
|
|
223
223
|
timeout?: number;
|
|
224
|
+
/** Optional per-request timeout in milliseconds for tool calls (default: 60000 from MCP SDK) */
|
|
225
|
+
requestTimeout?: number;
|
|
224
226
|
disabled?: boolean;
|
|
225
227
|
}
|
|
226
228
|
/**
|
|
@@ -322,7 +324,9 @@ interface McpClientConnection {
|
|
|
322
324
|
/** List available prompts from the server */
|
|
323
325
|
listPrompts(): Promise<McpPromptInfo[]>;
|
|
324
326
|
/** Call a tool with the given name and arguments */
|
|
325
|
-
callTool(name: string, args: Record<string, unknown
|
|
327
|
+
callTool(name: string, args: Record<string, unknown>, options?: {
|
|
328
|
+
timeout?: number;
|
|
329
|
+
}): Promise<CallToolResult>;
|
|
326
330
|
/** Read a resource by URI */
|
|
327
331
|
readResource(uri: string): Promise<ReadResourceResult>;
|
|
328
332
|
/** Get a prompt by name with optional arguments */
|
|
@@ -552,6 +556,7 @@ declare class McpClientManagerService {
|
|
|
552
556
|
connectToServer(serverName: string, config: McpServerConfig): Promise<void>;
|
|
553
557
|
registerServerConfigs(configs: Record<string, McpServerConfig>): void;
|
|
554
558
|
getKnownServerNames(): string[];
|
|
559
|
+
getServerRequestTimeout(serverName: string): number | undefined;
|
|
555
560
|
ensureConnected(serverName: string): Promise<McpClientConnection>;
|
|
556
561
|
private createConnection;
|
|
557
562
|
/**
|
package/dist/index.d.mts
CHANGED
|
@@ -222,6 +222,8 @@ interface McpServerConfig {
|
|
|
222
222
|
transport: McpServerTransportType;
|
|
223
223
|
config: McpServerTransportConfig;
|
|
224
224
|
timeout?: number;
|
|
225
|
+
/** Optional per-request timeout in milliseconds for tool calls (default: 60000 from MCP SDK) */
|
|
226
|
+
requestTimeout?: number;
|
|
225
227
|
disabled?: boolean;
|
|
226
228
|
}
|
|
227
229
|
/**
|
|
@@ -323,7 +325,9 @@ interface McpClientConnection {
|
|
|
323
325
|
/** List available prompts from the server */
|
|
324
326
|
listPrompts(): Promise<McpPromptInfo[]>;
|
|
325
327
|
/** Call a tool with the given name and arguments */
|
|
326
|
-
callTool(name: string, args: Record<string, unknown
|
|
328
|
+
callTool(name: string, args: Record<string, unknown>, options?: {
|
|
329
|
+
timeout?: number;
|
|
330
|
+
}): Promise<CallToolResult>;
|
|
327
331
|
/** Read a resource by URI */
|
|
328
332
|
readResource(uri: string): Promise<ReadResourceResult>;
|
|
329
333
|
/** Get a prompt by name with optional arguments */
|
|
@@ -553,6 +557,7 @@ declare class McpClientManagerService {
|
|
|
553
557
|
connectToServer(serverName: string, config: McpServerConfig): Promise<void>;
|
|
554
558
|
registerServerConfigs(configs: Record<string, McpServerConfig>): void;
|
|
555
559
|
getKnownServerNames(): string[];
|
|
560
|
+
getServerRequestTimeout(serverName: string): number | undefined;
|
|
556
561
|
ensureConnected(serverName: string): Promise<McpClientConnection>;
|
|
557
562
|
private createConnection;
|
|
558
563
|
/**
|
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { _ as DefinitionsCacheService, a as SseTransportHandler, b as ConfigFetcherService, c as createServer, f as UseToolTool, g as McpClientManagerService, h as SkillService, i as StdioTransportHandler, l as createSessionServer, m as DescribeToolsTool, n as RuntimeStateService, o as HttpTransportHandler, p as SearchListToolsTool, r as StdioHttpTransportHandler, s as TRANSPORT_MODE, t as StopServerService, u as initializeSharedServices, v as generateServerId, y as findConfigFile } from "./src-
|
|
1
|
+
import { _ as DefinitionsCacheService, a as SseTransportHandler, b as ConfigFetcherService, c as createServer, f as UseToolTool, g as McpClientManagerService, h as SkillService, i as StdioTransportHandler, l as createSessionServer, m as DescribeToolsTool, n as RuntimeStateService, o as HttpTransportHandler, p as SearchListToolsTool, r as StdioHttpTransportHandler, s as TRANSPORT_MODE, t as StopServerService, u as initializeSharedServices, v as generateServerId, y as findConfigFile } from "./src-QphCJFbi.mjs";
|
|
2
2
|
|
|
3
3
|
export { ConfigFetcherService, DefinitionsCacheService, DescribeToolsTool, HttpTransportHandler, McpClientManagerService, RuntimeStateService, SearchListToolsTool, SkillService, SseTransportHandler, StdioHttpTransportHandler, StdioTransportHandler, StopServerService, TRANSPORT_MODE, UseToolTool, createServer, createSessionServer, findConfigFile, generateServerId, initializeSharedServices };
|
|
@@ -36,8 +36,8 @@ let node_crypto = require("node:crypto");
|
|
|
36
36
|
let node_path = require("node:path");
|
|
37
37
|
let node_os = require("node:os");
|
|
38
38
|
let __modelcontextprotocol_sdk_client_index_js = require("@modelcontextprotocol/sdk/client/index.js");
|
|
39
|
-
let __modelcontextprotocol_sdk_client_stdio_js = require("@modelcontextprotocol/sdk/client/stdio.js");
|
|
40
39
|
let __modelcontextprotocol_sdk_client_sse_js = require("@modelcontextprotocol/sdk/client/sse.js");
|
|
40
|
+
let __modelcontextprotocol_sdk_client_stdio_js = require("@modelcontextprotocol/sdk/client/stdio.js");
|
|
41
41
|
let __modelcontextprotocol_sdk_client_streamableHttp_js = require("@modelcontextprotocol/sdk/client/streamableHttp.js");
|
|
42
42
|
let liquidjs = require("liquidjs");
|
|
43
43
|
let node_events = require("node:events");
|
|
@@ -234,6 +234,7 @@ const ClaudeCodeStdioServerSchema = zod.z.object({
|
|
|
234
234
|
disabled: zod.z.boolean().optional(),
|
|
235
235
|
instruction: zod.z.string().optional(),
|
|
236
236
|
timeout: zod.z.number().positive().optional(),
|
|
237
|
+
requestTimeout: zod.z.number().positive().optional(),
|
|
237
238
|
config: AdditionalConfigSchema
|
|
238
239
|
});
|
|
239
240
|
const ClaudeCodeHttpServerSchema = zod.z.object({
|
|
@@ -243,6 +244,7 @@ const ClaudeCodeHttpServerSchema = zod.z.object({
|
|
|
243
244
|
disabled: zod.z.boolean().optional(),
|
|
244
245
|
instruction: zod.z.string().optional(),
|
|
245
246
|
timeout: zod.z.number().positive().optional(),
|
|
247
|
+
requestTimeout: zod.z.number().positive().optional(),
|
|
246
248
|
config: AdditionalConfigSchema
|
|
247
249
|
});
|
|
248
250
|
const ClaudeCodeServerConfigSchema = zod.z.union([ClaudeCodeStdioServerSchema, ClaudeCodeHttpServerSchema]);
|
|
@@ -315,6 +317,7 @@ const McpServerConfigSchema = zod.z.discriminatedUnion("transport", [
|
|
|
315
317
|
omitToolDescription: zod.z.boolean().optional(),
|
|
316
318
|
prompts: zod.z.record(zod.z.string(), InternalPromptConfigSchema).optional(),
|
|
317
319
|
timeout: zod.z.number().positive().optional(),
|
|
320
|
+
requestTimeout: zod.z.number().positive().optional(),
|
|
318
321
|
transport: zod.z.literal("stdio"),
|
|
319
322
|
config: McpStdioConfigSchema
|
|
320
323
|
}),
|
|
@@ -325,6 +328,7 @@ const McpServerConfigSchema = zod.z.discriminatedUnion("transport", [
|
|
|
325
328
|
omitToolDescription: zod.z.boolean().optional(),
|
|
326
329
|
prompts: zod.z.record(zod.z.string(), InternalPromptConfigSchema).optional(),
|
|
327
330
|
timeout: zod.z.number().positive().optional(),
|
|
331
|
+
requestTimeout: zod.z.number().positive().optional(),
|
|
328
332
|
transport: zod.z.literal("http"),
|
|
329
333
|
config: McpHttpConfigSchema
|
|
330
334
|
}),
|
|
@@ -335,6 +339,7 @@ const McpServerConfigSchema = zod.z.discriminatedUnion("transport", [
|
|
|
335
339
|
omitToolDescription: zod.z.boolean().optional(),
|
|
336
340
|
prompts: zod.z.record(zod.z.string(), InternalPromptConfigSchema).optional(),
|
|
337
341
|
timeout: zod.z.number().positive().optional(),
|
|
342
|
+
requestTimeout: zod.z.number().positive().optional(),
|
|
338
343
|
transport: zod.z.literal("sse"),
|
|
339
344
|
config: McpSseConfigSchema
|
|
340
345
|
})
|
|
@@ -370,6 +375,7 @@ function transformClaudeCodeConfig(claudeConfig) {
|
|
|
370
375
|
omitToolDescription: stdioConfig.config?.omitToolDescription,
|
|
371
376
|
prompts: stdioConfig.config?.prompts,
|
|
372
377
|
timeout: stdioConfig.timeout,
|
|
378
|
+
requestTimeout: stdioConfig.requestTimeout,
|
|
373
379
|
transport: "stdio",
|
|
374
380
|
config: {
|
|
375
381
|
command: interpolatedCommand,
|
|
@@ -389,6 +395,7 @@ function transformClaudeCodeConfig(claudeConfig) {
|
|
|
389
395
|
omitToolDescription: httpConfig.config?.omitToolDescription,
|
|
390
396
|
prompts: httpConfig.config?.prompts,
|
|
391
397
|
timeout: httpConfig.timeout,
|
|
398
|
+
requestTimeout: httpConfig.requestTimeout,
|
|
392
399
|
transport,
|
|
393
400
|
config: {
|
|
394
401
|
url: interpolatedUrl,
|
|
@@ -1538,13 +1545,14 @@ var McpClient = class {
|
|
|
1538
1545
|
return (await this.client.listPrompts()).prompts;
|
|
1539
1546
|
});
|
|
1540
1547
|
}
|
|
1541
|
-
async callTool(name, args) {
|
|
1548
|
+
async callTool(name, args, options) {
|
|
1542
1549
|
if (!this.connected) throw new Error(`Client for ${this.serverName} is not connected`);
|
|
1543
1550
|
return this.withSessionRetry(async () => {
|
|
1551
|
+
const requestOptions = options?.timeout ? { timeout: options.timeout } : void 0;
|
|
1544
1552
|
return await this.client.callTool({
|
|
1545
1553
|
name,
|
|
1546
1554
|
arguments: args
|
|
1547
|
-
});
|
|
1555
|
+
}, void 0, requestOptions);
|
|
1548
1556
|
});
|
|
1549
1557
|
}
|
|
1550
1558
|
async readResource(uri) {
|
|
@@ -1610,6 +1618,9 @@ var McpClientManagerService = class {
|
|
|
1610
1618
|
getKnownServerNames() {
|
|
1611
1619
|
return Array.from(this.serverConfigs.keys());
|
|
1612
1620
|
}
|
|
1621
|
+
getServerRequestTimeout(serverName) {
|
|
1622
|
+
return this.serverConfigs.get(serverName)?.requestTimeout;
|
|
1623
|
+
}
|
|
1613
1624
|
async ensureConnected(serverName) {
|
|
1614
1625
|
const existingClient = this.clients.get(serverName);
|
|
1615
1626
|
if (existingClient) return existingClient;
|
|
@@ -2802,7 +2813,8 @@ IMPORTANT: Only use tools discovered from describe_tools with id="${this.serverI
|
|
|
2802
2813
|
}],
|
|
2803
2814
|
isError: true
|
|
2804
2815
|
};
|
|
2805
|
-
|
|
2816
|
+
const reqTimeout = this.clientManager.getServerRequestTimeout(serverName);
|
|
2817
|
+
return await client.callTool(actualToolName, toolArgs, reqTimeout ? { timeout: reqTimeout } : void 0);
|
|
2806
2818
|
} catch (error) {
|
|
2807
2819
|
return {
|
|
2808
2820
|
content: [{
|
|
@@ -2837,7 +2849,9 @@ IMPORTANT: Only use tools discovered from describe_tools with id="${this.serverI
|
|
|
2837
2849
|
};
|
|
2838
2850
|
try {
|
|
2839
2851
|
const targetServerName = matchingServers[0];
|
|
2840
|
-
|
|
2852
|
+
const client = await this.clientManager.ensureConnected(targetServerName);
|
|
2853
|
+
const targetReqTimeout = this.clientManager.getServerRequestTimeout(targetServerName);
|
|
2854
|
+
return await client.callTool(actualToolName, toolArgs, targetReqTimeout ? { timeout: targetReqTimeout } : void 0);
|
|
2841
2855
|
} catch (error) {
|
|
2842
2856
|
return {
|
|
2843
2857
|
content: [{
|
|
@@ -2861,7 +2875,7 @@ IMPORTANT: Only use tools discovered from describe_tools with id="${this.serverI
|
|
|
2861
2875
|
|
|
2862
2876
|
//#endregion
|
|
2863
2877
|
//#region package.json
|
|
2864
|
-
var version = "0.3.
|
|
2878
|
+
var version = "0.3.18";
|
|
2865
2879
|
|
|
2866
2880
|
//#endregion
|
|
2867
2881
|
//#region src/server/index.ts
|
|
@@ -8,8 +8,8 @@ import { createHash, randomBytes, randomUUID } from "node:crypto";
|
|
|
8
8
|
import { dirname, isAbsolute, join, resolve } from "node:path";
|
|
9
9
|
import { homedir, tmpdir } from "node:os";
|
|
10
10
|
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
|
11
|
-
import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";
|
|
12
11
|
import { SSEClientTransport } from "@modelcontextprotocol/sdk/client/sse.js";
|
|
12
|
+
import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";
|
|
13
13
|
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
|
|
14
14
|
import { Liquid } from "liquidjs";
|
|
15
15
|
import { once } from "node:events";
|
|
@@ -205,6 +205,7 @@ const ClaudeCodeStdioServerSchema = z.object({
|
|
|
205
205
|
disabled: z.boolean().optional(),
|
|
206
206
|
instruction: z.string().optional(),
|
|
207
207
|
timeout: z.number().positive().optional(),
|
|
208
|
+
requestTimeout: z.number().positive().optional(),
|
|
208
209
|
config: AdditionalConfigSchema
|
|
209
210
|
});
|
|
210
211
|
const ClaudeCodeHttpServerSchema = z.object({
|
|
@@ -214,6 +215,7 @@ const ClaudeCodeHttpServerSchema = z.object({
|
|
|
214
215
|
disabled: z.boolean().optional(),
|
|
215
216
|
instruction: z.string().optional(),
|
|
216
217
|
timeout: z.number().positive().optional(),
|
|
218
|
+
requestTimeout: z.number().positive().optional(),
|
|
217
219
|
config: AdditionalConfigSchema
|
|
218
220
|
});
|
|
219
221
|
const ClaudeCodeServerConfigSchema = z.union([ClaudeCodeStdioServerSchema, ClaudeCodeHttpServerSchema]);
|
|
@@ -286,6 +288,7 @@ const McpServerConfigSchema = z.discriminatedUnion("transport", [
|
|
|
286
288
|
omitToolDescription: z.boolean().optional(),
|
|
287
289
|
prompts: z.record(z.string(), InternalPromptConfigSchema).optional(),
|
|
288
290
|
timeout: z.number().positive().optional(),
|
|
291
|
+
requestTimeout: z.number().positive().optional(),
|
|
289
292
|
transport: z.literal("stdio"),
|
|
290
293
|
config: McpStdioConfigSchema
|
|
291
294
|
}),
|
|
@@ -296,6 +299,7 @@ const McpServerConfigSchema = z.discriminatedUnion("transport", [
|
|
|
296
299
|
omitToolDescription: z.boolean().optional(),
|
|
297
300
|
prompts: z.record(z.string(), InternalPromptConfigSchema).optional(),
|
|
298
301
|
timeout: z.number().positive().optional(),
|
|
302
|
+
requestTimeout: z.number().positive().optional(),
|
|
299
303
|
transport: z.literal("http"),
|
|
300
304
|
config: McpHttpConfigSchema
|
|
301
305
|
}),
|
|
@@ -306,6 +310,7 @@ const McpServerConfigSchema = z.discriminatedUnion("transport", [
|
|
|
306
310
|
omitToolDescription: z.boolean().optional(),
|
|
307
311
|
prompts: z.record(z.string(), InternalPromptConfigSchema).optional(),
|
|
308
312
|
timeout: z.number().positive().optional(),
|
|
313
|
+
requestTimeout: z.number().positive().optional(),
|
|
309
314
|
transport: z.literal("sse"),
|
|
310
315
|
config: McpSseConfigSchema
|
|
311
316
|
})
|
|
@@ -341,6 +346,7 @@ function transformClaudeCodeConfig(claudeConfig) {
|
|
|
341
346
|
omitToolDescription: stdioConfig.config?.omitToolDescription,
|
|
342
347
|
prompts: stdioConfig.config?.prompts,
|
|
343
348
|
timeout: stdioConfig.timeout,
|
|
349
|
+
requestTimeout: stdioConfig.requestTimeout,
|
|
344
350
|
transport: "stdio",
|
|
345
351
|
config: {
|
|
346
352
|
command: interpolatedCommand,
|
|
@@ -360,6 +366,7 @@ function transformClaudeCodeConfig(claudeConfig) {
|
|
|
360
366
|
omitToolDescription: httpConfig.config?.omitToolDescription,
|
|
361
367
|
prompts: httpConfig.config?.prompts,
|
|
362
368
|
timeout: httpConfig.timeout,
|
|
369
|
+
requestTimeout: httpConfig.requestTimeout,
|
|
363
370
|
transport,
|
|
364
371
|
config: {
|
|
365
372
|
url: interpolatedUrl,
|
|
@@ -1509,13 +1516,14 @@ var McpClient = class {
|
|
|
1509
1516
|
return (await this.client.listPrompts()).prompts;
|
|
1510
1517
|
});
|
|
1511
1518
|
}
|
|
1512
|
-
async callTool(name, args) {
|
|
1519
|
+
async callTool(name, args, options) {
|
|
1513
1520
|
if (!this.connected) throw new Error(`Client for ${this.serverName} is not connected`);
|
|
1514
1521
|
return this.withSessionRetry(async () => {
|
|
1522
|
+
const requestOptions = options?.timeout ? { timeout: options.timeout } : void 0;
|
|
1515
1523
|
return await this.client.callTool({
|
|
1516
1524
|
name,
|
|
1517
1525
|
arguments: args
|
|
1518
|
-
});
|
|
1526
|
+
}, void 0, requestOptions);
|
|
1519
1527
|
});
|
|
1520
1528
|
}
|
|
1521
1529
|
async readResource(uri) {
|
|
@@ -1581,6 +1589,9 @@ var McpClientManagerService = class {
|
|
|
1581
1589
|
getKnownServerNames() {
|
|
1582
1590
|
return Array.from(this.serverConfigs.keys());
|
|
1583
1591
|
}
|
|
1592
|
+
getServerRequestTimeout(serverName) {
|
|
1593
|
+
return this.serverConfigs.get(serverName)?.requestTimeout;
|
|
1594
|
+
}
|
|
1584
1595
|
async ensureConnected(serverName) {
|
|
1585
1596
|
const existingClient = this.clients.get(serverName);
|
|
1586
1597
|
if (existingClient) return existingClient;
|
|
@@ -2773,7 +2784,8 @@ IMPORTANT: Only use tools discovered from describe_tools with id="${this.serverI
|
|
|
2773
2784
|
}],
|
|
2774
2785
|
isError: true
|
|
2775
2786
|
};
|
|
2776
|
-
|
|
2787
|
+
const reqTimeout = this.clientManager.getServerRequestTimeout(serverName);
|
|
2788
|
+
return await client.callTool(actualToolName, toolArgs, reqTimeout ? { timeout: reqTimeout } : void 0);
|
|
2777
2789
|
} catch (error) {
|
|
2778
2790
|
return {
|
|
2779
2791
|
content: [{
|
|
@@ -2808,7 +2820,9 @@ IMPORTANT: Only use tools discovered from describe_tools with id="${this.serverI
|
|
|
2808
2820
|
};
|
|
2809
2821
|
try {
|
|
2810
2822
|
const targetServerName = matchingServers[0];
|
|
2811
|
-
|
|
2823
|
+
const client = await this.clientManager.ensureConnected(targetServerName);
|
|
2824
|
+
const targetReqTimeout = this.clientManager.getServerRequestTimeout(targetServerName);
|
|
2825
|
+
return await client.callTool(actualToolName, toolArgs, targetReqTimeout ? { timeout: targetReqTimeout } : void 0);
|
|
2812
2826
|
} catch (error) {
|
|
2813
2827
|
return {
|
|
2814
2828
|
content: [{
|
|
@@ -2832,7 +2846,7 @@ IMPORTANT: Only use tools discovered from describe_tools with id="${this.serverI
|
|
|
2832
2846
|
|
|
2833
2847
|
//#endregion
|
|
2834
2848
|
//#region package.json
|
|
2835
|
-
var version = "0.3.
|
|
2849
|
+
var version = "0.3.18";
|
|
2836
2850
|
|
|
2837
2851
|
//#endregion
|
|
2838
2852
|
//#region src/server/index.ts
|