Bug Description
On macOS (Apple Silicon, Sequoia 15.5), the PowerShell.MCP proxy fails to maintain a connection. The proxy spawns a Terminal.app window with pwsh, but the shell quoting for the -Command argument is broken — identical root cause to #39 (Linux), but affecting macOS.
The spawned command looks like:
pwsh -NoExit -WorkingDirectory '/Users/user' -Command '$global:PowerShellMCPProxyPid = 78022; $global:PowerShellMCPAgentId = ''default''; Import-Module PowerShell.MCP -Force; Remove-Module PSReadLine -ErrorAction SilentlyContinue'
The ''default'' is interpreted by bash/zsh as:
'' → empty string
default → executed as a bare command
'' → empty string
Result:
default: The term 'default' is not recognized as a name of a cmdlet, function, script file, or executable program.
The module partially loads but the $global:PowerShellMCPAgentId is never set correctly, the IPC back to the proxy fails, and the MCP connection drops.
Environment
- macOS: Sequoia 15.5, Darwin 24.6.0, ARM64 (Mac Mini M4)
- pwsh: 7.5.2 (Core), installed via .pkg at
/usr/local/bin/pwsh
- Shell: zsh 5.9
- Terminal: Terminal.app
- Claude Code: CLI (latest)
- PowerShell.MCP: Tested 1.6.8, 1.7.2, and 1.7.6 — all affected
Steps to Reproduce
- Install PowerShell.MCP on macOS ARM64
- Register as MCP server in Claude Code:
claude mcp add PowerShell /path/to/PowerShell.MCP.Proxy
- Launch Claude Code
- MCP shows "Connected" briefly, then tools become unavailable
- A Terminal.app window opens with the
default: The term 'default' is not recognized error
Expected Behavior
The proxy should correctly quote the -Command argument so that $global:PowerShellMCPAgentId is set to 'default' and the module initializes properly.
Suggested Fix
Same as #39 — use -EncodedCommand with Base64-encoded UTF-16LE to avoid shell quoting issues entirely. The fix in #39 was applied to the Linux launcher (PwshLauncherLinux.cs) but the macOS launcher still uses the broken '' quoting.
Alternatively, the command could be written to a temp .ps1 file and executed with -File.
Bug Description
On macOS (Apple Silicon, Sequoia 15.5), the PowerShell.MCP proxy fails to maintain a connection. The proxy spawns a Terminal.app window with
pwsh, but the shell quoting for the-Commandargument is broken — identical root cause to #39 (Linux), but affecting macOS.The spawned command looks like:
The
''default''is interpreted by bash/zsh as:''→ empty stringdefault→ executed as a bare command''→ empty stringResult:
The module partially loads but the
$global:PowerShellMCPAgentIdis never set correctly, the IPC back to the proxy fails, and the MCP connection drops.Environment
/usr/local/bin/pwshSteps to Reproduce
claude mcp add PowerShell /path/to/PowerShell.MCP.Proxydefault: The term 'default' is not recognizederrorExpected Behavior
The proxy should correctly quote the
-Commandargument so that$global:PowerShellMCPAgentIdis set to'default'and the module initializes properly.Suggested Fix
Same as #39 — use
-EncodedCommandwith Base64-encoded UTF-16LE to avoid shell quoting issues entirely. The fix in #39 was applied to the Linux launcher (PwshLauncherLinux.cs) but the macOS launcher still uses the broken''quoting.Alternatively, the command could be written to a temp
.ps1file and executed with-File.