Skip to content

Context7 Platform -- Up-to-date docs for AI agents

Use the SDK default responseMode instead of forcing sse (#3017)

Fahreddin Özcanaf7e4ad278f2
diff --git a/.changeset/mcp-response-mode-auto.md b/.changeset/mcp-response-mode-auto.md
new file mode 100644
index 00000000..cf581e59
--- /dev/null
+++ b/.changeset/mcp-response-mode-auto.md
@@ -0,0 +1,7 @@
+---
+"@upstash/context7-mcp": patch
+---
+
+Stop forcing `responseMode: "sse"` on the HTTP handler and use the SDK default `"auto"` instead. Forcing `"sse"` put every response on an SSE stream, and those streams were not released: concurrent upstream streams went from ~10 before v4.0.0 to over 5000, exhausting the gateway connection pool and returning 503 `reset reason: overflow` on `mcp.context7.com`. Traffic and latency were unchanged over that period, so the growth was not load.
+
+With `"auto"` a request is answered with a single JSON body unless a handler emits a related message before its result, which upgrades that one exchange to SSE. No tool emits progress today, so modern-protocol responses are now plain JSON. The 2025-era legacy fallback is constructed without a `responseMode` and still streams over SSE, so it is unaffected.
diff --git a/packages/mcp/src/index.ts b/packages/mcp/src/index.ts
index b63ff365..e7e3c3a6 100644
--- a/packages/mcp/src/index.ts
+++ b/packages/mcp/src/index.ts
@@ -365,14 +365,7 @@ async function main() {
// no session store. The handler serves modern (2026-07-28) traffic natively
// and 2025-era traffic through its stateless legacy fallback, which answers
// GET/DELETE (session operations) with 405.
- //
- // responseMode "sse" keeps responses streaming: headers flush immediately
- // after parsing the request rather than buffering until the tool returns.
- // This is required for long-running tools because some MCP HTTP clients cap
- // the underlying fetch at 60s waiting for headers, even though the per-tool
- // timeout is much higher.
const mcpHandler = createMcpHandler(() => createMcpServer(), {
- responseMode: "sse",
onerror: (error) => console.error("MCP handler error:", error),
});
// Without onerror, request-conversion / handler.fetch throws are answered