Description
The MCP server fails to start with the following error:
Failed to start PrimeVue MCP Server: Error: Tool get_composable expected a Zod schema or ToolAnnotations, but received an unrecognized object
at McpServer.tool (file:///.../@modelcontextprotocol/sdk/dist/esm/server/mcp.js:688:27)
Root Cause
In @primeuix/mcp, the internal F function that registers custom tools (passed via the customTools option) calls McpServer.tool() with a plain JSON object as the input schema:
function F(a, e, n) {
for (let c of n) {
let r = {};
for (let [l, t] of Object.entries(c.parameters))
r[l] = { type: t.type, description: t.description }; // ❌ plain object
a.tool(c.name, c.description, r, ...);
}
}
Starting with @modelcontextprotocol/sdk v1.28.x, McpServer.tool() now strictly validates that the schema argument is either a Zod schema or a ToolAnnotations object. Passing a plain object with nested values (like { name: { type: "string", description: "..." } }) throws an error.
Since @primeuix/mcp depends on "@modelcontextprotocol/sdk": "^1.25.2", users will automatically get a version that breaks the server.
Fix
The F function should convert parameter definitions to Zod schemas and use registerTool() instead of tool():
function F(a, e, n) {
for (let c of n) {
let r = {};
for (let [l, t] of Object.entries(c.parameters)) {
let schema = t.type === "boolean" ? z.boolean()
: t.type === "number" ? z.number()
: z.string();
r[l] = t.description ? schema.describe(t.description) : schema;
}
a.registerTool(c.name, { description: c.description, inputSchema: r }, ...);
}
}
Steps to Reproduce
npx -y @primevue/mcp
Environment
- @primevue/mcp: 4.5.4
- @primeuix/mcp: 1.0.1
- @modelcontextprotocol/sdk: 1.29.0 (resolved via ^1.25.2)
Description
The MCP server fails to start with the following error:
Root Cause
In @primeuix/mcp, the internal F function that registers custom tools (passed via the customTools option) calls McpServer.tool() with a plain JSON object as the input schema:
Starting with @modelcontextprotocol/sdk v1.28.x, McpServer.tool() now strictly validates that the schema argument is either a Zod schema or a ToolAnnotations object. Passing a plain object with nested values (like { name: { type: "string", description: "..." } }) throws an error.
Since @primeuix/mcp depends on "@modelcontextprotocol/sdk": "^1.25.2", users will automatically get a version that breaks the server.
Fix
The F function should convert parameter definitions to Zod schemas and use registerTool() instead of tool():
Steps to Reproduce
npx -y @primevue/mcpEnvironment