Skip to content

Commit cb222fb

Browse files
committed
pass headers to version test too
1 parent 8b2cbac commit cb222fb

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/mcp/client/streamable.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ async def streamable_client(
2828
"""
2929
Client transport for streamable HTTP, with fallback to SSE.
3030
"""
31-
if await _is_old_sse_server(url, timeout):
31+
if await _is_old_sse_server(url, headers=headers, timeout=timeout):
3232
async with sse_client(url, headers=headers) as (read_stream, write_stream):
3333
yield read_stream, write_stream
3434
return
@@ -148,7 +148,11 @@ async def post_writer():
148148
)
149149

150150

151-
async def _is_old_sse_server(url: str, timeout: float) -> bool:
151+
async def _is_old_sse_server(
152+
url: str,
153+
headers: dict[str, Any] | None,
154+
timeout: float,
155+
) -> bool:
152156
"""
153157
Test whether this is an old SSE MCP server.
154158
@@ -176,6 +180,7 @@ async def _is_old_sse_server(url: str, timeout: float) -> bool:
176180
headers=(
177181
("accept", "application/json"),
178182
("accept", "text/event-stream"),
183+
*(headers or {}).items(),
179184
),
180185
)
181186
if 400 <= response.status_code < 500:

0 commit comments

Comments
 (0)