fix(mcp): allow GET/SSE without session ID for claude.ai compatibility
This commit is contained in:
@@ -111,11 +111,8 @@ func (s *Server) handlePOST(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *Server) handleGET(w http.ResponseWriter, r *http.Request) {
|
func (s *Server) handleGET(w http.ResponseWriter, r *http.Request) {
|
||||||
sid := r.Header.Get("Mcp-Session-Id")
|
// Session ID is optional for GET: clients may open the SSE stream before
|
||||||
if !s.opts.Sessions.Valid(sid) {
|
// calling initialize (e.g. claude.ai probes on add). Accept with or without.
|
||||||
http.Error(w, "missing or invalid Mcp-Session-Id", http.StatusBadRequest)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
w.Header().Set("Content-Type", "text/event-stream")
|
w.Header().Set("Content-Type", "text/event-stream")
|
||||||
w.Header().Set("Cache-Control", "no-cache")
|
w.Header().Set("Cache-Control", "no-cache")
|
||||||
w.Header().Set("Connection", "keep-alive")
|
w.Header().Set("Connection", "keep-alive")
|
||||||
|
|||||||
Reference in New Issue
Block a user