Skip to content

Commit a834f3c

Browse files
authored
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.
1 parent 87f2224 commit a834f3c

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

mcp/streamable.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,12 @@ func (h *StreamableHTTPHandler) ServeHTTP(w http.ResponseWriter, req *http.Reque
9898
var jsonOK, streamOK bool
9999
for _, c := range accept {
100100
switch strings.TrimSpace(c) {
101-
case "application/json":
101+
case "application/json", "application/*":
102+
jsonOK = true
103+
case "text/event-stream", "text/*":
104+
streamOK = true
105+
case "*/*":
102106
jsonOK = true
103-
case "text/event-stream":
104107
streamOK = true
105108
}
106109
}

0 commit comments

Comments
 (0)