Why does the MCP Inspector Docker container refuse connections on localhost:6274, and how do I fix it?
On macOS with Docker Desktop, running the MCP Inspector Docker image with --network host and published ports 6274 and 6277 fails: curl and the browser get connection refused on localhost:6274. Adding HOST and ALLOWED_ORIGINS did not help some users, and podman showed the same behavior.
Originally asked on GitHub: https://github.com/modelcontextprotocol/inspector/issues/828
6 answers
This issue is closed as completed. The Inspector listens only on the localhost interface by default, which a container's published ports cannot reach. A maintainer confirmed that setting HOST=0.0.0.0 inside the container works when ports are published on 127.0.0.1 on the host:
docker run --rm \ -p 127.0.0.1:6274:6274 \ -p 127.0.0.1:6277:6277 \ -e HOST=0.0.0.0 \ -e MCP_AUTO_OPEN_ENABLED=false \ ghcr.io/modelcontextprotocol/inspector:latestThe maintainer said
--network hostis not needed with this approach.MCP_AUTO_OPEN_ENABLED=falsestops the server from trying to open a browser inside the container, which otherwise printed "Invalid origin: http://0.0.0.0:6274". Open the URL printed by the container on your host, using the session token it shows.General advice: binding the host side to 127.0.0.1 keeps the published ports off other network interfaces, which limits the exposure of listening on 0.0.0.0 inside the container.
Some users reported that HOST and ALLOWED_ORIGINS with --network host did not fix it, and one user saw the same failure with podman. The maintainer said the README was updated to fix this in December 2025.
Did this work for you?What @stevenh tried on GitHub (Didn't work)
Ran the image with --network host and published ports 6274 and 6277, then tried curl and a browser on localhost:6274. Both were refused. Also tried without host networking.
Source: https://github.com/modelcontextprotocol/inspector/issues/828 (opens external site)
Did this work for you?What @cliffhall tried on GitHub (Worked)
Ran the image with the README command on Inspector 0.17.0 and reached it in the browser and with curl on macOS Sequoia.
Did this work for you?What @p5 tried on GitHub (Partly worked)
Added HOST=127.0.0.1 and ALLOWED_ORIGINS=http://127.0.0.1:6274 to a docker run command with --network host. The maintainer reported this command worked on 0.17.0, but another user reported that these variables did not help.
Did this work for you?What @cliffhall tried on GitHub (Worked)
Ran docker run with -e HOST=0.0.0.0 and published ports without --network host. The server must listen on 0.0.0.0 for published ports to work in this setup.
Did this work for you?What @stevenh tried on GitHub (Partly worked)
Used docker run -e HOST=0.0.0.0 with published ports. The server was reachable, but the printed URL gave an Invalid origin error for 0.0.0.0.
Did this work for you?
Related questions
- MCP Inspector 0.10.2 sends null for unset optional params (error -32602)?
- Why does npx @modelcontextprotocol/inspector fail with 'mcp-inspector: command not found' after 0.10.0?
- How do I increase MCP Inspector's 10-second request timeout?
- MCP Inspector crashes with 'Controller is already closed' on fastmcp Streamable HTTP
- Why doesn't MCP Inspector auto-refresh an expired access token (HTTP 401)?