Skip to content

Fetch MCP server fails with -32000 Connection Closed on LM Studio #2517

@matthieu-vergne

Description

@matthieu-vergne

Describe the bug
The Fetch MCP server randomly fails to run (often second use, sometimes third use):

Image

To Reproduce
Steps to reproduce the behavior:

  1. Install LM Studio
  2. add the Fetch MCP server to its mcp.json using the docker version:
    "fetch": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "mcp/fetch"
      ]
    }
  1. reload the tool until it fails:
Image

You may also load a model and prompt it with a link, but the response generation stops immediately.

Expected behavior
It should properly reload the tools when requested.
Prompting should not fail.

Logs

2025-08-09 17:37:14  [INFO]
 [Plugin(mcp/fetch)] stdout: [Tools Prvdr.] Register with LM Studio
2025-08-09 17:37:15  [INFO]
 [Plugin(mcp/fetch)] stdout: [Tools Prvdr.] Register with LM Studio
2025-08-09 17:37:19  [INFO]
 [Plugin(mcp/fetch)] stdout: [Tools Prvdr.] Register with LM Studio
2025-08-09 17:37:22 [ERROR]
 [Plugin(mcp/fetch)] stderr:   + Exception Group Traceback (most recent call last):
  |   File "/app/.venv/lib/python3.11/site-packages/mcp/server/stdio.py", line 83, in stdio_server
2025-08-09 17:37:22 [ERROR]
 [Plugin(mcp/fetch)] stderr:   |     yield read_stream, write_stream
  |   File "/app/.venv/lib/python3.11/site-packages/mcp_server_fetch/server.py", line 288, in serve
2025-08-09 17:37:22 [ERROR]
 [Plugin(mcp/fetch)] stderr:   |     await server.run(read_stream, write_stream, options, raise_exceptions=True)
  |   File "/app/.venv/lib/python3.11/site-packages/mcp/server/lowlevel/server.py", line 424, in run
