Skip to content

windows run mcp error: #363

Closed as not planned
Closed as not planned
@lonngxiang

Description

@lonngxiang

run example:examples/mcp/filesystem_example/main.py

error:

Image

 uv run .\main.py
Error initializing MCP server: [WinError 2] 系统找不到指定的文件。    
Traceback (most recent call last): 
  File "E:\code\agent\openai-agents-python\examples\mcp\filesystem_example\main.py", line 57, in <module>
    asyncio.run(main())
  File "C:\Users\loong\.conda\envs\agent\Lib\asyncio\runners.py", line 190, in run
    return runner.run(main)        
           ^^^^^^^^^^^^^^^^        
  File "C:\Users\loong\.conda\envs\agent\Lib\asyncio\runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\loong\.conda\envs\agent\Lib\asyncio\base_events.py", line 650, in run_until_complete    
    return future.result()
           ^^^^^^^^^^^^^^^
  File "E:\code\agent\openai-agents-python\examples\mcp\filesystem_example\main.py", line 39, in main    
    async with MCPServerStdio(     
  File "E:\code\agent\openai-agents-python\src\agents\mcp\server.py", line 89, in __aenter__
    await self.connect()
  File "E:\code\agent\openai-agents-python\src\agents\mcp\server.py", line 102, in connect
    transport = await self.exit_stack.enter_async_context(self.create_streams())
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\loong\.conda\envs\agent\Lib\contextlib.py", line 635, in enter_async_context
    result = await _enter(cm)      
             ^^^^^^^^^^^^^^^^      
  File "C:\Users\loong\.conda\envs\agent\Lib\contextlib.py", line 204, in __aenter__
    return await anext(self.gen)   
           ^^^^^^^^^^^^^^^^^^^^^   
  File "E:\code\agent\openai-agents-python\.venv\Lib\site-packages\mcp\client\stdio.py", line 104, in stdio_client
    process = await anyio.open_process(
              ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\code\agent\openai-agents-python\.venv\Lib\site-packages\anyio\_core\_subprocesses.py", line 190, in open_process
    return await get_async_backend().open_process(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "E:\code\agent\openai-agents-python\.venv\Lib\site-packages\anyio\_backends\_asyncio.py", line 2561, in open_process
    process = await asyncio.create_subprocess_exec(
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\loong\.conda\envs\agent\Lib\asyncio\subprocess.py", line 218, in create_subprocess_exec 
    transport, protocol = await loop.subprocess_exec(
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\loong\.conda\envs\agent\Lib\asyncio\base_events.py", line 1680, in subprocess_exec      
    transport = await self._make_subprocess_transport(
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\loong\.conda\envs\agent\Lib\asyncio\windows_events.py", line 394, in _make_subprocess_transport
    transp = _WindowsSubprocessTransport(self, protocol, args, shell, 
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 
  File "C:\Users\loong\.conda\envs\agent\Lib\asyncio\base_subprocess.py", line 36, in __init__
    self._start(args=args, shell=shell, stdin=stdin, stdout=stdout,   
  File "C:\Users\loong\.conda\envs\agent\Lib\asyncio\windows_events.py", line 910, in _start
    self._proc = windows_utils.Popen(
                 ^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\loong\.conda\envs\agent\Lib\asyncio\windows_utils.py", line 153, in __init__
    super().__init__(args, stdin=stdin_rfd, stdout=stdout_wfd,        
  File "C:\Users\loong\.conda\envs\agent\Lib\subprocess.py", line 1022, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,      
  File "C:\Users\loong\.conda\envs\agent\Lib\subprocess.py", line 1491, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,        
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^        
FileNotFoundError: [WinError 2] 系 统找不到指定的文件。

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingneeds-more-infoWaiting for a reply/more info from the authorstale

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions