chore: enter beta prerelease mode (#2402)

This commit is contained in:
Felix Weinberger 2026-06-30 23:05:07 +01:00 • committed by GitHub
commit a4002596b9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 76 additions and 59 deletions

View file

@ -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/`,

View file

@ -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`.

View file

@ -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.
@ -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
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
@ -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
@ -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