@maplezzk/mcps 1.1.5 → 1.1.6
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/commands/daemon.js +4 -1
- package/dist/core/pool.js +3 -1
- package/package.json +1 -1
package/dist/commands/daemon.js
CHANGED
|
@@ -123,7 +123,8 @@ const startAction = async (options) => {
|
|
|
123
123
|
env: {
|
|
124
124
|
...process.env,
|
|
125
125
|
MCPS_DAEMON_DETACHED: 'true',
|
|
126
|
-
MCPS_VERBOSE: options.verbose ? 'true' : 'false'
|
|
126
|
+
MCPS_VERBOSE: options.verbose ? 'true' : 'false',
|
|
127
|
+
MCPS_CONNECTION_TIMEOUT: String((parseInt(options.connectionTimeout || process.env.MCPS_CONNECTION_TIMEOUT || '20', 10)) * 1000)
|
|
127
128
|
}
|
|
128
129
|
});
|
|
129
130
|
subprocess.unref();
|
|
@@ -401,6 +402,7 @@ export const registerDaemonCommand = (program) => {
|
|
|
401
402
|
.description('Start the daemon')
|
|
402
403
|
.option('-p, --port <number>', 'Daemon port', String(DAEMON_PORT))
|
|
403
404
|
.option('-t, --timeout <seconds>', 'Startup timeout in seconds (default: 30)')
|
|
405
|
+
.option('-c, --connection-timeout <seconds>', 'Server connection timeout in seconds (default: 20)')
|
|
404
406
|
.option('-v, --verbose', 'Show detailed logs')
|
|
405
407
|
.action((options) => startAction(options));
|
|
406
408
|
program.command('stop')
|
|
@@ -423,6 +425,7 @@ export const registerDaemonCommand = (program) => {
|
|
|
423
425
|
daemonCmd.command('start', { isDefault: true, hidden: true })
|
|
424
426
|
.description('Start the daemon (default)')
|
|
425
427
|
.option('-t, --timeout <seconds>', 'Startup timeout in seconds (default: 30)')
|
|
428
|
+
.option('-c, --connection-timeout <seconds>', 'Server connection timeout in seconds (default: 20)')
|
|
426
429
|
.action((options) => startAction(options));
|
|
427
430
|
daemonCmd.command('stop')
|
|
428
431
|
.description('Stop the running daemon')
|
package/dist/core/pool.js
CHANGED
|
@@ -79,6 +79,8 @@ export class ConnectionPool {
|
|
|
79
79
|
this.initializing = true;
|
|
80
80
|
this.initialized = false;
|
|
81
81
|
const verbose = process.env.MCPS_VERBOSE === 'true';
|
|
82
|
+
// 获取连接超时时间(从环境变量或默认 20 秒)
|
|
83
|
+
const connectionTimeout = parseInt(process.env.MCPS_CONNECTION_TIMEOUT || '20000', 10);
|
|
82
84
|
// 过滤掉 disabled 的服务器
|
|
83
85
|
const enabledServers = servers.filter(server => {
|
|
84
86
|
const disabled = server.disabled === true;
|
|
@@ -98,7 +100,7 @@ export class ConnectionPool {
|
|
|
98
100
|
for (const server of enabledServers) {
|
|
99
101
|
process.stdout.write(`- ${server.name}... `);
|
|
100
102
|
try {
|
|
101
|
-
await this.getClient(server.name, { timeoutMs:
|
|
103
|
+
await this.getClient(server.name, { timeoutMs: connectionTimeout });
|
|
102
104
|
results.push({ name: server.name, success: true });
|
|
103
105
|
console.log('Connected ✓');
|
|
104
106
|
}
|