-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Version Packages (alpha) #1845
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Version Packages (alpha) #1845
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,5 +1,84 @@ | ||||||
| # @modelcontextprotocol/client | ||||||
|
|
||||||
| ## 2.0.0-alpha.3 | ||||||
|
|
||||||
| ### Major Changes | ||||||
|
|
||||||
| - [#2128](https://github.com/modelcontextprotocol/typescript-sdk/pull/2128) [`c8d7401`](https://github.com/modelcontextprotocol/typescript-sdk/commit/c8d7401b46f34b6c49b7cfb7b321714d0d4048f6) Thanks [@felixweinberger](https://github.com/felixweinberger)! - SEP-2663: remove | ||||||
| 2025-11 experimental tasks (TaskManager, experimental.tasks.\* accessors). Tasks are now Extensions Track. | ||||||
|
|
||||||
| ### Minor Changes | ||||||
|
|
||||||
| - [#2049](https://github.com/modelcontextprotocol/typescript-sdk/pull/2049) [`4f226c1`](https://github.com/modelcontextprotocol/typescript-sdk/commit/4f226c1e35200616d62f1d7e46a2daa33d91172a) Thanks [@KKonstantinov](https://github.com/KKonstantinov)! - Add `SdkHttpError` subclass | ||||||
| with typed `.status` / `.statusText` accessors for HTTP transport failures. `StreamableHTTPClientTransport` now throws `SdkHttpError` (which extends `SdkError`) for non-OK HTTP responses; `SSEClientTransport` throws `SdkHttpError` for 401-after-reauth (circuit breaker). | ||||||
|
Comment on lines
+11
to
+13
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 PR #2049 (shipping in this alpha.3) introduced Extended reasoning...What the bug isPR #2049 (commit The migration docs that #2049 also rewrote do not consistently note this exception:
Why nothing prevents itThere is no automated check that migration-doc prose matches the implementation, and the contradiction lives between lines of the same hand-written table. The CHANGELOG entry being added in this PR is itself accurately scoped ("throws Step-by-step proof
ImpactDocs-precision drift introduced by a commit shipping in this alpha.3 release. The blast radius is narrow (the worked examples in the docs are correct, and How to fixEither:
|
||||||
|
|
||||||
| - [#1974](https://github.com/modelcontextprotocol/typescript-sdk/pull/1974) [`db83829`](https://github.com/modelcontextprotocol/typescript-sdk/commit/db83829c5bd5d6659c5e7b96638b11953b0e262d) Thanks [@felixweinberger](https://github.com/felixweinberger)! - Add custom (non-spec) | ||||||
| method support: a 3-arg `setRequestHandler(method, schemas, handler)` / `setNotificationHandler(method, schemas, handler)` form for vendor-prefixed methods, and a `request(req, resultSchema)` overload (also on `ctx.mcpReq.send`) for typed custom-method results. Spec-method | ||||||
| calls are unchanged. | ||||||
|
|
||||||
| Response result-schema validation failure now rejects with `SdkError(InvalidResult)` instead of a raw `ZodError`. Adds `SdkErrorCode.InvalidResult`. | ||||||
|
|
||||||
| - [#1653](https://github.com/modelcontextprotocol/typescript-sdk/pull/1653) [`6bec24a`](https://github.com/modelcontextprotocol/typescript-sdk/commit/6bec24a14cb7e3dbe9f5e04aeb893cd0d6e8cb83) Thanks [@rechedev9](https://github.com/rechedev9)! - Add `validateClientMetadataUrl()` | ||||||
| utility for early validation of `clientMetadataUrl` | ||||||
|
|
||||||
| Exports a `validateClientMetadataUrl()` function that `OAuthClientProvider` implementations can call in their constructors to fail fast on invalid URL-based client IDs, instead of discovering the error deep in the auth flow. | ||||||
|
Comment on lines
+3
to
+24
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 PR #1875 (commit 9ed62fe) added a public Extended reasoning...PR #1875 custom-claims feature absent from alpha.3 CHANGELOGWhat the bug is and how it manifests PR #1875 (commit 9ed62fe, merged 2026-04-14 — after the most recent bot review at 10:29 UTC) added a new public The specific code path The Version Packages commit Why existing checks don't catch it There is no CI gate that diffs the set of merged commits against the set of changeset slugs. Changesets faithfully renders whatever Impact Documentation-only: the feature ships and works, but alpha users reading the npm release notes for Step-by-step proof
How to fix Preferred: land a - [#1875] Support custom claims in `PrivateKeyJwtProvider` via a new `claims?: Record<string, unknown>` option on `PrivateKeyJwtProviderOptions`.
claude[bot] marked this conversation as resolved.
|
||||||
|
|
||||||
| - [#2248](https://github.com/modelcontextprotocol/typescript-sdk/pull/2248) [`db28156`](https://github.com/modelcontextprotocol/typescript-sdk/commit/db28156a23032290b3ce3bae00a17544c4807b8f) Thanks [@felixweinberger](https://github.com/felixweinberger)! - Restore the 2025-11-25 | ||||||
| task wire types that were removed together with the task feature: the task schemas and inferred types, task members of the request/result/notification unions, the `task` request-params augmentation, the `tasks` capability key, the `isTaskAugmentedRequestParams` guard, and | ||||||
| `RELATED_TASK_META_KEY`. The task feature itself remains removed — servers do not advertise the `tasks` capability and inbound `tasks/*` requests receive `-32601` — but the wire surface stays so SDKs interoperate cleanly with peers on the 2025-11-25 revision. | ||||||
|
|
||||||
| - [#1887](https://github.com/modelcontextprotocol/typescript-sdk/pull/1887) [`96db044`](https://github.com/modelcontextprotocol/typescript-sdk/commit/96db044fe965f0b7d5109e6d68598eaddce961c9) Thanks [@felixweinberger](https://github.com/felixweinberger)! - Export `isSpecType` and | ||||||
| `specTypeSchemas` records for runtime validation of any MCP spec type by name. `isSpecType.ContentBlock(value)` is a type predicate; `specTypeSchemas.ContentBlock` is a `StandardSchemaV1Sync<ContentBlock>` validator — `validate()` returns the result synchronously. Guards are | ||||||
| standalone functions, so `arr.filter(isSpecType.ContentBlock)` works. Also export the `SpecTypeName`, `SpecTypes`, and `StandardSchemaV1Sync` types. | ||||||
|
|
||||||
| - [#1871](https://github.com/modelcontextprotocol/typescript-sdk/pull/1871) [`9fc9070`](https://github.com/modelcontextprotocol/typescript-sdk/commit/9fc9070b7b8e18227127aaee9869f8809a87fdb1) Thanks [@felixweinberger](https://github.com/felixweinberger)! - Move stdio transports | ||||||
| to a `./stdio` subpath export. Import `StdioClientTransport`, `getDefaultEnvironment`, `DEFAULT_INHERITED_ENV_VARS`, and `StdioServerParameters` from `@modelcontextprotocol/client/stdio`, and `StdioServerTransport` from `@modelcontextprotocol/server/stdio`. The | ||||||
| `@modelcontextprotocol/client` root entry no longer pulls in `node:child_process`, `node:stream`, or `cross-spawn`, fixing bundling for browser and Cloudflare Workers targets; the `@modelcontextprotocol/server` root entry drops its `node:stream` reference. Node.js, Bun, and | ||||||
| Deno consumers update the import path; runtime behavior is unchanged. | ||||||
|
|
||||||
| ### Patch Changes | ||||||
|
|
||||||
| - [#1897](https://github.com/modelcontextprotocol/typescript-sdk/pull/1897) [`434b2f1`](https://github.com/modelcontextprotocol/typescript-sdk/commit/434b2f11ecec452f3dca0199f68afccd8b119dd4) Thanks [@felixweinberger](https://github.com/felixweinberger)! - Stop bundling | ||||||
| `@cfworker/json-schema` into the main package barrel. Previously `CfWorkerJsonSchemaValidator` was re-exported from the core internal barrel, so tsdown inlined the `@cfworker/json-schema` dependency into every consumer's bundle even when it was never used. The named validator | ||||||
| classes are now reachable only via the explicit `@modelcontextprotocol/{client,server}/validators/{ajv,cf-worker}` subpaths and the runtime `_shims` conditional, so consumers that import only from the root entry point no longer ship the validator dep. | ||||||
|
|
||||||
| - [#1834](https://github.com/modelcontextprotocol/typescript-sdk/pull/1834) [`42cb6b2`](https://github.com/modelcontextprotocol/typescript-sdk/commit/42cb6b2b728347d8b58a0d1940b7e63366a29ab9) Thanks [@felixweinberger](https://github.com/felixweinberger)! - Export | ||||||
| `InMemoryTransport` for in-process testing. | ||||||
|
Comment on lines
+45
to
+46
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 PR #1834 (shipping in this release) updated Extended reasoning...What the gap isPR #1834 (commit 42cb6b2, published in this alpha.3 release per the CHANGELOG entries being added here) changed However, Why this violates a stated repo conventionCLAUDE.md (lines ~27–30) explicitly requires: "When making breaking changes, document them in both: Before #1834 there was arguably no clean SKILL row to write — migration.md said "removed from public API", so there was no v2 target to map to. #1834 is precisely the commit that created the canonical v2 target, so it's the commit that should have added the SKILL row. The omission therefore originates with #1834 rather than being strictly pre-existing. ImpactAn LLM-driven migration that follows Step-by-step proof
Relationship to existing PR commentsNone of the existing timeline comments mention FixAdd one row to the "Types / shared imports" table in
This is a docs-only, one-line addition; it can land on |
||||||
|
|
||||||
| - [#1898](https://github.com/modelcontextprotocol/typescript-sdk/pull/1898) [`2a7611d`](https://github.com/modelcontextprotocol/typescript-sdk/commit/2a7611d46b0d4f4e7bd4147c7a3ad3da00e57e52) Thanks [@felixweinberger](https://github.com/felixweinberger)! - Add top-level `types` | ||||||
| field (and `typesVersions` on client/server for their subpath exports) so consumers on legacy `moduleResolution: "node"` can resolve type declarations. The `exports` map remains the source of truth for `nodenext`/`bundler` resolution. The `typesVersions` map includes entries | ||||||
| for subpaths added by sibling PRs in this series (`zod-schemas`, `stdio`); those entries are no-ops until the corresponding `dist/*.d.mts` files exist. | ||||||
|
|
||||||
| - [#1655](https://github.com/modelcontextprotocol/typescript-sdk/pull/1655) [`1eb3123`](https://github.com/modelcontextprotocol/typescript-sdk/commit/1eb31236e707c4f4ab9234d87db21ab3f34bf0bc) Thanks [@nielskaspers](https://github.com/nielskaspers)! - fix(client): append custom | ||||||
| Accept headers to spec-required defaults in StreamableHTTPClientTransport | ||||||
|
|
||||||
|
claude[bot] marked this conversation as resolved.
|
||||||
| Custom Accept headers provided via `requestInit.headers` are now appended to the spec-mandated Accept types instead of being overwritten. This ensures the required media types (`application/json, text/event-stream` for POST; `text/event-stream` for GET SSE) are always present | ||||||
| while allowing users to include additional types for proxy/gateway routing. | ||||||
|
|
||||||
|
Comment on lines
+53
to
+57
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 The CHANGELOG entry says custom Accept headers are "appended to the spec-mandated Accept types", implying spec-required types come first, but the actual implementation does the reverse: user-provided types are placed first and spec-required types are appended last. The description should be corrected to accurately reflect the ordering, e.g., "spec-mandated Accept types are appended to any custom Accept headers". Extended reasoning...CHANGELOG Wording Inverts Actual Accept Header OrderingWhat the bug is and how it manifests The new CHANGELOG entry (line 10) states: "Custom Accept headers provided via requestInit.headers are now appended to the spec-mandated Accept types instead of being overwritten." In standard English, "X appended to Y" means Y is the base and X is added after — so this sentence implies spec-required types come first, with user custom types added afterward. However, the actual implementation in streamableHttp.ts does the opposite. The GET SSE path uses: The specific code path and why it matters Per RFC 7231, when multiple Accept types share equal q-values, earlier entries carry higher implicit preference. So the actual behavior gives user-provided types higher preference than spec-required types. The CHANGELOG implies the opposite preference ordering. While this ordering may be intentional (user routing hints for proxies need higher preference), the documentation still misrepresents which type comes first. Addressing the refutation The refutation argues that user-types-first is intentional for proxy/gateway routing, that CHANGELOG entries are not formal specs, and that this is a version-bump PR. These points are valid context, but they do not resolve the wording inaccuracy. The key claim in the CHANGELOG — that spec-required types are always present — is correct, but the described ordering is backwards. The fix is a one-line wording update, not a code change. Since this CHANGELOG entry appears in this PR's diff, this is the appropriate place to catch it. Step-by-step proof of the discrepancy
Impact and fix This is a documentation-only inaccuracy — the functional behavior is correct (spec-required types are always present). The fix is to update the CHANGELOG wording to something like: "spec-mandated Accept types are appended to any custom Accept headers provided via requestInit.headers", which accurately reflects user types appearing first with spec types appended after. The secondary q-value deduplication issue (e.g., text/event-stream; q=0.9 not deduped against text/event-stream) is a pre-existing edge case from PR #1655 and not introduced by this PR. |
||||||
| - [#2088](https://github.com/modelcontextprotocol/typescript-sdk/pull/2088) [`16d13ab`](https://github.com/modelcontextprotocol/typescript-sdk/commit/16d13abf78b5dba5de73dfa284325b13d4219bb2) Thanks [@mattzcarey](https://github.com/mattzcarey)! - Bundle automatic JSON Schema | ||||||
| validator defaults in `@modelcontextprotocol/client` and `@modelcontextprotocol/server` runtime shims. | ||||||
|
|
||||||
| Client and server pick the right validator automatically based on the runtime: the Node shim uses AJV, the browser/workerd shim uses `@cfworker/json-schema`. Both backends are bundled into the shim chunks that select them, so the default code path needs no extra installs — | ||||||
| `import { McpServer } from '@modelcontextprotocol/server'` does not pull `ajv` or `@cfworker/json-schema` into the root entry chunk. | ||||||
|
|
||||||
| The named validator classes remain part of the public surface for consumers who want to customize the built-in backend (pre-register schemas by `$id`, register custom AJV formats, switch dialects, change `@cfworker/json-schema` draft). They are exposed through explicit | ||||||
| subpaths so they do not bloat the root index chunk: | ||||||
| - `import { AjvJsonSchemaValidator } from '@modelcontextprotocol/{client,server}/validators/ajv'` | ||||||
| - `import { CfWorkerJsonSchemaValidator } from '@modelcontextprotocol/{client,server}/validators/cf-worker'` | ||||||
|
|
||||||
| Importing from one of these subpaths means the corresponding peer dep (`ajv` + `ajv-formats`, or `@cfworker/json-schema`) must be in your `package.json`. The shim keeps its own vendored copy for the default path, so a project can use the subpath in some files and rely on the | ||||||
| default in others. | ||||||
|
|
||||||
| The `jsonSchemaValidator` interface remains the public extension point for replacing validation entirely with a custom implementation. | ||||||
|
Comment on lines
+57
to
+72
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 The #2088 entry (here and in packages/server/CHANGELOG.md and packages/core/CHANGELOG.md, generated from .changeset/workerd-shim-vendors-cfworker.md) misdescribes the change in two ways: the "the corresponding peer dep ... must be in your package.json" sentence is false — neither package declares any peerDependencies and both tsdown configs bundle ajv/ajv-formats/@cfworker/json-schema into the /validators/* subpath chunks (the in-source JSDoc added by the same commit says "no extra installs") — and the entry is filed as a purely-additive Patch Change even though #2088 also changed the root export of AjvJsonSchemaValidator to type-only, breaking the previously documented Extended reasoning...Two prose-vs-implementation mismatches in the #2088 entry1. The peer-dep sentence describes a contract that does not exist. The entry says importing from 2. The same commit's own JSDoc says the opposite. 3. The entry omits the breaking root-export removal. At the alpha.2 publish commit (0021561), Step-by-step proof (export removal):
Why nothing catches it: Changesets renders changeset prose verbatim; there is no check that CHANGELOG text matches the dependency metadata, the bundling config, or the export diff. This is the same class of issue the maintainers already accepted for the parallel How to fix (docs-only): In |
||||||
|
|
||||||
| - [#1976](https://github.com/modelcontextprotocol/typescript-sdk/pull/1976) [`55b1f06`](https://github.com/modelcontextprotocol/typescript-sdk/commit/55b1f06cd4569e334f3435b7971f0446f1ef9be9) Thanks [@felixweinberger](https://github.com/felixweinberger)! - refactor: subclasses | ||||||
| override `_wrapHandler` hook instead of redeclaring `setRequestHandler`. | ||||||
|
|
||||||
| - [#1895](https://github.com/modelcontextprotocol/typescript-sdk/pull/1895) [`b256546`](https://github.com/modelcontextprotocol/typescript-sdk/commit/b256546750277faeb7c886792aae5ed26e6904d5) Thanks [@felixweinberger](https://github.com/felixweinberger)! - Fix runtime crash on | ||||||
| `tools/list` when a tool's `inputSchema` comes from zod 4.0–4.1. The SDK requires `~standard.jsonSchema` (StandardJSONSchemaV1, added in zod 4.2.0); previously a missing `jsonSchema` crashed at `undefined[io]`. `standardSchemaToJsonSchema` now detects zod 4 schemas lacking | ||||||
| `jsonSchema` and falls back to the SDK-bundled `z.toJSONSchema()`, emitting a one-time console warning. zod 3 schemas (which the bundled zod 4 converter cannot introspect) and non-zod schema libraries without `jsonSchema` get a clear error pointing to `fromJsonSchema()`. The | ||||||
| workspace zod catalog is also bumped to `^4.2.0`. | ||||||
|
|
||||||
| ## 2.0.0-alpha.2 | ||||||
|
|
||||||
|
Comment on lines
+3
to
83
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 PR #1842 (commit 1eb80c4, 'v2: add guard methods') introduced new public API type guards — at minimum isCallToolResult and isJSONRPCResponse — to @modelcontextprotocol/client and @modelcontextprotocol/server without a changeset file, so these exports are absent from all alpha.3 CHANGELOGs. Before merging, manually add CHANGELOG entries for the new guard functions in packages/client/CHANGELOG.md and packages/server/CHANGELOG.md under 2.0.0-alpha.3. Extended reasoning...Guard methods from PR #1842 absent from alpha.3 CHANGELOGsWhat the bug is and how it manifests PR #1842 (commit 1eb80c4, 'v2: add guard methods') added new type guard functions to The specific code path The guards flow: Why existing code does not prevent it There is no CI check that validates CHANGELOG completeness against the set of merged commits. The Changesets action only generates entries from changeset files it finds; it cannot detect commits that should have had a changeset but did not. This is the same root cause as the CF Workers CHANGELOG omission (PR #1843). Impact Users upgrading from alpha.2 to alpha.3 who read the release notes have no way to discover these new type guard exports. Alpha users actively track release notes precisely to find new APIs, so undocumented public additions reduce the practical value of the alpha program. The omission is a documentation gap with no functional impact. Step-by-step proof
How to fix Manually add a patch-change entry to both |
||||||
| ### Patch Changes | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| { | ||
| "name": "@modelcontextprotocol/client", | ||
| "version": "2.0.0-alpha.2", | ||
| "version": "2.0.0-alpha.3", | ||
|
claude[bot] marked this conversation as resolved.
claude[bot] marked this conversation as resolved.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔴 PR #1875 (commit 9ed62fe, shipping in this alpha.3 release) added a Extended reasoning...What the bug isPR #1875 (commit 9ed62fe — direct parent of this version-bump commit, so it ships in
The implementation does spread new jose.SignJWT(claims)
.setProtectedHeader({ alg, typ: 'JWT' })
.setIssuer(options.issuer)
.setSubject(options.subject)
.setAudience(audience)
.setIssuedAt(now)
.setExpirationTime(now + lifetimeSeconds)
.setJti(jti)
.sign(...)Each of those setters writes back into the payload after the constructor copies Why existing code doesn't prevent itVerified against jose@6.2.2 source ( The tests added in 9ed62fe only exercise non-standard claims ( Step-by-step proof
ImpactThis is a docs-vs-implementation contradiction in a public API surface that ships to npm in this release. A user who follows the JSDoc to override The spread at line 60 is effectively dead code for the six standard claims — it only matters for additional, non-standard claims. How to fixTwo options, pick one:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟣 🟣 Pre-existing — and a correction to the five prior runtime-dependency comments (3035194589 / 3073682357 / 3073682371 / 3073783213 / 3078795515): I built dist and verified that Extended reasoning...Correction to prior comments + actual residual issuePrior comments are factually wrong about runtime. Five earlier comments on this PR (3035194589, 3073682357, 3073682371, 3073783213, 3078795515) assert that
Why the earlier reasoning was wrong: those comments assumed tsdown/rolldown externalises every bare import not listed in The actual residual issue (type-only)What the dist inspection did surface is that the bundled type declarations still reference external packages. import { Ajv } from 'ajv';
import { JSONSchema } from 'json-schema-typed';These are used at Neither Step-by-step proof
Impact and fixRuntime is fine; this is a compile-time-only break for the Two fix options:
Filed primarily so the maintainers don't act on the incorrect runtime-crash framing / There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Partially addressed by #2088 ( The
Either of the original fixes still applies and is now a one-liner given the #2088 precedent: add There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟣 Pre-existing: the alpha.1 #1710 entry in Extended reasoning...What the bug isThe #1710 entry in
All eight of those symbols are defined with Why nothing prevents itThe Changesets action renders changeset prose verbatim; there is no check that "New … export" claims in a CHANGELOG correspond to actual entries in the package barrel. Step-by-step proof
ImpactA user following the published alpha.1 release notes to use any of these eight helpers — e.g. Relationship to this PR / existing commentsFiled as pre-existing: the false claims live in the How to fixTwo options, pick one:
|
||
| "description": "Model Context Protocol implementation for TypeScript - Client package", | ||
| "license": "MIT", | ||
| "author": "Anthropic, PBC (https://anthropic.com)", | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| # @modelcontextprotocol/codemod | ||
|
|
||
| ## 2.0.0-alpha.1 | ||
|
|
||
| ### Minor Changes | ||
|
|
||
| - [#2206](https://github.com/modelcontextprotocol/typescript-sdk/pull/2206) [`e03bca9`](https://github.com/modelcontextprotocol/typescript-sdk/commit/e03bca90c1f925f80843dc27fb4eb2421408a0c1) Thanks [@KKonstantinov](https://github.com/KKonstantinov)! - Codemod now resolves SSE | ||
| server and OAuth auth imports to @modelcontextprotocol/server-legacy sub-paths instead of removing them. An info diagnostic suggests eventual migration to v2 equivalents. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| { | ||
| "name": "@modelcontextprotocol/codemod", | ||
| "version": "2.0.0-alpha.0", | ||
| "version": "2.0.0-alpha.1", | ||
| "description": "Codemod to migrate MCP TypeScript SDK code from v1 to v2", | ||
|
Comment on lines
+3
to
4
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 Merging this PR triggers the first npm publish of Extended reasoning...Codemod publishes without any package documentationWhat the gap is. This Version Packages PR bumps Why nothing else covers it. The Why this PR is the right place to flag it. The package is not Concrete walk-through.
Distinct from prior comments. The earlier publish-gate comments on this PR (the How to fix. Add a short |
||
| "license": "MIT", | ||
| "author": "Anthropic, PBC (https://anthropic.com)", | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔴 Merging this PR triggers the first npm publish of
@modelcontextprotocol/codemod@2.0.0-alpha.0(added as a 'draft' by #1950 with noprivate:true, no changeset, no CHANGELOG, and not in the changesets ignore list —pnpm changeset publishpublishes any non-private workspace package whose version isn't on the registry). The codemod that would ship still mapsStreamableHTTPError → SdkErrorand tells users to readerror.data?.status, which contradicts theSdkHttpErrormigration introduced by #2049 and documented indocs/migration.md/docs/migration-SKILL.mdshipping in this same alpha.3, and produces output that won't compile (SdkErrorhas no.statusaccessor;.datais typedunknown). Either markpackages/codemod/package.json"private": trueuntil the codemod catches up with #2049, or land a changeset for it and updateremovedApis.ts/importPaths.ts/the test to targetSdkHttpError.Extended reasoning...
Two compounding issues anchored at the publish gate
1. Silent first publish of a draft package
PR #1950 (
48251fe, "feat: add v2 codemod draft", merged 2026-05-21) addedpackages/codemodwithname: @modelcontextprotocol/codemodat version2.0.0-alpha.0. That package.json has no"private": trueand nopublishConfigrestricting access; the package is not in.changeset/config.json'signorelist (only the fiveexamples-*packages are ignored); and the package has noCHANGELOG.mdand no changeset describing its initial release.The release workflow (
.github/workflows/release.yml) runsci:publish→pnpm run build:all && pnpm changeset publishafter this Version Packages PR merges.changeset publishpublishes every non-private, non-ignored workspace package whosepackage.jsonversion is not already on the npm registry — regardless of whether a changeset exists for it.@modelcontextprotocol/codemod@2.0.0-alpha.0has never been published (it was added by the same commit that set its version), so merging this PR will publish it as a side effect.The visible artifact in this PR's diff is exactly that:
.changeset/pre.jsonline 22 records"@modelcontextprotocol/codemod": "2.0.0-alpha.0"ininitialVersions— the bot has noticed the new package but has nothing to bump it with, so it stays at the version that will be auto-published. This is inconsistent with repo convention: every other internal/non-publishable package (packages/core,test/helpers,test/integration,test/conformance) carries"private": true. Publishing under the@modelcontextprotocolscope on npm is hard to reverse (24-hour unpublish window; the version string can never be reused), so this is the right place to make a deliberate decision rather than ship by accident.2. The codemod that would ship is stale relative to #2049's
SdkHttpErrorPR #2049 (
4f226c1, also shipping in this same alpha.3 — see the@modelcontextprotocol/client@2.0.0-alpha.3and@modelcontextprotocol/core@2.0.0-alpha.2CHANGELOG entries in this diff) introducedSdkHttpError extends SdkError(packages/core/src/errors/sdkErrors.ts:94-110) with typed.status/.statusTextaccessors, and rewrote both migration docs to sayStreamableHTTPError→SdkHttpError(docs/migration.md:729,docs/migration-SKILL.md:98,119).The codemod added by #1950 (merged ~8 hours after #2049 but written before
SdkHttpErrorexisted) still targets the old name everywhere:packages/codemod/src/migrations/v1-to-v2/transforms/removedApis.ts:157—renameAllReferences(sourceFile, localName, 'SdkError'). Migrated v1 code likeif (e instanceof StreamableHTTPError) { use e.code }becomesif (e instanceof SdkError)— a broader check that loses the typed HTTP status accessors only the subclass has.removedApis.ts:151-152— constructor diagnostic recommendsnew SdkError(code, message, data?); the v2 replacement isnew SdkHttpError(code, message, { status, statusText }).removedApis.ts:175-176— import diagnostic says "HTTP status is now inerror.data?.status".SdkError.datais typedunknown(sdkErrors.ts:62), so following that diagnostic produces a compile error; the typed accessor isSdkHttpError.status.removedApis.ts:167addsSdkError/SdkErrorCodeto imports, neverSdkHttpError.importPaths.ts:16-17— re-export diagnostic also says "renamed to SdkError in v2".packages/codemod/test/v1-to-v2/transforms/removedApis.test.ts:166-200— tests assert theSdkErrormapping, locking the stale behavior in.Step-by-step proof
release.ymltriggers →changeset publishruns.@modelcontextprotocol/codemodis non-private, non-ignored, and2.0.0-alpha.0is not on the registry → it is published.if (err instanceof StreamableHTTPError) { console.log(err.code) }.if (err instanceof SdkError) { console.log(err.code) }and emits a diagnostic suggesting the user readerr.data?.statusfor the HTTP status.docs/migration.md("HTTP transport errors are now thrown asSdkHttpError") and the codemod output disagree. If they follow the codemod'serror.data?.statussuggestion, it fails to type-check (Property 'status' does not exist on type 'unknown'). The typed accessor lives only onSdkHttpError, which the codemod never imports or references.Why this is the right PR to flag it on
The defective code lives in
packages/codemod, which is not in this diff — but this Version Packages PR is the publish gate. Merging it is what triggers the first npm publish of the codemod, and the addition of@modelcontextprotocol/codemodtoinitialVersionsat line 22 of.changeset/pre.jsonis the diff's record of that. There is no later checkpoint where this can be caught.How to fix
Either:
"private": truetopackages/codemod/package.json(or add it to the changesetsignorelist) until theStreamableHTTPErrormigration is updated forSdkHttpErrorand a changeset/CHANGELOG exists. One-line change, matches thepackages/coreprecedent.@modelcontextprotocol/codemodonmainso the bot regenerates this PR with a proper alpha bump and CHANGELOG; and updateremovedApis.ts:151-176,importPaths.ts:16-17, andremovedApis.test.ts:166-200to targetSdkHttpErrorand recommenderror.statusinstead oferror.data?.status.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Partially addressed. The "silent first publish" half is resolved: #2206 (
e03bca9) landed a changeset for the codemod (.changeset/codemod-resolve-legacy-imports.md,@modelcontextprotocol/codemod: minor), so this Version Packages PR now bumps the package deliberately to2.0.0-alpha.1with a generatedpackages/codemod/CHANGELOG.md— the publish is no longer an accidental side effect of an undocumented draft.The stale-codemod half remains. At HEAD the codemod still targets the pre-#2049 error model:
packages/codemod/src/migrations/v1-to-v2/transforms/removedApis.ts:151-152,157,167— still renamesStreamableHTTPError → SdkErrorand only ever importsSdkError/SdkErrorCode, neverSdkHttpError.removedApis.ts:175-176— diagnostic still says "HTTP status is now inerror.data?.status", which doesn't type-check (SdkError.dataisunknown); the typed accessor isSdkHttpError.status.packages/codemod/src/migrations/v1-to-v2/transforms/importPaths.ts:16-17— re-export diagnostic still says "renamed to SdkError in v2". (v2 backcompat: server legacy package #2206 only changed the auth-import resolution in this file, not this mapping.)packages/codemod/test/v1-to-v2/transforms/removedApis.test.ts:166-200— tests still lock in theSdkErrormapping.So merging this PR still publishes a codemod whose output contradicts
docs/migration.md:737/docs/migration-SKILL.md:98,119(StreamableHTTPError → SdkHttpError) shipping in the same alpha.3. To fully close this, update the three files above to targetSdkHttpErrorand recommenderror.status(a follow-up onmainwould regenerate this PR), or accept the known gap for alpha.1 of the codemod and track it separately.