Skip to content

Commit 5b7f664

Browse files
qazbnm456claude
andcommitted
fix(mcp): resolve streamable-http client by new name, fall back to old
The mcp SDK renamed `streamablehttp_client` → `streamable_http_client` and @deprecated the old name (a DeprecationWarning surfaced in the test suite). The new name is NOT signature-compatible and did not exist across the whole `mcp>=1.0` floor, so a hard switch would ImportError on older mcp. Resolve the transport factory by the new name when present and fall back to the old — both accept a bare url and yield the same (read, write, get_session_id) transport, so the call site is unchanged. Silences the deprecation on current SDKs while keeping the >=1.0 floor working. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent b610578 commit 5b7f664

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

rlm_kit/mcp.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -127,9 +127,14 @@ async def _serve(self) -> None:
127127
def _transport(self):
128128
srv = self._server
129129
if isinstance(srv, str) or (isinstance(srv, dict) and "url" in srv):
130-
from mcp.client.streamable_http import streamablehttp_client
131-
132-
return streamablehttp_client(srv if isinstance(srv, str) else srv["url"])
130+
import mcp.client.streamable_http as _sh
131+
132+
# The SDK renamed streamablehttp_client → streamable_http_client (the old name is now
133+
# @deprecated). Prefer the new name, fall back to the old so the mcp>=1.0 floor keeps
134+
# working; both accept a bare url and yield the same (read, write, get_session_id)
135+
# transport, so the call site is unchanged.
136+
streamable_client = getattr(_sh, "streamable_http_client", None) or _sh.streamablehttp_client
137+
return streamable_client(srv if isinstance(srv, str) else srv["url"])
133138
if not (isinstance(srv, dict) and srv.get("command")):
134139
raise ValueError(
135140
"MCP server spec must be a URL string, {'url': ...}, or "

0 commit comments

Comments
 (0)