-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
base: main
Are you sure you want to change the base?
Conversation
pydantic_ai_slim/pydantic_ai/mcp.py
Outdated
@@ -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 |
There was a problem hiding this comment.
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!
There was a problem hiding this comment.
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.
fixes #2222