mcp: the streamable client does not start a new session after a 404, which the 2025-11-25 transport requires
Los mantenedores suelen responder en 1 día
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 35/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Necesita aclaración
- Estado de actividad
- Activo
- Stack tecnológico
- go
- Área
- api, networking
Línea de trabajo
Start with mcp/streamable.go, especially checkResponse and the ErrSessionMissing branch, then read the terminal-error documentation in mcp/streamable_client.go. Compare the two recovery shapes described in the issue and resolve the required client behavior and application hook or documentation scope. Done means the SDK's handling of a 404 session loss is explicitly chosen and conforms to the 2025-11-25 transport requirement.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
The clause. The 2025-11-25 streamable HTTP transport, Session Management, item 4: "When a client receives HTTP 404 in response to a request containing an MCP-Session-Id, it MUST start a new session by sending a new InitializeRequest without a session ID attached." Item 3 is the other half: a server "MAY terminate the session at any time, after which it MUST respond to requests containing that session ID with HTTP 404 Not Found."
What the client does. streamableClientConn treats that 404 as terminal. checkResponse returns ErrSessionMissing for a 404 on a request carrying a session ID (mcp/streamable.go, the "Only a stateful connection with a known session ID can experience ErrSessionMissing" branch, unchanged on main since v1.8.0), the connection fails, and every later call on the ClientSession returns that error. The package doc in mcp/streamable_client.go lists it under "Terminal (breaks the connection)". Nothing in the client sends the new InitializeRequest the clause requires; an application has to notice ErrSessionMissing, drop the session and call Client.Connect again. #715 exposed the error so an application could do that, which is useful, but nothing in the documentation tells an application that the specification makes it mandatory, so a client built on the SDK is non-conformant by default.
Why it matters in practice. A server that restarts, evicts an idle stateful session or refuses a session ID it does not recognise answers 404 and relies on the client's MUST to recover. With the Go client, a long-lived ClientSession outlives any of those and stays broken, so every call after it fails with "session not found" while the server is healthy. I maintain an MCP server whose stateful HTTP mode answers an unknown or foreign session ID with 404 for exactly this reason, and its recovery depends on the client.
Two shapes, and I would like your view before writing either.
- The client re-initializes on its own: on
ErrSessionMissing, theClientSessionruns the handshake again with the sameClientOptions, takes the new session ID and retries the failed request once. That meets the MUST with no application code. What it cannot restore by itself is state the old session carried (resource subscriptions, the logging level), so it would need a hook, for example a callback onClientOptions, that tells the application it is talking to a new session. - It stays terminal, and the SDK documents on
Client.ConnectandClientSessionthatErrSessionMissingmeans the specification requires a new session, perhaps with a helper or an example that does the reconnect, so each application does not reinvent it.
Related: #715 (exposing the error), #683 (terminal errors being too strict), and #579, which is about HTTP error details rather than this.
- Lenguaje dominante
- Go
- Estrellas
- 5.4k
- Forks
- 623
- Merge medio
- 22 h 10 min
- PR fusionados (30 d)
- 30
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
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
modelcontextprotocol/go-sdk#1557 ·
Los mantenedores suelen responder en 1 día
-
Streamable HTTP (2026-07-28): tools/call with an out-of-range number in arguments fails because extractName decodes Arguments into anyQuizá libre de nuevo @beiryu la tomó hace 10 días y no hay ningún pull request abierto. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
modelcontextprotocol/go-sdk#1534 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Expose generic `SendNotification` on `ServerSession` for custom protocol extensionsQuizá libre de nuevo Un pull request para esta issue se cerró sin fusionarse. 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
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 18/100
modelcontextprotocol/go-sdk#1555 ·
Los mantenedores suelen responder en 1 día
-
mcp: 2026-07-28 client runs elicitation and sampling handlers for standalone server requestsQuizá libre de nuevo Un pull request para esta issue se cerró sin fusionarse. Abierto
Dificultad 3/5 1-2 días Aptitud para principiantes 35/100
modelcontextprotocol/go-sdk#1552 ·
Los mantenedores suelen responder en 1 día
Todos los issues de modelcontextprotocol/go-sdk
Issues similares
-
Dificultad 1/5 1-3 horas Aptitud para principiantes 88/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
compiler-explorer/compiler-explorer#9738 ·
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 85/100
evilmartians/lefthook#1674 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día