2025-08-09 17:37:22 [ERROR]
 [Plugin(mcp/fetch)] stderr:   |     async with ServerSession(
  |   File "/app/.venv/lib/python3.11/site-packages/mcp/shared/session.py", line 122, in __aexit__
  |     return await self._task_group.__aexit__(exc_type, exc_val, exc_tb)
  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |   File "/app/.venv/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 763, in __aexit__
2025-08-09 17:37:22 [ERROR]
 [Plugin(mcp/fetch)] stderr:   |     raise BaseExceptionGroup(
  | ExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception)
  +-+---------------- 1 ----------------
    | Traceback (most recent call last):
    |   File "/app/.venv/lib/python3.11/site-packages/mcp/shared/session.py", line 235, in _receive_loop
    |     notification = self._receive_notification_type.model_validate(
    |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |   File "/app/.venv/lib/python3.11/site-packages/pydantic/main.py", line 627, in model_validate
2025-08-09 17:37:22 [ERROR]
 [Plugin(mcp/fetch)] stderr:     |     return cls.__pydantic_validator__.validate_python(
    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2025-08-09 17:37:22 [ERROR]
 [Plugin(mcp/fetch)] stderr:     | pydantic_core._pydantic_core.ValidationError: 5 validation errors for ClientNotification
ProgressNotification.method
  Input should be 'notifications/progress' [type=literal_error, input_value='notifications/cancelled', input_type=str]
    For further information visit https://errors.pydantic.dev/2.10/v/literal_error
ProgressNotification.params.progressToken
  Field required [type=missing, input_value={'requestId': 1, 'reason'... operation was aborted'}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.10/v/missing
ProgressNotification.params.progress
  Field required [type=missing, input_value={'requestId': 1, 'reason'... operation was aborted'}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.10/v/missing
InitializedNotification.method
  Input should be 'notifications/initialized' [type=literal_error, input_value='notifications/cancelled', input_type=str]
    For further information visit https://errors.pydantic.dev/2.10/v/literal_error
RootsListChangedNotification.method
  Input should be 'notifications/roots/list_changed' [type=literal_error, input_value='notifications/cancelled', input_type=str]
    For further information visit https://errors.pydantic.dev/2.10/v/literal_error
    +------------------------------------

During handling of the above exception, another exception occurred:

  + Exception Group Traceback (most recent call last):
  |   File "/app/.venv/bin/mcp-server-fetch", line 10, in <module>
  |     sys.exit(main())
  |              ^^^^^^
  |   File "/app/.venv/lib/python3.11/site-packages/mcp_server_fetch/__init__.py", line 21, in main
  |     asyncio.run(serve(args.user_agent, args.ignore_robots_txt, args.proxy_url))
  |   File "/root/.local/share/uv/python/cpython-3.11.13-linux-x86_64-gnu/lib/python3.11/asyncio/runners.py", line 190, in run
  |     return runner.run(main)
  |            ^^^^^^^^^^^^^^^^
  |   File "/root/.local/share/uv/python/cpython-3.11.13-linux-x86_64-gnu/lib/python3.11/asyncio/runners.py", line 118, in run
2025-08-09 17:37:22 [ERROR]
 [Plugin(mcp/fetch)] stderr:   |     return self._loop.run_until_complete(task)
  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |   File "/root/.local/share/uv/python/cpython-3.11.13-linux-x86_64-gnu/lib/python3.11/asyncio/base_events.py", line 654, in run_until_complete
  |     return future.result()
  |            ^^^^^^^^^^^^^^^
  |   File "/app/.venv/lib/python3.11/site-packages/mcp_server_fetch/server.py", line 287, in serve
  |     async with stdio_server() as (read_stream, write_stream):
  |   File "/root/.local/share/uv/python/cpython-3.11.13-linux-x86_64-gnu/lib/python3.11/contextlib.py", line 231, in __aexit__
2025-08-09 17:37:22 [ERROR]
 [Plugin(mcp/fetch)] stderr:   |     await self.gen.athrow(typ, value, traceback)
  |   File "/app/.venv/lib/python3.11/site-packages/mcp/server/stdio.py", line 80, in stdio_server
  |     async with anyio.create_task_group() as tg:
  |   File "/app/.venv/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 763, in __aexit__
  |     raise BaseExceptionGroup(
  | ExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception)
  +-+---------------- 1 ----------------
    | Exception Group Traceback (most recent call last):
    |   File "/app/.venv/lib/python3.11/site-packages/mcp/server/stdio.py", line 83, in stdio_server
    |     yield read_stream, write_stream
    |   File "/app/.venv/lib/python3.11/site-packages/mcp_server_fetch/server.py", line 288, in serve
2025-08-09 17:37:22 [ERROR]
 [Plugin(mcp/fetch)] stderr:     |     await server.run(read_stream, write_stream, options, raise_exceptions=True)
    |   File "/app/.venv/lib/python3.11/site-packages/mcp/server/lowlevel/server.py", line 424, in run
    |     async with ServerSession(
    |   File "/app/.venv/lib/python3.11/site-packages/mcp/shared/session.py", line 122, in __aexit__
    |     return await self._task_group.__aexit__(exc_type, exc_val, exc_tb)
    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |   File "/app/.venv/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 763, in __aexit__
2025-08-09 17:37:22 [ERROR]
 [Plugin(mcp/fetch)] stderr:     |     raise BaseExceptionGroup(
    | ExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception)
    +-+---------------- 1 ----------------
      | Traceback (most recent call last):
      |   File "/app/.venv/lib/python3.11/site-packages/mcp/shared/session.py", line 235, in _receive_loop
      |     notification = self._receive_notification_type.model_validate(
      |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      |   File "/app/.venv/lib/python3.11/site-packages/pydantic/main.py", line 627, in model_validate
      |     return cls.__pydantic_validator__.validate_python(
      |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      | pydantic_core._pydantic_core.ValidationError: 5 validation errors for ClientNotification
ProgressNotification.method
  Input should be 'notifications/progress' [type=literal_error, input_value='notifications/cancelled', input_type=str]
    For further information visit https://errors.pydantic.dev/2.10/v/literal_error
ProgressNotification.params.progressToken
  Field required [type=missing, input_value={'requestId': 1, 'reason'... operation was aborted'}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.10/v/missing
ProgressNotification.params.progress
  Field required [type=missing, input_value={'requestId': 1, 'reason'... operation was aborted'}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.10/v/missing
InitializedNotification.method
  Input should be 'notifications/initialized' [type=literal_error, input_value='notifications/cancelled', input_type=str]
    For further information visit https://errors.pydantic.dev/2.10/v/literal_error
RootsListChangedNotification.method
  Input should be 'notifications/roots/list_changed' [type=literal_error, input_value='notifications/cancelled', input_type=str]
    For further information visit https://errors.pydantic.dev/2.10/v/literal_error
      +------------------------------------

Additional context
No problem with MCP server file system, so seems to be specific to fetch.
I use Fedora 42, but it should not be relevant since I use the docker version.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions