diff --git a/mcp-spring/mcp-spring-webflux/src/main/java/io/modelcontextprotocol/client/transport/WebClientStreamableHttpTransport.java b/mcp-spring/mcp-spring-webflux/src/main/java/io/modelcontextprotocol/client/transport/WebClientStreamableHttpTransport.java index 53b59cb30..930022fc2 100644 --- a/mcp-spring/mcp-spring-webflux/src/main/java/io/modelcontextprotocol/client/transport/WebClientStreamableHttpTransport.java +++ b/mcp-spring/mcp-spring-webflux/src/main/java/io/modelcontextprotocol/client/transport/WebClientStreamableHttpTransport.java @@ -2,6 +2,7 @@ import java.io.IOException; import java.util.List; +import java.util.Objects; import java.util.Optional; import java.util.concurrent.atomic.AtomicReference; import java.util.function.Consumer; @@ -422,8 +423,13 @@ private Tuple2, Iterable> parse(Serve throw new McpError("Error parsing JSON-RPC message: " + event.data()); } } + else if (null == event.event() && Objects.requireNonNull(event.comment()).startsWith("ping")) { + // https://github.com/modelcontextprotocol/java-sdk/issues/93 + logger.warn("Ignore ping from python fastmcp server: {}", event.comment()); + return Tuples.of(Optional.empty(), List.of()); + } else { - throw new McpError("Received unrecognized SSE event type: " + event.event()); + throw new McpError("Received unrecognized network event type: " + event.event()); } }