shutdown

View as MarkdownOpen in Claude

Gracefully shut down the gateway. Closes all active sessions via SessionManager.shutdown(), stops all MCP clients via MCPManager.shutdown(), and stops the HTTP server. Session and MCP manager shutdown run in parallel with a 5-second timeout each.

Called automatically when the server receives a SIGTERM or SIGINT signal during run().

Parameters

None.

Returns

None

Example

1from signalwire.mcp_gateway import MCPGateway
2import threading
3
4gateway = MCPGateway("config.json")
5server_thread = threading.Thread(target=gateway.run)
6server_thread.start()
7gateway.shutdown()
8server_thread.join()