Skip to content

Conversation

@SpringMT
Copy link

@SpringMT SpringMT commented Nov 5, 2025

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.

… layer

The 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
- Log session ID, method names, duration, and error status
- Add middleware to server using AddReceivingMiddleware()
- Simplify main.go by removing HTTP handler wrapping
- Use standard log package with structured format for clarity

This allows SSE streams to work properly while still providing detailed
logging for all MCP protocol-level method calls.
@findleyr findleyr requested a review from jba November 7, 2025 21:24
@findleyr
Copy link
Contributor

findleyr commented Nov 7, 2025

Thank you. I'll see if @jba wants to review, since he reviewed the original. Otherwise, I will review on Monday.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants