Skip to content

NotImplementedError in asyncio subprocess_exec when using MCP client on Windows with Python 3.12 #369

Closed

Description

@isakulaksiz

Describe the bug
When using MCP client with Python 3.12 on Windows, it fails to connect to the server with a NotImplementedError. This is happening because asyncio subprocess functionality is not properly implemented in Python 3.12 on Windows.

To Reproduce
Steps to reproduce the behavior:

  1. Install Python 3.12 on Windows
  2. Install MCP and required packages
  3. Create a simple MCP server script and MCP client
  4. Try to connect to the server using the client
  5. See error: NotImplementedError is raised in asyncio's _make_subprocess_transport method

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots

Image

Desktop

  • OS: [Windows 10]
  • Browser [chrome]
  • Package versions: anyio, mcp, asyncio standard library

Additional context
it works fine with macos.

Activity

  1. jayanthma commented on Mar 27, 2025

    @jayanthma

    Hi @isakulaksiz , the issue was persisting in the jupyter notebook so I converted it to .py and it ran successfully. Find the code below.

    from langchain_mcp_adapters.client import MultiServerMCPClient

    from langgraph.prebuilt import create_react_agent

    from langchain_aws import ChatBedrockConverse
    import boto3

    bedrock_client=boto3.client(service_name='bedrock-runtime', region_name="us-east-1")

    model = ChatBedrockConverse(
    client=bedrock_client,
    model="us.meta.llama3-3-70b-instruct-v1:0",
    temperature=0,
    )

    async def test_mcp_client():
    async with MultiServerMCPClient(
    {
    "math": {
    "command": "C:/Users/jay/coding_projects/LangGraph/venv/Scripts/python.exe",

    Make sure to update to the full absolute path to your math_server.py file

    "args": ["C:/Users/jay/coding_projects/LangGraph/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:
    tools = client.get_tools()
    print("Tools: ", tools)
    agent = create_react_agent(model, client.get_tools(), debug=True)
    math_response = await agent.ainvoke({"messages": "what's 3*175"})
    weather_response = await agent.ainvoke({"messages": "what is the weather in nyc?"})

    return math_response, weather_response
    if name == "main":
    import asyncio
    math_response, weather_response = asyncio.run(test_mcp_client())
    print(math_response)
    print(weather_response)

    Hope it helps!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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