Title: MCP Server won't work with wildcard in "Accept" header and therefore is non‑compliant with HTTP spec · Issue #1641 · modelcontextprotocol/python-sdk · GitHub
Open Graph Title: MCP Server won't work with wildcard in "Accept" header and therefore is non‑compliant with HTTP spec · Issue #1641 · modelcontextprotocol/python-sdk
X Title: MCP Server won't work with wildcard in "Accept" header and therefore is non‑compliant with HTTP spec · Issue #1641 · modelcontextprotocol/python-sdk
Description: Question Use Case My client sends a request to MCP Server with Accept header */* (Same for application/*, text/event-stream). Server rejects this request because it expected strictly application/json or application/json and text/event-st...
Open Graph Description: Question Use Case My client sends a request to MCP Server with Accept header */* (Same for application/*, text/event-stream). Server rejects this request because it expected strictly application/js...
X Description: Question Use Case My client sends a request to MCP Server with Accept header */* (Same for application/*, text/event-stream). Server rejects this request because it expected strictly application/js...
Opengraph URL: https://github.com/modelcontextprotocol/python-sdk/issues/1641
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"MCP Server won't work with wildcard in \"Accept\" header and therefore is non‑compliant with HTTP spec","articleBody":"### Question\n\n### Use Case\nMy client sends a request to MCP Server with `Accept` header `*/*` (Same for `application/*, text/event-stream`). Server rejects this request because it expected strictly `application/json` or `application/json and text/event-stream` if `json_response=False`. \n\n### Expected\nAccording to the HTTP/1.1 spec (RFC 7231, section 5.3.2), the Accept header allows wildcard so values `*/*` and `application/*` should be valid, therefore server should accept them\n\n```\nfrom mcp.server.fastmcp import FastMCP\nfrom starlette.applications import Starlette\n\n...\n\nmcp_server: FastMCP = FastMCP(streamable_http_path=\"/\", stateless_http=True, json_response=True)\n\n...\n\napp: Starlette = mcp_server.streamable_http_app()\n```\nStart server: `uvicorn mcp-server:app --host 127.0.0.1 --port 8000 --log-level trace`\n\n### Example of Call\n```\n### Request\nPOST / HTTP/1.1.\nHost: localhost:8000.\nAccept-Encoding: gzip, deflate, br, zstd.\nConnection: keep-alive.\nUser-Agent: python-httpx/0.28.1.\nContent-Type: application/json.\nAccept: */*.\nContent-Length: 159.\n.\n\n{\"jsonrpc\":\"2.0\",\"id\":0,\"method\":\"initialize\",\"params\":{\"protocolVersion\":\"2025-06-18\",\"capabilities\":{},\"clientInfo\":{\"name\":\"mcp-client\",\"version\":\"1.0.0\"}}}\n\n\n### Response\nHTTP/1.1 406 Not Acceptable.\ndate: Tue, 18 Nov 2025 16:16:17 GMT.\nserver: uvicorn.\ncontent-type: application/json.\ncontent-length: 125.\n.\n\nT 127.0.0.1:8000 -\u003e 127.0.0.1:61346 [AP] #107\n{\"jsonrpc\":\"2.0\",\"id\":\"server-error\",\"error\":{\"code\":-32600,\"message\":\"Not Acceptable: Client must accept application/json\"}}\n```\n\n### Additional Context\n\n- mcp 1.18.0\n- Python 3.11.13\n- uvicorn 0.38.0\n- starlette 0.49.1","author":{"url":"https://github.com/rh-fr","@type":"Person","name":"rh-fr"},"datePublished":"2025-11-18T16:33:22.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/1641/python-sdk/issues/1641"}
| 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:b2e095a4-af17-2a2d-5dba-4eac47b88c57 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | EBC6:E0123:12ED77C:194964A:6A5AB3F2 |
| html-safe-nonce | 8ed4ff4f0007ebb52f4a437a6ea5e3ad494f7ae5a8bc4b5c8527dd3473e5bb02 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQkM2OkUwMTIzOjEyRUQ3N0M6MTk0OTY0QTo2QTVBQjNGMiIsInZpc2l0b3JfaWQiOiI2ODIxODE4ODk0NzQ4NjgyMTAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | fb77c5122e2c7aa606a6ab56518822f2821119239a619d0f8fc929f40d707cde |
| hovercard-subject-tag | issue:3639034766 |
| 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/1641/issue_layout |
| twitter:image | https://opengraph.githubassets.com/3d2cf49e6d13185866c52fcca733c786495b070982938221ec8ff677cca60767/modelcontextprotocol/python-sdk/issues/1641 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/3d2cf49e6d13185866c52fcca733c786495b070982938221ec8ff677cca60767/modelcontextprotocol/python-sdk/issues/1641 |
| og:image:alt | Question Use Case My client sends a request to MCP Server with Accept header */* (Same for application/*, text/event-stream). Server rejects this request because it expected strictly application/js... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | rh-fr |
| hostname | github.com |
| expected-hostname | github.com |
| None | 2702febe50e53f9152dda552dc2049a5eb182778b2655abd5b8619e82e899b4a |
| 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 | c0211a077f9b056c5e115f996d9049616d85c3b5 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width