Repository navigation
Conversation
## Motivation and Context An `Accept` header with an empty list member, such as `application/json,,text/event-stream` or one with a leading comma, makes the Streamable HTTP transport answer a POST with 500 and report a `NoMethodError` to the exception reporter, and raise out of a GET, although the required media types are listed (issue modelcontextprotocol#609): `parse_accept_header` splits each member on `;` and an empty member yields nothing to strip. RFC 9110 section 5.6.1.2 has a recipient parse and ignore a reasonable number of empty list elements, and the TypeScript and Python servers accept such a header, the one by substring checks and the other by stripping each member. `parse_accept_header` now skips empty members, so the POST and GET checks see the media types that are there. Fixes modelcontextprotocol#609. ## How Has This Been Tested? Two new tests in `test/mcp/server/transports/streamable_http_transport_test.rb`, a POST with a doubled and with a leading comma and a GET with a leading comma. Against the previous library the POST test fails with a 500 and the GET test raises. ## Breaking Changes None.
atesgoral
approved these changes
Oct 15, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation and Context
An
Acceptheader with an empty list member, such asapplication/json,,text/event-streamor one with a leading comma, makes the Streamable HTTP transport answer a POST with 500 and report aNoMethodErrorto the exception reporter, and raise out of a GET, although the required media types are listed (issue #609):parse_accept_headersplits each member on;and an empty member yields nothing to strip. RFC 9110 section 5.6.1.2 has a recipient parse and ignore a reasonable number of empty list elements, and the TypeScript and Python servers accept such a header, the one by substring checks and the other by stripping each member.parse_accept_headernow skips empty members, so the POST and GET checks see the media types that are there.Fixes #609.
How Has This Been Tested?
Two new tests in
test/mcp/server/transports/streamable_http_transport_test.rb, a POST with a doubled and with a leading comma and a GET with a leading comma. Against the previous library the POST test fails with a 500 and the GET test raises.Breaking Changes
None.
Types of changes
Checklist