Skip to content

NotImplementedError with MultiServerMCPClient on Windows due to SelectorEventLoop #25

@woaidapaopao

Description

@woaidapaopao

重现步骤 (To Reproduce)

  1. 在 Windows 11 上,使用 Python 3.11。
  2. 配置 MultiServerMCPClient 以通过 stdio 启动子进程,例如:
    @asynccontextmanager
     async def make_graph():
         async with MultiServerMCPClient(
             {
                 "math": {
                     "command": "D:\codehub\langgraph_test\.venv\Scripts\python.exe",
                     # Make sure to update to the full absolute path to your math_server.py file
                     "args": ["D:\codehub\langgraph_test\mcp\math_server.py"],
                     "transport": "stdio",
                 },
                 "weather": {
                     # make sure you start your weather server on port 8000
                     "url": "http://localhost:8000/sse",
                     "transport": "sse",
                 }
             }
         ) as client:
             agent = create_react_agent(model, client.get_tools())
             yield agent
  3. 使用langgraph dev运行代码。
  4. 观察到以下错误:
    File "D:\Python\Python311\Lib\asyncio\base_events.py", line 503, in _make_subprocess_transport
      raise NotImplementedError
    NotImplementedError
    

环境信息 (Environment)

  • 操作系统: Windows 11
  • Python 版本: 3.11
  • 依赖版本:
    • langchain-mcp-adapters: 0.0.4

错误堆栈

Traceback (most recent call last):
File "D:\codehub\langgraph_test.venv\Lib\site-packages\langchain_mcp_adapters\client.py", line 223, in aenter
await self.connect_to_server_via_stdio(server_name, **connection_dict)
File "D:\codehub\langgraph_test.venv\Lib\site-packages\langchain_mcp_adapters\client.py", line 176, in connect_to_server_via_stdio
stdio_transport = await self.exit_stack.enter_async_context(stdio_client(server_params))
File "D:\Python\Python311\Lib\asyncio\base_events.py", line 503, in _make_subprocess_transport
raise NotImplementedError
NotImplementedError

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions