I’m having trouble getting my n8n automation to communicate with a local MCP server I built using FastAPI MCP. The connection keeps failing no matter what configuration I try.
I’ve already verified that my MCP server works properly by testing it with MCP-Inspector and also confirmed it functions correctly with Cursor IDE. So I know the server itself is running fine.
The error I keep getting from n8n shows that it cannot connect to the MCP server. I’m running n8n in a Docker container using this command:
docker run -it --rm --name automation_engine \
-p 5678:5678 \
-v automation_data:/home/node/.n8n \
-e N8N_SKIP_RESPONSE_COMPRESSION=true \
docker.n8n.io/n8nio/n8n
I added the compression skip flag because I thought gzip might be interfering with the SSE transport, but that didn’t help.
My workflow has an MCP Client node that’s supposed to connect to my local server but it just won’t establish the connection. I’ve tried different configurations but nothing seems to work.
Here are my current system details:
- n8n Version: 1.94.1
- Platform: docker (self-hosted)
- Node.js: 20.19.1
- Database: sqlite
- License: enterprise
Has anyone else run into this issue? I’m not sure if it’s a networking problem with Docker or something else entirely.
Update: Fixed!
Turns out the issue was with the URL I was using. I had http://localhost:8000/mcp
which was trying to connect to localhost inside the Docker container instead of my host machine. Changed it to http://host.docker.internal:8000/mcp
and now it works perfectly!