-
Notifications
You must be signed in to change notification settings - Fork 91
Add Accept header validation #207
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
koic
merged 1 commit into
modelcontextprotocol:main
from
keisku:add-Accept-header-validation
Jan 7, 2026
Merged
Add Accept header validation #207
koic
merged 1 commit into
modelcontextprotocol:main
from
keisku:add-Accept-header-validation
Jan 7, 2026
+319
−8
Conversation
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
atesgoral
reviewed
Jan 5, 2026
Contributor
Author
|
@atesgoral Thank you! I addressed it. |
atesgoral
reviewed
Jan 6, 2026
atesgoral
reviewed
Jan 6, 2026
atesgoral
previously approved these changes
Jan 7, 2026
koic
reviewed
Jan 7, 2026
koic
reviewed
Jan 7, 2026
koic
reviewed
Jan 7, 2026
test/mcp/server/transports/streamable_http_notification_integration_test.rb
Outdated
Show resolved
Hide resolved
Member
|
I've left a few minor comments, but overall this looks ready to move forward. Can you address them and squash the commits into one? |
- Set Accept header to request JSON or SSE responses - Validate response Content-Type and raise error for non-JSON responses - Add Accept header to test fixtures - Use explicit hash syntax for Ruby 2.7 compatibility
6c061a0 to
ab8f53c
Compare
koic
approved these changes
Jan 7, 2026
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
The MCP 2025-06-18 specification requires clients to include specific
Acceptheaders when communicating with servers via Streamable HTTP transport:application/jsonandtext/event-streamtext/event-streamThis change brings the SDK into compliance with the specification by:
How Has This Been Tested?
Breaking Changes
Yes.
Servers will now reject requests without proper Accept headers with HTTP 406. Clients that don't send the required Accept header will receive an error response. However, compliant MCP clients should already be sending this header per the specification.
This change aligns with https://github.com/modelcontextprotocol/typescript-sdk/pull/266/changes#diff-fa2d8ab461bf11229eaa80d28cfa765b7244ab37a737a0b67f26aae8102175eeR121-R123.
Types of changes
Checklist