Bug
expect mcp crashes on Windows with:
Error: Cannot find module 'C:\C:\Users\...\expect-cli\dist\browser-mcp.js'
Root cause
In dist/index.js, the mcp command spawns browser-mcp.js using:
let v = fileURLToPath(new URL('./browser-mcp.js', import.meta.url))
// then: execFileSync(process.execPath, [v], ...)
On Windows, fileURLToPath returns a POSIX-style path /C:/Users/.../browser-mcp.js instead of C:\Users\...\browser-mcp.js. When this is passed as a CLI argument to node.exe, Windows interprets /C:/... relative to the current drive root, producing C:\C:\....
Repro
npm install -g expect-cli
echo '{"jsonrpc":"2.0","method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"test","version":"1"}},"id":1}' | expect mcp
Environment
- OS: Windows 11
- Node.js: v22.22.2
- expect-cli: 0.1.3
- Shell: Git Bash (bash via MINGW64)
Fix suggestion
Wrap the path with a Windows path normalization before passing to execFileSync:
import { fileURLToPath } from 'node:url';
import path from 'node:path';
let v = path.resolve(fileURLToPath(new URL('./browser-mcp.js', import.meta.url)));
path.resolve will normalize /C:/... → C:\... on Windows.
This blocks Claude Code MCP integration on Windows entirely — the MCP server can never start.
Bug
expect mcpcrashes on Windows with:Root cause
In
dist/index.js, themcpcommand spawnsbrowser-mcp.jsusing:On Windows,
fileURLToPathreturns a POSIX-style path/C:/Users/.../browser-mcp.jsinstead ofC:\Users\...\browser-mcp.js. When this is passed as a CLI argument tonode.exe, Windows interprets/C:/...relative to the current drive root, producingC:\C:\....Repro
Environment
Fix suggestion
Wrap the path with a Windows path normalization before passing to
execFileSync:path.resolvewill normalize/C:/...→C:\...on Windows.This blocks Claude Code MCP integration on Windows entirely — the MCP server can never start.