mcp: use rand.Text and slog.DiscardHandler over internal implementation (#773)

Address TODOs in code requiring go 1.24 as minimum version

mcp/logging.go: use slog.DiscardHandler, over local implementation
mcp/util.go: use rand.Text, over local implementation

Fixes #772
This commit is contained in:
Suraj Bobade 2026-02-03 18:53:59 +05:30 • committed by GitHub
commit df4f0d56a4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -7,6 +7,7 @@ package mcp
import (
"bytes"
"context"
"crypto/rand"
"encoding/base64"
"encoding/gob"
"encoding/json"
@ -175,7 +176,7 @@ func NewServer(impl *Implementation, options *ServerOptions) *Server {
}
if opts.GetSessionID == nil {
opts.GetSessionID = randText
opts.GetSessionID = rand.Text
}
if opts.Logger == nil { // ensure we have a logger