MCP HTTP client fails to resolve $defs/$ref in tool schema ("can't resolve reference")
Description
When connecting to a remote HTTP MCP server whose tool schemas use a top-level $defs block with internal $ref pointers, the MCP client fails to fetch the tool list with a schema-resolution error, even though the connection and authentication succeed.
Steps to reproduce
- Register a remote HTTP MCP server that returns tool schemas containing
$defsand$ref: "#/$defs/<Name>":
``bash``
claude mcp add stitch --transport http https://stitch.googleapis.com/mcp --header "X-Goog-Api-Key: <redacted>" -s user
- Run:
``bash``
claude mcp get stitch
Observed behavior
stitch:
Scope: User config (available in all your projects)
Status: ! Connected · tools fetch failed
Issue: can't resolve reference #/$defs/ScreenInstance from id #
Type: http
URL: https://stitch.googleapis.com/mcp
The connection and auth handshake succeed (the server is reachable and the API key is accepted), but the subsequent tool-list fetch fails during JSON Schema resolution. The error persists across claude mcp get stitch calls and across a full Claude Code restart — it is not transient/caching-related.
Expected behavior
The MCP client's JSON Schema resolver should support standard $defs/$ref references (including refs relative to the schema root, #/$defs/<name>), consistent with the JSON Schema spec and how other MCP-compatible clients (e.g. Cursor, VS Code, Antigravity, Gemini CLI) handle the same server's schemas per its own setup docs.
Environment
- Claude Code version: 2.1.207
- OS: Linux
- Transport:
http - Server: Google Stitch MCP (
https://stitch.googleapis.com/mcp), a remote/hosted MCP server documented at https://stitch.withgoogle.com/docs/mcp/setup/
Additional context
This may be specific to how the Stitch server structures its schema (top-level $defs referenced via #/$defs/ScreenInstance), so it's possible the fix belongs on either side — filing here first since the client-side error message is what's actionable from the user's perspective. Happy to provide the raw schema response if useful for debugging (not included here since it may contain implementation details from a third party).