mcp: SSEClientTransport ties the event stream to the context passed to Connect
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 76/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- go
- Área
- api, networking
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- Go
- Estrellas
- 5.2k
- Forks
- 568
- Merge medio
- 1 d 18 h
- PR fusionados (30 d)
- 36
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la 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.
Más de modelcontextprotocol/go-sdk
-
Session-lifecycle bookkeeping logs at info, spamming multiple log lines per request on stateless streamable HTTPPosiblemente ocupada @anneheartrecord la tomó hace 41 días. AbiertoP3
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
modelcontextprotocol/go-sdk#1204 · 1 reacción ·
Los mantenedores suelen responder en 1 día
-
Expose generic `SendNotification` on `ServerSession` for custom protocol extensionsPosiblemente ocupada @ajuijas la tomó hace 207 días. Abiertoneeds investigation
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
modelcontextprotocol/go-sdk#745 · 13 comentarios · 1 reacción ·
Los mantenedores suelen responder en 1 día
-
auth: Authorize fails against a 2025-03-26 server whose URL has a query stringPosiblemente ocupada @akshita317 la tomó hace 2 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 40/100
modelcontextprotocol/go-sdk#1347 ·
Los mantenedores suelen responder en 1 día
-
P3
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
modelcontextprotocol/go-sdk#1337 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
mcp: Client.Connect never falls back to initialize when a stdio server ignores server/discoverPosiblemente ocupada @crossxr la tomó hace 6 días. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 45/100
modelcontextprotocol/go-sdk#1332 · 3 comentarios ·
Los mantenedores suelen responder en 1 día
Todos los issues de modelcontextprotocol/go-sdk
Issues similares
-
proxy logs "no user in context" at error level for every data gateway downloadPosiblemente ocupada @paul43210 la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
txn2/mcp-data-platform#2063 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 83/100
kubernetes-sigs/kueue#16990 ·
Los mantenedores suelen responder en 1 día
-
enhancement exporter/awss3 needs triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
open-telemetry/opentelemetry-collector-contrib#51905 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
stellar/stellar-horizon#245 ·
Los mantenedores suelen responder en 1 día