I’m having trouble connecting n8n, which is installed on Docker, to claude n8n mcp.For a Docker-based n8n system to successfully communicate with Claude Desktop, the first step is overcoming network barriers. Many users can access the n8n interface via a browser using http://localhost:5678, and the same address can be entered into the Claude security file. However, when Claude starts an MCP server (e.g., n8n-mcp), if that server is started as a Docker container, the localhost address will be used within that new container and will not reach the n8n on another machine. In short, I couldn’t connect mcp to the n8n installed on locale. I’m waiting for anyone with knowledge on this subject to share their insights below.
The reason you’re hitting a wall is that localhost inside a Docker container is like a private room that can’t see the rest of the house.
To fix this, you just need to point the MCP server to the “gate” leading back to your machine. If you’re on Windows or Mac, swap localhost for host.docker.internal in your Claude config file. If you’re on Linux, you’ll usually use the bridge IP 172.17.0.1. This tells the MCP container to look outside itself and talk to the n8n instance running on your actual system. Alternatively, just run the MCP server via npx instead of Docker , that way it’s already on your host machine and can “see” localhost without any extra networking.
Let me know if you need more help debugging this issue, but keep in mind as never use localhost:XXXX for connecting anything as it wouldnt work.
I tried to solve the problem with Docker, but I failed again; I probably did something wrong. The issue was resolved by installing with npm instead of Docker. Thank you for your suggestion.
I solved the problem. I’ve included the Docker Compose installation and Claude config settings below. The Python part is optional; I installed it because I needed it for work.