You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Client hangs when ctx.info() logging with pure Python client #201
Describe the bug
When a tool includes client-side logging with, the client seems to hang.
The following tool works ok with Claude Desktop and Inspector, but does not complete with a Python client.
Activity
Test and example MCP server to illustrate Issue modelcontextprotocol#201
refactor: improve typing with memory stream type aliases
refactor: update test files to use ParsedMessage
refactor: improve typing with memory stream type aliases
refactor: update test files to use ParsedMessage
refactor: reorganize message handling for better type safety and clar…
samuelcolvin commentedon Mar 16, 2025
I've spent most of my day held up by this bug, see pydantic/pydantic-ai#1140 (comment)
On
mainthe problem is atpython-sdk/src/mcp/shared/session.py
Lines 344 to 346 in c897868
If I change these lines to
Everything works correctly, obviously that's not a proper solution, but it demonstrates the problem.
In case it helps, to reproduce this problem, run
(see pydantic/pydantic-ai#1140 for context)
Then run
Obviously you can disable the logfire bit, I was using it to see the raw http requests, I see the same hanging behaviour with both SSE and stdio.
As I mentioned in the comment linked above, you can also comment out
await session.set_logging_level('debug')to avoid the issue.sheffler commentedon Mar 16, 2025
Those are the same three lines i identified, and I believe is deadlock. PR #202 is an end-to-end test that illustrates the condition.
Move incoming message stream from BaseSession to ServerSession
Fix modelcontextprotocol#201: Move incoming message stream from BaseS…