Describe the bug
In the StreamableHttpHandler, the SDK explicitly sets the Content-Encoding header to "identity" when preparing an SSE (Server-Sent Events) response. This is a violation of RFC 9110 Section 8.4, which governs HTTP Semantics.
To Reproduce
Steps to reproduce the behavior:
- Start an MCP server using the AspNetCore SDK.
- Initiate a text/event-stream connection using client of choice.
- Inspect the response headers.
- Observe Content-Encoding: identity in the response.
Expected behavior
Content-Encoding header should be omitted from the response.
Additional context
From RFC 9910
If one or more encodings have been applied to a representation, the sender that applied the encodings MUST generate a Content-Encoding header field that lists the content codings in the order in which they were applied. Note that the coding named "identity" is reserved for its special role in Accept-Encoding and thus SHOULD NOT be included.
Setting this header can cause issues with strict HTTP clients, load balancers, or proxies that validate header compliance. While often used in ASP.NET as a "hack" to bypass compression middleware for streaming responses, it results in a spec-non-compliant response.
Suggestion
Removing the header: Since "identity" is the default when no encoding is present, the header is redundant.
Describe the bug
In the StreamableHttpHandler, the SDK explicitly sets the Content-Encoding header to "identity" when preparing an SSE (Server-Sent Events) response. This is a violation of RFC 9110 Section 8.4, which governs HTTP Semantics.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
Content-Encoding header should be omitted from the response.
Additional context
From RFC 9910
Setting this header can cause issues with strict HTTP clients, load balancers, or proxies that validate header compliance. While often used in ASP.NET as a "hack" to bypass compression middleware for streaming responses, it results in a spec-non-compliant response.
Suggestion
Removing the header: Since "identity" is the default when no encoding is present, the header is redundant.