Issue Description
I’m having trouble getting my n8n automation workflow to connect with my locally running MCP server. The server was built using the FastAPI MCP framework and works perfectly when tested with other tools.
What I’ve Verified
- MCP server functionality confirmed through MCP-Inspector testing
- Successfully tested server integration with Cursor IDE
- Server responds correctly to all test queries
Current Setup
Running n8n in a Docker container with this configuration:
docker run -it --rm --name automation_server \
-p 5678:5678 \
-v automation_data:/home/node/.n8n \
-e N8N_SKIP_RESPONSE_COMPRESSION=true \
docker.n8n.io/n8nio/n8n
Error Details
The MCP Client node consistently fails with connection errors when attempting to reach my local MCP server endpoint. I’ve tried various troubleshooting approaches including disabling response compression.
Environment Information
System Details:
- n8n Version: 1.94.1
- Platform: Docker (self-hosted)
- Node.js: 20.19.1
- Database: SQLite
- License: Enterprise (production)
Storage Config:
- Success/Error logs: enabled
- Binary mode: memory
- Manual execution: enabled
Pruning Settings:
- Enabled with 336 hour retention
- Max count: 10000 executions
Solution Found
The issue was related to Docker networking. When using http://localhost:8000/mcp as the server URL, n8n was trying to connect to localhost within the container instead of the host machine.
Fix: Changed the MCP server URL from http://localhost:8000/mcp to http://host.docker.internal:8000/mcp
This allows the containerized n8n instance to properly reach the MCP server running on the host system. The connection now works perfectly and all MCP tools are accessible within the workflow.