Add requestTimeout to MCP server#134
Closed
EvanMi wants to merge 3 commits intomodelcontextprotocol:mainfrom
Closed
Add requestTimeout to MCP server#134EvanMi wants to merge 3 commits intomodelcontextprotocol:mainfrom
EvanMi wants to merge 3 commits intomodelcontextprotocol:mainfrom
Conversation
tzolov
pushed a commit
that referenced
this pull request
Apr 15, 2025
Adds the ability to configure request timeouts for MCP server operations. This enhancement allows setting a custom duration to wait for server responses before timing out requests, which applies to all requests made through the client including tool calls, resource access, and prompt operations. - Add requestTimeout parameter to McpServerSession constructor - Add requestTimeout field and builder method to server classes - Pass timeout configuration through to session creation - Add tests for both success and failure scenarios across different transport implementations - Default timeout is set to 10 seconds if not explicitly configured.
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add timeout config for sever call client.
In Sampling process, Server will send request to client, then client may call LLM, this may cost some time more then 10 seconds, so the fix 10 seconds is too short.
Motivation and Context
How Has This Been Tested?
yes
Breaking Changes
if don't use this feature, they don't need to.
Types of changes
Checklist
Additional context