Skip to content

fix: ignore SSE retry: field to prevent McpTransportException - #1082

Open
chao6118 wants to merge 1 commit into
modelcontextprotocol:mainfrom
chao6118:fix/sse-retry-field
Open

fix: ignore SSE retry: field to prevent McpTransportException#1082
chao6118 wants to merge 1 commit into
modelcontextprotocol:mainfrom
chao6118:fix/sse-retry-field

Conversation

@chao6118

@chao6118 chao6118 commented Aug 9, 2026

Copy link
Copy Markdown

Problem

The SSE specification includes retry: as a valid field. SseLineSubscriber.hookOnNext() treats unrecognized lines as errors, crashing when servers emit retry directives.

Reproduction

Connect to a SurrealDB MCP server (rmcp-based) via Streamable HTTP. The server sends retry: 3000 in SSE, causing:

McpTransportException: Invalid SSE response. Status code: 200 Line: retry: 3000
  at ResponseSubscribers$SseLineSubscriber.hookOnNext(ResponseSubscribers.java:185)

Fix

Ignore retry: lines silently, same as : comments. The W3C SSE spec defines retry: as a valid field.

Related

#685 (SSE comment handling)

The SSE specification includes 'retry:' as a valid field for setting
the reconnection interval. However, the SseLineSubscriber treats any
unrecognized line as an error, causing McpTransportException when
MCP servers (e.g., rmcp-based servers like SurrealDB) emit retry
directives in SSE responses.

This fix adds a handler that silently ignores 'retry:' lines, matching
the existing behaviour for ':' comment lines.

Related: servers using rmcp (Rust MCP SDK) send 'retry: 3000' by
default, which triggers this error and breaks Streamable HTTP
connections to SurrealDB and other rmcp-based MCP servers.
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.

1 participant