ref(mcp-server): Shrink the stdio bundle's Zod and memory footprint
Los mantenedores suelen responder en 1 día
@BYK ya está trabajando en esto.
Desde el 30/10/2026.
Evaluación
Este issue todavía no se ha evaluado.
Descripción
Follow-up from #1731. BYK asked for @sentry/mcp-server to use valibot instead of Zod, like the CLI. We left it out of #1731 and track it here, together with the bundle size and memory use it affects.
Measurements
Taken from the esbuild metafile of packages/mcp-server/dist/sentry-mcp.cjs, built from the #1731 branch:
| Input | Size | Share of 3.58 MB |
|---|---|---|
mcp-core |
832 KB | 23% |
zod 4.6.7 |
508 KB | 14% |
@sentry/api |
482 KB | 13% |
@modelcontextprotocol/server 2.x |
288 KB | 8% |
ajv |
104 KB | 3% |
@modelcontextprotocol/sdk 1.x |
62 KB | 2% |
The 508 KB of Zod breaks down as:
zod/v4/locales: 260 KB. Every error-message locale is included, but we only use English. The classic, mini, and core entry points all importlocales/index.js.zod/v3: about 58 KB. It is loaded by@ai-sdk/provider-utils,zod-to-json-schema, and the v1 SDK'szod-compat.zod/v4core and classic: about 190 KB.
Memory on Node 22: bare node uses about 45 MB RSS. The bundle uses about 137 MB RSS for --version and about 144 MB RSS (27 MB heap) when idle as a stdio server. Loading zod alone adds about 3.5 MB of heap and 80 ms.
Why moving to valibot alone won't fix this
@modelcontextprotocol/server 2.x depends on zod ^4.2.0 and loads zod/v4 internally. Replacing our schemas with valibot would still ship Zod core in the bundle. On top of that, the change would touch 96 non-test files in mcp-core and 6 in mcp-cloudflare, and valibot would need @valibot/to-json-schema to produce the tool JSON schemas the SDK requires.
Options, cheapest first
- Stub
zod/v4/localesdown toeninpackages/mcp-server/script/bundle.ts. This saves about 260 KB without changing any code. - Remove the
zod/v3andzod-to-json-schemapaths and the v1@modelcontextprotocol/sdkfrom the stdio bundle, if nothing in that graph needs them at runtime. - Lazy-load the tool modules so
--version,--help, and startup don't parse the whole bundle. - Only if that isn't enough: migrate
mcp-coreschemas to Standard Schema / valibot. Measure first, because the SDK keeps Zod in the bundle regardless.
Done when
- The bundle size and idle RSS have been measured before and after each change.
MAX_BUNDLE_BYTESinbundle.tsis lowered to the new size.
via BYK.
--
- Lenguaje dominante
- TypeScript
- Estrellas
- 949
- Forks
- 171
- Merge medio
- 22 h 56 min
- PR fusionados (30 d)
- 345
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de getsentry/toolkit
-
CLI enhancement MCP
Dificultad 2/5 1-3 horas Aptitud para principiantes 63/100
getsentry/toolkit#1908 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Docs MCP URL normalization retains query strings and fragmentsPosiblemente ocupada @pcbeingused333 la tomó hace 5 días. Abiertobug MCP
Dificultad 2/5 1-3 horas Aptitud para principiantes 73/100
getsentry/toolkit#1618 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
getsentry/toolkit#1471 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 55/100
getsentry/toolkit#1975 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Release v4 as the Sentry CLI, replacing sentry-cliPosiblemente ocupada @BYK la tomó hoy. Abierto
getsentry/toolkit#1965 · 1 comentario · 1 asignado ·
Los mantenedores suelen responder en 1 día
Todos los issues de getsentry/toolkit
Issues similares
-
cloudflare-cache-binding: `unstorage://` keys are rejected by the Cache API, cache never storesAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 3 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 66/100
Los mantenedores suelen responder en 2 días
-
desktop: pasted image breaks and send fails with "Failed to fetch" after the clipboard temp file is deletedPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abiertoreproduced
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
anomalyco/opencode#62052 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
strapi/design-system#2084 ·
Los mantenedores suelen responder en 3 días
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
Los mantenedores suelen responder en 1 día