Skip to content

add a timeout arguments on per-request basis (as per MCP specifications) #601

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

Merged
merged 3 commits into from
Apr 29, 2025

Conversation

grll
Copy link
Contributor

@grll grll commented Apr 29, 2025

Motivation and Context

The MCP Specifications says:

SDKs and other middleware SHOULD allow these timeouts to be configured on a per-request basis.

How Has This Been Tested?

No regression on the test / test running locally.

Breaking Changes

No it's a transparent change which enable to set timeout on per-request basis. If not set it default to the previous behavior of not having a timeout or using the session based timeout.

Types of changes

  • 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

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

Additional context

Notes:

I have added the capacity to set the read timeout only on the tool_call requests which is probably the most critical one but we might want to extend that to other calls from the client as well.

@grll
Copy link
Contributor Author

grll commented Apr 29, 2025

fixes #600

@grll
Copy link
Contributor Author

grll commented Apr 29, 2025

@dsp-ant / @jerome3o-anthropic, I know the amount of notifications must be crazy but it's a very quick and simple change that makes the python sdk more compliant with the MCP specifications with regard to timeouts. Hope you get some time to review it at some point.

Copy link
Member

@dsp-ant dsp-ant left a comment

Choose a reason for hiding this comment

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

This looks good to me. Thank you for the change!

@dsp-ant dsp-ant merged commit 96e5327 into modelcontextprotocol:main Apr 29, 2025
6 checks passed
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.

3 participants