feat: add SSE transport support for MCP client#19135
Closed
andrewhosf wants to merge 1 commit into
Closed
Conversation
Add support for MCP servers using the SSE transport protocol
(SseServerTransport) alongside the existing Streamable HTTP and stdio
transports. Many MCP servers use SSE (GET /sse + POST /messages/)
which was previously unsupported -- the client silently fell back to
Streamable HTTP, causing 10s connection timeouts.
Changes:
- Import mcp.client.sse.sse_client with graceful fallback
- Check config.get('transport') == 'sse' in _run_http() to select
the SSE transport path with proper timeout handling
- Read transport type from config in get_mcp_status() instead of
hardcoding 'http' for URL-based servers
- Update docstring, example config, and feature list
Collaborator
Collaborator
|
Likely duplicate of #18801 cluster. |
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds support for MCP servers that use SSE transport (
SseServerTransport— GET/sse+ POST/messages/) alongside the existing Streamable HTTP and stdio transports.Currently
_run_http()unconditionally usesStreamableHTTPTransportfor all URL-based MCP servers. Servers using SSE transport silently fail — the client connects but never receives SSE events, and the connection hangs untilconnect_timeoutfires (~10s).Changes
tools/mcp_tool.pymcp.client.sse.sse_clientwith graceful fallbacktools/mcp_tool.pyconfig.get('transport') == 'sse'in_run_http()to select SSE transport path with proper timeout handlingtools/mcp_tool.pyget_mcp_status()instead of hardcoding 'http' for URL-based serverstools/mcp_tool.pyUsage
Configure SSE-based MCP servers with
transport: sseinconfig.yaml:When
transportis omitted (or set tostreamable-http), the existing Streamable HTTP path is used unchanged — zero impact on existing configs.Test Plan
get_mcp_status()correctly displays transport type from config