Skip to content

Could not connect to MCP Server via HTTP #1391

Open
@LePenseur13

Description

@LePenseur13

Describe the bug
When running the GPT Researcher MCP server in Docker, the server logs show it starting, port 8000 is exposed, and the container is on the correct network—but any HTTP request to /docs or /mcp immediately returns a connection refused error:

curl: (7) Failed to connect to gpt-mcp-server port 8000 after 0 ms: Could not connect to server

I saw the exact same behavior when running the server directly on my host (no Docker).


To Reproduce
Steps to reproduce the behavior:

  1. Clone the repo and cd mcp-server.

  2. Add your OpenAI and tavily key to .env (e.g. OPENAI_API_KEY=…).

  3. Build and run in Docker:

    docker build -t gpt-mcp-server .  
    docker network create n8n-mcp-net
    docker run -d \
      --name gpt-mcp-server \
      --network n8n-mcp-net \
      -p 8000:8000 \
      gpt-mcp-server  
  4. From another container on n8n-mcp-net (or from the host), run:

docker run --rm \                                                         
--network n8n-mcp-net \
curlimages/curl:latest \
http://gpt-mcp-server:8000/mcp
curl http://gpt-mcp-server:8000/docs  
curl http://gpt-mcp-server:8000/mcp  
  1. Observe: connection refused.

Expected behavior

  • A 200 OK response with the Swagger UI HTML at /docs.
  • A valid MCP handshake or OpenAPI JSON at /mcp.

Desktop (please complete the following information):

  • OS: Ubuntu 22.04 (Docker host), normal host Mac OS Sequoia
  • Docker Engine: 24.x
  • Python base image: python:3.11-slim

Smartphone (please complete the following information):

  • N/A

Additional context
Dockerfile used (in mcp-server/):

# Dockerfile for gpt-researcher MCP server
FROM python:3.11-slim

WORKDIR /app

COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt

COPY . .

EXPOSE 8000

CMD ["python", "server.py"]
  • Server logs only show the “Starting GPT Researcher MCP Server…” info line and no binding errors.
  • Both n8n and gpt-mcp-server containers are on the same user‑defined bridge network.
  • I have confirmed I can ping the MCP container by name, but HTTP connections are refused.

Happy to share any further logs or try suggested configuration changes. Thanks for any assistance!

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