Skip to content

build: declare sideEffects in core, client and server - #3254

Draft
ochafik wants to merge 1 commit into
mainfrom
claude/loving-johnson-onwvrg-side-effects
Draft

ochafik wants to merge 1 commit into
mainfrom
claude/loving-johnson-onwvrg-side-effects

Conversation

@ochafik

@ochafik ochafik commented Nov 30, 2026

Copy link
Copy Markdown
Contributor

Declares sideEffects in the core, client and server manifests so bundlers can leave out modules an app does not use. Draft, as a basis for discussion; first of a stack of three.

Motivation and Context

Browser code that only needs Protocol currently gets Client, the JSON Schema validator and @opentelemetry/api too. MCP Apps views and hosts (@modelcontextprotocol/ext-apps) are in that position.

Minified size of a bundle using App from ext-apps, zod included, against packed builds of main:

esbuild webpack rolldown rollup
before 347 kB 338 kB 264 kB 247 kB
after 256 kB 245 kB 246 kB 243 kB

shimsWorkerd calls preloadSchemas() at module scope, so client and server list it instead of using false.

How Has This Been Tested?

New treeShaking.test.ts bundles the built client with esbuild. It fails on main and passes here, and checks the Workers warm-up survives. The server warm-up was checked by hand only. The core, core-internal, client, server, integration and e2e suites were run on the full stack with no new failures, using unlocked dependencies; three tests fail there with and without this change.

Breaking Changes

None.

Types of changes

  • CI/build script update

Additional context

To discuss:

  • esbuild becomes a devDependency of client (already in the lockfile). Fine, and wanted in server too?
  • server-legacy and the middleware packages are not audited or changed.

Generated by Claude Code

Lets bundlers leave out unused modules. The workerd shim is listed so its
schema warm-up survives.

Co-authored-by: ochafik <ochafik@anthropic.com>
@changeset-bot

changeset-bot Bot commented Nov 30, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 23538c4

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 6 packages
Name Type
@modelcontextprotocol/core Patch
@modelcontextprotocol/client Patch
@modelcontextprotocol/server Patch
@modelcontextprotocol/core-internal Patch
@modelcontextprotocol/server-legacy Patch
@modelcontextprotocol/codemod Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new

pkg-pr-new Bot commented Nov 30, 2026

Copy link
Copy Markdown

Open in StackBlitz

@modelcontextprotocol/client

npm i https://pkg.pr.new/@modelcontextprotocol/client@3254

@modelcontextprotocol/codemod

npm i https://pkg.pr.new/@modelcontextprotocol/codemod@3254

@modelcontextprotocol/core

npm i https://pkg.pr.new/@modelcontextprotocol/core@3254

@modelcontextprotocol/server

npm i https://pkg.pr.new/@modelcontextprotocol/server@3254

@modelcontextprotocol/server-legacy

npm i https://pkg.pr.new/@modelcontextprotocol/server-legacy@3254

@modelcontextprotocol/express

npm i https://pkg.pr.new/@modelcontextprotocol/express@3254

@modelcontextprotocol/fastify

npm i https://pkg.pr.new/@modelcontextprotocol/fastify@3254

@modelcontextprotocol/hono

npm i https://pkg.pr.new/@modelcontextprotocol/hono@3254

@modelcontextprotocol/node

npm i https://pkg.pr.new/@modelcontextprotocol/node@3254

commit: 23538c4

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants