Title: Fix Streamable HTTP Accept header quality-factor handling · Issue #3154 · modelcontextprotocol/python-sdk · GitHub
Open Graph Title: Fix Streamable HTTP Accept header quality-factor handling · Issue #3154 · modelcontextprotocol/python-sdk
X Title: Fix Streamable HTTP Accept header quality-factor handling · Issue #3154 · modelcontextprotocol/python-sdk
Description: Initial Checks I confirm that I'm using the latest version of MCP Python SDK I confirm that I searched for my issue in https://github.com/modelcontextprotocol/python-sdk/issues before opening this issue Description Streamable HTTP curren...
Open Graph Description: Initial Checks I confirm that I'm using the latest version of MCP Python SDK I confirm that I searched for my issue in https://github.com/modelcontextprotocol/python-sdk/issues before opening this ...
X Description: Initial Checks I confirm that I'm using the latest version of MCP Python SDK I confirm that I searched for my issue in https://github.com/modelcontextprotocol/python-sdk/issues before opening t...
Opengraph URL: https://github.com/modelcontextprotocol/python-sdk/issues/3154
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Fix Streamable HTTP Accept header quality-factor handling","articleBody":"### Initial Checks\n\n- [x] I confirm that I'm using the latest version of MCP Python SDK\n- [x] I confirm that I searched for my issue in https://github.com/modelcontextprotocol/python-sdk/issues before opening this issue\n\n### Description\n\nStreamable HTTP currently ignores `q=0` values in the `Accept` header, so requests that explicitly mark a media type as unacceptable can still be accepted. This violates RFC 7231 semantics for content negotiation and can cause clients and servers to disagree about which response format is actually allowed.\n\n\n### Example Code\n\n```Python\nfrom starlette.requests import Request\n\ndef check_accept_headers(request: Request) -> tuple[bool, bool]:\n accept_header = request.headers.get(\"accept\", \"\")\n accept_types = [media_type.strip().split(\";\")[0].strip().lower() for media_type in accept_header.split(\",\")]\n\n has_wildcard = \"*/*\" in accept_types\n has_json = has_wildcard or any(t in (\"application/json\", \"application/*\") for t in accept_types)\n has_sse = has_wildcard or any(t in (\"text/event-stream\", \"text/*\") for t in accept_types)\n\n return has_json, has_sse\n\n# Example: client explicitly rejects JSON\nrequest = Request({\"type\": \"http\", \"method\": \"GET\", \"headers\": [(b\"accept\", b\"application/json;q=0, text/event-stream;q=1.0\")]})\n\nprint(check_accept_headers(request))\n# -> (True, True)\n```\n\n### Python & MCP Python SDK\n\n```Text\nPython 3.12.10\nMCP Python SDK: 1.28.1\n```","author":{"url":"https://github.com/dchou1618","@type":"Person","name":"dchou1618"},"datePublished":"2026-07-23T23:29:06Z","url":"https://github.com/modelcontextprotocol/python-sdk/issues/3154"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| 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:ea797cb1-7f6b-624b-811a-2435d5b0f610 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | CCF8:BBAAA:338A08:45B2EC:6B00C4F8 |
| html-safe-nonce | c0fa0fe03d756a6f69e400e9f8174210239d0bf372e2969830d4bc033dda823b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQ0Y4OkJCQUFBOjMzOEEwODo0NUIyRUM6NkIwMEM0RjgiLCJ2aXNpdG9yX2lkIjoiNzI3MDU5NzI3ODgzNzQ4NjAwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 54119aa08aceaf43c1f91ac176b5ff452aa39c4e73b04940cbf9d3e80e3f903a |
| hovercard-subject-tag | issue:4963724807 |
| 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/3154/issue_layout |
| twitter:image | https://opengraph.githubassets.com/50216a3995efe29051ca8bc61cca13e3639cc320db03ed56362f7a3cb77948f6/modelcontextprotocol/python-sdk/issues/3154 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/50216a3995efe29051ca8bc61cca13e3639cc320db03ed56362f7a3cb77948f6/modelcontextprotocol/python-sdk/issues/3154 |
| og:image:alt | Initial Checks I confirm that I'm using the latest version of MCP Python SDK I confirm that I searched for my issue in https://github.com/modelcontextprotocol/python-sdk/issues before opening this ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | dchou1618 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 93edd3bebc4afb7ce711ee74cb5d2a95927850b082a4d43e212222389cb1c415 |
| 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 | 1fee81a280ea86312b69448e261b418189bfd5b5 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width