mcp-log-query-server 3.4.1 → 3.4.2
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/index.js +22 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -818,11 +818,32 @@ async function handleToolCall(name, args) {
|
|
|
818
818
|
}
|
|
819
819
|
}
|
|
820
820
|
|
|
821
|
+
// 优雅关闭(对齐 auggie MCP 启动代码)
|
|
822
|
+
function gracefulShutdown() {
|
|
823
|
+
console.error('[MCP] 优雅关闭...');
|
|
824
|
+
server.close().catch(() => {});
|
|
825
|
+
// 给 close 一点时间完成,然后强制退出
|
|
826
|
+
setTimeout(() => process.exit(0), 500).unref();
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
process.on('SIGINT', gracefulShutdown);
|
|
830
|
+
process.on('SIGTERM', gracefulShutdown);
|
|
831
|
+
|
|
821
832
|
// 启动服务器
|
|
822
833
|
async function main() {
|
|
834
|
+
// 对齐 auggie: 监听 stdin end/close,宿主进程断开时优雅关闭
|
|
835
|
+
process.stdin.on('end', () => {
|
|
836
|
+
console.error('[MCP] stdin end, initiating graceful shutdown');
|
|
837
|
+
gracefulShutdown();
|
|
838
|
+
});
|
|
839
|
+
process.stdin.on('close', () => {
|
|
840
|
+
console.error('[MCP] stdin close, initiating graceful shutdown');
|
|
841
|
+
gracefulShutdown();
|
|
842
|
+
});
|
|
843
|
+
|
|
823
844
|
const transport = new StdioServerTransport();
|
|
824
845
|
await server.connect(transport);
|
|
825
|
-
console.error('[MCP] Log Query Server v3.2.0 已启动 (支持超时保护 + 进程看门狗)');
|
|
846
|
+
console.error('[MCP] Log Query Server v3.2.0 已启动 (支持超时保护 + 进程看门狗 + stdin 优雅关闭)');
|
|
826
847
|
}
|
|
827
848
|
|
|
828
849
|
main().catch((error) => {
|