fix: bind server to 0.0.0.0 and add meaningful health check#6
Open
jimscard wants to merge 2 commits into
Open
Conversation
The previous health check (npm list -g @playwright/mcp) only verified the package was installed, not that the server was running. A crashed MCP process would still report the container as healthy. Replace with pgrep to verify the @playwright/mcp process is actually running. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@playwright/mcp defaults to binding on localhost (127.0.0.1) inside the container. Docker forwards traffic to the container's eth0 IP, not loopback, so all client connections got ECONNRESET. Pass --host 0.0.0.0 alongside --port so the server listens on all interfaces and is reachable from outside the container. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Two bugs affect all users running this as a Docker container.
1. ECONNRESET on all client connections
@playwright/mcpdefaults to binding onlocalhost(127.0.0.1) inside the container. Docker's port forwarding routes traffic to the container'seth0IP — not loopback — so every MCP client connection is immediately reset (ECONNRESET).Fix: Pass
--host 0.0.0.0inentrypoint.shso the server listens on all interfaces.2. Health check reports false positives
The container had no
HEALTHCHECK. Without one, Docker always reports the container as healthy even if the@playwright/mcpprocess crashes after startup.Fix: Add a
HEALTHCHECKusingpgrepto verify the process is actually running.Changes
entrypoint.sh: add--host 0.0.0.0alongside--portDockerfile: addHEALTHCHECKthat checks the process is aliveVerification
After the fix,
curl http://localhost:8931/ssereturns200 OKwith a livetext/event-streamresponse. Before the fix it returnedECONNRESET.