Back to feed
Dev.to
Dev.to
6/25/2026
MCP Connection Issues: Why My MCP Server Kept Dropping Connections and How I Fixed It (After 86 Production Outages)

MCP Connection Issues: Why My MCP Server Kept Dropping Connections and How I Fixed It (After 86 Production Outages)

Short summary

After dealing with 86 production outages, the author traced random MCP server disconnects to SSE idle timeouts on proxies and load balancers, which vary by hosting platform (Fly.io 75s, Cloudflare 100s, Heroku 55s). The elegant fix: send SSE comment heartbeats (: heartbeat) every 30 seconds to keep connections alive without interrupting the event stream or requiring platform configuration changes. Includes complete, production-ready Java Spring Boot implementation using ScheduledExecutorService.

  • MCP/SSE connections drop when proxies timeout idle connections after 55–100 seconds depending on hosting platform
  • Solution: send SSE comment heartbeats every 30 seconds to signal activity without interrupting the data stream
  • Working Java Spring Boot implementation provided with ScheduledExecutorService and proper error handling

Generated with AI, which can make mistakes.

Is this a good recommendation for you?

Explore more