vmoo-mcp-database-server 1.3.9 → 1.3.10

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vmoo-mcp-database-server",
3
- "version": "1.3.9",
3
+ "version": "1.3.10",
4
4
  "description": "VMOO数据库MCP服务器集合 - 支持开发和生产环境的安全数据库访问",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -30,7 +30,7 @@ function createConnectionPool(config) {
30
30
  return mysql.createPool({
31
31
  ...processedConfig,
32
32
  waitForConnections: true,
33
- connectionLimit: 10,
33
+ connectionLimit: 3,
34
34
  queueLimit: 0
35
35
  });
36
36
  }
@@ -17,8 +17,9 @@ class QueryRateLimiter {
17
17
  this.maxQueriesPerMinute = 10;
18
18
  this.cleanupInterval = 60000; // 1分钟清理一次
19
19
 
20
- // 定期清理过期记录
21
- setInterval(() => this.cleanup(), this.cleanupInterval);
20
+ // 定期清理过期记录(使用 unref 防止 timer 阻止进程退出)
21
+ const cleanupTimer = setInterval(() => this.cleanup(), this.cleanupInterval);
22
+ cleanupTimer.unref();
22
23
  }
23
24
 
24
25
  /**
@@ -283,6 +283,17 @@ async function main() {
283
283
  console.error(`VMOO配送测试站MCP服务器已启动 - ${config.server.name} v${config.server.version}`);
284
284
  console.error(`安全级别: ${config.security.level} - ${config.security.description}`);
285
285
  console.error(`️ 表前缀: ${prefixConfig ? (prefixConfig.enabled ? prefixConfig.prefix : '无前缀') : 'fanwe_(默认)'}`);
286
+
287
+ // Graceful shutdown:当 MCP 通信管道关闭时,主动退出进程
288
+ const gracefulShutdown = async () => {
289
+ console.error('MCP服务器正在关闭...');
290
+ try { await pool.end(); } catch (e) { /* ignore */ }
291
+ process.exit(0);
292
+ };
293
+
294
+ process.stdin.on('end', gracefulShutdown);
295
+ process.on('SIGTERM', gracefulShutdown);
296
+ process.on('SIGINT', gracefulShutdown);
286
297
  }
287
298
 
288
299
  main().catch(console.error);
@@ -299,6 +299,17 @@ async function main() {
299
299
  console.error(`安全级别: ${config.security.level} - ${config.security.description}`);
300
300
  console.error(`️ 防护功能: 频率限制防爬虫数据匿名化`);
301
301
  console.error(`️ 表前缀: ${prefixConfig ? (prefixConfig.enabled ? prefixConfig.prefix : '无前缀') : 'fanwe_(默认)'}`);
302
+
303
+ // Graceful shutdown:当 MCP 通信管道关闭时,主动退出进程
304
+ const gracefulShutdown = async () => {
305
+ console.error('MCP服务器正在关闭...');
306
+ try { await pool.end(); } catch (e) { /* ignore */ }
307
+ process.exit(0);
308
+ };
309
+
310
+ process.stdin.on('end', gracefulShutdown);
311
+ process.on('SIGTERM', gracefulShutdown);
312
+ process.on('SIGINT', gracefulShutdown);
302
313
  }
303
314
 
304
315
  main().catch(console.error);
@@ -276,6 +276,17 @@ async function main() {
276
276
  await server.connect(transport);
277
277
  console.error(`VMOO开发环境MCP服务器已启动 - ${config.server.name} v${config.server.version}`);
278
278
  console.error(`安全级别: ${config.security.level} - ${config.security.description}`);
279
+
280
+ // Graceful shutdown:当 MCP 通信管道关闭时,主动退出进程
281
+ const gracefulShutdown = async () => {
282
+ console.error('MCP服务器正在关闭...');
283
+ try { await pool.end(); } catch (e) { /* ignore */ }
284
+ process.exit(0);
285
+ };
286
+
287
+ process.stdin.on('end', gracefulShutdown);
288
+ process.on('SIGTERM', gracefulShutdown);
289
+ process.on('SIGINT', gracefulShutdown);
279
290
  }
280
291
 
281
292
  main().catch(console.error);
@@ -295,6 +295,17 @@ async function main() {
295
295
  console.error(`VMOO生产环境MCP服务器已启动 - ${config.server.name} v${config.server.version}`);
296
296
  console.error(`安全级别: ${config.security.level} - ${config.security.description}`);
297
297
  console.error(`️ 防护功能: 频率限制防爬虫数据匿名化`);
298
+
299
+ // Graceful shutdown:当 MCP 通信管道关闭时,主动退出进程
300
+ const gracefulShutdown = async () => {
301
+ console.error('MCP服务器正在关闭...');
302
+ try { await pool.end(); } catch (e) { /* ignore */ }
303
+ process.exit(0);
304
+ };
305
+
306
+ process.stdin.on('end', gracefulShutdown);
307
+ process.on('SIGTERM', gracefulShutdown);
308
+ process.on('SIGINT', gracefulShutdown);
298
309
  }
299
310
 
300
311
  main().catch(console.error);