Skip to content

Commit e4e0d48

Browse files
feat: Add backwards compatibility for StreamableHTTPTransport parameters
Keep constructor parameters (headers, timeout, sse_read_timeout, auth) for backwards compatibility, but mark them as deprecated and ignore them. The transport now reads all configuration from the httpx.AsyncClient passed to request methods. These parameters are kept to avoid breaking existing code that might instantiate the transport directly.
1 parent 1579db4 commit e4e0d48

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/mcp/client/streamable_http.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,22 @@ class RequestContext:
7474
class StreamableHTTPTransport:
7575
"""StreamableHTTP client transport implementation."""
7676

77-
def __init__(self, url: str) -> None:
77+
def __init__(
78+
self,
79+
url: str,
80+
headers: dict[str, str] | None = None,
81+
timeout: float | timedelta = 30,
82+
sse_read_timeout: float | timedelta = 60 * 5,
83+
auth: httpx.Auth | None = None,
84+
) -> None:
7885
"""Initialize the StreamableHTTP transport.
7986
8087
Args:
8188
url: The endpoint URL.
89+
headers: DEPRECATED - Ignored. Configure headers on the httpx.AsyncClient instead.
90+
timeout: DEPRECATED - Ignored. Configure timeout on the httpx.AsyncClient instead.
91+
sse_read_timeout: DEPRECATED - Ignored. Configure read timeout on the httpx.AsyncClient instead.
92+
auth: DEPRECATED - Ignored. Configure auth on the httpx.AsyncClient instead.
8293
"""
8394
self.url = url
8495
self.session_id = None

0 commit comments

Comments
 (0)