Closed
Description
Describe the bug
I encountered an AttributeError
when running the example code from MCP Quickstart - Client with MCP version 1.4.0. The error suggests that the JSONRPCMessage
object is missing the message
attribute. This issue does not occur with MCP 1.3.0.
To Reproduce
Steps to reproduce the behavior:
-
Install MCP version 1.4.0:
uv add mcp==1.4.0
-
Run the example client code from the MCP Quickstart.
-
Observe the following error:
Exception Group Traceback (most recent call last): | File "/Users/cesaraugustogoncalves/mcp-client/.venv/lib/python3.11/site-packages/mcp/client/stdio.py", line 153, in stdio_client | yield read_stream, write_stream | File "/Users/cesaraugustogoncalves/.local/share/uv/python/cpython-3.11.11-macos-aarch64-none/lib/python3.11/contextlib.py", line 728, in __aexit__ | cb_suppress = await cb(*exc_details) | ^^^^^^^^^^^^^^^^^^^^^^ | File "/Users/cesaraugustogoncalves/mcp-client/.venv/lib/python3.11/site-packages/mcp/shared/session.py", line 217, in __aexit__ | return await self._task_group.__aexit__(exc_type, exc_val, exc_tb) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | File "/Users/cesaraugustogoncalves/mcp-client/.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/cesaraugustogoncalves/mcp-client/.venv/lib/python3.11/site-packages/mcp/shared/session.py", line 324, in _receive_loop | message = raw_message.message | ^^^^^^^^^^^^^^^^^^^ | File "/Users/cesaraugustogoncalves/mcp-client/.venv/lib/python3.11/site-packages/pydantic/main.py", line 891, in __getattr__ | raise AttributeError(f'{type(self).__name__!r} object has no attribute {item!r}') | AttributeError: 'JSONRPCMessage' object has no attribute 'message'
Expected behavior
The client should run without raising an AttributeError
, as it does with MCP 1.3.0.
Desktop (please complete the following information):
- OS: macOS Sequoia 15.3.2 (M1 ARM64)
- Python Version: 3.11.11
- MCP Client Version: 1.4.0
Additional context
- The issue does not occur when using MCP 1.3.0.
- It seems like the
JSONRPCMessage
class no longer has amessage
attribute in version 1.4.0, but this is just based on the traceback.
Would appreciate any insights on whether this is an intended change or a regression. Thanks!
Metadata
Metadata
Assignees
Labels
No labels