Skip to content

Commit e2057d1

Browse files
author
张建平
committed
Add wildcard '*' to the Accept header in response to API requests.
1 parent ed25167 commit e2057d1

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/mcp/server/streamable_http.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
# Content types
5252
CONTENT_TYPE_JSON = "application/json"
5353
CONTENT_TYPE_SSE = "text/event-stream"
54+
CONTENT_TYPE_ALL = "*/*"
5455

5556
# Special key for the standalone GET stream
5657
GET_STREAM_KEY = "_GET_stream"
@@ -282,6 +283,9 @@ async def handle_request(self, scope: Scope, receive: Receive, send: Send) -> No
282283
def _check_accept_headers(self, request: Request) -> tuple[bool, bool]:
283284
"""Check if the request accepts the required media types."""
284285
accept_header = request.headers.get("accept", "")
286+
if accept_header == CONTENT_TYPE_ALL:
287+
return True, True
288+
285289
accept_types = [media_type.strip() for media_type in accept_header.split(",")]
286290

287291
has_json = any(

0 commit comments

Comments
 (0)