Error “Could not connect to your MCP server” when integrating external tool via SSE in AI Agent

I’m building an automation using n8n and trying to connect an AI Agent to an SSE (Server-Sent Events) endpoint using the MCP Client node.

However, I’m getting this error in the flow:

:cross_mark: Error in sub-node ‘MCP Client’

Could not connect to your MCP server

The endpoint I’m using is public and should work, but I keep getting the message:

“Cannot GET /mcp/teste/sse”

I’m not sure if the problem is with my endpoint configuration or something I’m missing on the n8n side.

Has anyone faced this before?

Any tips on what I should check to make this connection work properly with SSE?

Thanks in advance!

2 Likes

same issue

I got the same issue here. My MCP server was created in another workflow and my n8n is installed via coolify

1 Like

same issue. both production and test url did not work.

getting the same error got it to work for a while then it just would not connect ! anyone figured it out

Hey guys, this is a known issue.
It turns out MCP uses SSE connection and that’s a new thing for n8n.

So you have to adapt the infrastructure to treat the connection differently when using MCP.

With Coolify I found out you have to disable gzip compression for the /mcp path, while leaving it enabled for everything else.

That’s also true for traefik and nginx users.

Here’s some useful resources:

The video is in Portuguese, but it’s very well explained. Enable subtitles.

@Robin_Ramkhalawan @Lucas_Mozzatto_Chave @damiao_j @Jonathan_Politzki @khai-mle

5 Likes

Do you know where gzip is disabled for MCP? I can’t find that information easily.

1 Like

On the links I sent above I know there’s a guy teaching how to do it.

Hello everyone, I managed to connect my client by passing the following URL in the agent tool (SSE Endpoint field): http://[SERVICENAME]:[PORT]/mcp/… Mine ended up something like: http://n8n:5678/mcp/…
this is for using within n8n only but is better than connect via internet.

For those who wants to disable gzip just uncheck this and restart your n8n service:

1 Like

Did you fixed the issue…?? I am also having the same problem

same for this worfklow please help

1 Like

Thanks @damiao_j, using container name worked for me.

SSE Endpoint:

http://n8n:5678/mcp/{path}/sse

I also tested exposing n8n with ngrok and works fine too.

1 Like

I am having the same problem too, if someone has a concise and an easy-forward way to solve this issue please share it with the community :slight_smile:

2 Likes

Hey @yasafa, please provide more details and what you have tried so far. Is it local or hosted?

In the meantime, check for any typos in scheme, URL, port, and path.
{SCHEME}://{URL}:{PORT}/{PATH}

no i mean it was really similar to what others described, when connecting an MCP client with a local MCP trigger (on n8n) it fails to connect using the production URL. is there another way to do it?
because with external mcp servers, like brave search I managed to connect with STDIO, so yeah I was wondering if there is a simple solution to connect the client to a local MCP trigger on n8n itself

1 Like

I simply replaced “localhost” with the IP equivalent 127.0.0.1 and it worked

1 Like

Where did you do this?

1 Like

You enter that on MCP Clients’s SSE Endpoint field.

2 Likes

SOLVED: In my case (n8n is hosted in hostinger) the solution was:

1- add the port after my domain
2- due n8n doesn’t have SSL, the url of my MCP Server is http://
3- the example: http://n8n.YOURDOMAIN:5678/mcp/XXXXXXXX/sse

Hoping it helps you.

Thank you. Worked for me as well.

1 Like