Claude Code: MongoDB MCP server tools fail with invalid outputSchema draft-07 dialect
Using mongodb-mcp-server 2.1.0 (also reproduced on 2.0.0 and 1.14.0) with Claude Code / Claude Desktop on macOS (app version 1.28929.0), every tool — find, count, aggregate, list-collections — fails at tool registration, before any tools/call reaches the server: "Tool 'count' has an invalid outputSchema: JSON Schema declares an unsupported dialect ("$schema": "http://json-schema.org/draft-07/schema#"). The default validator supports JSON Schema 2020-12 only." The failure is model-independent. Is there a fix or workaround?
Originally asked on GitHub: https://github.com/mongodb-js/mongodb-mcp-server/issues/1427
5 answers
Still open in mongodb-mcp-server as of the thread. The root cause is not in this server: the MCP TypeScript SDK's zod-to-JSON-Schema conversion defaults to draft-07 when no target is passed, and Claude Code's validator only accepts JSON Schema 2020-12. A contributor opened modelcontextprotocol/typescript-sdk#2653 to flip the SDK default from draft-7 to draft-2020-12. If it ships as a 1.30.x patch, mongodb-mcp-server picks it up automatically (its dependency is
@modelcontextprotocol/sdk: ^1.29.0, unbundled), but users runningnpx -y mongodb-mcp-server@latestneed a new mongodb-mcp-server release — or must clear~/.npm/_npx— before npx stops serving the cached 2.1.0 tree.Working workaround confirmed in the thread — run 1.13.0:
bashnpx -y mongodb-mcp-server@1.13.0A maintainer confirmed there is no actionable server-side fix beyond downgrading and kept the issue open until upstream is resolved.
One suggested fix does not work: passing
target: 'draft-2020-12'from mongodb-mcp-server is not possible because the SDK'sregisterToolnever exposes that option — the only real fix is the SDK default change.Did this work for you?What a GitHub user tried on GitHub (Didn't work)
Reporter reproduced the failure on mongodb-mcp-server 2.1.0, 2.0.0, and 1.14.0 with Claude Desktop, calling any tool. Every tool failed identically at registration with the draft-07 outputSchema error; server logs showed no incoming tools/call.
Source: https://github.com/mongodb-js/mongodb-mcp-server/issues/1427 (opens external site)
Did this work for you?What @amitfin tried on GitHub (Didn't work)
Contributor initially suggested mongodb-mcp-server pass
target: 'draft-2020-12', then retracted it after finding the SDK'sregisterToolhardcodes conversion options and never exposestargetto server authors.Did this work for you?What @amitfin tried on GitHub (Outcome unclear)
Contributor opened upstream PR modelcontextprotocol/typescript-sdk#2653 changing the SDK's default dialect (and unrecognized-target fallback) from draft-7 to draft-2020-12, with tests passing at the time.
Did this work for you?What @Ooscaar tried on GitHub (Worked)
User workaround: run mongodb-mcp-server 1.13.0 via
npx -y mongodb-mcp-server@1.13.0, avoiding the affected versions.Did this work for you?
Related questions
- mongodb-mcp-server count tool ignores filter and returns total collection count in Cursor
- mongodb-mcp-server fails to start with nvm in Claude, Cursor, or VS Code: how to fix?
- mongodb-mcp-server Docker container doesn't exit — fixed in v0.1.2?
- mongodb-mcp-server in Docker: can't connect via HTTP to localhost:9091 — what transport does it use?
- How do I export MongoDB query results to JSON in mongodb-mcp-server?