Skip to content

Your lightweight open-source personal agent.

fix: catch BaseException in MCP connection to handle CancelledError

chengyongru127ac390632a
diff --git a/nanobot/agent/loop.py b/nanobot/agent/loop.py
index 5fe0ee0e2..dc764418d 100644
--- a/nanobot/agent/loop.py
+++ b/nanobot/agent/loop.py
@@ -139,7 +139,7 @@ class AgentLoop:
await self._mcp_stack.__aenter__()
await connect_mcp_servers(self._mcp_servers, self.tools, self._mcp_stack)
self._mcp_connected = True
- except Exception as e:
+ except BaseException as e:
logger.error("Failed to connect MCP servers (will retry next message): {}", e)
if self._mcp_stack:
try: