Skip to content

pass sse_read_timeout to MCP ClientSession read_timeout_seconds #2240

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
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

AntSan813
Copy link

@AntSan813 AntSan813 commented Jul 17, 2025

fixes #2222

@DouweM DouweM self-assigned this Jul 18, 2025
@@ -59,6 +60,7 @@ class MCPServer(AbstractToolset[Any], ABC):
log_level: mcp_types.LoggingLevel | None = None
log_handler: LoggingFnT | None = None
timeout: float = 5
sse_read_timeout: float = 5 * 60
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we call this read_timeout as it's not SSE specific anymore? We'd still want to keep the sse_read_timeout argument on constructor to _MCPServerHTTP subclasses for backward compatibility, but we can set the new property and print a deprecation warning. We'd likely need to define a custom __init__ and pass init=False to @dataclass.

Let me know if you'd like some more guidance!

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good, thanks for reviewing.

I mapped sse_read_timeout to read_timeout and added a deprecation warning. I also updated the tests. Let me know if I misused the dataclass setup -- still learning the python way.

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

Successfully merging this pull request may close these issues.

Add read_timeout_seconds to MCPServerStreamableHTTP
2 participants