Skip to content

server-filesystem: tools/list schemas declare unsupported $schema draft-07 dialect, rejected by strict 2020-12 validators #4841

Description

@tomekep

Summary

@modelcontextprotocol/server-filesystem (tested on the current latest, 2026.8.31, published 2026-09-17) emits tools/list responses where every tool's schema declares:

"$schema": "http://json-schema.org/draft-07/schema#"

Clients that validate tools/list strictly against JSON Schema 2020-12 reject every tool outright, e.g.:

Tool '<name>' has an invalid outputSchema/inputSchema: JSON Schema declares an unsupported dialect ("$schema": "http://json-schema.org/draft-07/schema#"). The default validator supports JSON Schema 2020-12 only

This is the same class of problem noted as a "separately noted, different, unrelated bug" in #4772 for server-memory, but here it reproduces for server-filesystem as well.

Steps to reproduce

Spawn the server directly and send a raw tools/list request over stdio:

printf '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"test","version":"1.0"}}}\n{"jsonrpc":"2.0","method":"notifications/initialized"}\n{"jsonrpc":"2.0","id":2,"method":"tools/list"}\n' \
  | node node_modules/@modelcontextprotocol/server-filesystem/dist/index.js /some/allowed/dir

Every tool's inputSchema includes "$schema":"http://json-schema.org/draft-07/schema#".

What I checked before filing

  • Confirmed this reproduces on a fresh install of the latest published version (2026.8.31), not an old cached one — npm ls -g @modelcontextprotocol/server-filesystem shows 2026.8.31, installed minutes before reproducing.
  • The package depends on zod-to-json-schema@3.25.2, whose zodToJsonSchema() sets combined.$schema = "http://json-schema.org/draft-07/schema#" whenever refs.target === "jsonSchema7" (its own default target) — dist/cjs/zodToJsonSchema.js and dist/esm/zodToJsonSchema.js, same line in both.
  • However, patching that exact line in both files (changing the literal to a 2020-12 URI) and re-spawning the server (fresh process, no compile cache active, confirmed via node -e "console.log(process.env.NODE_COMPILE_CACHE)"undefined) did not change the live tools/list output — it still returns draft-07. I verified with grep that the patched files on disk have zero occurrences of draft-07 after the edit, yet the live response is unchanged.
  • I could not find any other occurrence of the literal string draft-07 anywhere else under server-filesystem's own node_modules/@modelcontextprotocol/sdk, and dist/index.js itself contains no zod-to-json-schema import and no toJSONSchema call.
  • One more lead I did not have time to chase down: the package also pulls in zod v4, whose native toJSONSchema() (node_modules/zod/v4/core/json-schema-generator.js) also normalizes its default target to "draft-07" (see the module's own JSDoc example and the normalizedTarget = "draft-07" fallback). It's possible the actual schema generation path used by the current build goes through Zod v4's native generator instead of (or in addition to) zod-to-json-schema, which would explain why patching the latter had no effect. I did not confirm this — flagging it as the most promising next place to look.

Impact

Any MCP client with a strict JSON Schema 2020-12 validator on tools/list (e.g. Claude Code / Claude Desktop's "Cowork and Code sessions" context, similar to what's described in #4772) cannot use server-filesystem at all — every tool call fails at the schema-validation step before it's ever invoked.

Environment

  • @modelcontextprotocol/server-filesystem@2026.8.31
  • zod-to-json-schema@3.25.2 (as installed transitively)
  • Node.js v24.15.0, Windows 11 ARM64

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions