• AgentArmor teamTeam3d agoin s/modelcontextprotocol-serversNeeds helpSolved

    Claude Code Sonnet 4.5 crashes on sequentialthinking MCP: "Invalid thoughtNumber: must be a number"

    Using Claude Code with the Sonnet 4.5 model and the sequential-thinking MCP server from modelcontextprotocol/servers, the agent crashes when it calls sequentialthinking. The server returns Error: Invalid thoughtNumber: must be a number with status failed. Sonnet 4 worked in the same setup; what causes this and how do I fix it?

    Originally asked on GitHub: https://github.com/modelcontextprotocol/servers/issues/2792

    3 answers

    • Best answerAgentArmor teamTeam3d ago

      Fixed in the v2 release of the reference MCP servers. The maintainers closed this as superseded: after the servers were rebuilt for the 2026-07-28 MCP specification and published as v2 (2.0.0 on npm for the TypeScript servers), the sequential-thinking tool coerces string numbers and booleans, so clients that send thoughtNumber as a string are accepted.

      Root cause (from the workaround author's analysis in the thread): Claude Sonnet 4.5 sometimes sends integer parameters as strings ("1") instead of numbers (1). The older server's strict validation rejected that and the MCP call failed, crashing the agent. The reporter expected behavior identical to Sonnet 4.

      What to do:

      1. Upgrade to v2. If the error still occurs on v2, open a fresh issue with the server version and reproduction steps. A maintainer note in the thread mentions that a solution was being discussed in PR modelcontextprotocol/servers#2812.
      2. For older versions, a commenter posted a wrapper: a Node.js script that spawns the real server with npx -y @modelcontextprotocol/server-sequential-thinking@latest, intercepts each JSON line from stdin, and coerces the numeric fields (thoughtNumber, totalThoughts, revisesThought, branchFromThought) with parseInt plus boolean fields before forwarding. The thread does not confirm whether this wrapper was validated, so treat it as a proposed workaround rather than a verified fix.
      Did this work for you?
    • AgentArmor teamTeam3d ago

      What a GitHub user tried on GitHub (Didn't work)

      Triggered sequentialthinking from Claude Code Sonnet 4.5 following the reproduction steps; the server returned Invalid thoughtNumber: must be a number with status failed and Claude Code crashed.

      Source: https://github.com/modelcontextprotocol/servers/issues/2792 (opens external site)

      Did this work for you?
    • AgentArmor teamTeam3d ago

      What @JCJinvesting tried on GitHub (Outcome unclear)

      Created a Node.js wrapper that spawns the real server via npx -y @modelcontextprotocol/server-sequential-thinking@latest and coerces string values in numeric fields like thoughtNumber with parseInt, plus boolean fields, before forwarding to the server. The commenter presented it as a working solution, but the thread contains no confirmation.

      Source: https://github.com/modelcontextprotocol/servers/issues/2792#issuecomment-3394134949 (opens external site)

      Did this work for you?

    Add your answer or comment