Uh oh!
There was an error while loading. Please reload this page.
fix(server): parse Accept media types exactly - #2481
Conversation
🦋 Changeset detectedLatest commit: 1b4079e The changes in this PR will be included in the next version bump. This PR includes changesets to release 6 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
@modelcontextprotocol/client@modelcontextprotocol/codemod@modelcontextprotocol/core@modelcontextprotocol/server@modelcontextprotocol/server-legacy@modelcontextprotocol/express@modelcontextprotocol/fastify@modelcontextprotocol/hono@modelcontextprotocol/nodecommit: |
9f897d9 to
e3715bcCompareSnowSky1
commented
Jul 30, 2026
Rebased onto current |
SnowSky1
commented
Jul 30, 2026
@felixweinberger, when you have a chance, could you review this? It complements #2441 by applying exact media-type parsing to |
e3715bc to
63fb4adCompareReject Streamable HTTP requests whose Accept values only contain the required media types as substrings, while preserving case-insensitive and parameterized values. Adds GET/POST regression coverage. Fixesmodelcontextprotocol#2480. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
63fb4ad to
bf3bfcbCompareRebased again onto current main (head bf3bfcb). The branch is mergeable and no longer behind; all 14 checks are green, including build, examples E2E, Node 20/22/24 unit and E2E suites, Bun/Deno runtime tests, and client/server conformance. @felixweinberger, when you have bandwidth, could you review this focused Accept media-type parsing fix? |
Merged current The latest head also respects RFC 9110 quality exclusions: a required media type with All 14 checks are green at head The focused current-head suites also pass locally: core-internal media-type tests 12/12 and server Streamable HTTP tests 61/61. The corresponding @felixweinberger, this is the remaining |
Fixes#2480.
Summary
Streamable HTTP server
Acceptvalidation used raw substring checks, so values such asapplication/jsonxandtext/event-stream-bogusincorrectly satisfied the required concrete media types. This affected both POST negotiation and GET SSE requests.This change:
listsMediaTypehelper that parses the comma-separatedAcceptlist and compares media-type essences case-insensitively;q=0is not treated as supported;This follows the same parsed-media-type approach recently applied to
Content-Typein #2441 / #2444, while keepingAccept-specific list parsing internal.Testing
Validated after merging current
main(70de0c8b):pnpm --filter @modelcontextprotocol/core-internal exec vitest run test/shared/mediaType.test.ts— 12 passingpnpm --filter @modelcontextprotocol/server exec vitest run test/server/streamableHttp.test.ts— 61 passingpnpm build:all— cleanThe remaining platform-local
check:alldocs step is covered by CI; TypeDoc rejects native Windows backslash entry-point globs before documentation generation.