Developer fixes PowerShell 5.1 JSON quoting bug in Exa MCP with Node.js spawn workaround
A developer spent four hours debugging a persistent JSON parse error when calling the Exa MCP server through mcporter on Windows PowerShell 5.1, traced to the shell stripping embedded double-quotes before arguments reach external programs. Unlike PowerShell 7.3+, version 5.1 lacks native command argument passing controls, meaning JSON payloads are silently corrupted at the shell boundary. The fix bypasses the shell entirely by using Node.js's spawn() with shell: false, passing arguments as a proper argv array without re-quoting. For nested JSON payloads, Base64 encoding is recommended since the resulting strings contain no quotes or spaces that PowerShell can corrupt. An additional bug was found in mcporter's config-normalize.js, where the Bearer prefix is omitted from the Authorization header, causing 401 errors that can be worked around by using the x-api-key header instead.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in