mcp: gracefully handle a nil server in handlers (#164)

If the getServer function passed to NewSSEHandler or
NewStreamableHTTPHandler returns nil, serve a 400 instead of panicking.

Fixes #161.
This commit is contained in:
Jonathan Amsterdam 2025-07-24 10:35:14 -04:00 • committed by GitHub
commit c879ac3c61
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -53,5 +53,5 @@ func main() {
return nil
}
})
http.ListenAndServe(*httpAddr, handler)
log.Fatal(http.ListenAndServe(*httpAddr, handler))
}