modelcontextprotocol / modelcontextprotocol/java-sdk
SDK rejects valid SSE comments, causing initialization timeout with Tavily MCP remote server
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- Java
- Estrellas
- 3.7k
- Forks
- 1.1k
- Merge medio
- 1 d 15 h
- PR fusionados (30 d)
- 9
Descripción
The Java MCP SDK throws an McpError: Invalid SSE response when receiving SSE comment lines (lines starting with :), which are valid per the SSE specification. This causes initialization failures with MCP servers that send keep-alive or ping comments.
Environment
SDK Version: Java SDK (latest)
Protocol Version: 2025-03-26
Java Version: 17+
Affected Server: Tavily MCP Server (https://mcp.tavily.com/mcp/)
Steps to Reproduce:
String url = "https://mcp.tavily.com/mcp/";
McpClientTransport transport = HttpClientStreamableHttpTransport.builder(url).build();
SyncSpec clientBuilder = McpClient.sync(transport);
McpSyncClient client = clientBuilder.build();
// This will fail during initialization
client.initialize();
Symptoms
Initial Symptom (with default/short timeout)
The initialization hangs and eventually times out:
_INFO io.modelcontextprotocol.client.LifecycleInitializer -- Server response with Protocol: 2025-03-26, Capabilities: ServerCapabilities[...], Info: Implementation[name=tavily-mcp, title=null, version=1.17.0] and Instructions null
WARN io.modelcontextprotocol.client.LifecycleInitializer -- Failed to initialize
java.util.concurrent.TimeoutException: Did not observe any item or terminal signal within 3000ms in 'map' (and no fallback has been configured)_
This timeout occurs because the SSE parsing is failing silently in the background, preventing the initialization from completing.
Root Cause Revealed (with increased timeout ~300 seconds)
When the timeout is increased significantly, the actual error becomes visible:
WARN io.modelcontextprotocol.client.LifecycleInitializer -- Handling exception
io.modelcontextprotocol.spec.McpError: Invalid SSE response. Status code: 200 Line: : ping - 2025-11-20 17:27:30.586492+00:00
at io.modelcontextprotocol.client.transport.ResponseSubscribers$SseLineSubscriber.hookOnNext(ResponseSubscribers.java:173)
Guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
Comienza en ResponseSubscribers.java, en SseLineSubscriber.hookOnNext, y luego reproduce la inicialización con el Tavily MCP server y la configuración de transporte mostrada. Se considera terminado cuando las líneas de comentario SSE válidas que comienzan por ':' ya no provocan un error de respuesta no válida y client.initialize() se completa normalmente.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- java
- Área
- api
- Tipo de issue
- Error
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Estado de actividad
- Estancado
- Claridad
- Bien especificado
- Aptitud para principiantes
- 45/100