Title: Add warning log when rejecting request with unknown/expired session ID by rameshreddy-adutla · Pull Request #2212 · modelcontextprotocol/python-sdk · GitHub
Open Graph Title: Add warning log when rejecting request with unknown/expired session ID by rameshreddy-adutla · Pull Request #2212 · modelcontextprotocol/python-sdk
X Title: Add warning log when rejecting request with unknown/expired session ID by rameshreddy-adutla · Pull Request #2212 · modelcontextprotocol/python-sdk
Description: Summary Add a logger.warning() call in the else branch of StreamableHTTPSessionManager._handle_stateful_request() when rejecting a request with an unknown or expired session ID. Problem The else branch silently returns HTTP 404 without any logging. The other two branches both log: logger.debug("Session already exists...") (existing session) logger.info("Created new transport...") (new session) This made it very difficult to diagnose connection failures in production — for example, after a server restart when clients continued sending stale mcp-session-id headers. Operators had to wrap the ASGI app in custom middleware just to see why requests were being rejected. Fix Add logger.warning() with the rejected session ID before returning the 404 response. Using warning level (not debug/info) since this typically indicates a problem that operators should investigate. Testing Existing test test_unknown_session_id_returns_404 passes and now shows the warning in log output: WARNING mcp.server.streamable_http_manager: Rejected request with unknown or expired session ID: non-existent-session-id Fixes #2204
Open Graph Description: Summary Add a logger.warning() call in the else branch of StreamableHTTPSessionManager._handle_stateful_request() when rejecting a request with an unknown or expired session ID. Problem The else br...
X Description: Summary Add a logger.warning() call in the else branch of StreamableHTTPSessionManager._handle_stateful_request() when rejecting a request with an unknown or expired session ID. Problem The else br...
Opengraph URL: https://github.com/modelcontextprotocol/python-sdk/pull/2212
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:68e2aaa6-8a75-0775-d9b2-1f795bc1bb44 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | A7BA:32870C:83FBBB:BB14F7:6A587EE6 |
| html-safe-nonce | 3ac614a6a6647becb34a226c370aeebec152ebd248205695b61ed9784007f4fd |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBN0JBOjMyODcwQzo4M0ZCQkI6QkIxNEY3OjZBNTg3RUU2IiwidmlzaXRvcl9pZCI6IjUyMzYwMzk2NDM1OTUwNDY2MzAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 19f9a94b1b16b628cb33896641c29732383bbc418e292994b08e4cdae19a750e |
| hovercard-subject-tag | pull_request:3355311980 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,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/modelcontextprotocol/python-sdk/pull/2212/files |
| twitter:image | https://avatars.githubusercontent.com/u/134313151?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/134313151?s=400&v=4 |
| og:image:alt | Summary Add a logger.warning() call in the else branch of StreamableHTTPSessionManager._handle_stateful_request() when rejecting a request with an unknown or expired session ID. Problem The else br... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5f2a0c7865178af3d91dd9f13b0cdfc3c73a2529c873d2780bb4c01271a57ec6 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| 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 full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 8aae7b8d6caacacf5c66eaeb2702d8dc88d85b4a |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width