feat(gateway): add MCP server shutdown on gateway exit

Ensures MCP subprocess connections are closed when the messaging
gateway shuts down, preventing orphan processes.
This commit is contained in:
0xbyt4
2026-03-02 21:06:17 +03:00
parent 3c252ae44b
commit 0eb0bec74c

View File

@@ -2202,7 +2202,14 @@ async def start_gateway(config: Optional[GatewayConfig] = None) -> bool:
# Stop cron ticker cleanly
cron_stop.set()
cron_thread.join(timeout=5)
# Close MCP server connections
try:
from tools.mcp_tool import shutdown_mcp_servers
shutdown_mcp_servers()
except Exception:
pass
return True