mcp: SSEClientTransport ties the event stream to the context passed to Connect
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 76/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- go
- Ambito
- api, networking
Direzione di ricerca
Start in mcp/sse.go at SSEClientTransport.Connect and inspect how the request uses the context passed to Client.Connect; compare this with StreamableClientTransport's connection lifetime. Reproduce the issue with a short-lived context, then verify that the SSE stream remains usable for session.ListTools until Close ends the connection.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Describe the bug
SSEClientTransport.Connect opens the long-lived event stream with http.NewRequestWithContext(ctx, "GET", c.Endpoint, nil), using the context given to Client.Connect (mcp/sse.go; present in v1.8.0 and on main at 53effc0). Callers usually bound the handshake with a timeout:
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
session, err := client.Connect(ctx, &mcp.SSEClientTransport{Endpoint: url}, nil)
The session works until cancel runs or the timeout fires. After that the stream is closed and every later call fails. StreamableClientTransport detaches its connection from the Connect context, so the same code works on one transport and silently breaks on the other.
To Reproduce
- Connect to an SSE server with a context that has a short timeout, as above.
- Let the timeout fire (or call
cancel). - Call
session.ListTools: it fails because the event stream is gone.
Expected behavior
The stream's lifetime is tied to the connection, ended by Close, as with the streamable transport. If the current behavior is intended, document it on Client.Connect and SSEClientTransport. Happy to send a PR.
Additional context
Found while moving PromptKit's MCP client onto go-sdk v1.8.0 (AltairaLabs/PromptKit#2141). We work around it by passing Connect a context that outlives the handshake: dial.
- Lingua principale
- Go
- Stelle
- 5.2k
- Fork
- 568
- Merge medio
- 1g 15h
- PR unite (30g)
- 39
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di modelcontextprotocol/go-sdk
-
Session-lifecycle bookkeeping logs at info, spamming multiple log lines per request on stateless streamable HTTPForse già presa @anneheartrecord l’ha presa 42 giorni fa. ApertaP3
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
modelcontextprotocol/go-sdk#1204 · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
Expose generic `SendNotification` on `ServerSession` for custom protocol extensionsForse già presa @ajuijas l’ha presa 208 giorni fa. Apertaneeds investigation
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
modelcontextprotocol/go-sdk#745 · 13 commenti · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
mcp: client returns an input_required result that has only requestState instead of retryingForse già presa @SergeevDmitry l’ha presa oggi. Aperta
Difficoltà 3/5 Mezza giornata Idoneità per principianti 62/100
modelcontextprotocol/go-sdk#1364 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 18/100
modelcontextprotocol/go-sdk#1359 ·
I maintainer di solito rispondono entro 1 giorno
-
Streamable HTTP: a tool result that fails to marshal leaves the POST hanging (no JSON-RPC error)Aperta
Difficoltà 4/5 1-2 giorni Idoneità per principianti 45/100
modelcontextprotocol/go-sdk#1358 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di modelcontextprotocol/go-sdk
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
siyuan-note/siyuan#20353 ·
I maintainer di solito rispondono entro 1 giorno
-
attributes-natural-language "en-US" is rejected by PAPPL >= 1.4.12 printers (RFC 8011 requires lowercase)Forse già presa @ChrisEdgington l’ha presa oggi. Aperta
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 84/100
OpenPrinting/ipp-usb#140 ·
-
Discriminator mapping keys are listed in a random orderForse già presa @reuvenharrison l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Idle compaction monitors LIST the replica every tick when the newest destination file spans more than one TXIDForse già presa @pishuv l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
benbjohnson/litestream#1563 ·
I maintainer di solito rispondono entro 2 giorni
-
triage needed
Difficoltà 1/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 2 giorni