-
Notifications
You must be signed in to change notification settings - Fork 246
Open
Description
Description
When connecting to multiple MCP servers I am getting an error RuntimeError: async generator ignored GeneratorExit
. I can replicate with the example provided in your documetation
Full Error
Exception ignored in: <async_generator object HTTP11ConnectionByteStream.__aiter__ at 0x112c68640>
Traceback (most recent call last):
File "/Users/willudstrand/python/ai-assistant/clients/.venv/lib/python3.12/site-packages/httpcore/_async/connection_pool.py", line 404, in __aiter__
yield part
RuntimeError: async generator ignored GeneratorExit
Exception ignored in: <coroutine object HTTP11ConnectionByteStream.aclose at 0x112d7dfc0>
Traceback (most recent call last):
File "/Users/willudstrand/python/ai-assistant/clients/.venv/lib/python3.12/site-packages/httpcore/_async/http11.py", line 348, in aclose
await self._connection._response_closed()
File "/Users/willudstrand/python/ai-assistant/clients/.venv/lib/python3.12/site-packages/httpcore/_async/http11.py", line 239, in _response_closed
async with self._state_lock:
File "/Users/willudstrand/python/ai-assistant/clients/.venv/lib/python3.12/site-packages/httpcore/_synchronization.py", line 77, in __aenter__
await self._anyio_lock.acquire()
File "/Users/willudstrand/python/ai-assistant/clients/.venv/lib/python3.12/site-packages/anyio/_backends/_asyncio.py", line 1799, in acquire
await AsyncIOBackend.cancel_shielded_checkpoint()
File "/Users/willudstrand/python/ai-assistant/clients/.venv/lib/python3.12/site-packages/anyio/_backends/_asyncio.py", line 2349, in cancel_shielded_checkpoint
with CancelScope(shield=True):
File "/Users/willudstrand/python/ai-assistant/clients/.venv/lib/python3.12/site-packages/anyio/_backends/_asyncio.py", line 457, in __exit__
raise RuntimeError(
RuntimeError: Attempted to exit cancel scope in a different task than it was entered in
Exception ignored in: <async_generator object HTTP11ConnectionByteStream.__aiter__ at 0x112d96740>
Traceback (most recent call last):
File "/Users/willudstrand/python/ai-assistant/clients/.venv/lib/python3.12/site-packages/httpcore/_async/connection_pool.py", line 404, in __aiter__
yield part
RuntimeError: async generator ignored GeneratorExit
Steps to replicate
- Run a simple mcp server locally on port 8000
- Setup a uv environment with the requirements below
- Run the script provided
Requirements
langchain-mcp-adapters==0.1.9
asyncio==3.4.3
mcp==1.9.2
Script
import asyncio
from langchain_mcp_adapters.client import MultiServerMCPClient
async def main():
client = MultiServerMCPClient(
{
"mcp_server": {
"url": "http://localhost:8000/mcp/",
"transport": "streamable_http",
}
}
)
tools = await client.get_tools()
print("here")
if __name__ == "__main__":
asyncio.run(main())
vlzx, zhou-san, ee-juni, nitin302, thormtl and 1 more
Metadata
Metadata
Assignees
Labels
No labels