-
Notifications
You must be signed in to change notification settings - Fork 273
Closed
Description
Describe the bug
GET requests with valid session IDs do not immediately return HTTP headers as required by the MCP specification. Instead, they hang indefinitely until the client disconnects, at which point they return a 204 status.
According to the MCP Streamable HTTP Transport specification:
"The server MUST either return Content-Type: text/event-stream in response to this HTTP GET, or else return HTTP 405 Method Not Allowed, indicating that the server does not offer an SSE stream at this endpoint."
To Reproduce
Steps to reproduce the behavior:
- Run any streamable HTTP MCP server, for example:
func main() {
// Create a minimal MCP server
server := mcp.NewServer(&mcp.Implementation{
Name: "minimal-test-server",
Version: "1.0.0",
}, nil)
handler := mcp.NewStreamableHTTPHandler(func(req *http.Request) *mcp.Server {
return server
}, nil)
port := 8010
log.Printf("Starting minimal reproduction server on localhost:%d", port)
if err := http.ListenAndServe(fmt.Sprintf("localhost:%d", port), handler); err != nil {
log.Fatalf("Server failed: %v", err)
}
}
- Establish session
curl -X POST http://localhost:8010/ \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-03-26","capabilities":{},"clientInfo":{"name":"test-client","version":"1.0.0"}}}' -i
- Extract
Mcp-Session-Idfrom response - Make a GET request
curl -v -H "Accept: text/event-stream" -H "Mcp-Session-Id: <SESSION_ID>" http://localhost:8010/ --max-time 30
Expected behavior
When a client makes a GET request with a valid Mcp-Session-Id header:
- Server should immediately respond with HTTP status 200 and headers including
Content-Type: text/event-stream - Connection should remain open to stream server-sent events
Actual behavior
- Server receives the GET request
- No HTTP response headers are sent immediately
- Request hangs indefinitely
- Only when client disconnects/times out does server respond with status 204
petarovrdimitrov
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working