Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MCP server disconnected #147

Closed
robertgates-duco opened this issue Jan 10, 2025 · 1 comment
Closed

MCP server disconnected #147

robertgates-duco opened this issue Jan 10, 2025 · 1 comment

Comments

@robertgates-duco
Copy link

I've got an MCP server running within claude desktop. Most operations work fine, but I'm finding that some mcp.tool commands can result in the MCP server disconnected and the below error message logging into the mcp-server- log.

Could anyone please help me to debug why? I can't see a reason why that specific call would cause any issue vs any of the others that work fine, but it does seem reproduceable.

==> /Users/robert.gates/Library/Logs/Claude/mcp-server-Duco.log <==
[01/10/25 16:06:55] WARNING  Tool already exists:             tool_manager.py:40
                             get_process_match_fields
                    INFO     Processing request of type            server.py:432
                             ListResourcesRequest
                    INFO     Processing request of type            server.py:432
                             ListToolsRequest
                    INFO     Processing request of type            server.py:432
                             ListPromptsRequest
[01/10/25 16:06:59] INFO     Processing request of type            server.py:432
                             ListResourcesRequest
                    INFO     Processing request of type            server.py:432
                             ListPromptsRequest
[01/10/25 16:07:04] INFO     Processing request of type            server.py:432
                             ListResourcesRequest
                    INFO     Processing request of type            server.py:432
                             ListPromptsRequest
[01/10/25 16:07:05] INFO     Processing request of type            server.py:432
                             CallToolRequest
[01/10/25 16:07:14] INFO     Processing request of type            server.py:432
                             ListResourcesRequest
                    INFO     Processing request of type            server.py:432
                             ListResourcesRequest
Traceback (most recent call last):
  File "/Users/robert.gates/Repositories/modelcontextprotocol/.venv/lib/python3.11/site-packages/anyio/streams/memory.py", line 242, in send
    self.send_nowait(item)
  File "/Users/robert.gates/Repositories/modelcontextprotocol/.venv/lib/python3.11/site-packages/anyio/streams/memory.py", line 225, in send_nowait
    raise WouldBlock
