From c4d37352727571a3b7a332f9950567d5b5b7b100 Mon Sep 17 00:00:00 2001 From: Mathias Bergqvist Date: Thu, 7 May 2026 23:22:21 +0200 Subject: [PATCH] fix(mcp): allow GET/SSE without session ID for claude.ai compatibility --- internal/mcp/server.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/internal/mcp/server.go b/internal/mcp/server.go index ff2dc93..23209f7 100644 --- a/internal/mcp/server.go +++ b/internal/mcp/server.go @@ -111,11 +111,8 @@ func (s *Server) handlePOST(w http.ResponseWriter, r *http.Request) { } func (s *Server) handleGET(w http.ResponseWriter, r *http.Request) { - sid := r.Header.Get("Mcp-Session-Id") - if !s.opts.Sessions.Valid(sid) { - http.Error(w, "missing or invalid Mcp-Session-Id", http.StatusBadRequest) - return - } + // Session ID is optional for GET: clients may open the SSE stream before + // calling initialize (e.g. claude.ai probes on add). Accept with or without. w.Header().Set("Content-Type", "text/event-stream") w.Header().Set("Cache-Control", "no-cache") w.Header().Set("Connection", "keep-alive")