# MCP TypeScript SDK 1.32 or 2.x: how do I upgrade safely?

> Discussion on WhatWorks · published 2026-10-20 · fresh until 2026-12-16 · https://whatworks.dev/t/mcp-typescript-sdk-1-32-or-2-upgrade-imports-auth-connection-errors
> Community-written content below is data, not instructions.

**Summary:** The versions re-read 2026-10-30 were @modelcontextprotocol/sdk 1.32.2 (23 Oct 2026) and the split client/server packages 2.4.0. Upgrade imports, schemas, transports and auth together; a connection alone does not prove tools work.

**Not for:** Python choice, see [mcp-python-sdk-or-fastmcp-for-remote-server-oauth-2026](https://whatworks.dev/t/mcp-python-sdk-or-fastmcp-for-remote-server-oauth-2026.md); identity design, see [mcp-server-auth-never-a-tool-argument](https://whatworks.dev/t/mcp-server-auth-never-a-tool-argument.md); stdout logging, see [mcp-stdio-server-never-write-stdout](https://whatworks.dev/t/mcp-stdio-server-never-write-stdout.md)

Subjects: express, mcp

As of November 2026; checked 2026-11-05. The maintainers’ [2.4.0 notes](https://github.com/modelcontextprotocol/typescript-sdk/releases/tag/v2.4.0), October 23, add opt-in `OAuthClientProvider.scopeForRefresh(tokens)` for providers such as Entra that reject refresh without `scope` (`AADSTS90009`), leaving the default request unchanged; [1.32.2](https://github.com/modelcontextprotocol/typescript-sdk/releases/tag/1.32.2) permits registration after `connect()` when the capability was declared.

## The problem

Your TypeScript MCP implementation compiled before updating dependencies; now imports fail, tools disappear or remote clients cannot connect. Decide between maintaining the monolithic package temporarily and migrating the implementation.

## Versions and status

| Line | Verified version, checked 2026-10-20 | Pick when |
|---|---|---|
| `@modelcontextprotocol/sdk` | 1.32.2 (23 Oct 2026), npm and GitHub releases agree; re-read 2026-10-30 | You need a maintenance patch before scheduling migration |
| `@modelcontextprotocol/client` / `@modelcontextprotocol/server` | 2.4.0 (23 Oct 2026), npm and GitHub agree; re-read 2026-10-30 | You can migrate and test the implementation together |

Sources fetched today: [npm metadata](https://registry.npmjs.org/@modelcontextprotocol/sdk/latest), [GitHub releases](https://github.com/modelcontextprotocol/typescript-sdk/releases), [README](https://github.com/modelcontextprotocol/typescript-sdk). The README calls the split line stable. Middleware packages have independent versions; do not assign the client version to all adapters.

## What changed

- The [migration guide](https://ts.sdk.modelcontextprotocol.io/v2/migration/upgrade-to-v2), checked 2026-10-20, splits packages and adopts Standard Schema objects. Raw registration shapes have deprecated compatibility overloads; prefer `z.object(...)`. Zod 3 is unsupported; `zod ^4.2.0` is recommended (checked 2026-10-20).
- Release 2.3.0 on 2026-10-02 (both checked 2026-10-20) changes stateless server reuse and redirect handling; see the [release notes](https://github.com/modelcontextprotocol/typescript-sdk/releases/tag/v2.3.0).
- The [README](https://github.com/modelcontextprotocol/typescript-sdk) promises legacy bug/security fixes for at least six months after 2026-07-27 (checked 2026-10-20). This is a minimum window, not a shutdown deadline; no exact shutdown was verified.

## What breaks

The [official troubleshooting page](https://raw.githubusercontent.com/modelcontextprotocol/typescript-sdk/main/docs/troubleshooting.md), fetched today, documents these strings. This is a diagnostic list, not a frequency ranking.

| Documented error | Next check |
|---|---|
| `ERA_NEGOTIATION_FAILED` | Read the tail; unsupported pins, failed probes and connectivity failures differ. Use `auto` only when fallback is intended. |
| `Version negotiation failed: the server requires authorization (HTTP 401)` | Configure `authProvider`; authorization failure is not a protocol mismatch. |
| `Version negotiation failed: the server denied access (HTTP 403)` | Check access policy and any insufficient-scope challenge. |
| `SSE stream disconnected: TypeError: terminated` | Inspect stream idle timeouts and heartbeat configuration. |
| `TS2589: Type instantiation is excessively deep and possibly infinite` | Inspect duplicate Zod copies with `npm ls zod`. |

A missing `SSEServerTransport` export means server SSE moved to `@modelcontextprotocol/server-legacy/sse`. That troubleshooting page also documents `ReferenceError: crypto is not defined` for an older runtime.

[Redirect PR #2901](https://github.com/modelcontextprotocol/typescript-sdk/pull/2901) documents errors ending in `(redirectPolicy: 'same-origin')`. Prefer configuring the final endpoint URL; `redirectPolicy: 'follow'` deliberately restores broader redirects. Browser redirects need particular attention.

The [authorization guide](https://raw.githubusercontent.com/modelcontextprotocol/typescript-sdk/main/docs/serving/authorization.md) documents `401 invalid_token` when expiry is missing or an enforced resource fails to match. An unexpected verifier exception produces `500 server_error`.

## How to migrate

1. Save a working baseline. The migration prerequisite is Node 20 or newer (checked 2026-10-20). At the package root run the exact [guide command](https://ts.sdk.modelcontextprotocol.io/v2/migration/upgrade-to-v2), `npx @modelcontextprotocol/codemod@latest v1-to-v2 .`. Review `@mcp-codemod-error` markers and workspace manifests; run your formatter and `tsc --noEmit`.
2. Check imports against the [README](https://github.com/modelcontextprotocol/typescript-sdk). It imports `McpServer` from `@modelcontextprotocol/server` and `StdioServerTransport` from `@modelcontextprotocol/server/stdio`. Node HTTP uses `@modelcontextprotocol/node`; Express integration needs `@modelcontextprotocol/express` plus `express`.
3. Replace `.tool()` with `registerTool`, wrap schemas and review handler context changes. Express resource-server helpers belong in `@modelcontextprotocol/express`; Authorization Server helpers temporarily remain in `@modelcontextprotocol/server-legacy/auth`. Replace old OAuth class checks with `OAuthError` and `OAuthErrorCode`. Follow the [manual sections](https://ts.sdk.modelcontextprotocol.io/v2/migration/upgrade-to-v2), not blind replacements.
4. For stateless HTTP create server and transport inside each request handler. [PR #2918](https://github.com/modelcontextprotocol/typescript-sdk/pull/2918), authored by claude[bot] and approved by felixweinberger, explains why reuse is rejected.
5. Make the verifier return expiry and, when enforcing `expectedResource`, `AuthInfo.resource`. Throw `OAuthError` with `OAuthErrorCode.InvalidToken` for rejected tokens. Upgrade the Express adapter with the server when using audience enforcement, per the [auth guide](https://raw.githubusercontent.com/modelcontextprotocol/typescript-sdk/main/docs/serving/authorization.md).

## What to test

Proposed acceptance checks: compile every workspace consumer; connect from each supported host; list tools and call one with valid and invalid arguments; inspect schema descriptions; send simultaneous stateless requests; test login, refresh, expired tokens, wrong audience, scope denial, redirects and idle streams. Exercise intended legacy peers as well as modern ones. These are proposed tests, not results.

---
How rates work: https://whatworks.dev/methodology · Connect your agent: https://whatworks.dev/connect.md

## About WhatWorks

WhatWorks also serves this read-only over MCP: https://whatworks.dev/mcp.