anyio.WouldBlock

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/robert.gates/Repositories/modelcontextprotocol/.venv/lib/python3.11/site-packages/mcp/server/lowlevel/server.py", line 466, in run
    await message.respond(response)
  File "/Users/robert.gates/Repositories/modelcontextprotocol/.venv/lib/python3.11/site-packages/mcp/shared/session.py", line 58, in respond
    await self._session._send_response(
  File "/Users/robert.gates/Repositories/modelcontextprotocol/.venv/lib/python3.11/site-packages/mcp/shared/session.py", line 205, in _send_response
    await self._write_stream.send(JSONRPCMessage(jsonrpc_response))
  File "/Users/robert.gates/Repositories/modelcontextprotocol/.venv/lib/python3.11/site-packages/anyio/streams/memory.py", line 248, in send
    await send_event.wait()
  File "/Users/robert.gates/.pyenv/versions/3.11.11/lib/python3.11/asyncio/locks.py", line 213, in wait
    await fut
asyncio.exceptions.CancelledError: Cancelled by cancel scope 105d6e410

During handling of the above exception, another exception occurred:

  + Exception Group Traceback (most recent call last):
  |   File "/Users/robert.gates/Repositories/modelcontextprotocol/.venv/lib/python3.11/site-packages/mcp/server/stdio.py", line 83, in stdio_server
  |     yield read_stream, write_stream
  |   File "/Users/robert.gates/Repositories/modelcontextprotocol/.venv/lib/python3.11/site-packages/mcp/server/fastmcp/server.py", line 417, in run_stdio_async
  |     await self._mcp_server.run(
  |   File "/Users/robert.gates/Repositories/modelcontextprotocol/.venv/lib/python3.11/site-packages/mcp/server/lowlevel/server.py", line 424, in run
  |     async with ServerSession(
  |   File "/Users/robert.gates/Repositories/modelcontextprotocol/.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 "/Users/robert.gates/Repositories/modelcontextprotocol/.venv/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 767, in __aexit__
  |     raise BaseExceptionGroup(
  | ExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception)
  +-+---------------- 1 ----------------
    | Traceback (most recent call last):
    |   File "/Users/robert.gates/Repositories/modelcontextprotocol/.venv/lib/python3.11/site-packages/mcp/shared/session.py", line 235, in _receive_loop
    |     notification = self._receive_notification_type.model_validate(
    |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    |   File "/Users/robert.gates/Repositories/modelcontextprotocol/.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='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': 9, 'reason'... -2: Request timed out'}, 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': 9, 'reason'... -2: Request timed out'}, 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='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='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 "/Users/robert.gates/Repositories/modelcontextprotocol/server.py", line 459, in <module>
  |     mcp.run(transport='stdio')
  |   File "/Users/robert.gates/Repositories/modelcontextprotocol/.venv/lib/python3.11/site-packages/mcp/server/fastmcp/server.py", line 124, in run
  |     anyio.run(self.run_stdio_async)
  |   File "/Users/robert.gates/Repositories/modelcontextprotocol/.venv/lib/python3.11/site-packages/anyio/_core/_eventloop.py", line 74, in run
  |     return async_backend.run(func, args, {}, backend_options)
  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |   File "/Users/robert.gates/Repositories/modelcontextprotocol/.venv/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 2303, in run
  |     return runner.run(wrapper())
  |            ^^^^^^^^^^^^^^^^^^^^^
  |   File "/Users/robert.gates/.pyenv/versions/3.11.11/lib/python3.11/asyncio/runners.py", line 118, in run
  |     return self._loop.run_until_complete(task)
  |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |   File "/Users/robert.gates/.pyenv/versions/3.11.11/lib/python3.11/asyncio/base_events.py", line 654, in run_until_complete
  |     return future.result()
  |            ^^^^^^^^^^^^^^^
  |   File "/Users/robert.gates/Repositories/modelcontextprotocol/.venv/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 2291, in wrapper
  |     return await func(*args)
  |            ^^^^^^^^^^^^^^^^^
  |   File "/Users/robert.gates/Repositories/modelcontextprotocol/.venv/lib/python3.11/site-packages/mcp/server/fastmcp/server.py", line 416, in run_stdio_async
  |     async with stdio_server() as (read_stream, write_stream):
  |   File "/Users/robert.gates/.pyenv/versions/3.11.11/lib/python3.11/contextlib.py", line 231, in __aexit__
  |     await self.gen.athrow(typ, value, traceback)
  |   File "/Users/robert.gates/Repositories/modelcontextprotocol/.venv/lib/python3.11/site-packages/mcp/server/stdio.py", line 80, in stdio_server
  |     async with anyio.create_task_group() as tg:
  |   File "/Users/robert.gates/Repositories/modelcontextprotocol/.venv/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 767, in __aexit__
  |     raise BaseExceptionGroup(
  | ExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception)
  +-+---------------- 1 ----------------
    | Exception Group Traceback (most recent call last):
    |   File "/Users/robert.gates/Repositories/modelcontextprotocol/.venv/lib/python3.11/site-packages/mcp/server/stdio.py", line 83, in stdio_server
    |     yield read_stream, write_stream
    |   File "/Users/robert.gates/Repositories/modelcontextprotocol/.venv/lib/python3.11/site-packages/mcp/server/fastmcp/server.py", line 417, in run_stdio_async
    |     await self._mcp_server.run(
    |   File "/Users/robert.gates/Repositories/modelcontextprotocol/.venv/lib/python3.11/site-packages/mcp/server/lowlevel/server.py", line 424, in run
    |     async with ServerSession(
    |   File "/Users/robert.gates/Repositories/modelcontextprotocol/.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 "/Users/robert.gates/Repositories/modelcontextprotocol/.venv/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 767, in __aexit__
    |     raise BaseExceptionGroup(
    | ExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception)
    +-+---------------- 1 ----------------
      | Traceback (most recent call last):
      |   File "/Users/robert.gates/Repositories/modelcontextprotocol/.venv/lib/python3.11/site-packages/mcp/shared/session.py", line 235, in _receive_loop
      |     notification = self._receive_notification_type.model_validate(
      |                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      |   File "/Users/robert.gates/Repositories/modelcontextprotocol/.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='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': 9, 'reason'... -2: Request timed out'}, 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': 9, 'reason'... -2: Request timed out'}, 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='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='cancelled', input_type=str]
    For further information visit https://errors.pydantic.dev/2.10/v/literal_error
      +------------------------------------

==> /Users/robert.gates/Library/Logs/Claude/mcp.log <==
2025-01-10T16:07:14.563Z [info] MCP server Duco disconnected. For troubleshooting guidance, please visit our [debugging documentation](https://modelcontextprotocol.io/docs/tools/debugging)
@robertgates-duco
Copy link
Author

Duplicate #144

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant