Fix "Unexpected token ... is not valid JSON" from a local MCP server
"Unexpected token ... is not valid JSON" in your MCP logs means a local server printed plain text on stdout, the channel reserved for protocol messages. Here is how to find the stray line and move it to stderr, from a quick terminal test to fixing your own server code.