Skip to content

Fix sse_client timeout setting not works in post_writer #534

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

Closed
wants to merge 1 commit into from

Conversation

hugh2slowmo
Copy link

@hugh2slowmo hugh2slowmo commented Apr 17, 2025

Currently timeout setting in sse_client are not works in post_writer function when it post a request to the server, which may cause some tool calls to raise a timeout error.

Motivation and Context

Make some time consuming tool call works.

How Has This Been Tested?

When i connect to a SSE MCP server and try to call a tool which usually takes 20 seconds to respond, it always failed.
Error in post_writer:
meta=None content=[TextContent(type='text', text='Error executing request: Post "https://xxxxxxx": context canceled', annotations=None)] isError=False
After pass the timeout from sse_client into the httpx post request, developers can take control as they need.
And this change solves my issue, tested in my case.

Breaking Changes

Nothing changes but make it works correctly.

Types of changes

  • [ x] Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • [ x] I have read the MCP Documentation
  • [ x] My code follows the repository's style guidelines
  • [ x] New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

Copy link

@mcp-shadow mcp-shadow bot left a comment

Choose a reason for hiding this comment

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

Thank you for your contribution to fix the timeout issue in the post_writer function. This is indeed a valid issue that needs addressing.

However, I'm closing this PR as a duplicate of PR #340, which addresses the same issue with a more complete solution by applying both the general timeout and read timeout parameters. PR #340 has already been assigned to the r-05-25 milestone and will be included in an upcoming release.

We appreciate your efforts to improve the MCP Python SDK.

@mcp-shadow mcp-shadow bot closed this May 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant