Title: SDKs and other middleware SHOULD allow these timeouts to be configured on a per-request basis. · Issue #600 · modelcontextprotocol/python-sdk · GitHub
Open Graph Title: SDKs and other middleware SHOULD allow these timeouts to be configured on a per-request basis. · Issue #600 · modelcontextprotocol/python-sdk
X Title: SDKs and other middleware SHOULD allow these timeouts to be configured on a per-request basis. · Issue #600 · modelcontextprotocol/python-sdk
Description: Describe the bug According to the MCP specs: "SDKs and other middleware SHOULD allow these timeouts to be configured on a per-request basis." But looking at the code the timeouts are set at the session level and not easily configured on ...
Open Graph Description: Describe the bug According to the MCP specs: "SDKs and other middleware SHOULD allow these timeouts to be configured on a per-request basis." But looking at the code the timeouts are set at the ses...
X Description: Describe the bug According to the MCP specs: "SDKs and other middleware SHOULD allow these timeouts to be configured on a per-request basis." But looking at the code the timeouts are set ...
Opengraph URL: https://github.com/modelcontextprotocol/python-sdk/issues/600
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"SDKs and other middleware SHOULD allow these timeouts to be configured on a per-request basis.","articleBody":"**Describe the bug**\nAccording to the [MCP specs](https://modelcontextprotocol.io/specification/2025-03-26/basic/lifecycle#timeouts): \n\u003e \"SDKs and other middleware SHOULD allow these timeouts to be configured on a per-request basis.\"\n\nBut looking at the code the timeouts are set at the session level and not easily configured on a per-request basis as the specs recommend:\n\n```python\nasync def send_request(\n self,\n request: SendRequestT,\n result_type: type[ReceiveResultT],\n) -\u003e ReceiveResultT:\n ...\n try:\n with anyio.fail_after(\n None\n if self._read_timeout_seconds is None\n else self._read_timeout_seconds.total_seconds()\n ):\n response_or_error = await response_stream_reader.receive()\n except TimeoutError:\n raise McpError(\n ErrorData(\n code=httpx.codes.REQUEST_TIMEOUT,\n message=(\n f\"Timed out while waiting for response to \"\n f\"{request.__class__.__name__}. Waited \"\n f\"{self._read_timeout_seconds} seconds.\"\n ),\n )\n )\n```\n[see](https://github.com/modelcontextprotocol/python-sdk/blob/697b6e8e05accf6c9dc16627319e2e12ce4b5d5c/src/mcp/shared/session.py#L246-L263)\n\n**Suggestion**\n\nAdd an optional argument `request_read_timeout_seconds` and rename current _read_timeout_seconds into `session_read_timeout_seconds` if `request_read_timeout_seconds` is set it would override the session one.\n\nI will publish a small PR in that sense.\n","author":{"url":"https://github.com/grll","@type":"Person","name":"grll"},"datePublished":"2025-04-29T05:45:37.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/600/python-sdk/issues/600"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:710aaced-7091-0c84-4130-dd60efd46044 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9DAC:3F1BD0:98D8A9:D756EB:6A624B0B |
| html-safe-nonce | ca1115726926e3a18c5318e2d3dd17e3e4145dd9f655dc4f9f0504be24d5dcf8 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5REFDOjNGMUJEMDo5OEQ4QTk6RDc1NkVCOjZBNjI0QjBCIiwidmlzaXRvcl9pZCI6IjE3MzM5OTA0NjY1NDU5Mjg5NzEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 4fc95597cbc5f8db0c50dedb2642a5a343fb8d596d83561b92f13b571393471c |
| hovercard-subject-tag | issue:3027119482 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/modelcontextprotocol/python-sdk/600/issue_layout |
| twitter:image | https://opengraph.githubassets.com/8d94201c95afc2949ecd5a7c7a6dba370fee9a4f50c4b5323df19af00afad877/modelcontextprotocol/python-sdk/issues/600 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/8d94201c95afc2949ecd5a7c7a6dba370fee9a4f50c4b5323df19af00afad877/modelcontextprotocol/python-sdk/issues/600 |
| og:image:alt | Describe the bug According to the MCP specs: "SDKs and other middleware SHOULD allow these timeouts to be configured on a per-request basis." But looking at the code the timeouts are set at the ses... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | grll |
| hostname | github.com |
| expected-hostname | github.com |
| None | 77f5af7d0fa3843b1779a53f60ec016b3f962e46051fb05c2e9b608a8138eefb |
| turbo-cache-control | no-preview |
| go-import | github.com/modelcontextprotocol/python-sdk git https://github.com/modelcontextprotocol/python-sdk.git |
| octolytics-dimension-user_id | 182288589 |
| octolytics-dimension-user_login | modelcontextprotocol |
| octolytics-dimension-repository_id | 862584018 |
| octolytics-dimension-repository_nwo | modelcontextprotocol/python-sdk |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 862584018 |
| octolytics-dimension-repository_network_root_nwo | modelcontextprotocol/python-sdk |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | d3ce7d369aae307e197872f810f80f3ed9051c78 |
| ui-target | canary-2 |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width