fix: accept 200 with empty body notification responses in addition to 202#849
Merged
Conversation
jamadeo
previously approved these changes
May 14, 2026
| .get(HEADER_SESSION_ID) | ||
| .and_then(|v| v.to_str().ok()) | ||
| .map(|s| s.to_string()); | ||
| if status.is_success() |
Contributor
There was a problem hiding this comment.
In the past, we've opted to be pretty strict about non-compliant clients. This does have the benefit of exposing issues that other tools might mask.
But other than that, I think it is probably harmless to accept empty 200s as equivalent to 202s.
I would suggest putting a comment note here though, just to state we're deliberately allowing something outside of the spec.
Contributor
Author
There was a problem hiding this comment.
added a comment
53bc756 to
11a76b2
Compare
jamadeo
approved these changes
May 14, 2026
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
Some Streamable HTTP MCP servers return
200 OKwith an empty body for JSON-RPC notifications likenotifications/initialized, instead of the spec-required202 Accepted. Previously this could fail withUnexpectedContentType(None). This change treats empty successful responses to notifications/responses/errors as accepted.How Has This Been Tested?
Added a focused test for an empty
200 OKresponse to a client notification.Ran:
cargo test -p rmcp --test test_streamable_http_empty_2xx_notification --features client,transport-streamable-http-client,transport-streamable-http-client-reqwest cargo fmt -- --check git diff --checkBreaking Changes
None.
Types of changes
Checklist
Additional context
This improves compatibility with non-compliant servers while preserving the existing behavior for normal JSON/SSE responses.