Skip to navigation

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

from signalwire.mcp_gateway import MCPGateway
import threading
gateway = MCPGateway("config.json")
server_thread = threading.Thread(target=gateway.run)
server_thread.start()
gateway.shutdown()
server_thread.join()