MCP HTTP client fails to resolve JSON Schema $ref (#/$defs/ScreenInstance) from Google Stitch MCP server

Status Open
Reported on v2.1.205
Maintainer reply ✓ Yes — bcherny
Activity 3 comments · opened Jul 9, 2026
💡 Likely answer: A maintainer (bcherny, collaborator) responded on this thread — see the highlighted reply below.

Claude Code version: 2.1.205 (macOS, Darwin 25.5.0)

Steps to reproduce:

  1. claude mcp add stitch --transport http https://stitch.googleapis.com/mcp --header "X-Goog-Api-Key: <valid key>" -s user
  2. claude mcp list or claude mcp get stitch

Expected: Server connects and tools load successfully.

Actual:

stitch: https://stitch.googleapis.com/mcp (HTTP) - ! Connected . tools fetch failed
Issue: can't resolve reference #/$defs/ScreenInstance from id #

Verification the server itself is fine:
A raw curl POST to the same endpoint with the same API key, calling tools/list directly over the MCP JSON-RPC protocol, returns a valid response including a create_project tool whose outputSchema contains nested $defs and $ref entries (e.g. referencing ScreenInstance). The raw JSON-RPC response is well-formed.

This suggests Claude Code's MCP client has a bug resolving $ref pointers into $defs when the referenced schema is nested inside a tool's outputSchema (as opposed to top-level inputSchema), causing the entire tools/list fetch to fail rather than degrading gracefully or skipping the one problematic tool.

Impact: The Stitch MCP server (stitch.googleapis.com/mcp) cannot be used at all from Claude Code, even with a correct, working API key.

View original on GitHub ↗

3 Comments

Ali-xra · 1 month ago

Still reproduces on Claude Code 2.1.218 (VS Code ext, Windows 11) — currently the latest published release (npm dist-tags → latest: 2.1.218), so no update resolves it. claude mcp get stitch → ! Connected · tools fetch failed / can't resolve reference #/$defs/ScreenInstance from id #. Deterministic across restarts. Root cause in #77106 (recursive $ref in Stitch's ScreenInstance, no cycle detection). Server remains unusable from Claude Code on latest.

natanael-melo · 27 days ago

+1

bcherny collaborator · 14 days ago

Reproduced on 2.1.233 (Linux) — confirmed, though the root trigger is slightly different from the description.

A well-formed outputSchema with $ref pointing into $defs actually resolves fine (tested as a control — the server connects and tools load). The real trigger: the Stitch server's upload_design_md tool declares "$ref": "#/$defs/ScreenInstance" in its outputSchema but that schema contains no $defs at all — a dangling reference (you can see it in your raw tools/list curl output). The schema validator correctly rejects it.

The bug on our side: one tool with an unresolvable schema fails the entire tools fetch, so the server's 15 other perfectly valid tools don't load either. We should skip the malformed tool and load the rest — keeping this open to track that fix.

In the meantime, this is also worth reporting to the Stitch team: their upload_design_md output schema references #/$defs/ScreenInstance without defining it, which will trip up spec-compliant MCP clients generally.

🤖 Generated with Claude Code