mcp: set default logging level to info (#411)

During initialization, the default logging level is set to info allowing
servers to emit logs immediately without waiting for a client to set a
log level.
The updated example shows how to send a notification in the context of
the request.

Fixes #387
This commit is contained in:
ln-12 2025-09-04 17:10:39 +02:00 • committed by GitHub
commit 4257528dde
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -282,6 +282,7 @@ func (h *StreamableHTTPHandler) ServeHTTP(w http.ResponseWriter, req *http.Reque
if !hasInitialized {
state.InitializedParams = new(InitializedParams)
}
state.LogLevel = "info"
connectOpts = &ServerSessionOptions{
State: state,
}