Skip to content

feat(compat): add /server/zod-schemas subpath re-exporting *Schema constants#1906

Draft
felixweinberger wants to merge 1 commit intomainfrom
fweinberger/v2-bc-zod-schemas-subpath
Draft

feat(compat): add /server/zod-schemas subpath re-exporting *Schema constants#1906
felixweinberger wants to merge 1 commit intomainfrom
fweinberger/v2-bc-zod-schemas-subpath

Conversation

@felixweinberger
Copy link
Copy Markdown
Contributor

Part of the v2 backwards-compatibility series — see reviewer guide.

v2 stopped exporting Zod schema constants (only TS types). Consumers using them for runtime validation at HTTP boundaries (token endpoints, OIDC discovery, custom transports) lose validators. This re-exports them under a @deprecated subpath.

Motivation and Context

v2 stopped exporting Zod schema constants (only TS types). Consumers using them for runtime validation at HTTP boundaries (token endpoints, OIDC discovery, custom transports) lose validators. This re-exports them under a @deprecated subpath.

v1 vs v2 pattern & evidence

v1 pattern:

`import { OAuthTokensSchema, CallToolRequestSchema } from '@modelcontextprotocol/sdk/types.js'`

v2-native:

Use `specTypeSchema('CallToolRequest')` (see #1887) or import types only

Evidence: Hits any consumer doing runtime validation of HTTP responses or implementing a custom transport.

How Has This Been Tested?

  • Import-compiles test
  • Integration: validated bump-only against 5 OSS repos via the v2-bc-integration validation branch
  • pnpm typecheck:all && pnpm lint:all && pnpm test:all green

Breaking Changes

None — additive @deprecated shim. Removed in v3.

Types of changes

  • New feature (non-breaking change which adds functionality)

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added or updated documentation as needed

Additional context

Stacks on: none

@felixweinberger felixweinberger added the v2-bc v2 backwards-compatibility series label Apr 15, 2026
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Apr 15, 2026

🦋 Changeset detected

Latest commit: ab8b2ed

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 5 packages
Name Type
@modelcontextprotocol/server Patch
@modelcontextprotocol/express Patch
@modelcontextprotocol/fastify Patch
@modelcontextprotocol/hono Patch
@modelcontextprotocol/node Patch

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

@felixweinberger felixweinberger added this to the v2.0.0-bc milestone Apr 15, 2026
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Apr 15, 2026

Open in StackBlitz

@modelcontextprotocol/client

npm i https://pkg.pr.new/@modelcontextprotocol/client@1906

@modelcontextprotocol/server

npm i https://pkg.pr.new/@modelcontextprotocol/server@1906

@modelcontextprotocol/express

npm i https://pkg.pr.new/@modelcontextprotocol/express@1906

@modelcontextprotocol/fastify

npm i https://pkg.pr.new/@modelcontextprotocol/fastify@1906

@modelcontextprotocol/hono

npm i https://pkg.pr.new/@modelcontextprotocol/hono@1906

@modelcontextprotocol/node

npm i https://pkg.pr.new/@modelcontextprotocol/node@1906

commit: ab8b2ed

@felixweinberger felixweinberger force-pushed the fweinberger/v2-bc-zod-schemas-subpath branch from 7cb49f6 to 8c9a388 Compare April 16, 2026 09:37
Re-exports the internal *Schema Zod constants (CallToolRequestSchema,
JSONRPCMessageSchema, etc.) from a deprecated /zod-schemas subpath so v1
code that imported schemas from @modelcontextprotocol/sdk/types.js has a
single drop-in target.

- packages/server/src/zodSchemas.ts: re-export barrel (deprecated module)
- packages/server/package.json: ./zod-schemas exports entry
- packages/server/tsdown.config.ts: build entry + dts path mapping
- packages/server/tsconfig.json: path mappings for core/schemas and the
  self-reference subpath
- packages/core/package.json: internal ./schemas subpath (core is private,
  consumed only by sibling packages)
- compat test asserting the import resolves and schemas parse

The schemas remain an internal implementation detail; their Zod major
version is not covered by semver. Subpath will be removed in v3.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v2-bc v2 backwards-compatibility series

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant