Skip to content

feat: add SSE transport support for MCP client#19135

Closed
andrewhosf wants to merge 1 commit into
NousResearch:mainfrom
andrewhosf:feat/mcp-sse-transport
Closed

feat: add SSE transport support for MCP client#19135
andrewhosf wants to merge 1 commit into
NousResearch:mainfrom
andrewhosf:feat/mcp-sse-transport

Conversation

@andrewhosf

Copy link
Copy Markdown
Contributor

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 uses StreamableHTTPTransport for all URL-based MCP servers. Servers using SSE transport silently fail — the client connects but never receives SSE events, and the connection hangs until connect_timeout fires (~10s).

Changes

File Change
tools/mcp_tool.py Import mcp.client.sse.sse_client with graceful fallback
tools/mcp_tool.py Check config.get('transport') == 'sse' in _run_http() to select SSE transport path with proper timeout handling
tools/mcp_tool.py Read transport type from config in get_mcp_status() instead of hardcoding 'http' for URL-based servers
tools/mcp_tool.py Update docstring, example config, and feature list

Usage

Configure SSE-based MCP servers with transport: sse in config.yaml:

mcp_servers:
  searxng:
    url: http://localhost:8000/sse
    transport: sse
    timeout: 180
    connect_timeout: 10

When transport is omitted (or set to streamable-http), the existing Streamable HTTP path is used unchanged — zero impact on existing configs.

Test Plan

  • SSE import works with mcp>=1.24.0 (tested with mcp-1.27.0)
  • Graceful error when mcp SDK lacks sse_client
  • Streamable HTTP path unchanged (default when transport key absent)
  • get_mcp_status() correctly displays transport type from config
  • End-to-end test: searxng MCP server (SSE transport) connects in ~0.04s instead of timing out at 10s

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
@alt-glitch alt-glitch added type/feature New feature or request P3 Low — cosmetic, nice to have tool/mcp MCP client and OAuth labels May 3, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Likely duplicate of #18801 / #5981 / #11647 / #3976 — fifth competing PR for MCP SSE transport support. Needs consolidation with existing PRs.

@alt-glitch

Copy link
Copy Markdown
Collaborator

Likely duplicate of #18801 cluster.

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

Labels

P3 Low — cosmetic, nice to have tool/mcp MCP client and OAuth type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants