Skip to content

Commit 5cfc840

Browse files
ysyneuclaude
andcommitted
fix: return 405 for standalone SSE GET requests
The MCP Go SDK sends a GET request for standalone SSE streams during Connect(). Without this, mcp-go creates an orphan session and blocks indefinitely, causing ~60s hangs for every MCP connection. This server doesn't use server-initiated features (sampling, elicitation), so 405 is the correct MCP-spec-compliant response. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 8c1a0c7 commit 5cfc840

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

internal/flashduty/server.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,10 @@ func RunHTTPServer(cfg HTTPServerConfig) error {
340340
httpServer := server.NewStreamableHTTPServer(
341341
mcpServer,
342342
server.WithLogger(&slogAdapter{logger: logger}),
343+
// Return 405 for GET requests — this server doesn't use server-initiated
344+
// features (sampling, elicitation). Without this, the SDK's standalone SSE
345+
// GET hangs indefinitely because mcp-go creates an orphan session and blocks.
346+
server.WithDisableStreaming(true),
343347
server.WithHTTPContextFunc(func(ctx context.Context, r *http.Request) context.Context {
344348
// Extract W3C Trace Context from HTTP headers, or generate a new one
345349
traceCtx, err := trace.FromHTTPHeadersOrNew(r.Header)

0 commit comments

Comments
 (0)