Skip to content

chore: sync schemas to spec @142b3c3c; segregate pre-2026 wire schemas#2129

Draft
felixweinberger wants to merge 2 commits into
fweinberger/v2-tasks-deletefrom
fweinberger/v2-schema-sync
Draft

chore: sync schemas to spec @142b3c3c; segregate pre-2026 wire schemas#2129
felixweinberger wants to merge 2 commits into
fweinberger/v2-tasks-deletefrom
fweinberger/v2-schema-sync

Conversation

@felixweinberger
Copy link
Copy Markdown
Contributor

@felixweinberger felixweinberger commented May 20, 2026

2026-06 stateless stack (v2-stateless label):

# PR
1 #2128 tasks-delete (mechanical)
2 #2129 schema-sync (mechanical)
3 #2130 Dispatcher extraction (zero-Δ refactor)
4 #2131 HTTP-stateless (the substantive review)
5 #2132 stdio/InMemory transports (additive)
6 #2133 docs + changeset
7 #2134 LegacyServer/LegacyClient extraction

Regenerates spec.types.ts from spec draft @142b3c3c and hand-syncs schemas.ts to match. Pre-2026 wire schemas (Initialize/Ping/SetLevel/Subscribe/Unsubscribe) move to legacyWireSchemas.ts since the regenerated spec no longer includes them.

Motivation and Context

Prerequisite for SEP-2575/2322 — the SDK needs DiscoverRequest, InputRequiredResult, SubscriptionFilter, namespaced _meta types.

How Has This Been Tested?

pnpm test:all (1241). C2 (regen) intentionally fails typecheck in isolation; C3 restores it.

Breaking Changes

Public types updated to match spec; see docs/migration.md.

Types of changes

  • Breaking change

Checklist

  • My code follows the repository's style guidelines
  • New and existing tests pass locally

pnpm fetch:spec-types. Spec moved 44 commits since last regen.

Brings:
- RequestMetaObject with namespaced io.modelcontextprotocol/* keys (required protocolVersion/clientInfo/clientCapabilities)
- Result.resultType: "complete" | "input_required" (required)
- DiscoverRequest/Result, InputRequiredResult, InputRequest/Response/s, InputResponseRequestParams
- SubscriptionsListenRequest, SubscriptionFilter, SubscriptionsAcknowledgedNotification
- UnsupportedProtocolVersionError, MissingRequiredClientCapabilityError (-32003)

Removes (moved to extension or removed from spec):
- InitializeRequest/Result, InitializedNotification, PingRequest, SetLevelRequest
- SubscribeRequest, UnsubscribeRequest, RootsListChangedNotification
- All Task* types, taskSupport, TaskAugmentedRequestParams

Typecheck broken pending next commit (schemas.ts/guards.ts reference removed types).
Isolated for diff clarity per plan §10.
…emas

schemas.ts:
- Result/Notification _meta now use plain MetaObject (not RequestMetaSchema)
- ResultTypeSchema, resultType optional on ResultSchema (BC: pre-2026 omits it)
- RequestMetaSchema kept simple {progressToken?}; namespaced io.modelcontextprotocol/*
  keys validated by parseClientMeta in P2, not here (TS2589 depth budget)
- DiscoverRequest/Result, UnsupportedProtocolVersionErrorData,
  MissingRequiredClientCapabilityErrorData
- SubscriptionFilter, SubscriptionsListenRequest/Params,
  SubscriptionsAcknowledgedNotification/Params
- InputRequest/Response/s, InputRequiredResult, InputResponseRequestParams
- CacheableResult/CacheScope (SEP-2243), PaginatedResult extends CacheableResult,
  ReadResourceResult extends CacheableResult
- structuredContent: unknown (was Record<string,unknown>)
- Tool inputSchema/outputSchema loosened to match spec (open record + type:object on input)
- ToolExecution removed (only had taskSupport)
- ClientRequest/ServerNotification/etc unions = 2026 spec methods only
- registerLegacySchemas() lets legacyWireSchemas merge into runtime lookup maps
- Dropped Initialize*/Ping/SetLevel/Subscribe/Unsubscribe/RootsListChanged

NEW legacyWireSchemas.ts:
- LegacyRequestParams/Result/RequestMetaObject base types (no namespaced keys, no resultType)
- TS interfaces + zod for Initialize/Ping/SetLevel/Subscribe/Unsubscribe/RootsListChanged
- legacyRequest/Result/NotificationSchemas maps; registerLegacySchemas() side-effect on import

types.ts: re-exports legacy types; RequestTypeMap/NotificationTypeMap/ResultTypeMap
merge legacy methods. Adds Discover*/InputRequired*/Subscriptions*/Cache* types.

guards.ts: isInitializeRequest/isInitializedNotification import from legacyWireSchemas.

specTypeSchema.ts: allowlist updated (drop legacy, add 2026).

spec.types.test.ts: Relax<T> helper makes spec-required PermissiveKeys
(_meta/resultType/ttlMs/cacheScope/inputResponses/requestState/io.modelcontextprotocol/*)
optional so mutual assignability holds for everything else. Dropped checks for
removed types; added 17 checks for 2026 types. Count 176→150.

types.capabilities.test.ts: import InitializeRequestParamsSchema from legacyWireSchemas.
types.test.ts: outputSchema no longer requires type:object.

mcp.ts: drop ToolExecution/execution (removed from spec).
client.ts: assertCapabilityForMethod switches on RequestMethod (includes legacy).
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 20, 2026

⚠️ No Changeset found

Latest commit: c67522f

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented May 20, 2026

Open in StackBlitz

@modelcontextprotocol/client

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

@modelcontextprotocol/server

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

@modelcontextprotocol/express

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

@modelcontextprotocol/fastify

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

@modelcontextprotocol/hono

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

@modelcontextprotocol/node

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

commit: c67522f

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v2-stateless 2026-06 SDK: Protocol decomposition + SEP alignment (request-first / stateless)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant