N8n Docker + MCP toolkit docker (solved)

EDIT: i made it working using
1: Integrate Model Context Protocol (#mcp) in n8n with in docker installation in my case (docker exec -it)

Describe the problem/error/question

N8N does not see my MCP server from docker MCP toolkit. I have both (n8n + MCP) working at the same docker network. Also i have exposed port to my local PC to make sure the container works and it does

Docker container name: gateway-1
Locally it does work at http://localhost:8811/sse
curl http://localhost:8811/health returns 200

What is the error message (if any)?

N8N does not connect with address https://gateway-1:8811/sse

Also not working with http://host.docker.internal:8811/sse


Could not connect to your MCP server

Information on your n8n setup

  • n8n version: latest community
  • Database (default: SQLite): N/A
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
  • Operating system: W11

Any suggestions? Thanks

Hey @soks is your query solved?

1 Like

yes, it’s solved

COuld you share the solution please? thanks

Please could you share the solution? Im in the same situation at the moment :wink:

Hi
SBAutomate, DT_Lab
, its been a while so i don’t remember exactly what i did step by step, but it looks like this now. Pleas note that i almost don’t use this setup anymore, so it could be wrongly configured and i haven’t even noticed: Basically all my containers works within the same docker network (Edge) (see th compose file below) and from n8n I’ve set it up so it would talk internally to the docker gateway. so it should alos work like this:
http://gateway:8811/sse

n8n MCP node configuration:

DOCKER setup

docker compose:


networks:
  edge: {}

services:
  traefik:
    image: traefik:v3.0
    container_name: traefik
    command:
      - --api.dashboard=false
      - --entrypoints.web.address=:80
      - --entrypoints.websecure.address=:443
      - --providers.file.filename=/etc/traefik/dynamic.yml
      - --providers.file.watch=true
      - --certificatesresolvers.le.acme.email= email
      - --certificatesresolvers.le.acme.storage=/letsencrypt/acme.json
      - --certificatesresolvers.le.acme.tlschallenge=true
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - ./dynamic.yml:/etc/traefik/dynamic.yml:ro
      - ./letsencrypt:/letsencrypt

    networks:
      - edge
    restart: unless-stopped
    labels:
      - traefik.enable=false

  openwebui:
    image: ghcr.io/open-webui/open-webui:latest
    container_name: openwebui
    environment:
      - OLLAMA_API_BASE_URL=/ollama
      - OLLAMA_BASE_URL=http://host.docker.internal:11434
      - ENABLE_RAG_WEB_SEARCH=True
      - RAG_WEB_SEARCH_ENGINE=brave
      - BRAVE_SEARCH_API_KEY=XXXXXXXXXXXXXXX
      - RAG_WEB_SEARCH_RESULT_COUNT=3
      - RAG_WEB_SEARCH_CONCURRENT_REQUESTS=10
    networks:
      - edge
    ports:
      - "127.0.0.1:3000:8080"
    volumes:
      - ./data:/app/data
    restart: unless-stopped
    labels:
      - traefik.enable=false

  n8n:
    image: n8nio/n8n:nightly
    container_name: n8n  
    environment:
      - N8N_HOST=my web adress
      - N8N_PORT=5678
      - N8N_PROTOCOL=https
      - N8N_PUBLIC_URL=my web adress
      - WEBHOOK_URL=my web adress
      - N8N_SECURE_COOKIE=true
      - N8N_COMMUNITY_PACKAGES_ALLOW_TOOL_USAGE=true
    networks:
      - edge
    ports:
      - "5678:5678"
    volumes:
      - .n8n_data:/home/node/.n8n
    restart: unless-stopped
    labels:
      - traefik.enable=false   

  gateway:
    image: docker/mcp-gateway
    command:
      - --servers=duckduckgo
      - --servers=curl
      - --transport=sse
      - --port=8811
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    ports:
      - "8811:8811"
    restart: unless-stopped
    networks:
      - edge


and my reverse proxy setup:

http:
  routers:
    n8n:
      rule: "Host(`my web adreess`)"
      entryPoints: ["websecure"]
      service: n8n
      tls: { certResolver: le }
      priority: 100

    ollama:
      rule: "Host(`my webadress`) && PathPrefix(`/ollama`)"
      entryPoints: ["websecure"]
      middlewares: ["strip-ollama"]
      service: ollama
      tls: { certResolver: le }
      priority: 200

    webui:
      rule: "Host(`my another web adress`)"
      entryPoints: ["websecure"]
      service: webui
      tls: { certResolver: le }
      priority: 10
  
    redirect-to-https:
      rule: "Host(`my web adress`, `my anotherwebadress`)"
      entryPoints: ["web"]
      middlewares: ["https-redirect"]
      service: webui, n8n
      
  
  middlewares:
    strip-ollama:
      stripPrefix:
        prefixes: ["/ollama"]
        forceSlash: false

  services:
    webui:
      loadBalancer:
        servers:
          - url: "http://openwebui:8080"
    ollama:
      loadBalancer:
        servers:
          - url: "http://host.docker.internal:11434"
    n8n:
      loadBalancer:
        servers:
          - url: "http://n8n:5678"


1 Like