Skip to content

Server hangs on search POST request inside Docker #17

@com6-ai

Description

@com6-ai

Hi!

I'm trying to run your DuckDuckGo MCP server inside a Docker container, but I'm encountering a deadlock issue. The server starts correctly, but when it receives a POST request for the search tool, the process hangs indefinitely and the client receives a "Connection reset by peer" error.

Environment:

  • Host OS: Ubuntu/Debian-based Linux
  • Docker: Recent version (e.g., 26.x)
  • Installation Method: Building the Docker image from source using the provided Dockerfile.

Steps to Reproduce:

  1. Clone the repository:
    git clone [https://github.com/nickclyde/duckduckgo-mcp-server.git](https://github.com/nickclyde/duckduckgo-mcp-server.git)
  2. Navigate into the directory:
    cd duckduckgo-mcp-server
  3. Build the Docker image:
    docker build -t my-duckduckgo-server .
  4. Run the container in the foreground to observe its output (in Terminal 1):
    docker run -it --rm -p 8080:8080 --name mcp-duckduckgo my-duckduckgo-server sh -c "python -m duckduckgo_mcp_server.server"
  5. In a second terminal (Terminal 2), send a search request:
    curl -X POST -H "Content-Type: application/json" -d '{"tool": "search", "parameters": {"query": "test"}}' http://localhost:8080/

Expected Behavior:

The curl command in Terminal 2 should receive a JSON response with search results.

Actual Behavior:

  • The curl command in Terminal 2 fails with the error: curl: (56) Recv failure: Connection reset by peer.
  • The server process in Terminal 1 does not crash or print any error messages. It just hangs and becomes unresponsive.

Diagnostic Steps Taken:

We have thoroughly debugged the environment and can confirm the following:

  • The container has full network connectivity. From an interactive shell inside the container, both ping duckduckgo.com and curl -v https://duckduckgo.com work perfectly, confirming DNS and SSL/TLS are working correctly.
  • The docker logs for the container are always empty, as the process never logs an error before hanging.
  • The issue persists even after changing the base image in the Dockerfile from python:3.11-alpine to python:3.11-slim and explicitly installing ca-certificates.

This strongly suggests the issue is not with the Docker environment, networking, or SSL, but likely an internal deadlock within the Python application itself when it attempts to make the outbound request to DuckDuckGo.

Thanks for creating this tool! Let me know if you need any more information from my side.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions