n8n cannot access mcp client in Phoenix

Im running an MCP server in my Phoenix application. MCP Inspector says that everything is set up correctly. Now Im trying to access that MCP server locally from n8n using the MCP client node but it keeps saying that it could not connect. Phoenix returns the following error: (Phoenix.Router.NoRouteError) no route found for POST /%7B%22url%22:%22http:/localhost:4000/mcp%22%7D n8n seems to send a json object in the url In the MCP Client Node in the SSE Endpoint field I have provided http://localhost:4000/mcp Does anybody have experience with n8n and know how to correctly integrate it with Phoenix and Ash?
5 Replies
ZachDaniel
ZachDaniel2mo ago
first instinct is some kind of configuration error are you serving your mcp at /mcp?
EnesS
EnesSOP2mo ago
Yes It is working fine with MCP Inspector but perhaps I have not configured it correctly for n8n.
ZachDaniel
ZachDaniel2mo ago
Oh, well, the string you're showing is a url encoded json object
/%7B%22url%22:%22http:/localhost:4000/mcp%22%7D
/%7B%22url%22:%22http:/localhost:4000/mcp%22%7D
iex(1)> URI.decode_www_form("/%7B%22url%22:%22http:/localhost:4000/mcp%22%7D")
"/{\"url\":\"http:/localhost:4000/mcp\"}"
iex(3)>
iex(1)> URI.decode_www_form("/%7B%22url%22:%22http:/localhost:4000/mcp%22%7D")
"/{\"url\":\"http:/localhost:4000/mcp\"}"
iex(3)>
So yeah looks like a configuration error somewhere there
EnesS
EnesSOP2mo ago
Yeah, I noticed that too, but I do not understand why it does that. This question is aimed at people who have successfully integrated Phoenix and n8n, as it is somewhat a niche topic
barnabasj
barnabasj2mo ago
I had a similar problem, using the rust proxy in between fixed the problem with the url being encoded.

Did you find this page helpful?