Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .changeset/beta-release.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
'@modelcontextprotocol/server': patch
'@modelcontextprotocol/client': patch
'@modelcontextprotocol/core': patch
'@modelcontextprotocol/server-legacy': patch
'@modelcontextprotocol/codemod': patch
'@modelcontextprotocol/express': patch
'@modelcontextprotocol/hono': patch
'@modelcontextprotocol/fastify': patch
'@modelcontextprotocol/node': patch
---

First beta release of SDK v2 with support for the MCP 2026-07-28 specification
revision. See the migration guides for upgrading from v1
(`docs/migration/upgrade-to-v2.md`) and adopting the 2026-07-28 revision
(`docs/migration/support-2026-07-28.md`).
32 changes: 16 additions & 16 deletions .changeset/pre.json
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
{
"mode": "pre",
"tag": "alpha",
"tag": "beta",
Comment thread
claude[bot] marked this conversation as resolved.
Comment thread
claude[bot] marked this conversation as resolved.
"initialVersions": {
"@modelcontextprotocol/eslint-config": "2.0.0",
"@modelcontextprotocol/tsconfig": "2.0.0",
"@modelcontextprotocol/vitest-config": "2.0.0",
"@modelcontextprotocol/examples": "2.0.0-alpha.0",
"@modelcontextprotocol/client": "2.0.0-alpha.0",
"@modelcontextprotocol/core-internal": "2.0.0-alpha.0",
"@modelcontextprotocol/express": "2.0.0-alpha.0",
"@modelcontextprotocol/fastify": "2.0.0-alpha.0",
"@modelcontextprotocol/hono": "2.0.0-alpha.0",
"@modelcontextprotocol/node": "2.0.0-alpha.0",
"@modelcontextprotocol/server": "2.0.0-alpha.0",
"@modelcontextprotocol/server-legacy": "2.0.0-alpha.0",
"@modelcontextprotocol/core": "2.0.0-alpha.0",
"@modelcontextprotocol/codemod": "2.0.0-alpha.0",
"@modelcontextprotocol/test-conformance": "2.0.0-alpha.0",
"@modelcontextprotocol/test-helpers": "2.0.0-alpha.0",
"@modelcontextprotocol/test-integration": "2.0.0-alpha.0",
"@modelcontextprotocol/test-e2e": "2.0.0-alpha.0",
"@mcp-examples/client-quickstart": "2.0.0-alpha.0",
"@mcp-examples/server-quickstart": "2.0.0-alpha.0",
"@mcp-examples/shared": "2.0.0-alpha.0"
"@mcp-examples/shared": "2.0.0-alpha.0",
Comment thread
claude[bot] marked this conversation as resolved.
"@modelcontextprotocol/client": "2.0.0-alpha.4",
"@modelcontextprotocol/codemod": "2.0.0-alpha.2",
"@modelcontextprotocol/core": "2.0.0-alpha.2",
"@modelcontextprotocol/core-internal": "2.0.0-alpha.3",
"@modelcontextprotocol/express": "2.0.0-alpha.4",
"@modelcontextprotocol/fastify": "2.0.0-alpha.4",
"@modelcontextprotocol/hono": "2.0.0-alpha.4",
"@modelcontextprotocol/node": "2.0.0-alpha.4",
"@modelcontextprotocol/server": "2.0.0-alpha.4",
"@modelcontextprotocol/server-legacy": "2.0.0-alpha.4",
"@modelcontextprotocol/test-conformance": "2.0.0-alpha.1",
"@modelcontextprotocol/test-e2e": "2.0.0-alpha.1",
"@modelcontextprotocol/test-helpers": "2.0.0-alpha.0",
"@modelcontextprotocol/test-integration": "2.0.0-alpha.1"
},
"changesets": [
"abort-handlers-on-close",
Expand Down
2 changes: 1 addition & 1 deletion docs/migration/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ v2 packages (`@modelcontextprotocol/client`, `@modelcontextprotocol/server`, …
Start by running the codemod:

```bash
npx @modelcontextprotocol/codemod@alpha v1-to-v2 .
npx @modelcontextprotocol/codemod@beta v1-to-v2 .
```

Run it at the package root (`.`) — real projects import the SDK from `test/`,
Expand Down
7 changes: 4 additions & 3 deletions docs/migration/support-2026-07-28.md
Original file line number Diff line number Diff line change
Expand Up @@ -614,9 +614,10 @@ Task methods are excluded from the typed method maps: `RequestMethod` / `Request
`ctx.mcpReq.send()`, `setRequestHandler()`, `setNotificationHandler()` reject task
methods at compile time. `ResultTypeMap['tools/call']` is plain `CallToolResult` (no
`| CreateTaskResult`); same for `sampling/createMessage` and `elicitation/create`.
(The published `2.0.0-alpha.3` typings predate this exclusion — there the typed maps
still carry the `tasks/*` entries and the `CreateTaskResult` unions; narrow with the
`isCallToolResult` guard until the next published alpha.) Where
(Typings published before `2.0.0-alpha.4` predate this exclusion: there the typed
maps still carry the `tasks/*` entries and the `CreateTaskResult` unions; narrow with
the `isCallToolResult` guard if you are pinned to one of those alphas. `2.0.0-alpha.4`
and later include the exclusion.) Where
task interop is genuinely required, use the explicit-schema custom-method form
(`request({ method: 'tasks/get', params }, GetTaskResultSchema)`). Inbound `tasks/*`
requests → `-32601`.
Expand Down
30 changes: 15 additions & 15 deletions docs/migration/upgrade-to-v2.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ If you are already on v2 and want to adopt the **2026-07-28 protocol revision**,
only; CommonJS callers must use dynamic `import()`.
2. **Run the codemod.**
```bash
npx @modelcontextprotocol/codemod@alpha v1-to-v2 .
npx @modelcontextprotocol/codemod@beta v1-to-v2 .
```
Run it at the **package root** (`.`), not `./src` — it also rewrites `package.json`,
and real projects import the SDK from `test/`, `scripts/`, and fixtures too.
Expand Down Expand Up @@ -233,15 +233,14 @@ for the literal instead; and the emitted quote style differs from v1, so a
quote-anchored pattern misses silently — match either quote. v2 also ships ESM only:
`/dist/cjs/` ↔ `/dist/esm/` flavor-pair path swaps have no equivalent.

#### Registry availability during the alpha
#### Registry availability during the beta

All v2 packages are published on the public npm registry. Two notes for the alpha
All v2 packages are published on the public npm registry. Two notes for the beta
window:

- The packages do not share one version number — at the time of writing
`@modelcontextprotocol/core` rides a lower prerelease than its siblings. The
codemod writes ranges that match what is published, so prefer its manifest output
over hand-pinning every package to the same tag.
- As of `2.0.0-beta.1` all v2 packages share one version number (earlier alphas
Comment thread
claude[bot] marked this conversation as resolved.
did not). The codemod writes ranges that match what is published, so prefer its
manifest output over hand-pinning every package.
- Environments that resolve through a corporate or private registry mirror may not
have synced the newer scoped packages yet (the symptom is "not found" for a package
that exists on npmjs.org). Point the install at the public registry
Expand Down Expand Up @@ -1000,8 +999,9 @@ the third argument — `new SdkHttpError(SdkErrorCode.ClientHttpNotImplemented,
(carries `data.requiredCapabilities`) are new typed `ProtocolError` subclasses.
`resources/read` for an unknown URI now answers `-32602` on every protocol revision
(v1.x already emitted `-32602`; an interim `-32002` from earlier v2 alphas is mapped at
the encode seam — published `2.0.0-alpha.3` predates the mapping and still emits
`-32002` on the wire, so accept both until the next published alpha). The encode-seam mapping applies to **your own throws too**: a handler
the encode seam — `2.0.0-alpha.3` and earlier predate the mapping and still emit
`-32002` on the wire, so accept both if peers may run those alphas; `2.0.0-alpha.4`
and later emit `-32602`). The encode-seam mapping applies to **your own throws too**: a handler
that deliberately throws `ProtocolError(ProtocolErrorCode.ResourceNotFound, …)` reaches
peers as `-32602` — a server can no longer emit `-32002` on the wire.
`ProtocolErrorCode.ResourceNotFound` (`-32002`) stays importable as
Expand Down Expand Up @@ -1373,12 +1373,12 @@ The role-aggregate unions (`ClientRequest`, `ServerResult`, `ServerRequest`,
(`RequestMethod`, `RequestTypeMap`, `ResultTypeMap`, `NotificationTypeMap`) no longer
include task vocabulary; the deprecated `Task*` types remain importable on their own.
(One published-alpha qualification, like the `-32002` note in [Errors](#errors): the
`2.0.0-alpha.3` typings predate this — the typed maps there still carry the `tasks/*`
entries, and `ResultTypeMap['tools/call']` still unions `CreateTaskResult`, so a
`client.request({ method: 'tools/call', … })` result does not assign to
`Promise<CallToolResult>`. Narrow with the `isCallToolResult` guard until the next
published alpha — the guard is the recommended discrimination tool anyway, per the next
paragraph.)
`2.0.0-alpha.3` and earlier typings predate this — the typed maps there still carry the
`tasks/*` entries, and `ResultTypeMap['tools/call']` still unions `CreateTaskResult`, so
a `client.request({ method: 'tools/call', … })` result does not assign to
`Promise<CallToolResult>`. If pinned to those alphas, narrow with the
`isCallToolResult` guard the recommended discrimination tool anyway, per the next
paragraph; `2.0.0-alpha.4` and later are unaffected.)

**Discriminating result shapes: use guards, not the `in` operator.** The v2
zod-inferred result types are passthrough objects — every union member carries an index
Expand Down
2 changes: 1 addition & 1 deletion examples/client-quickstart/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@mcp-examples/client-quickstart",
"private": true,
"version": "2.0.0-alpha.0",
"version": "2.0.0-beta.0",
"type": "module",
"scripts": {
"build": "tsc",
Expand Down
2 changes: 1 addition & 1 deletion examples/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@modelcontextprotocol/examples",
"private": true,
"version": "2.0.0-alpha.0",
"version": "2.0.0-beta.0",
"description": "Runnable MCP TypeScript SDK examples — one story per directory, each a self-verifying client/server pair",
"license": "MIT",
"author": "Anthropic, PBC (https://anthropic.com)",
Expand Down
2 changes: 1 addition & 1 deletion examples/server-quickstart/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@mcp-examples/server-quickstart",
"private": true,
"version": "2.0.0-alpha.0",
"version": "2.0.0-beta.0",
"type": "module",
"scripts": {
"build": "tsc",
Expand Down
2 changes: 1 addition & 1 deletion examples/shared/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@mcp-examples/shared",
"private": true,
"version": "2.0.0-alpha.0",
"version": "2.0.0-beta.0",
"description": "Model Context Protocol implementation for TypeScript",
"license": "MIT",
"author": "Anthropic, PBC (https://anthropic.com)",
Expand Down
4 changes: 2 additions & 2 deletions packages/client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ The MCP (Model Context Protocol) TypeScript client SDK. Build MCP clients that c

<!-- prettier-ignore -->
> [!WARNING]
> **This is an alpha release.** Expect breaking changes until v2 stabilizes. We're publishing early to gather feedback — please try it and open issues — but we can't guarantee API stability yet. We'll aim to minimize disruption between alphas.
> **This is a beta release.** The API surface is settling but breaking changes remain possible until v2 stabilizes. Please try it and open issues — feedback during the beta directly shapes the stable release.

<!-- prettier-ignore -->
> [!NOTE]
Expand All @@ -13,7 +13,7 @@ The MCP (Model Context Protocol) TypeScript client SDK. Build MCP clients that c
## Install

```bash
npm install @modelcontextprotocol/client@alpha
npm install @modelcontextprotocol/client@beta
```

TypeScript ≥6.0 no longer auto-includes `@types/*` — add `"types": ["node"]` to your `tsconfig.json` `compilerOptions` (the published `.d.mts` references `Buffer`).
Expand Down
2 changes: 1 addition & 1 deletion packages/client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@modelcontextprotocol/client",
"version": "2.0.0-alpha.4",
"version": "2.0.0-beta.0",
"description": "Model Context Protocol implementation for TypeScript - Client package",
"license": "MIT",
"author": "Anthropic, PBC (https://anthropic.com)",
Expand Down
4 changes: 2 additions & 2 deletions packages/codemod/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ Codemods for migrating MCP TypeScript SDK code between major versions.
## Usage

```bash
npx @modelcontextprotocol/codemod@alpha v1-to-v2 .
npx @modelcontextprotocol/codemod@beta v1-to-v2 .

# or a single source file (manifest changes are reported, not applied)
npx @modelcontextprotocol/codemod@alpha v1-to-v2 src/server.ts
npx @modelcontextprotocol/codemod@beta v1-to-v2 src/server.ts
```

The codemod rewrites TypeScript and JavaScript source files
Expand Down
2 changes: 1 addition & 1 deletion packages/codemod/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@modelcontextprotocol/codemod",
"version": "2.0.0-alpha.2",
"version": "2.0.0-beta.0",
"description": "Codemod to migrate MCP TypeScript SDK code from v1 to v2",
"license": "MIT",
"author": "Anthropic, PBC (https://anthropic.com)",
Expand Down
2 changes: 1 addition & 1 deletion packages/core-internal/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@modelcontextprotocol/core-internal",
"private": true,
"version": "2.0.0-alpha.3",
"version": "2.0.0-beta.0",
"description": "Model Context Protocol implementation for TypeScript - Core package",
"license": "MIT",
"author": "Anthropic, PBC (https://anthropic.com)",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@modelcontextprotocol/core",
"version": "2.0.0-alpha.2",
"version": "2.0.0-beta.0",
"description": "Model Context Protocol for TypeScript — public Zod schemas (spec + OAuth/OpenID)",
"license": "MIT",
"author": "Anthropic, PBC (https://anthropic.com)",
Expand Down
2 changes: 1 addition & 1 deletion packages/middleware/express/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@modelcontextprotocol/express",
"private": false,
"version": "2.0.0-alpha.4",
"version": "2.0.0-beta.0",
"description": "Express adapters for the Model Context Protocol TypeScript server SDK - Express middleware",
"license": "MIT",
"author": "Anthropic, PBC (https://anthropic.com)",
Expand Down
2 changes: 1 addition & 1 deletion packages/middleware/fastify/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@modelcontextprotocol/fastify",
"private": false,
"version": "2.0.0-alpha.4",
"version": "2.0.0-beta.0",
"description": "Fastify adapters for the Model Context Protocol TypeScript server SDK - Fastify middleware",
"license": "MIT",
"author": "Anthropic, PBC (https://anthropic.com)",
Expand Down
2 changes: 1 addition & 1 deletion packages/middleware/hono/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@modelcontextprotocol/hono",
"private": false,
"version": "2.0.0-alpha.4",
"version": "2.0.0-beta.0",
"description": "Hono adapters for the Model Context Protocol TypeScript server SDK - Hono middleware",
"license": "MIT",
"author": "Anthropic, PBC (https://anthropic.com)",
Expand Down
2 changes: 1 addition & 1 deletion packages/middleware/node/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@modelcontextprotocol/node",
"version": "2.0.0-alpha.4",
"version": "2.0.0-beta.0",
"description": "Model Context Protocol implementation for TypeScript - Node.js middleware",
"license": "MIT",
"author": "Anthropic, PBC (https://anthropic.com)",
Expand Down
2 changes: 1 addition & 1 deletion packages/server-legacy/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@modelcontextprotocol/server-legacy",
"private": false,
"version": "2.0.0-alpha.4",
"version": "2.0.0-beta.0",
"description": "Frozen v1 SSE transport and OAuth Authorization Server helpers for the Model Context Protocol TypeScript SDK. Deprecated; use StreamableHTTP and a dedicated OAuth server in production.",
"deprecated": "This package is a frozen copy of v1's SSE transport and OAuth Authorization Server helpers for migration purposes only. Use StreamableHTTP from @modelcontextprotocol/server and a dedicated OAuth server in production. Will not receive new features.",
"license": "MIT",
Expand Down
4 changes: 2 additions & 2 deletions packages/server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ The MCP (Model Context Protocol) TypeScript server SDK. Build MCP servers that e

<!-- prettier-ignore -->
> [!WARNING]
> **This is an alpha release.** Expect breaking changes until v2 stabilizes. We're publishing early to gather feedback — please try it and open issues — but we can't guarantee API stability yet. We'll aim to minimize disruption between alphas.
> **This is a beta release.** The API surface is settling but breaking changes remain possible until v2 stabilizes. Please try it and open issues — feedback during the beta directly shapes the stable release.

<!-- prettier-ignore -->
> [!NOTE]
Expand All @@ -13,7 +13,7 @@ The MCP (Model Context Protocol) TypeScript server SDK. Build MCP servers that e
## Install

```bash
npm install @modelcontextprotocol/server@alpha
npm install @modelcontextprotocol/server@beta
```

TypeScript ≥6.0 no longer auto-includes `@types/*` — add `"types": ["node"]` to your `tsconfig.json` `compilerOptions` (the published `.d.mts` references `Buffer`).
Expand Down
2 changes: 1 addition & 1 deletion packages/server/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@modelcontextprotocol/server",
"version": "2.0.0-alpha.4",
"version": "2.0.0-beta.0",
"description": "Model Context Protocol implementation for TypeScript - Server package",
"license": "MIT",
"author": "Anthropic, PBC (https://anthropic.com)",
Expand Down
2 changes: 1 addition & 1 deletion test/conformance/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@modelcontextprotocol/test-conformance",
"private": true,
"version": "2.0.0-alpha.1",
"version": "2.0.0-beta.0",
"description": "Model Context Protocol implementation for TypeScript",
"license": "MIT",
"author": "Anthropic, PBC (https://anthropic.com)",
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@modelcontextprotocol/test-e2e",
"private": true,
"version": "2.0.0-alpha.1",
"version": "2.0.0-beta.0",
"description": "Model Context Protocol implementation for TypeScript",
"license": "MIT",
"author": "Anthropic, PBC (https://anthropic.com)",
Expand Down
2 changes: 1 addition & 1 deletion test/helpers/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@modelcontextprotocol/test-helpers",
"private": true,
"version": "2.0.0-alpha.0",
"version": "2.0.0-beta.0",
"description": "Model Context Protocol implementation for TypeScript",
"license": "MIT",
"author": "Anthropic, PBC (https://anthropic.com)",
Expand Down
2 changes: 1 addition & 1 deletion test/integration/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@modelcontextprotocol/test-integration",
"private": true,
"version": "2.0.0-alpha.1",
"version": "2.0.0-beta.0",
"description": "Model Context Protocol implementation for TypeScript",
"license": "MIT",
"author": "Anthropic, PBC (https://anthropic.com)",
Expand Down
Loading