Skip to content

[Bug]: MCP: 0.0.0.0 is incorrectly translated to loopback for http mode, breaking non-loopback use #42952

Description

@yeasah

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

irrelevant

No activity

Activity on this issue will appear here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions