Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@
"@cloudflare/vite-plugin@1.31.2": "patches/@cloudflare%2Fvite-plugin@1.31.2.patch",
"agents@0.17.3": "patches/agents@0.17.3.patch",
"libsql@0.5.29": "patches/libsql@0.5.29.patch",
"@electric-sql/pglite-socket@0.1.4": "patches/@electric-sql%2Fpglite-socket@0.1.4.patch"
"@electric-sql/pglite-socket@0.1.4": "patches/@electric-sql%2Fpglite-socket@0.1.4.patch",
"@modelcontextprotocol/client@2.0.0": "patches/@modelcontextprotocol%2Fclient@2.0.0.patch"
}
}
39 changes: 39 additions & 0 deletions patches/@modelcontextprotocol%2Fclient@2.0.0.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
diff --git a/dist/shimsWorkerd.cjs b/dist/shimsWorkerd.cjs
index 29ef3a5b9872dbc934ec094d7419f6c965808e86..4b2dc3e755e5566edbbfd56087587e5c080ade02 100644
--- a/dist/shimsWorkerd.cjs
+++ b/dist/shimsWorkerd.cjs
@@ -7,7 +7,11 @@ const require_cfWorkerProvider = require('./cfWorkerProvider-B3dvjU3F.cjs');
*
* This file is selected via package.json export conditions when running in workerd.
*/
-require_src.preloadSchemas();
+/* executor-patch: no-preload-schemas — the upstream warm-up eagerly builds
+ * both protocol eras' zod schemas (~15MB heap) in EVERY isolate at module
+ * eval; under Cloudflare memory pressure this collapsed isolate reuse
+ * (~5-7 -> ~3 requests/isolate, 2026-08-25 latency incident). Schemas stay
+ * lazy+memoized; the first MCP use in an isolate pays ~15ms CPU instead. */
/**
* Whether `fetch()` may throw `TypeError` due to CORS. CORS is a browser-only concept —
* in Cloudflare Workers, a `TypeError` from `fetch` is always a real network/configuration
diff --git a/dist/shimsWorkerd.mjs b/dist/shimsWorkerd.mjs
index 02d2730aca540adf88d52487ec3f3a9b3f8e80ee..beb9604d2f7f486f711ef4ba7f93a85caf72c2dc 100644
--- a/dist/shimsWorkerd.mjs
+++ b/dist/shimsWorkerd.mjs
@@ -1,4 +1,3 @@
-import { n as preloadSchemas } from "./src-D_zzAWoS.mjs";
import { t as CfWorkerJsonSchemaValidator } from "./cfWorkerProvider-BylNJ1R5.mjs";

//#region src/shimsWorkerd.ts
@@ -7,7 +6,11 @@ import { t as CfWorkerJsonSchemaValidator } from "./cfWorkerProvider-BylNJ1R5.mj
*
* This file is selected via package.json export conditions when running in workerd.
*/
-preloadSchemas();
+/* executor-patch: no-preload-schemas — the upstream warm-up eagerly builds
+ * both protocol eras' zod schemas (~15MB heap) in EVERY isolate at module
+ * eval; under Cloudflare memory pressure this collapsed isolate reuse
+ * (~5-7 -> ~3 requests/isolate, 2026-08-25 latency incident). Schemas stay
+ * lazy+memoized; the first MCP use in an isolate pays ~15ms CPU instead. */
/**
* Whether `fetch()` may throw `TypeError` due to CORS. CORS is a browser-only concept —
* in Cloudflare Workers, a `TypeError` from `fetch` is always a real network/configuration
15 changes: 15 additions & 0 deletions scripts/check-patched-deps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,21 @@ const runtimeChecks: readonly RuntimeCheck[] = [
// not exist in the upstream 0.17.3 dist.
sentinels: ["markStreamUndelivered", "replayUndeliveredResponses"],
},
{
package: "@modelcontextprotocol/client@2.0.0 (dist/shimsWorkerd.mjs)",
purpose:
"drops the workerd shim's module-eval preloadSchemas() (~15MB heap per isolate; " +
"collapsed isolate reuse in the 2026-08-25 latency incident) — schemas build lazily",
resolveEntry: () => {
// The workerd shim is only reachable through the `workerd` export
// condition, which require.resolve doesn't use — resolve the package
// main from the workspace package that depends on it and take the
// sibling shim file.
const main = resolveFrom("@modelcontextprotocol/client", "packages/plugins/mcp");
return resolve(main, "..", "shimsWorkerd.mjs");
},
sentinels: ["executor-patch: no-preload-schemas"],
},
];

for (const check of runtimeChecks) {
Expand Down
Loading