Skip to content

armgit / camel

Public Imported from GitHub
0

🐫 CAMEL: The first and the best multi-agent framework. Finding the Scaling Law of Agents. https://www.camel-ai.org

fix : ACI Windows MCPToolkit fix (#2870)

Parth Sharmaca007d80ea3b
diff --git a/camel/utils/mcp_client.py b/camel/utils/mcp_client.py
index 7df3d861c..0a7f009c9 100644
--- a/camel/utils/mcp_client.py
+++ b/camel/utils/mcp_client.py
@@ -353,6 +353,14 @@ class MCPClient:
finally:
self._connection_context = None
+ # Add a small delay to allow subprocess cleanup on Windows
+ # This prevents "Event loop is closed" errors during shutdown
+ import asyncio
+ import sys
+
+ if sys.platform == "win32":
+ await asyncio.sleep(0.01)
+
finally:
# Ensure state is reset
self._tools = []