How to control when timeout occurs? #65
Replies: 2 comments 2 replies
-
Timeouts are controlled on the client side, not the server side. This is necessary because a misbehaving server may never respond (even if it "meant to"). You may want to consider prefetching the resource, or introducing some kind of multi-step loading, like:
Though this question did make me think that we could support auto-extending timeouts when progress notifications are used, which doesn't currently happen. |
Beta Was this translation helpful? Give feedback.
-
Thanks tons for the response about timeouts! Reading the MCP Python SDK documentation, I see examples of progress tracking using request_context.meta.progressToken, but when I tried this it turned out these objects (context and progressToken) are None when accessed through server.request_context. Is this because progress notification support needs to be implemented on the client side first? The documentation suggests this functionality but if I understand correctly, I should focus on implementing the multi-step approach you suggested instead of trying to use progress notifications at this point? |
Beta Was this translation helpful? Give feedback.
-
Pre-submission Checklist
Question Category
Your Question
Using Python SDK how can I set how long MCP implementation should wait for the response from an external resource? I am building an mcp server which talks to a resource that sometimes takes about 20-40 seconds to respond, so the response is never returned because a timeout occurs. Looked at the docs but I don't see indication how to do this.
Beta Was this translation helpful? Give feedback.
All reactions