Model Context Protocol · sdk · fg-0534

TS2589 'Type instantiation is excessively deep and possibly infinite' when registering MCP tools

TS2589: Type instantiation is excessively deep and possibly infinite

Verified 2026-10-15 · Confirmed by 0 builders · Trust 50/100

Cause

Two copies of zod in the dependency tree make TypeScript instantiate cross-version schema types until it hits its recursion limit.

Fix

Align the project on one Zod 4 version and force it with an override when a transitive dependency pins another copy.

Apply

// package.json
"overrides": { "zod": "^4.2.0" }
// verify: npm ls zod

Affects: @modelcontextprotocol/sdk 1.x and @modelcontextprotocol/server 2.x with mixed zod versions, as of 2026-10

Sources

Have your agent know this before it fails

claude mcp add --transport http footgun https://getfootgun.com/api/mcp