Disable standalone GET SSE Stream option for Streamable HTTP client transport
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 3/5
- Temps estimé
- 1-2 jours
- Accessibilité débutants
- 72/100
- Type d'issue
- Fonctionnalité
- Clarté
- Clairement spécifiée
- Activité
- Calme
- Stack technique
- java
- Domaine
- api, networking
Piste de recherche
Commencez par HttpClientStreamableHttpTransport.Builder et le point d’entrée sendMessage() mentionné dans l’issue, puis suivez le chemin GET depuis connect() et l’initialisation de la session. Ajoutez une option du builder qui empêche les deux déclencheurs GET SSE autonomes, et vérifiez que le mode désactivé n’envoie que du trafic de requête/réponse POST sans ouvrir de flux GET.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Expected Behavior
The HttpClientStreamableHttpTransport.Builder should provide an option to completely disable the GET SSE stream, allowing the client to operate in pure request-response mode:
var transport = HttpClientStreamableHttpTransport.builder("https://example.com")
.openSseStream(false) // Disable all GET SSE connections
.build();
When openSseStream(false) is set:
- No GET request is sent during
connect()(regardless ofopenConnectionOnStartup) - No GET request is sent after session initialization in
sendMessage() - The client operates in pure POST request / response mode
- Server-initiated notifications and requests outside of POST response streams are not received
This aligns with the MCP specification, which uses MAY (RFC 2119) for the client GET across all spec versions (2025-03-26 and latest 2025-11-25):
The client MAY issue an HTTP GET to the MCP endpoint. This can be used to open an SSE stream, allowing the server to communicate to the client, without the client first sending data via HTTP POST.
Current Behavior
After the first successful POST response (typically InitializeResult), the transport unconditionally opens a GET SSE stream. The relevant code in HttpClientStreamableHttpTransport.sendMessage():
if (transportSession.markInitialized(
responseEvent.responseInfo().headers().firstValue("mcp-session-id").orElseGet(() -> null))) {
// Once we have a session, we try to open an async stream for
// the server to send notifications and requests out-of-band.
reconnect(null).contextWrite(deliveredSink.contextView()).subscribe();
}
The reconnect(null) call is unconditional — there is no builder flag, callback, or any mechanism to prevent it.
The existing openConnectionOnStartup(false) (which defaults to false) only prevents the eager GET during connect(). It does NOT prevent the GET triggered after the first POST response. There is no combination of existing builder options that achieves "never open a GET SSE stream."
Context
The MCP specification explicitly marks the GET SSE stream as optional — unchanged across both spec versions:
- 2025-03-26: "The client MAY issue an HTTP GET to the MCP endpoint."
- 2025-11-25: "The client MAY issue an HTTP GET to the MCP endpoint."
Despite this, the Java SDK provides no way to opt out. The GET stream is unconditionally opened after session initialization, and its lifecycle is difficult to manage:
Alternatives considered:
openConnectionOnStartup(false)— does not prevent the post-initialization GET- Intercepting at the
HttpClientlevel to return a synthetic405 Method Not Allowedfor GET requests — this tricks the SDK into thinking the server doesn't support SSE streams, and the SDK stops trying. It works, but it's a hack: you have to wrap the HTTP client, intercept by method, and fabricate a response. This should be a first-class builder option, not something consumers need to reverse-engineer from the SDK's 405-handling behavior.
Precedent: The Go SDK already solved this exact problem via go-sdk#729 (merged Jan 11, 2026), adding a DisableStandaloneSSE field to StreamableClientTransport. The Java SDK should provide equivalent functionality.
Proposed fix: Add a builder option (e.g. disableStandaloneSSE(boolean) or openSseStream(boolean)) and guard both GET trigger points with it.
- Langage dominant
- Java
- Étoiles
- 3.7k
- Forks
- 1.1k
- Merge moyen
- 1 j 15 h
- PR mergées (30 j)
- 9
Guide de contribution
Ouvrir le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de modelcontextprotocol/java-sdk
-
area/transport bug P2
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100
modelcontextprotocol/java-sdk#1136 ·
-
area/client bug P2
Difficulté 2/5 1-3 heures Accessibilité débutants 84/100
modelcontextprotocol/java-sdk#1124 · 1 commentaire ·
-
ServerCapabilities.logging is added unconditionally, overriding the caller's explicit capabilities Ouvertebug P2 ready for work
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
modelcontextprotocol/java-sdk#1086 · 1 commentaire ·
-
enhancement good first issue P3
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
modelcontextprotocol/java-sdk#1067 ·
-
bug P2 ready for work
Difficulté 2/5 1-3 heures Accessibilité débutants 74/100
modelcontextprotocol/java-sdk#898 · 1 commentaire ·
Toutes les issues de modelcontextprotocol/java-sdk
Issues similaires
-
Bug Java Platform: Java
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
getsentry/sentry-java#6138 · 1 commentaire ·
-
bug needs triage p2
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
GoogleCloudPlatform/DataflowTemplates#4273 · 1 commentaire ·
-
[Studio][Bug] Bulk-deleting a full page of alert rules steps the page back while more rules remain Ouverte
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
apache/rocketmq-dashboard#4654 · 1 commentaire ·
-
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
-
Difficulté 2/5 1-3 heures Accessibilité débutants 76/100