Repository navigation
fix(mcp): serve streamable HTTP statelessly to stop per-connection Durable Object writes - #270
Merged
Merged
Conversation
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.
What happened
The Durable Objects free tier (100,000
rows_writtenper day) was exceeded on 2026-11-05 UTC, and writes began failing withExceeded allowed rows written in Durable Objects free tier.Traffic was a steady 500-600 requests/min ofGET/POST /ssefrom Claude.ai's connector.Cause
Every
GET /sseopens a newMyMCPDurable Object, and theagentslibrary creates its bookkeeping tables on each new object. Measured in the Workers test pool, one newGET /ssecosts 54 SQL statements writing 50 rows, plus 6storage.putcalls.Fix
/mcpandPOST /ssenow run without a Durable Object: a fresh MCP server per request, noMcp-Session-Id. No tool sends server-initiated messages, so nothing depends on a session.GET /sse(it carriesmcp-protocol-version) andDELETEget405instead of reaching a Durable Object.GET /mcpalso gets405.GET /ssewithout that header, thenPOST /sse/message) is unchanged and still uses a Durable Object.Result
POST /mcpandPOST /sse(initialize,tools/list, tool calls) construct 0 Durable Objects; a new E2E test asserts this, with a legacyGET /sseas a positive control that constructs exactly 1. The full suite passes.rows_writtenis not measured yet.405(its headers match the streamable follow-upGET). Both are stated in the README.Test plan
rows_writtenper request via the GraphQLdurableObjectsPeriodicGroupssum.rowsWritten.cpuTimeforinitialize,tools/listandtools/callin Workers Observability: each request now registers every tool, and a local Node benchmark puttools/listnear 8-14 ms against the Free plan's 10 ms limit.