Skip to content

feat(server): accept Standard Schemas in inputRequired.elicit - #2369

Merged
felixweinberger merged 16 commits into
mainfrom
feat/elicitation-standard-schema
Jul 9, 2026
Merged

feat(server): accept Standard Schemas in inputRequired.elicit#2369
felixweinberger merged 16 commits into
mainfrom
feat/elicitation-standard-schema

Conversation

@mattzcarey

@mattzcareymattzcarey commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

Fixes#662.

Summary

  • allow inputRequired.elicit() to accept a Standard Schema/Zod object as requestedSchema
  • convert that schema to MCP's restricted form-elicitation JSON Schema
  • reuse the same schema with acceptedContent() to validate and type the response on handler re-entry
  • keep deprecated Server.elicitInput() and ctx.mcpReq.elicitInput() unchanged
  • reject converted validation constraints that MCP form elicitation cannot express instead of weakening them silently
  • preserve the raw JSON Schema input path unchanged

The modern write-once handler works on 2026-07-28 natively and on 2025-era connections through the existing legacy input_required shim.

Release

  • @modelcontextprotocol/core-internal: minor
  • @modelcontextprotocol/server: minor
  • no client package change

Verification

  • core-internal tests: 1,327 passed
  • server tests: 439 passed
  • modern input_required integration coverage
  • 2025 legacy-shim integration coverage
  • core-internal/server typechecks
  • examples typecheck
  • client/server builds
  • dist declaration smoke with skipLibCheck: false
  • snippet sync check
  • pre-push full build, typecheck, and lint

@mattzcarey
mattzcarey requested a review from a team as a code ownerJune 25, 2026 12:46
@changeset-bot

changeset-botBot commented Jun 25, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: ea34a7d

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

This PR includes changesets to release 6 packages
NameType
@modelcontextprotocol/core-internalMinor
@modelcontextprotocol/serverMinor
@modelcontextprotocol/expressMajor
@modelcontextprotocol/fastifyMajor
@modelcontextprotocol/honoMajor
@modelcontextprotocol/nodeMajor

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

@pkg-pr-new

pkg-pr-newBot commented Jun 25, 2026

Copy link
Copy Markdown

Open in StackBlitz

@modelcontextprotocol/client

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

@modelcontextprotocol/codemod

npm i https://pkg.pr.new/@modelcontextprotocol/codemod@2369

@modelcontextprotocol/core

npm i https://pkg.pr.new/@modelcontextprotocol/core@2369

@modelcontextprotocol/server

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

@modelcontextprotocol/server-legacy

npm i https://pkg.pr.new/@modelcontextprotocol/server-legacy@2369

@modelcontextprotocol/express

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

@modelcontextprotocol/fastify

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

@modelcontextprotocol/hono

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

@modelcontextprotocol/node

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

commit: ea34a7d

Comment threadpackages/server/src/server/server.ts Outdated
Comment threadpackages/core-internal/src/shared/protocol.ts Outdated
Comment threadpackages/core-internal/src/shared/protocol.ts Outdated
Comment threadpackages/server/src/server/server.ts Outdated
Comment threadexamples/server/src/serverGuide.examples.ts Outdated
@mattzcarey
mattzcareyforce-pushed the feat/elicitation-standard-schema branch from 01f43f4 to f732d6fCompareJune 25, 2026 13:51
Comment threadpackages/server/src/server/server.ts Outdated
Comment threadpackages/server/src/server/server.ts Outdated
Comment threadexamples/server/src/elicitationFormExample.ts Outdated
felixweinberger
felixweinberger previously approved these changes Jun 25, 2026

@felixweinbergerfelixweinberger left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SGTM

Comment threadpackages/server/src/server/server.ts Outdated
Comment threadpackages/server/src/server/server.ts Outdated
Comment threadpackages/core-internal/src/shared/elicitation.ts Outdated
Comment thread.changeset/standard-schema-elicitation.md
Comment threadexamples/server/src/elicitationFormExample.ts Outdated
@mattzcarey
mattzcareyforce-pushed the feat/elicitation-standard-schema branch from 918c601 to a300f51CompareJuly 1, 2026 09:18
Comment threadpackages/server/src/server/server.ts Outdated
Comment threadpackages/core-internal/src/shared/elicitation.ts Outdated
Comment threadpackages/core-internal/src/shared/elicitation.ts Outdated
Comment threadpackages/server/src/server/server.ts Outdated
@mattzcarey
mattzcareyforce-pushed the feat/elicitation-standard-schema branch from 7908e11 to 15e6243CompareJuly 6, 2026 18:36
@mattzcarey
mattzcareyforce-pushed the feat/elicitation-standard-schema branch from 15e6243 to 12eb9e5CompareJuly 6, 2026 19:01
@mattzcarey
mattzcarey enabled auto-merge (squash) July 6, 2026 19:02

@felixweinbergerfelixweinberger left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mostly wondering if we should be updating the elicitInput API given we want people to use inputRequired for MRTR going forward.

Comment threadpackages/core-internal/src/shared/protocol.ts Outdated
Comment threadpackages/server/src/server/server.ts Outdated
Comment threadpackages/core-internal/src/shared/inputRequired.ts Outdated
@mattzcarey
mattzcarey disabled auto-merge July 7, 2026 08:32
@mattzcarey
mattzcareyforce-pushed the feat/elicitation-standard-schema branch from 12eb9e5 to 481c112CompareJuly 7, 2026 08:55
@mattzcareymattzcarey changed the title feat(server): accept Standard Schemas for elicitationfeat(server): accept Standard Schemas in inputRequired.elicitJul 7, 2026
@felixweinberger
felixweinberger merged commit 24be404 into mainJul 9, 2026
20 checks passed
@felixweinberger
felixweinberger deleted the feat/elicitation-standard-schema branch July 9, 2026 10:04
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support Zod schema with Elicitation?

2 participants

@mattzcarey@felixweinberger