Skip to content

Local MCP wouldn't start on windows / git bash #1321

Open
@intval

Description

@intval

Describe the bug
Subprocess (MCP) wouldn't start.. Asyncio not implement error

2025-06-11 22:35:02,328 - ERROR - fast_api.py:788 - Error in event_generator: 
Traceback (most recent call last):
  File "B:\code\gen1\backend\.venv\Lib\site-packages\mcp\client\stdio\win32.py", line 72, in create_windows_process
    process = await anyio.open_process(
              ^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<8 lines>...
    )
    ^
  File "B:\code\gen1\backend\.venv\Lib\site-packages\anyio\_core\_subprocesses.py", line 190, in open_process
    return await get_async_backend().open_process(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<11 lines>...
    )
    ^
  File "B:\code\gen1\backend\.venv\Lib\site-packages\anyio\_backends\_asyncio.py", line 2561, in open_process
    process = await asyncio.create_subprocess_exec(
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<5 lines>...
    )
    ^
  File "C:\Users\spc\AppData\Roaming\uv\python\cpython-3.13.3-windows-x86_64-none\Lib\asyncio\subprocess.py", line 224, in create_subprocess_exec
    transport, protocol = await loop.subprocess_exec(
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<3 lines>...
        stderr=stderr, **kwds)
        ^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\spc\AppData\Roaming\uv\python\cpython-3.13.3-windows-x86_64-none\Lib\asyncio\base_events.py", line 1788, in subprocess_exec
    transport = await self._make_subprocess_transport(
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        protocol, popen_args, False, stdin, stdout, stderr,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        bufsize, **kwargs)
        ^^^^^^^^^^^^^^^^^^
  File "C:\Users\spc\AppData\Roaming\uv\python\cpython-3.13.3-windows-x86_64-none\Lib\asyncio\base_events.py", line 533, in _make_subprocess_transport
    raise NotImplementedError
