From a834f3cf9acd0b79181cdb9a95ebe36755194ecc Mon Sep 17 00:00:00 2001 From: Riley Norton <46510750+RileyNorton@users.noreply.github.com> Date: Wed, 13 Aug 2025 14:12:13 -0700 Subject: [PATCH] mcp: allow correct 'Accept' header values Allow other header values for the 'Accept' header that imply application/json and text/event-stream for requests to the Streamable HTTP Transport. Fixes #290 Unit tests here seemed like unnecessary complexity and wouldn't fit cleanly with the style of the `streamable_test.go` tests. Happy to add those if desired though. --- mcp/streamable.go | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/mcp/streamable.go b/mcp/streamable.go index 048b99a..0d417bc 100644 --- a/mcp/streamable.go +++ b/mcp/streamable.go @@ -98,9 +98,12 @@ func (h *StreamableHTTPHandler) ServeHTTP(w http.ResponseWriter, req *http.Reque var jsonOK, streamOK bool for _, c := range accept { switch strings.TrimSpace(c) { - case "application/json": + case "application/json", "application/*": + jsonOK = true + case "text/event-stream", "text/*": + streamOK = true + case "*/*": jsonOK = true - case "text/event-stream": streamOK = true } }