go-sdk
go-sdk copied to clipboard
examples: Fix SSE streaming issue by moving logging from HTTP to MCP middlewarre
In examples/http, previous HTTP-level logging middleware blocked SSE streaming because handler.ServeHTTP() does not return until the connection closes for GET requests (SSE streams).
This prevented response headers from being sent to the client.
Changes:
- Replace HTTP-level logging handler with MCP middleware pattern
- Implement logging at the MCP protocol layer using mcp.Middleware
- Add middleware to server using AddReceivingMiddleware()
- Simplify main.go by removing HTTP handler wrapping
This allows SSE streams to work properly while still providing detailed logging for all MCP protocol-level method calls.