File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -740,15 +740,17 @@ async def connect_and_lifecycle() -> None:
740740
741741 try :
742742 await asyncio .wait_for (connect_done .wait (), timeout = timeout )
743- except asyncio .TimeoutError :
743+ except ( asyncio .TimeoutError , asyncio . CancelledError ) as e :
744744 lifecycle_task .cancel ()
745745 await asyncio .gather (lifecycle_task , return_exceptions = True )
746746 async with self ._runtime_lock :
747747 self ._mcp_starting .discard (name )
748748 self ._mcp_server_runtime .pop (name , None )
749- raise MCPInitTimeoutError (
750- f"Connected to MCP server { name } timeout ({ timeout :g} seconds)"
751- )
749+ if isinstance (e , asyncio .TimeoutError ):
750+ raise MCPInitTimeoutError (
751+ f"Connected to MCP server { name } timeout ({ timeout :g} seconds)"
752+ ) from e
753+ raise
752754
753755 if connect_error is not None :
754756 async with self ._runtime_lock :
You can’t perform that action at this time.
0 commit comments