Skip to content

Commit 431e181

Browse files
committed
mcp/streamable: reuse transport if sessionID is given in stateless mode
This change fixes logging not working in stateless mode as the transport (and therefore the configured log level) is not used across requests. Fixes #387
1 parent 7bfde44 commit 431e181

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mcp/streamable.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ func (h *StreamableHTTPHandler) ServeHTTP(w http.ResponseWriter, req *http.Reque
308308
http.Error(w, "failed connection", http.StatusInternalServerError)
309309
return
310310
}
311-
if h.opts.Stateless {
311+
if sessionID == "" && h.opts.Stateless {
312312
// Stateless mode: close the session when the request exits.
313313
defer ss.Close() // close the fake session after handling the request
314314
} else {

0 commit comments

Comments
 (0)