fix(professional-crm): remove Accept header patch causing SSE reconnect loop#148
Open
Promithius-DR wants to merge 2 commits intoNateBJones-Projects:mainfrom
Open
fix(professional-crm): remove Accept header patch causing SSE reconnect loop#148Promithius-DR wants to merge 2 commits intoNateBJones-Projects:mainfrom
Promithius-DR wants to merge 2 commits intoNateBJones-Projects:mainfrom
Conversation
…ct loop The Accept: text/event-stream header patch forced StreamableHTTPTransport into SSE mode on every request. Since Supabase edge functions are stateless, the SSE stream terminates immediately after each response — causing the MCP client to reconnect every ~2 seconds (~43k invocations/day). StreamableHTTPTransport is request/response by design. Removing the patch lets it respond with plain JSON, eliminating the reconnect loop entirely.
|
Hey @Promithius-DR — welcome to Open Brain Source! 👋 Thanks for submitting your first PR. The automated review will run shortly and check things like metadata, folder structure, and README completeness. If anything needs fixing, the review comment will tell you exactly what. Once the automated checks pass, a human admin will review for quality and clarity. Expect a response within a few days. If you have questions, check out CONTRIBUTING.md or open an issue. |
…econnect loop Removing text/event-stream from the Accept header before it reaches StreamableHTTPTransport prevents it from opening SSE streams. MCP clients send Accept: application/json, text/event-stream per spec -- this is what triggers SSE mode even without the original workaround. JSON-only responses close cleanly, eliminating the boot/shutdown cycle.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The
POST /mcphandler patches every incoming request to addAccept: application/json, text/event-streambefore passing it toStreamableHTTPTransport. WhenStreamableHTTPTransportseestext/event-streamin the Accept header, it switches to SSE response mode.Supabase edge functions are stateless — they terminate after each response. An SSE stream that terminates immediately looks like a dropped connection to the MCP client, which reconnects every ~2 seconds. This results in ~43,000 Supabase invocations per day with zero actual tool usage.
Root Cause
Fix
Remove the Accept header patch entirely.
StreamableHTTPTransportis designed for request/response — without the SSE accept header, it responds with plain JSON, the edge function terminates cleanly, and the client only calls again when it needs to invoke a tool.Claude Code (the primary consumer of this extension) sends correct Streamable HTTP headers and does not need this workaround.
Impact
🤖 Generated with Claude Code