Version
v1.63.0
Steps to reproduce
run the MCP server with --host 0.0.0.0, i.e.:
node /app/cli.js --headless --browser chromium --no-sandbox --port 8931 --host 0.0.0.0
This is the actual docker configuration recommended by the playwright-mcp documentation, and it doesn't work (the service binds to 127.0.0.1):
docker run -d -i --rm --init --pull=always \
--entrypoint node \
--name playwright \
-p 8931:8931 \
mcr.microsoft.com/playwright/mcp \
/app/cli.js --headless --browser chromium --no-sandbox --port 8931 --host 0.0.0.0
Expected behavior
http binds to 0.0.0.0 when so configured
Actual behavior
http binds to 127.0.0.1 instead
Additional context
Line 56 of packages/playwright-core/src/tools/utils/mcp/http.ts replaces 0.0.0.0 with localhost when the normalizeloopback option is set (and this is only called in one place and is always set). 0.0.0.0 is not a loopback address, and doing this translation prevents non-localhost use without the explicit specification of an interface IP (and entirely so in a container environment where no such IP is available)
Environment
Version
v1.63.0
Steps to reproduce
run the MCP server with
--host 0.0.0.0, i.e.:node /app/cli.js --headless --browser chromium --no-sandbox --port 8931 --host 0.0.0.0This is the actual docker configuration recommended by the playwright-mcp documentation, and it doesn't work (the service binds to 127.0.0.1):
Expected behavior
http binds to 0.0.0.0 when so configured
Actual behavior
http binds to 127.0.0.1 instead
Additional context
Line 56 of
packages/playwright-core/src/tools/utils/mcp/http.tsreplaces 0.0.0.0 with localhost when thenormalizeloopbackoption is set (and this is only called in one place and is always set). 0.0.0.0 is not a loopback address, and doing this translation prevents non-localhost use without the explicit specification of an interface IP (and entirely so in a container environment where no such IP is available)Environment