Skip to content

Commit dd9034b

Browse files
committed
fix: request identity encoding for streamable HTTP
1 parent e8e6484 commit dd9034b

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

src/mcp/client/streamable_http.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ def _prepare_headers(self) -> dict[str, str]:
9090
"""
9191
headers: dict[str, str] = {
9292
"accept": "application/json, text/event-stream",
93+
"accept-encoding": "identity",
9394
"content-type": "application/json",
9495
}
9596
# Add session headers if available

tests/shared/test_streamable_http.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2283,6 +2283,8 @@ async def test_streamable_http_client_mcp_headers_override_defaults(
22832283
assert "content-type" in headers_data
22842284
assert headers_data["content-type"] == "application/json"
22852285

2286+
assert headers_data.get("accept-encoding") == "identity"
2287+
22862288

22872289
@pytest.mark.anyio
22882290
async def test_streamable_http_client_preserves_custom_with_mcp_headers(
@@ -2318,3 +2320,5 @@ async def test_streamable_http_client_preserves_custom_with_mcp_headers(
23182320

23192321
assert "content-type" in headers_data
23202322
assert headers_data["content-type"] == "application/json"
2323+
2324+
assert headers_data.get("accept-encoding") == "identity"

0 commit comments

Comments
 (0)