| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
… into feature/codemod-iterations-3
IMPORT_MAP was looked up by exact key, so extensionless specifiers like @modelcontextprotocol/sdk/types (vs .../types.js) fell through to an 'Unknown SDK import path' diagnostic and were left unmigrated. Add a shared lookupImportMapping() that tolerates .js/.mjs/.cjs extension variance, and use it for import, re-export, and mock-path resolution. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016f6h88mdVxLUdx1cNT96pW
Shared protocol types/constants resolve to either @modelcontextprotocol/client or /server. The codemod read that choice from package.json, but a project mid-migration still declares the single v1 @modelcontextprotocol/sdk dependency, so the project type came back 'unknown' and every file importing only shared symbols defaulted to server with an action-required warning. Infer from source instead: when the v2 split deps are absent, scan for quoted @modelcontextprotocol/sdk/client/ and .../server/ import specifiers (both -> 'both', one -> that side, neither -> 'unknown'). Matching quoted specifiers rather than bare substrings ignores comments/prose and catches extensionless/bare subpaths. For a 'both' project, shared types resolve to server with an info note (both re-export them) instead of an action-required warning; 'unknown' still warns. The scan is bounded (skips heavy dirs, file budget, early-exit). On firebase this cuts the codemod diagnostics from 14 to 2 with 0 introduced typecheck errors.
The handler-registration transform rewrites setRequestHandler(XSchema, …) and setNotificationHandler(XSchema, …) to the v2 spec form via a schema→method table. The task schemas were missing, so a handler like setNotificationHandler(TaskStatusNotificationSchema, …) fell through to the generic "use the 3-argument form" diagnostic and was left for manual migration. Add the task entries: tasks/get, tasks/result, tasks/list, tasks/cancel, and notifications/tasks/status. These are spec methods (the request schemas are members of ServerRequestSchema and the notification is in the notification union), so the rewritten two-argument call resolves to the spec overload of setRequestHandler/setNotificationHandler and typechecks. Co-Authored-By: Felix Weinberger <fweinberger@anthropic.com>
🦋 Changeset detectedLatest commit: 68b2120 The changes in this PR will be included in the next version bump. This PR includes changesets to release 9 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Sorry, something went wrong.
|
@modelcontextprotocol/client
npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/client@2354
npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/codemod@2354
npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/core@2354
npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/server@2354
npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/server-legacy@2354
npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/express@2354
npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/fastify@2354
npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/hono@2354
npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/node@2354 commit: 68b2120 |
Sorry, something went wrong.
… arg, preserve import comments - importPaths: aliased named imports now route through the per-symbol splitter (addOrMergeImport carries aliases), so a mixed type+schema import no longer collapses into one v2 package and mis-routes schema constants - schemaParamRemoval: drop a literal `undefined` result-schema argument from request()/callTool() when an options arg follows - importPaths: preserve the first SDK import's leading header/JSDoc comment across the rewrite - batch-test: install pnpm clones standalone (--ignore-workspace --no-frozen-lockfile, CI=true) so repos nested in this workspace actually install
There was a problem hiding this comment.
stoked about this
Sorry, something went wrong.
|
Handling some of the edge cases raised by claude[bot], then renaming core to core-internal and sdk-shared to core |
Sorry, something went wrong.
… into feature/codemod-iterations-3 # Conflicts: # packages/client/test/client/streamableHttp.test.ts
…iddleware
eslint
Follow-ups to the core→core-internal / sdk-shared→core rename:
- CLAUDE.md exports section was missing the public @modelcontextprotocol/core package
- middleware express/fastify/hono internal-regex still listed a vestigial 'core' the sweep
could not reach (non-contiguous substring inside the alternation)
…red rename
changeset
- core index.ts/tsdown.config.ts/test comments pointed at core/src/... paths that
now live under core-internal/src/...; renamed sdkSharedSchemas→coreSchemas refs
- codemod drift-guard tests carried stale sdkShared* variable names
- @modelcontextprotocol/sdk-shared was never published to npm, so the rename
changeset's 'migrate your imports' entry would mislead the first core changelog;
add-core-public-package.md already provides a single accurate 'new package' entry
…ale validator
comment
- mockPaths: import('…/types.js').then(({ CallToolResultSchema }) => …) was silently
rewritten to the context package (server/client, no Zod schema exports) with no diagnostic.
Generalize destructure handling (getModuleBindingPattern) so a .then(({…}) => …) param is
routed/renamed per-symbol like 'const { … } = await import()' — schema-only → core, mixed
flagged. +3 tests.
- core-internal index.ts: validator-import comment listed @modelcontextprotocol/core/validators/*,
which doesn't exist after the rename (core exports only '.'); point at {client,server}.
There was a problem hiding this comment.
No new issues found on the latest revision — the fixes for the earlier findings (auth-schema routing, JSONRPCResponseSchema rename, lazy context resolution, the fetch-spec-types output path, and the rename leftovers) all look incorporated. That said, this PR introduces a new published package and renames the internal core package, so a maintainer should sign off on the public API surface and the rename before merge.
Extended reasoning...This PR (276 files) introduces @modelcontextprotocol/core as the new public home for the spec + OAuth/OpenID Zod schemas, renames the private internal barrel to @modelcontextprotocol/core-internal, and makes a series of codemod accuracy/correctness changes (per-symbol schema routing, project-type inference from source, task-handler method mapping, formatter detection, package.json reconciliation against surviving imports). The latest commits address the findings raised in earlier review rounds — including the previously-missing packages/core-internal directory, the OAuth schema routing gap, the JSONRPCResponseSchema semantic-widening rename, the unguarded undefined-arg removal, the eager project-type diagnostics, the fetch-spec-types.ts output path, and the destructured .then() dynamic-import routing.
Low. No auth/crypto logic changes — the OAuth Zod schemas are only re-exported from a new package, not modified. The codemod changes only affect migration tooling that rewrites user source locally; there is no network or credential handling introduced.
High, and human-level. The PR creates a brand-new published npm package with a deliberately curated export surface, takes over the clean core package name, and bumps nine packages via changesets. Per the repo's own conventions (minimalism, burden of proof on addition, every export intentional), the decision to publish the raw Zod schemas as a standalone package — and the bundling-vs-external-dependency trade-off described in the PR — is a design call that maintainers should explicitly endorse, not something to shadow-approve.
The bug-hunting system found no new issues on this revision, codemod/core test coverage was substantially expanded (drift guards, batch test against firebase-tools), and the author has been responsive to every prior review round. The remaining open questions are design/ownership questions rather than correctness defects.
Sorry, something went wrong.
Co-authored-by: Matt <77928207+mattzcarey@users.noreply.github.com> Co-authored-by: Konstantin Konstantinov <KKonstantinov@users.noreply.github.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
… export Additive public API on core's root barrel is a minor under semver, and core's changelog ships export-surface additions as minor (#2354, #2513). The changeset fixed group lifts core, client, server, server-legacy, and codemod together to 2.1.0. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KXnNnp3fxQYR5HF9BUVhYP
| Back | FazBrowse Home | New Git URL |
Introduce @modelcontextprotocol/core as the public home for the MCP specification and OAuth/OpenID Zod schemas, and teach the v1→v2 codemod to migrate schema usage to it — plus several codemod accuracy and correctness fixes surfaced by running the migration against real-world v1 repos and by code review. This PR also renames the private internal barrel @modelcontextprotocol/core → core-internal, freeing the clean core name for the public schema package (published in alpha as @modelcontextprotocol/sdk-shared).
Motivation and Context
In v2, @modelcontextprotocol/server and @modelcontextprotocol/client deliberately expose a Zod-free public surface. That left the raw spec Zod schemas (CallToolResultSchema, ListToolsResultSchema, …) — which v1 users imported from @modelcontextprotocol/sdk/types.js — with no public home. Code that did runtime validation like CallToolResultSchema.safeParse(value) had nowhere to import the schema from after migrating, and the codemod's previous workaround rewrote those calls into the Standard-Schema form (specTypeSchemas.X['~standard'].validate(...)), which changed user code more than necessary. The same gap applied to the OAuth/OpenID schemas (OAuthTokensSchema, OAuthMetadataSchema, …) that v1 exposed from @modelcontextprotocol/sdk/shared/auth.js.
This PR closes that gap and tightens the migration:
How Has This Been Tested?
Breaking Changes
None for existing v2 consumers. @modelcontextprotocol/core is a new, additive package. server and client gain one small additive (non-breaking) public-API surface — the v2-only IdJagTokenExchangeResponse spec type (type export + SpecTypeName member + isSpecType/specTypeSchemas entry), covered by a client/server changeset; the private core-internal package registers it. The middleware packages are unchanged. The package rename is invisible to stable consumers: the internal barrel (core → core-internal) was always private and unpublished, and the only public-name change — the alpha @modelcontextprotocol/sdk-shared → @modelcontextprotocol/core — affects only those who installed the alpha schema package, who update with a one-line import swap (sdk-shared → core) that the codemod applies automatically (rename-sdk-shared-to-core changeset). The schema-import-location change core supports is part of the existing v1→v2 migration (not new breakage) and is applied automatically by the codemod and documented in the migration guide.
Types of changes
Checklist
Additional context