Skip to content

MCP connection error #20

Description

@LDlornd

When I run python utils/collect_mcp_info.py to test the mcp servers, there are many tracebacks like this:

2025-10-17 17:26:14,236 - ERROR - Full traceback:
  + Exception Group Traceback (most recent call last):
  |   File "C:\Users\lornd\Documents\Projects\mcp-bench\mcp_modules\server_manager.py", line 93, in _connect_stdio_server
  |     async with stdio_client(connector.server_params) as (read, write):
  |   File "C:\Users\lornd\AppData\Roaming\uv\python\cpython-3.10.17-windows-x86_64-none\lib\contextlib.py", line 217, in __aexit__
  |     await self.gen.athrow(typ, value, traceback)
  |   File "C:\Users\lornd\Documents\Projects\mcp-bench\.venv\lib\site-packages\mcp\client\stdio\__init__.py", line 180, in stdio_client    
  |     async with (
  |   File "C:\Users\lornd\Documents\Projects\mcp-bench\.venv\lib\site-packages\anyio\_backends\_asyncio.py", line 781, in __aexit__        
  |     raise BaseExceptionGroup(
  | exceptiongroup.ExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception)
  +-+---------------- 1 ----------------
    | Exception Group Traceback (most recent call last):
    |   File "C:\Users\lornd\Documents\Projects\mcp-bench\.venv\lib\site-packages\mcp\client\stdio\__init__.py", line 187, in stdio_client  
    |     yield read_stream, write_stream
    |   File "C:\Users\lornd\Documents\Projects\mcp-bench\mcp_modules\server_manager.py", line 94, in _connect_stdio_server
    |     async with ClientSession(read, write) as session:
    |   File "C:\Users\lornd\Documents\Projects\mcp-bench\.venv\lib\site-packages\mcp\shared\session.py", line 218, in __aexit__
    |     return await self._task_group.__aexit__(exc_type, exc_val, exc_tb)
    |   File "C:\Users\lornd\Documents\Projects\mcp-bench\.venv\lib\site-packages\anyio\_backends\_asyncio.py", line 781, in __aexit__      
    |     raise BaseExceptionGroup(
    | exceptiongroup.ExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception)
    +-+---------------- 1 ----------------
      | Traceback (most recent call last):
      |   File "C:\Users\lornd\Documents\Projects\mcp-bench\mcp_modules\server_manager.py", line 95, in _connect_stdio_server
      |     await session.initialize()
      |   File "C:\Users\lornd\Documents\Projects\mcp-bench\.venv\lib\site-packages\mcp\client\session.py", line 151, in initialize
      |     result = await self.send_request(
      |   File "C:\Users\lornd\Documents\Projects\mcp-bench\.venv\lib\site-packages\mcp\shared\session.py", line 286, in send_request       
      |     raise McpError(response_or_error.error)
      | mcp.shared.exceptions.McpError: Connection closed
      +------------------------------------

And when I run benchmark in debug mode, there will be error:

[Errno 9] Bad file descriptor
  File "C:\Users\lornd\Documents\Projects\mcp-bench\mcp_servers\unit-converter-mcp\src\unit_converter_mcp\server.py", line 373, in main
    app.run()
  File "C:\Users\lornd\Documents\Projects\mcp-bench\mcp_servers\unit-converter-mcp\src\unit_converter_mcp\server.py", line 377, in <module>
    main()
OSError: [Errno 9] Bad file descriptor

Could you help me identify what happened and how to fix it? Thank you~

Activity

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