Conversation
…357) Add `streamable_http` as a supported transport type for `MCPProvider`, enabling connections to MCP servers that use the Streamable HTTP protocol (e.g. Tavily remote endpoints). Previously only SSE transport was supported, causing silent 5-minute timeouts when connecting to incompatible endpoints. - Expand `MCPProvider.provider_type` to `Literal["sse", "streamable_http"]` (default remains `"sse"` for backwards compatibility) - Route `streamable_http` providers through `streamablehttp_client` from the MCP SDK in `MCPIOService._get_or_create_session()` - Handle variable-length context manager results from MCP transport clients - Add `DataDesigner.list_mcp_tool_names()` for discovering available tools - Update CLI form builder and controller to support the new transport option - Add tests for streamable_http config, session creation, and form builder Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Greptile SummaryThis PR successfully adds Streamable HTTP transport support for remote MCP providers, resolving the 5-minute timeout issue when connecting to Streamable HTTP-only endpoints. The implementation properly handles the different tuple return types from the MCP SDK (2-tuple for SSE/stdio vs 3-tuple for streamable_http) through indexed unpacking. Key Changes:
Previous Review Comments Addressed:
The implementation is clean, well-tested, and maintains backward compatibility.
|
| Filename | Overview |
|---|---|
| packages/data-designer-config/src/data_designer/config/mcp.py | Adds streamable_http to MCPProvider.provider_type Literal type with proper defaults and documentation |
| packages/data-designer-engine/src/data_designer/engine/mcp/io.py | Adds streamable_http transport support with proper branching logic and tuple unpacking to handle both 2-tuple (SSE/stdio) and 3-tuple (streamable_http) context manager returns |
| packages/data-designer/src/data_designer/cli/forms/mcp_provider_builder.py | Refactored _run_sse_form to _run_remote_form with proper type annotations and support for both SSE and streamable_http providers |
| packages/data-designer/src/data_designer/interface/data_designer.py | Adds list_mcp_tool_names() convenience method with proper error handling for unknown providers |
| packages/data-designer-engine/tests/engine/mcp/test_mcp_io.py | Adds test for streamable_http session creation with mock that properly returns 3-tuple as per MCP SDK |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
Start[_get_or_create_session] --> CheckSession{Session exists<br/>in pool?}
CheckSession -->|Yes| ReturnSession[Return cached session]
CheckSession -->|No| CheckProvider{Provider type?}
CheckProvider -->|LocalStdioMCPProvider| StdioClient[Create stdio_client<br/>with command/args/env]
CheckProvider -->|MCPProvider +<br/>streamable_http| StreamableClient[Create streamablehttp_client<br/>with endpoint/headers]
CheckProvider -->|MCPProvider +<br/>sse default| SSEClient[Create sse_client<br/>with endpoint/headers]
StdioClient --> ContextEnter[ctx.__aenter__]
StreamableClient --> ContextEnter
SSEClient --> ContextEnter
ContextEnter --> UnpackTuple["Unpack tuple:<br/>read = ctx_result[0]<br/>write = ctx_result[1]"]
UnpackTuple --> CreateSession[Create ClientSession<br/>with read, write]
CreateSession --> InitSession[Initialize session]
InitSession --> CacheSession[Store in session pool]
CacheSession --> ReturnNewSession[Return new session]
Last reviewed commit: f0b0e6a
packages/data-designer/src/data_designer/cli/forms/mcp_provider_builder.py
Outdated
Show resolved
Hide resolved
Additional Comments (1)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time! Prompt To Fix With AIThis is a comment left during a code review.
Path: packages/data-designer/src/data_designer/cli/forms/mcp_provider_builder.py
Line: 22-24
Comment:
Update docstring to mention Streamable HTTP support
```suggestion
"""Builds interactive forms for MCP provider configuration.
Supports both MCPProvider (remote SSE and Streamable HTTP) and LocalStdioMCPProvider (subprocess).
"""
```
<sub>Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!</sub>
How can I resolve this? If you propose a fix, please make it concise. |
eric-tramel
left a comment
There was a problem hiding this comment.
LGTM. Food for thought -- an Option C is to use a auto-detect/fallback on health check. This would mean that, unless it was specifically set by the user, we could "just" find which one of these two modes works and then run with it accordingly.
| """ | ||
|
|
||
| provider_type: Literal["sse"] = "sse" | ||
| provider_type: Literal["sse", "streamable_http"] = "sse" |
There was a problem hiding this comment.
Nit: Do we opt for StrEnum?
📋 Summary
Adds
streamable_httpas a supported transport type forMCPProvider, resolving #357. Previously, remote MCP providers only supported SSE transport, causing silent 5-minute timeouts when connecting to Streamable HTTP-only endpoints (e.g. Tavily). Also addsDataDesigner.list_mcp_tool_names()for discovering available tools on a configured provider, and updates documentation across the board.🔄 Changes
✨ Added
streamable_httptransport option onMCPProvider.provider_type(default remains"sse"for backwards compatibility)DataDesigner.list_mcp_tool_names()— convenience method to discover tools exposed by a configured MCP providerlist_tool_names()helper inmcp.iomodulestub_streamable_http_providertest fixture🔧 Changed
MCPIOService._get_or_create_session()— routesstreamable_httpproviders throughstreamablehttp_client, handles variable-length context manager results (3-tuple fromstreamablehttp_clientvs 2-tuple fromsse_client)MCPProviderFormBuilder— renamed_run_sse_form→_run_remote_formto handle both SSE and Streamable HTTP with appropriate labelsMCPProviderController._select_provider— shows "Streamable HTTP" vs "SSE" in provider display📚 Docs
mcp-providers.md— updated overview table, fields table, Python examples, and YAML examples for both transportsconfigure-mcp-cli.md— added Streamable HTTP to provider type selection and updated endpoint examplescode_reference/mcp.md— updated MCPProvider description to mention both transports🔍 Attention Areas
io.py#L222-L223— Context manager result unpacking changed fromread, write = ...toctx_result[0], ctx_result[1]to handle both 2-tuple (SSE) and 3-tuple (Streamable HTTP) returns from the MCP SDKmcp.py#L47—provider_typeexpanded fromLiteral["sse"]toLiteral["sse", "streamable_http"]— this changes the Pydantic discriminator union; verify deserialization of existing configs still works🤖 Generated with AI