Skip to content

[BUG] Client can't to connect mcp sever SSE #134

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

Open
ratchanonth60 opened this issue May 10, 2025 · 6 comments
Open

[BUG] Client can't to connect mcp sever SSE #134

ratchanonth60 opened this issue May 10, 2025 · 6 comments
Labels
bug Something isn't working

Comments

@ratchanonth60
Copy link

app-1 | | File "/usr/local/lib/python3.13/site-packages/mcp/shared/session.py", line 209, in aexit
app-1 | | return await self._task_group.aexit(exc_type, exc_val, exc_tb)
app-1 | | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
app-1 | | File "/usr/local/lib/python3.13/site-packages/anyio/_backends/_asyncio.py", line 772, in aexit
app-1 | | raise BaseExceptionGroup(
app-1 | | "unhandled errors in a TaskGroup", self._exceptions
app-1 | | ) from None
app-1 | | ExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception)
app-1 | +-+---------------- 1 ----------------
app-1 | | Traceback (most recent call last):
app-1 | | File "/usr/local/lib/python3.13/site-packages/mcp/server/session.py", line 146, in _receive_loop
app-1 | | await super()._receive_loop()
app-1 | | File "/usr/local/lib/python3.13/site-packages/mcp/shared/session.py", line 331, in _receive_loop
app-1 | | elif isinstance(message.message.root, JSONRPCRequest):
app-1 | | ^^^^^^^^^^^^^^^
app-1 | | File "/usr/local/lib/python3.13/site-packages/pydantic/main.py", line 989, in getattr
app-1 | | raise AttributeError(f'{type(self).name!r} object has no attribute {item!r}')
app-1 | | AttributeError: 'JSONRPCMessage' object has no attribute 'message'
app-1 | +------------------------------------

@ratchanonth60 ratchanonth60 added the bug Something isn't working label May 10, 2025
@hyson666
Copy link

I had the same problem. I downgraded my mcp package to version 1.7.0. It was probably a compatibility issue with the new version: pip3 install mcp==1.7.0

@quantotto
Copy link

In the mcp/shared/session.py the code is expecting to read SessionMessage, but it actually gets JSONRPCMessage and thus anywhere it says message.message gets the above exception. I experimentally changed all the occurrences of message.message to just message and it started working.

This is the commit in the mcp python SDK that introduced the change of wrapping messages into SessionMessage:

modelcontextprotocol/python-sdk@da0cf22#diff-aaa1596dd4db91f5cd7f743c8afbe58596daf01a2ecec4a0024768f7409fb1dc

@sndp-s
Copy link

sndp-s commented May 10, 2025

Thanks @hyson666 @quantotto

@daidi
Copy link

daidi commented May 12, 2025

+1

@ierickson
Copy link
Contributor

There is a PR (#137) that addresses this issue.

@xiuluoshendaren
Copy link

I had the same problem. I downgraded my mcp package to version 1.7.0. It was probably a compatibility issue with the new version: pip3 install mcp==1.7.0

Thank you very much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

7 participants