Skip to content

fix: replace deprecated streamablehttp_client with streamable_http_client#479

Open
Vedanshu Joshi (Vedanshu7) wants to merge 2 commits intolangchain-ai:mainfrom
Vedanshu7:fix/replace-deprecated-streamablehttp-client
Open

fix: replace deprecated streamablehttp_client with streamable_http_client#479
Vedanshu Joshi (Vedanshu7) wants to merge 2 commits intolangchain-ai:mainfrom
Vedanshu7:fix/replace-deprecated-streamablehttp-client

Conversation

@Vedanshu7
Copy link
Copy Markdown

@Vedanshu7 Vedanshu Joshi (Vedanshu7) commented Apr 14, 2026

Summary

  • Replaces the deprecated streamablehttp_client (positional-arg form) with the new streamable_http_client(url, *, http_client, terminate_on_close) API introduced in MCP SDK v1.27+
  • Builds an httpx.AsyncClient via create_mcp_http_client (or a caller-supplied factory) to carry headers, timeout, sse_read_timeout, and auth — preserving all existing config options
  • Eliminates the DeprecationWarning that users see at runtime when using streamable_http transport

Closes #478

Test plan

  • Five unit tests (mocked transport) verifying correct function is called, timeouts/headers/auth forwarded, and custom factory takes precedence
  • One end-to-end smoke test with a real in-process FastMCP server that asserts no DeprecationWarning about streamablehttp_client is emitted
  • make lint passes (ruff + format)
  • Full test suite: 80/80 pass

…ient

Migrates _create_streamable_http_session() to the new MCP SDK v1.27+
streamable_http_client(url, *, http_client, terminate_on_close) API,
dropping the deprecated positional-argument form that triggers a
DeprecationWarning at runtime.

Headers, timeout, sse_read_timeout, auth, and httpx_client_factory are
forwarded via an httpx.AsyncClient built by create_mcp_http_client (or a
caller-supplied factory) so all existing config options are preserved.

Adds tests/test_sessions.py with five unit tests (mocked transport) and
one end-to-end smoke test (real FastMCP server) that asserts no
DeprecationWarning is emitted.

Closes langchain-ai#478
@Sasao4o
Copy link
Copy Markdown

When will this PR be merged? I believe openinference-instrumentation-mcp is failing with me because of naming inconsistencies between the adapter and the SDK

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DeprecationWarning: Use instead (sessions.py uses deprecated function)

2 participants