Skip to content

feat: add Streamable HTTP transport to MCPToolProvider (TS + Python) - #639

Merged
cornelcroi merged 1 commit into
mainfrom
feat/632-streamable-http-transport
Jul 29, 2026
Merged

feat: add Streamable HTTP transport to MCPToolProvider (TS + Python)#639
cornelcroi merged 1 commit into
mainfrom
feat/632-streamable-http-transport

Conversation

@cornelcroi

Copy link
Copy Markdown
Collaborator

Issue Link

Closes #632

Summary

MCPToolProvider in both trees only spoke stdio and sse — and HTTP+SSE is the legacy transport, deprecated by the MCP spec since 2025-03-26. This adds the current standard HTTP transport as a third MCPServerConfig type, "streamable-http", reusing the existing url/headers fields. It works on today's 1.x SDKs and is the prerequisite for the MCP 2026-07-28 protocol work (#633, #634).

Changes

  • TypeScript: lazy import of StreamableHTTPClientTransport (@modelcontextprotocol/sdk >= 1.10) with the same null-fallback + use-time error pattern as the other transports; constructed with { requestInit: { headers } } (verified against SDK tag 1.30.0). 3 new tests (transport shape, no-headers case, missing-url error) — 34/34 pass, lint clean.
  • Python: separately guarded streamablehttp_client import (mcp >= 1.9) so older 1.x installs keep working until the new type is actually used; connect unpack handles its 3-tuple (read, write, get_session_id) while stdio/sse 2-tuples are untouched (read, write, *_). Headers verified working across mcp 1.9.0 → 1.29.0. 3 new tests — 29/29 pass, ruff clean.
  • Docs: mcp-tool-provider.mdx now documents three transports with TS + Python examples; SSE reframed as legacy; config reference tables updated; inline docstrings updated.

User experience

provider = await MCPToolProvider.create([
    MCPServerConfig(type="streamable-http", url="https://api.example.com/mcp",
                    headers={"Authorization": f"Bearer {token}"}),
])

Fully additive: existing stdio/sse configurations behave byte-identically; no new required fields, no dependency changes.

Both language expert reviews returned APPROVED with no required changes. One pre-existing bug surfaced during review (separate issue to follow): the TS sse branch passes { headers } to SSEClientTransport, which has no such option — custom headers on TS SSE are likely silently dropped today.

Checklist

  • Issue linked
  • Tests added (both trees)
  • Docs updated with usage examples (both trees)
  • Backward compatible — additive only
  • Optional deps stay optional

Code written by Claude (Fable 5), architected and approved by @cornelcroi.

Both trees only spoke stdio and HTTP+SSE, the transport deprecated by
the MCP spec since 2025-03-26. Add type="streamable-http" to
MCPServerConfig, reusing the existing url/headers fields. TypeScript
lazily imports StreamableHTTPClientTransport (SDK >=1.10) with the same
null-fallback pattern as the other transports; Python guards the
streamablehttp_client import separately (mcp >=1.9) so older installs
keep working until they actually use the new type, and the connect
unpack handles its 3-tuple. Existing stdio/sse paths unchanged.

Closes #632

Code written by Claude (Fable 5), architected and approved by @cornelcroi.
@cornelcroi
cornelcroi merged commit 8a0e6b0 into main Jul 29, 2026
9 of 12 checks passed
@cornelcroi
cornelcroi deleted the feat/632-streamable-http-transport branch July 29, 2026 10:27
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.

Add Streamable HTTP transport to MCPToolProvider (TypeScript + Python)

1 participant