From 9331d1fcd55ad3ee0ccd1f2a1eda0563d3d821f2 Mon Sep 17 00:00:00 2001 From: zhangzikuan Date: Sun, 1 Feb 2026 21:41:35 +0800 Subject: [PATCH 1/3] =?UTF-8?q?feat:=20=E5=B0=86=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E5=99=A8=E8=BF=9E=E6=8E=A5=E8=B6=85=E6=97=B6=E4=BB=8E=208s=20?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=88=B0=2020s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 某些 MCP 服务器启动较慢(如 alibaba-dms),8 秒超时不够用。 现在增加到 20 秒,提高连接成功率。 Co-Authored-By: Claude Sonnet 4.5 --- src/core/pool.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core/pool.ts b/src/core/pool.ts index 4ade523..f10be0f 100644 --- a/src/core/pool.ts +++ b/src/core/pool.ts @@ -110,7 +110,7 @@ export class ConnectionPool { for (const server of enabledServers) { process.stdout.write(`- ${server.name}... `); try { - await this.getClient(server.name, { timeoutMs: 8000 }); + await this.getClient(server.name, { timeoutMs: 20000 }); results.push({ name: server.name, success: true }); console.log('Connected ✓'); } catch (error: any) { From 3e442808ecb335028d0ed6e8666d65f6d5d6986d Mon Sep 17 00:00:00 2001 From: zhangzikuan Date: Sun, 1 Feb 2026 21:47:26 +0800 Subject: [PATCH 2/3] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=20--connection-t?= =?UTF-8?q?imeout=20=E5=8F=82=E6=95=B0=E8=87=AA=E5=AE=9A=E4=B9=89=E8=BF=9E?= =?UTF-8?q?=E6=8E=A5=E8=B6=85=E6=97=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 添加 `-c, --connection-timeout ` 参数 - 默认值为 20 秒 - 支持通过命令行参数或环境变量 MCPS_CONNECTION_TIMEOUT 配置 - 单位为秒,与 --timeout 参数保持一致 Co-Authored-By: Claude Sonnet 4.5 --- src/commands/daemon.ts | 5 ++++- src/core/pool.ts | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/commands/daemon.ts b/src/commands/daemon.ts index 32d6ce3..13fdb56 100644 --- a/src/commands/daemon.ts +++ b/src/commands/daemon.ts @@ -139,7 +139,8 @@ const startAction = async (options: any) => { env: { ...process.env, MCPS_DAEMON_DETACHED: 'true', - MCPS_VERBOSE: options.verbose ? 'true' : 'false' + MCPS_VERBOSE: options.verbose ? 'true' : 'false', + MCPS_CONNECTION_TIMEOUT: String((parseInt(options.connectionTimeout || process.env.MCPS_CONNECTION_TIMEOUT || '20', 10)) * 1000) } }); @@ -445,6 +446,7 @@ export const registerDaemonCommand = (program: Command) => { .description('Start the daemon') .option('-p, --port ', 'Daemon port', String(DAEMON_PORT)) .option('-t, --timeout ', 'Startup timeout in seconds (default: 30)') + .option('-c, --connection-timeout ', 'Server connection timeout in seconds (default: 20)') .option('-v, --verbose', 'Show detailed logs') .action((options) => startAction(options)); @@ -473,6 +475,7 @@ export const registerDaemonCommand = (program: Command) => { daemonCmd.command('start', { isDefault: true, hidden: true }) .description('Start the daemon (default)') .option('-t, --timeout ', 'Startup timeout in seconds (default: 30)') + .option('-c, --connection-timeout ', 'Server connection timeout in seconds (default: 20)') .action((options) => startAction(options)); daemonCmd.command('stop') diff --git a/src/core/pool.ts b/src/core/pool.ts index f10be0f..634f331 100644 --- a/src/core/pool.ts +++ b/src/core/pool.ts @@ -88,6 +88,9 @@ export class ConnectionPool { const verbose = process.env.MCPS_VERBOSE === 'true'; + // 获取连接超时时间(从环境变量或默认 20 秒) + const connectionTimeout = parseInt(process.env.MCPS_CONNECTION_TIMEOUT || '20000', 10); + // 过滤掉 disabled 的服务器 const enabledServers = servers.filter(server => { const disabled = (server as any).disabled === true; @@ -110,7 +113,7 @@ export class ConnectionPool { for (const server of enabledServers) { process.stdout.write(`- ${server.name}... `); try { - await this.getClient(server.name, { timeoutMs: 20000 }); + await this.getClient(server.name, { timeoutMs: connectionTimeout }); results.push({ name: server.name, success: true }); console.log('Connected ✓'); } catch (error: any) { From 9506c497033fe1d98579b4cc1414c4aeb6056a45 Mon Sep 17 00:00:00 2001 From: zhangzikuan Date: Sun, 1 Feb 2026 21:47:31 +0800 Subject: [PATCH 3/3] 1.1.6 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index f271f49..764e9bf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@maplezzk/mcps", - "version": "1.1.5", + "version": "1.1.6", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@maplezzk/mcps", - "version": "1.1.5", + "version": "1.1.6", "license": "ISC", "dependencies": { "@modelcontextprotocol/sdk": "^1.25.3", diff --git a/package.json b/package.json index 82305b1..ecb1e3b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@maplezzk/mcps", - "version": "1.1.5", + "version": "1.1.6", "description": "A CLI to manage and use MCP servers", "publishConfig": { "access": "public"