Filesystem MCP server inputSchema fails: 'Invalid literal value, expected object' after upgrade
After upgrading @modelcontextprotocol/server-filesystem, the OpenAI Agent SDK (0.6.1) and the MCP Inspector fail to list tools on Node 24. The Inspector reports 'invalid_literal, expected "object"' for each tool's inputSchema.type, and OpenAI reports 'Invalid schema for function read_file: schema must be a JSON Schema of type: "object", got type: "None"'. Is there a fixed version or a workaround?
Originally asked on GitHub: https://github.com/modelcontextprotocol/servers/issues/3051
6 answers
Status: root cause explained, but the published npm package was still broken when the issue was closed (closed as not planned). The August 23rd build generated tool schemas with an incorrect call to zod-to-json-schema, so every tool's inputSchema was only {"$schema":"http://json-schema.org/draft-07/schema#"} instead of a JSON Schema object with type "object". Both the MCP SDK and OpenAI reject that. The fix was already on the main branch, but it had not been released to npm; a release was awaiting approval.
Workarounds that worked in the thread:
- Build a custom server with @modelcontextprotocol/sdk ^1 and zod ^3, and define tools with server.tool instead of server.registerTool. One developer ran this without tool-listing errors.
- If you use server.registerTool with the OpenAI Agent SDK, set use_structured_content=True when creating MCPServerStdio; that combination worked for a custom read_file tool.
- Running the filesystem server from the main branch source avoided the inputSchema error, but one reporter then hit a different error when OpenAI parsed the result, so it is not a complete drop-in fix.
General advice: the filesystem server performs read/write operations on the directory you pass it, so only expose paths you intend to share.
Did this work for you?What @buehler tried on GitHub (Worked)
Built a custom McpServer with @modelcontextprotocol/sdk ^1 and zod ^3, used server.registerTool, and set use_structured_content=True on OpenAI's MCPServerStdio; this worked with the OpenAI Agent SDK.
Did this work for you?What @buehler tried on GitHub (Worked)
Used @modelcontextprotocol/sdk ^1 with zod ^3 and server.tool instead of server.registerTool; the server ran without issues.
Did this work for you?What @buehler tried on GitHub (Partly worked)
Ran the filesystem server from the main branch source; tool listing worked until the OpenAI Agent SDK parsed the result, where a different return-type error appeared.
Did this work for you?What @vincentjames501 tried on GitHub (Didn't work)
Tried older published versions via npx -y @modelcontextprotocol/inspector@0.16.8 npx @modelcontextprotocol/server-filesystem@2025.1.14 ./data; the inputSchema failure still occurred.
Did this work for you?What a GitHub user tried on GitHub (Didn't work)
Reproduced with npx -y @modelcontextprotocol/inspector npx @modelcontextprotocol/server-filesystem ./; listing tools returned the invalid_literal inputSchema errors, and OpenAI Agent SDK 0.6.1 rejected the read_file schema.
Source: https://github.com/modelcontextprotocol/servers/issues/3051 (opens external site)
Did this work for you?
Related questions
- mcp-server-fetch: 'AnyUrl' object has no attribute 'decode' error
- Does the official MCP Postgres example validate SQL before executing it?
- How to fix UTF-8 Japanese text corruption/crash in mcp-server-sqlite with Claude Desktop on Windows?
- MCP Knowledge Graph Memory Server fails with ${workspaceFolder} in MEMORY_FILE_PATH
- npx @modelcontextprotocol/server-filesystem: ERR_MODULE_NOT_FOUND for zod-to-json-schema