NotImplementedError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "B:\code\gen1\backend\.venv\Lib\site-packages\google\adk\cli\fast_api.py", line 777, in event_generator
    async for event in runner.run_async(
    ...<8 lines>...
      yield f"data: {sse_event}\n\n"
  File "B:\code\gen1\backend\.venv\Lib\site-packages\google\adk\runners.py", line 197, in run_async
    async for event in invocation_context.agent.run_async(invocation_context):
    ...<2 lines>...
      yield event
  File "B:\code\gen1\backend\.venv\Lib\site-packages\google\adk\agents\base_agent.py", line 147, in run_async
    async for event in self._run_async_impl(ctx):
      yield event
  File "B:\code\gen1\backend\.venv\Lib\site-packages\google\adk\agents\llm_agent.py", line 278, in _run_async_impl
    async for event in self._llm_flow.run_async(ctx):
      self.__maybe_save_output_to_state(event)
      yield event
  File "B:\code\gen1\backend\.venv\Lib\site-packages\google\adk\flows\llm_flows\base_llm_flow.py", line 282, in run_async
    async for event in self._run_one_step_async(invocation_context):
      last_event = event
      yield event
  File "B:\code\gen1\backend\.venv\Lib\site-packages\google\adk\flows\llm_flows\base_llm_flow.py", line 302, in _run_one_step_async
    async for event in self._preprocess_async(invocation_context, llm_request):
      yield event
  File "B:\code\gen1\backend\.venv\Lib\site-packages\google\adk\flows\llm_flows\base_llm_flow.py", line 340, in _preprocess_async
    for tool in await agent.canonical_tools(
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        ReadonlyContext(invocation_context)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ):
    ^
  File "B:\code\gen1\backend\.venv\Lib\site-packages\google\adk\agents\llm_agent.py", line 367, in canonical_tools
    resolved_tools.extend(await _convert_tool_union_to_tools(tool_union, ctx))
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "B:\code\gen1\backend\.venv\Lib\site-packages\google\adk\agents\llm_agent.py", line 114, in _convert_tool_union_to_tools
    return await tool_union.get_tools(ctx)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "B:\code\gen1\backend\.venv\Lib\site-packages\google\adk\tools\mcp_tool\mcp_session_manager.py", line 110, in wrapper
    return await func(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "B:\code\gen1\backend\.venv\Lib\site-packages\google\adk\tools\mcp_tool\mcp_toolset.py", line 138, in get_tools
    self._session = await self._mcp_session_manager.create_session()
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "B:\code\gen1\backend\.venv\Lib\site-packages\google\adk\tools\mcp_tool\mcp_session_manager.py", line 208, in create_session
    transports = await self._exit_stack.enter_async_context(client)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\spc\AppData\Roaming\uv\python\cpython-3.13.3-windows-x86_64-none\Lib\contextlib.py", line 668, in enter_async_context
    result = await _enter(cm)
             ^^^^^^^^^^^^^^^^
  File "C:\Users\spc\AppData\Roaming\uv\python\cpython-3.13.3-windows-x86_64-none\Lib\contextlib.py", line 214, in __aenter__
    return await anext(self.gen)
           ^^^^^^^^^^^^^^^^^^^^^
  File "B:\code\gen1\backend\.venv\Lib\site-packages\mcp\client\stdio\__init__.py", line 115, in stdio_client
    process = await _create_platform_compatible_process(
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<9 lines>...
    )
    ^
  File "B:\code\gen1\backend\.venv\Lib\site-packages\mcp\client\stdio\__init__.py", line 230, in _create_platform_compatible_process
    process = await create_windows_process(command, args, env, errlog, cwd)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "B:\code\gen1\backend\.venv\Lib\site-packages\mcp\client\stdio\win32.py", line 85, in create_windows_process
    process = await anyio.open_process(
              ^^^^^^^^^^^^^^^^^^^^^^^^^
        [command, *args], env=env, stderr=errlog, cwd=cwd
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "B:\code\gen1\backend\.venv\Lib\site-packages\anyio\_core\_subprocesses.py", line 190, in open_process
    return await get_async_backend().open_process(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<11 lines>...
    )
    ^
  File "B:\code\gen1\backend\.venv\Lib\site-packages\anyio\_backends\_asyncio.py", line 2561, in open_process
    process = await asyncio.create_subprocess_exec(
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<5 lines>...
    )
    ^
  File "C:\Users\spc\AppData\Roaming\uv\python\cpython-3.13.3-windows-x86_64-none\Lib\asyncio\subprocess.py", line 224, in create_subprocess_exec
    transport, protocol = await loop.subprocess_exec(
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<3 lines>...
        stderr=stderr, **kwds)
        ^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\spc\AppData\Roaming\uv\python\cpython-3.13.3-windows-x86_64-none\Lib\asyncio\base_events.py", line 1788, in subprocess_exec
    transport = await self._make_subprocess_transport(
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        protocol, popen_args, False, stdin, stdout, stderr,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        bufsize, **kwargs)
        ^^^^^^^^^^^^^^^^^^
  File "C:\Users\spc\AppData\Roaming\uv\python\cpython-3.13.3-windows-x86_64-none\Lib\asyncio\base_events.py", line 533, in _make_subprocess_transport
    raise NotImplementedError
NotImplementedError

To Reproduce
(Copied from the docs as is)

agent = LlmAgent(
    model=MODEL,
    name="capital_agent_tool",
    description="Retrieves the capital city using a specific tool.",
    instruction=get_instructions(),
    tools=[
        MCPToolset(
            connection_params=StdioServerParameters(
                command='python',
                args=[
                    "-y",  # Argument for npx to auto-confirm install
                    "@modelcontextprotocol/server-filesystem",
                    # IMPORTANT: This MUST be an ABSOLUTE path to a folder the
                    # npx process can access.
                    # Replace with a valid absolute path on your system.
                    # For example: "/Users/youruser/accessible_mcp_files"
                    # or use a dynamically constructed absolute path:
                    os.path.abspath("/c/Users/spc/mcp-googledocs-server"),
                ],
            ),
            # Optional: Filter which tools from the MCP server are exposed
            # tool_filter=['list_directory', 'read_file']
        )
    ],
    output_key="expose_result"
)

Expected behavior
Starts npx process

Desktop (please complete the following information):

  • OS: windows 11
  • Python version(python -V): cpython-3.13.3-windows-x86_64-none
  • ADK version: 1.2.1
  • Git Bash on windows

Metadata

Metadata

Assignees

No one assigned

    Labels

    toolsIssues related to tools

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions