Load the MCP client SDK lazily on first outbound connection - #1747
Merged
Conversation
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
executor-cloud | e6eaeff | Aug 25 2026, 09:50 PM |
Contributor
Cloudflare previewTorn down — the PR is closed. |
@executor-js/cli
@executor-js/config
@executor-js/execution
@executor-js/sdk
@executor-js/codemode-core
@executor-js/runtime-quickjs
@executor-js/plugin-file-secrets
@executor-js/plugin-graphql
@executor-js/plugin-keychain
@executor-js/plugin-mcp
@executor-js/plugin-onepassword
@executor-js/plugin-openapi
executor
commit: |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
executor-marketing | e6eaeff | Commit Preview URL Branch Preview URL |
Aug 25 2026, 09:48 PM |
RhysSullivan
marked this pull request as ready for review
August 25, 2026 22:05
This was referenced Aug 25, 2026
Merged
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.
Follow-up to #1742. That patch removed the eager schema preload, but the statically-imported
@modelcontextprotocol/clientbarrel still costs ~11MB of heap plus module-eval CPU per isolate, and@modelcontextprotocol/core(imported for one JSON schema) another ~8.6MB. Post-#1742 traces show the remaining p95 tail is entirely first-request-on-fresh-isolate cost: session verify p50 is 2.5s on isolates whose JWKS cache was empty at start and 0ms otherwise.client-module.tslazy-loads and memoizes the client barrel + cf-worker validator on first outbound connect, mirroring the existing stdio dynamic import. Isolates that never dial an MCP server never load it.SdkHttpError.isInstanceetc.) consults the loader'smcpClientSdkIfLoaded: errors of those classes are only constructed by the loaded module, so "not loaded" soundly means "not an SDK error".call-tool-result-schema.gen.ts+ drift test + regen script), removing the runtime@modelcontextprotocol/coreimport entirely — it was needed for exactly one schema, including on cached-catalog paths that never connect.In the built cloud worker, the client chunk is now reachable only through dynamic import (via the execution stack, itself lazy); it was previously in the eager first-request graph.
Verify after deploy: isolate reuse (requests per
service.instance.id) up from ~4-5, and cold-isolatelocal_verifyp50 down from ~2.5s in the executor-cloud dataset.