MCP prompts/list fails entirely when one prompt argsSchema cannot convert to JSON Schema
Node Version
v22.20.0
Package Manager
yarn
Package Manager Version
4.12.0
Strapi Version
develop at #27505 (MCP TypeScript SDK v2). Content-manager does not register prompts today; the defect is in prompt registration and prompts/list.
Operating System
MacOS
Database
SQLite
Javascript or Typescript
TypeScript
Reproduction URL
No response
Bug Description
Registering one MCP prompt whose argsSchema cannot be converted to JSON Schema succeeds with no error. The prompt stays enabled in the registry. The next prompts/list then fails with JSON-RPC -32603 and returns no prompts at all. Healthy sibling prompts disappear from discovery even though prompts/get on those names still works.
Verified unconvertible types include z.date(), z.coerce.date(), z.custom(), z.instanceof(), and z.bigint(). The listed error for z.date() is Date cannot be represented in JSON Schema.
This is not a handler bug. registerPrompt only asks the SDK to inspect the Zod shape for completable fields. Conversion runs later, unguarded, inside the SDK v2 prompts/list handler. createSafeCapabilityRegistration never sees the throw, so it cannot disable the bad prompt.
resources/list is unaffected. tools/list has the same hole when a tool carries an unconvertible field, but that path already failed on SDK 1.30 (5.52.2). The prompt-side failure is new with SDK v2: listing still ships only { name, description, required } per argument, yet v2 converts the full schema to derive that metadata.
Found during QA of #27505. Out of scope for that PR. Documented there as breaking change 2.
Upstream conversion failure: modelcontextprotocol/typescript-sdk#2464.
Steps to Reproduce
- Enable MCP (
server.mcp.enabled: true). - Register two prompts. Give one a JSON-representable
argsSchema(z.string(),z.number(), …). Give the other an unconvertible field, for examplez.date(). - Confirm
registerPromptreturns success and both registry entries areenabled. - Call
prompts/listthrough a real MCP client.
Expected Behavior
- Registration of an unconvertible
argsSchemafails or disables that prompt, with a server log naming it. prompts/liststill returns every healthy prompt.- A conversion error on one prompt does not become
-32603for the whole list.
Logs
-32603 "Date cannot be represented in JSON Schema"
prompts/list returns no prompts. Direct prompts/get on a healthy sibling still succeeds.
Code Snippets
// Registration succeeds. prompts/list then fails for every prompt.
argsSchema: z.object({
due: z.date().describe('Due date'),
});
// Lists correctly.
argsSchema: z.object({
due: z.string().datetime().describe('Due date as ISO-8601'),
});
createSafeCapabilityRegistration (packages/core/core/src/services/mcp/utils/createSafeCapabilityRegistration.ts) catches SDK registration errors only. SDK v2 does not convert the schema at registerPrompt time, so the catch never fires.
Media
No response
Additional information
Reproduced in-process against createMcpServerWithRegistries with a real MCP client over an in-memory transport, and cross-checked against develop on SDK 1.30.
QA source: giu1io's review on #27505.
Related docs-only issue: #27558. This ticket is the product defect, not the guide wording.
Confirmation Checklist
- I have checked the existing issues for duplicates.
- I agree to follow this project's Code of Conduct.
AI assisted
Source: strapi/strapi