`claude mcp serve` tools with anyOf schemas fail to parse in MCP clients
Summary
When using claude mcp serve as an MCP server, tools fail to be displayed in various MCP clients (Claude Desktop, Cursor) due to validation errors in the tool schemas.
Environment
- Claude Code version: 2.0.24
- Clients tested:
- Claude Desktop (macOS)
- Cursor (with MCP support)
- OS: macOS 25.0.0
Problem Description
The MCP server starts successfully and returns a tools list, but MCP clients fail to parse the tools due to schema validation errors.
Error Details
Cursor Error Log
Error listing tools: [
{
"code": "invalid_literal",
"expected": "object",
"path": ["tools", 0, "outputSchema", "type"],
"message": "Invalid literal value, expected \"object\""
},
{
"code": "invalid_literal",
"expected": "object",
"path": ["tools", 5, "outputSchema", "type"],
"message": "Invalid literal value, expected \"object\""
}
]
Found 0 tools, 0 prompts, and 0 resources
Claude Desktop Behavior
- Server shows as "connected" in UI
- Tools list appears empty:
Tools: (none) - Log shows server started successfully but tools not displayed
Root Cause
The following tools have outputSchema that uses anyOf for Union types without a top-level type field:
- Task (tools[0])
- Read (tools[5])
Example schema structure:
{
"anyOf": [...],
"$schema": "http://json-schema.org/draft-07/schema#"
}
While this is valid JSON Schema, MCP clients appear to require an explicit top-level type: "object" field in the outputSchema.
Verification
Direct JSON-RPC testing confirms the server returns tools correctly:
$ echo '{"jsonrpc":"2.0","id":1,"method":"tools/list"}' | claude mcp serve
# Returns 16 tools including: Task, Bash, Glob, Grep, Read, Edit, Write, etc.
However, all tested MCP clients fail to parse the response.
Expected Behavior
All 16 tools should be displayed and usable in MCP clients.
Actual Behavior
0 tools are displayed due to schema validation errors.
Suggested Fix
For tools using Union types (anyOf) in outputSchema, either:
- Wrap the
anyOfin an object withtype: "object"at the top level, or - Update MCP client implementations to handle Union types correctly
Impact
This prevents claude mcp serve from being usable with third-party MCP clients, limiting its utility for cross-tool workflows.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