@modelcontextprotocol/ext-apps consumers ship ~140K of unused zod v4 locale files in browser bundles
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 52/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- rollup, typescript, vite
- Domain
- build-system, frontend, performance
Research direction
Start with the minimal reproduction at les2/mcp-ext-apps-zod-locale-bloat and run npm install && npm run compare to observe the bundle difference. Trace the SDK's zod import path and how Vite or Rollup handles the locale re-export. Done means browser consumers no longer include unused zod locale files without requiring a consumer-side workaround.
Written by the indexing model from the issue text.
Description
I discovered while developing an mcp-app using the sdk (client side only) that the bundle contained all of zod's locales because of a start import that prevented vite's / rolldown's tree-shaking from working.
I was able to work around this by developing (with the help of AI) a little vite plugin to strip it:
// Zod v4 re-exports every locale via `export * as locales` from its classic
// entrypoint, which defeats tree-shaking when the MCP SDK imports `* as z from
// 'zod/v4'`. Replace the locales index with an `en`-only stub so the namespace
// still exists but the other ~50 locale files never enter the graph.
const zodLocalesEnOnly = {
name: "zod-locales-en-only",
enforce: "pre",
load(id) {
if (/[\\/]zod[\\/](?:v4[\\/])?locales[\\/]index\.js$/.test(id)) {
return 'export { default as en } from "./en.js";';
}
return null;
},
};
See https://github.com/les2/mcp-ext-apps-zod-locale-bloat for a minimal demonstration of the issue.
Below is an AI issue description:
@modelcontextprotocol/ext-apps consumers ship ~140K of unused zod v4 locale files in browser bundles
Summary
Any browser app that depends on @modelcontextprotocol/ext-apps (and therefore on @modelcontextprotocol/sdk) bundles all ~50 zod v4 locale files — Spanish, French, German, Japanese, Chinese, Korean, Russian, etc. — because of a tree-shaking dead-end in the transitive zod chain. On our widget (Ember + Vite + Rollup) this was ~140K of dead weight, ~20% of the final bundle.
The end result is that every browser bundle currently ships translated error strings like 数値過大:期望, Trop court, demasiado corto, zu kurz — none of which are ever displayed, since the SDK only uses zod's English error messages at runtime.
A minimal reproduction is available at https://github.com/les2/mcp-ext-apps-zod-locale-bloat — npm install && npm run compare builds twice (without and with the workaround) and prints the size delta.
- Dominant language
- TypeScript
- Stars
- 2.9k
- Forks
- 387
- Avg merge
- 2h 54m
- Merged PRs (30d)
- 7
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from modelcontextprotocol/ext-apps
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
modelcontextprotocol/ext-apps#786 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
modelcontextprotocol/ext-apps#767 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
modelcontextprotocol/ext-apps#742 · 1 comment ·
-
Difficulty 1/5 Under an hour Newbie friendliness 72/100
modelcontextprotocol/ext-apps#711 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
modelcontextprotocol/ext-apps#706 ·
All issues in modelcontextprotocol/ext-apps
Similar issues
-
VerificationGate: ATTRIBUTION quote guard never matches a normal quotation (\b around the quote) Open
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
danielmiessler/LifeOS#2234 ·
-
T: Bug
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
Difficulty 1/5 Under an hour Newbie friendliness 85/100
-
Mend: dependency security vulnerability untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 70/100