Serverdex error reference · read 21 November 2026
Unexpected token … is not valid JSON: what it means and how to fix it
Unexpected token … is not valid JSON · Unexpected end of JSON inputThe client read a line from the server's stdout that is not JSON-RPC. On the stdio transport stdout is reserved for protocol messages; any banner, progress bar or log line breaks parsing. This is the one error the TypeScript SDK's troubleshooting page is explicitly about.
Shown by: Claude Desktop · Claude Code · Cursor · VS Code
Causes, most likely first — and the fix for each
1The server (or a library it uses) prints to stdout: `console.log`, Python `print`, a progress bar, a deprecation warning routed to stdout.
Fix: Log to stderr only (`console.error`, `logging` to stderr); never `print` on a stdio server. If you do not own the server, report it with the offending line.
2`npx` prints an install notice to stdout the first time it fetches a package.
Fix: Run the command once in a terminal so the package is cached, or add `--quiet`/`-y` flags the package manager supports.
3A remote server answered with HTML (a login page, a 404 page) instead of JSON.
Fix: Check the URL; the Serverdex live check reports `not_mcp` for endpoints that answer with non-JSON bodies.
Still failing?
Work through the twelve general causes in order in MCP server not working: the causes, in order, check the exact config file path and shape for your client in the client setup guides, or generate a known-good config with the config generator.
Sources (read 21 November 2026)
Other MCP errors: MCP error -32000: Connection closed · MCP error -32001: Request timed out · MCP error -32601: Method not found · MCP error -32602: Invalid params · MCP error -32603: Internal error · MCP error -32600: Invalid request · HTTP 406 Not Acceptable from an MCP server · spawn npx ENOENT · spawn uvx ENOENT (and uv, docker) · Server transport closed unexpectedly · Client closed (Cursor) · No tools, prompts, or resources (Cursor) · SSE error: Invalid content type, expected text/event-stream · Could not attach to MCP server (Claude Desktop) · Failed to reconnect to an MCP server (Claude Code) · MCP server needs authentication (401 Unauthorized) · MCP OAuth loop (infinite sign-in tabs) · Tools limited to 40 total (Cursor) · executable file not found in $PATH (Antigravity) · MODULE_NOT_FOUND / No module named mcp.server.fastmcp.