I Spent 4 Hours Fighting PowerShell 5.1 Quoting Hell to Make Exa MCP Work. Here is the 10-Line Fix That Saved Me
Everything looked perfect. I had mcporter 0.7.3 configured with the Exa MCP server: mcporter list exa # ✅ exa (2 tools) — "Search the web for any topic..." Healthy. Ready. Then I made the first real call: mcporter call "exa.web_search_exa(query: \" ollama cloud models\ ", numResults: 5)" JSON parse error at position 1. Every. Single. Time. I tried every quoting trick known to PowerShell: Backslash escaping --% stop-parsing operator cmd /c wrapper Single-quoted outer strings Same error. The shell was eating my quotes before mcporter ever saw them. This is the full story of how I debugged it, verified on Windows PowerShell 5.1 on July 31, 2026. Chapter 1: The Root Cause - PowerShell 5.1's Dirty Secret PowerShell 5.1 strips ALL embedded double-quotes at the native-argument boundary when passing args to external programs. There is no $PSNativeCommandArgumentPassing in 5.1. That is a PowerShell 7.3+ feature. So this: mcporter call --args '{"query":"test"}' Literally becomes this before Node.js even starts: { query:test } The JSON is destroyed. No shell-level trick can fix it. Stop fighting the shell. Chapter 2: The Hero - A 10-Line Node.js Spawn Wrapper The fix is to bypass the shell entirely with spawn(..., { shell: false }) . Node passes a real argv array, no re-quoting happens. Create mcporter_exa.js : // mcporter_exa.js - The hero const { spawn } = require ( ' node:child_process ' ); const args = process . argv . slice ( 2 ); // --tool <tool> <base64Json> mode, or default web_search_exa const tool = args [ 0 ] === ' --tool ' ? args [ 1 ] : ' exa.web_search_exa ' ; const payload = args [ 0 ] === ' --tool ' ? args [ 2 ] : JSON . stringify ({ query : args [ 0 ], numResults : Number ( args [ 1 ] || 5 ) }); const child = spawn ( process . execPath , [ require . resolve ( ' mcporter/dist/cli.js ' ), ' call ' , tool , ' --args ' , payload ], { shell : false , stdio : ' inherit ' }); child . on ( ' exit ' , ( code ) => process . exit ( code ?? 0 )); Usage: # Web search - que