MCPcopy Create free account
hub / github.com/agentforce314/clawcodex / shutdown

Method shutdown

src/server/mcp_runtime.py:146–162  ·  view source on GitHub ↗

Disconnect clients and stop the background loop. Idempotent.

(self)

Source from the content-addressed store, hash-verified

144 )
145
146 def shutdown(self) -> None:
147 """Disconnect clients and stop the background loop. Idempotent."""
148 loop = self._loop
149 if loop is None:
150 return
151 for name, client in list(self.clients.items()):
152 try:
153 self._run(client.close(), 5.0)
154 except Exception: # noqa: BLE001
155 logger.debug("[mcp] close failed: %s", name, exc_info=True)
156 try:
157 loop.call_soon_threadsafe(loop.stop)
158 except Exception: # noqa: BLE001
159 pass
160 self._loop = None
161 self.clients = {}
162 self.tools = []

Calls 3

_runMethod · 0.95
itemsMethod · 0.80
closeMethod · 0.45