Skip to content

[BUG?] FastAPI-MCP tool execution fails with connection errors when running in Docker container #124

Open
@osushinekotan

Description

@osushinekotan

Describe the bug
When running FastAPI-MCP inside a Docker container, tool calls fail with "httpx.ConnectError: All connection attempts failed" errors. The MCP endpoint successfully connects (/mcp endpoint responds with 200 OK) and messages are received (POST to /mcp/messages returns 202 Accepted), but when trying to execute any tool from an MCP client, the internal HTTP client fails to connect to the API endpoints within the same container.

To Reproduce

docker compose up

claude desktop

{
  "mcpServers": {
    "servers": {
      "command": "uvx",
      "args": ["mcp-proxy", "http://localhost:8001/mcp"]
    }
  }
}

httpx.ConnectError: All connection attempts failed

System Info

  • MacOS

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions