ref(mcp-server): Shrink the stdio bundle's Zod and memory footprint
维护者通常 1 天内回复
@BYK 已经在做这个了。
开始于 2026年10月30日。
评估
这个 Issue 还没有评估数据。
描述
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.
--
- 主要语言
- TypeScript
- 星标
- 957
- 派生
- 174
- 平均合并
- 22 小时 56 分钟
- 30 天内合并 PR
- 345
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
getsentry/toolkit 的其他 Issue
-
CLI enhancement MCP
难度 2/5 1-3 小时 新手友好度 63/100
getsentry/toolkit#1908 · 1 条评论 ·
维护者通常 1 天内回复
-
Docs MCP URL normalization retains query strings and fragments可能已有人在做 @pcbeingused333 于 5 天前认领。 未关闭bug MCP
难度 2/5 1-3 小时 新手友好度 73/100
getsentry/toolkit#1618 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
getsentry/toolkit#1471 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 55/100
getsentry/toolkit#1975 · 1 条评论 ·
维护者通常 1 天内回复
-
Release v4 as the Sentry CLI, replacing sentry-cli可能已有人在做 @BYK 今天认领。 未关闭
getsentry/toolkit#1965 · 1 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
查看 getsentry/toolkit 的全部 Issue
相似的 Issue
-
unwrapDatabaseError masks real DB errors with TypeError: Cannot convert object to primitive value未关闭
难度 2/5 1-3 小时 新手友好度 74/100
NEARBuilders/everything-dev#798 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
vercel-labs/durable-harness#53 ·
维护者通常 1 天内回复
-
[Bug]: Redesign tab bars ignore clicks on Linux: hidden chat layers keep window drag regions可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 2/5 1-3 小时 新手友好度 82/100
维护者通常 1 天内回复
-
experiência: a doc manda subir para o Micro do Supabase, mas não diz que exige plano pago nem quanto custa可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭area/docs area/ui enhancement
难度 1/5 1-3 小时 新手友好度 88/100
melgarafael/DeskcommCRM#4098 ·
维护者通常 1 天内回复
-
dependencies platform: ios
难度 1/5 1-3 小时 新手友好度 78/100
software-mansion/react-native-executorch#1617 ·
维护者通常 1 天内回复