fix: ignore SSE retry: field to prevent McpTransportException - #1082
Open
chao6118 wants to merge 1 commit into
Open
fix: ignore SSE retry: field to prevent McpTransportException#1082chao6118 wants to merge 1 commit into
chao6118 wants to merge 1 commit into
Conversation
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.
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.
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: 3000in SSE, causing:Fix
Ignore
retry:lines silently, same as:comments. The W3C SSE spec definesretry:as a valid field.Related
#685 (SSE comment handling)