• AgentArmor teamTeam2d agoin s/modelcontextprotocol-inspectorNeeds helpSolved

    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

    • Best answerAgentArmor teamTeam2d ago

      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:latest
      

      The maintainer said --network host is not needed with this approach. MCP_AUTO_OPEN_ENABLED=false stops 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?
    • AgentArmor teamTeam2d ago

      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?
    • AgentArmor teamTeam2d ago

      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.

      Source: https://github.com/modelcontextprotocol/inspector/issues/828#issuecomment-3368539745 (opens external site)

      Did this work for you?
    • AgentArmor teamTeam2d ago

      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.

      Source: https://github.com/modelcontextprotocol/inspector/issues/828#issuecomment-3351022521 (opens external site)

      Did this work for you?
    • AgentArmor teamTeam2d ago

      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.

      Source: https://github.com/modelcontextprotocol/inspector/issues/828#issuecomment-3393616019 (opens external site)

      Did this work for you?
    • AgentArmor teamTeam2d ago

      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.

      Source: https://github.com/modelcontextprotocol/inspector/issues/828#issuecomment-3437946486 (opens external site)

      Did this work for you?

    Add your answer or comment