Skip to content

Drop MCP SDK v1 runtime dependency by migrating the --proxy server to SDK v2 #322

Description

@jancurn

Problem

The v0.6.0-beta.0 release grew the full install size by +34.5% (21.77 MB → 29.28 MB) compared to v0.5.0.

The cause: 0.6.0 added the MCP TypeScript SDK v2 (@modelcontextprotocol/client + @modelcontextprotocol/core) for 2026-07-28 protocol support, while SDK v1 (@modelcontextprotocol/sdk) remains a runtime dependency — its only production use is src/bridge/proxy-server.ts (the connect --proxy MCP server). Users therefore install both SDK generations.

Measured production node_modules (npm, Linux):

Configuration Size
v0.5.0 (SDK v1 only) 33 MB
v0.6.0-beta.0 (v1 + v2 client/core) 41 MB
v2 client/core only (v1 removed) 22 MB
Full v2 stack incl. @modelcontextprotocol/server (v1 removed) 28 MB

The delta is exactly the two new packages (client 6.5 MB + core 1.3 MB, no new transitive deps). SDK v1 is disproportionately heavy because it drags in a full HTTP-server stack (express, hono, @hono/node-server, cors, ajv, raw-body, zod-to-json-schema, …) that the v2 client does not need.

Proposed fix

  1. Port src/bridge/proxy-server.ts to the SDK v2 server packages (@modelcontextprotocol/server, already a devDependency for the modern e2e test server).
  2. Demote @modelcontextprotocol/sdk to devDependencies — its only remaining user is the legacy e2e test server (test/e2e/server/index.ts).

End state measured at 28 MB — below the v0.5.0 baseline, i.e. this more than undoes the regression.

Blockers — why not now

  • The v2 server packages don't yet serve legacy-protocol clients (our own v2 test server rejects legacy initialize requests). The proxy must keep working for existing 2025-11-25-era MCP clients, so we need legacy fallback support server-side in SDK v2 first.
  • Tasks moved to the io.modelcontextprotocol/tasks extension, which the TS SDK v2 does not implement yet. The proxy doesn't forward tasks today, but migrating before the extension lands would cement that gap instead of letting the proxy pick up tasks passthrough.

Revisit when SDK v2 gains legacy-client compatibility and tasks extension support (or leaves beta).

Side note (upstream)

~55% of the v2 packages' unpacked size is .map source-map files shipped in the npm tarballs (~4.3 MB across client + core alone). Excluding maps from published tarballs upstream would shrink the v2 stack by several MB for every consumer — worth filing on the typescript-sdk repo.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions