mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-04-11 13:32:34 +00:00
Replace per-call asyncio.run() with a single persistent background event loop for all MCP operations. The MCP SDK's streamable HTTP transport uses anyio task groups whose cancel scopes must be entered and exited on the same event loop and task. Creating a throwaway loop per tool call caused "Attempted to exit cancel scope in a different task" RuntimeErrors during cleanup, preventing MCP tools from working reliably