Skip to content

feat(mcp): add Streamable HTTP client to extra/mcp#592

Open
adrienduchemin wants to merge 4 commits into
mainfrom
adrienduchemin/extra-mcp-streamable-http
Open

feat(mcp): add Streamable HTTP client to extra/mcp#592
adrienduchemin wants to merge 4 commits into
mainfrom
adrienduchemin/extra-mcp-streamable-http

Conversation

@adrienduchemin

Copy link
Copy Markdown

Summary

Adds a Streamable HTTP MCP client to mistralai.extra.mcp, alongside the existing SSE and stdio clients, for MCP servers that speak the Streamable HTTP transport (--transport http).

  • StreamableHTTPServerParams (url, headers, timeout, sse_read_timeout)
  • MCPClientStreamableHTTP(MCPClientBase) whose _get_transport wires mcp.client.streamable_http.streamable_http_client to an httpx.AsyncClient.

Why

extra/mcp ships sse.py and stdio.py but no Streamable HTTP client. Streamable HTTP is the transport used by self-hosted / remote MCP servers (e.g. the official Notion MCP with --transport http), and it's the only option for callers that can't spawn a stdio subprocess.

Credentials (bearer token, per-request integration headers) are set as the httpx client's default headers, so they are sent on every request including the initialize call. This is required because recent mcp releases deprecate and ignore the transport's own headers= argument (headers must live on the httpx.AsyncClient).

Notes

  • src/mistralai/extra/* is excluded from codegen (.genignore), so this hand-written module is safe.
  • Mirrors sse.py's structure and MCPClientBase contract; no OAuth flow (not applicable to the bearer/header model this targets).

Context

Currently consumers (Mistral Workflows SDK plugins) carry a local subclass of MCPClientBase to get this transport; once this lands and is released they can import it here instead, symmetric with SSE/stdio.

Adds MCPClientStreamableHTTP + StreamableHTTPServerParams alongside the existing
SSE and stdio MCP clients, for servers that speak the Streamable HTTP transport
(--transport http). Credentials are set on the httpx client so they ride every
request including initialize; the transport's own headers arg is deprecated.
@adrienduchemin adrienduchemin requested a review from HHK1 July 16, 2026 14:39
Comment thread src/mistralai/extra/mcp/streamable_http.py Outdated

@arnaudde arnaudde left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Low risk, lgtm

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.

2 participants