Mcp server not running on n8n

Describe the problem/error/question

I’m experiencing an issue with the MCP (Model Context Protocol) server functionality in my n8n installation. I’ve created a simple MCP server with a calculator tool, but it doesn’t work at all - it’s as if the MCP functionality isn’t present. When attempting to run a workflow that uses the MCP Client node, I receive a connection error.

What is the error message (if any)?

When running the workflow in n8n: Error in sub-node ‘MCP Client’: Could not connect to your MCP server

Please share your workflow

{
  "nodes": [
    {
      "parameters": {},
      "type": "@n8n/n8n-nodes-langchain.toolCalculator",
      "typeVersion": 1,
      "position": [
        440,
        180
      ],
      "id": "e6015157-ddfa-4f48-96f7-d686e62642d9",
      "name": "Calculator"
    },
    {
      "parameters": {
        "path": "te"
      },
      "type": "@n8n/n8n-nodes-langchain.mcpTrigger",
      "typeVersion": 1,
      "position": [
        220,
        -80
      ],
      "id": "cfd1b8d1-a73e-4cef-8d0b-27a16bb7c253",
      "name": "MCP Server Trigger",
      "webhookId": "dcdd5a88-481d-4636-baa0-7244b4e4723f"
    }
  ],
  "connections": {
    "Calculator": {
      "ai_tool": [
        [
          {
            "node": "MCP Server Trigger",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  },
  "pinData": {},
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "91cb9c1aae5938057abecf7c7c74f18cc4299fba77e8af33cac6f7e368af36a9"
  }
}



{
  "nodes": [
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "typeVersion": 1.1,
      "position": [
        -400,
        -140
      ],
      "id": "c0b15dff-b22e-4234-a04a-0e25a3bed54a",
      "name": "When chat message received",
      "webhookId": "412bbb4c-3860-4e9b-8fe0-b06bc76ff907"
    },
    {
      "parameters": {
        "options": {
          "systemMessage": "du bist ein assistent namens Ulf und antwortest auf fragen des users. nutze den dir zur verfügung stehenden Calculator tool für mathematische fragen."
        }
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 1.9,
      "position": [
        -160,
        -140
      ],
      "id": "ed1832d6-876f-4a45-babe-699ce87d3e55",
      "name": "AI Agent"
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini"
        },
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.2,
      "position": [
        -260,
        80
      ],
      "id": "2975a421-9fc9-4de7-a7b1-ac5724237034",
      "name": "OpenAI Chat Model",
      "credentials": {
        "openAiApi": {
          "id": "hc0M7qFJzj4HBatp",
          "name": "OpenAi account n8n projekt"
        }
      }
    },
    {
      "parameters": {
        "sseEndpoint": "https://my.automationsdr.com/mcp/te/sse"
      },
      "type": "@n8n/n8n-nodes-langchain.mcpClientTool",
      "typeVersion": 1,
      "position": [
        120,
        100
      ],
      "id": "6be5e937-9bb1-493d-beaf-887b29964085",
      "name": "MCP Client"
    }
  ],
  "connections": {
    "When chat message received": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "MCP Client": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  },
  "pinData": {},
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "91cb9c1aae5938057abecf7c7c74f18cc4299fba77e8af33cac6f7e368af36a9"
  }
}

Share the output returned by the last node

The workflow fails with the error message: “Error in sub-node ‘MCP Client’: Could not connect to your MCP server”

Information on your n8n setup

  • n8n version: 1.92.2
  • Database: PostgreSQL
  • n8n EXECUTIONS_PROCESS setting: regular
  • Running n8n via: Docker (self-hosted) via Coolify on Hetzner Server
  • Operating system: Linux (Hetzner Cloud)

Additional details:

  • License: Enterprise (production)
  • Node.js version: 20.19.0
  • Concurrency: -1
  • Storage:
    • success: all
    • error: all
    • progress: false
    • manual: true
    • binaryMode: memory
  • Pruning:
    • enabled: true
    • maxAge: 336 hours
    • maxCount: 10000 executions
  • Client:
    • userAgent: mozilla/5.0 (windows nt 10.0; win64; x64) applewebkit/537.36 (khtml, like gecko) chrome/136.0.0.0 safari/537.36
    • isTouchDevice: false

I’ve tried creating a basic MCP server in n8n, but the MCP functionality appears to be non-existent or non-functional. The MCP Client node consistently fails to connect to the server with a generic “Could not connect to your MCP server” error. I’ve tried restarting and redeploying the server, but the issue persists.

Has anyone experienced similar issues with MCP functionality in n8n? Are there specific configurations or prerequisites needed for MCP to work properly in an n8n Enterprise installation? Any insights or troubleshooting steps would be greatly appreciated.

Hi Dari!

Thanks for sharing all the details — super helpful to understand what’s going on. Let’s break down the issue and the likely cause of your MCP Client error:

“Could not connect to your MCP server”


Things to Check to Get MCP Working

1. MCP Server Is Only Enabled in Agent Mode

Ensure your n8n instance is running with the MCP feature enabled. In self-hosted setups, MCP support is tied to agent mode and must be explicitly activated.

If you’re running in Docker, check that your container is started with:

N8N_FEATURE_FLAG_MCP=true

You can pass this in your Docker Compose environment: section or as a -e flag.


2. MCP Server Trigger (Listener) Must Be Active

You included this node:

"type": "@n8n/n8n-nodes-langchain.mcpTrigger"

This is your MCP Server, and it must be active and running in an always-on workflow.

In n8n self-hosted, workflows with Trigger nodes (like MCP Server Trigger) must be activated and stay running.

→ Go to your workflow, click Activate, and make sure it’s always running in the background.
Without activation, the SSE endpoint (/mcp/te/sse) won’t respond.


3. Check That the URL Is Accessible

You’re using:

https://my.automationsdr.com/mcp/te/sse

This URL must:

  • Be reachable externally (i.e., your Docker container must expose ports correctly)
  • Have valid SSL (if using https)
  • Match the path you defined in the MCP Trigger node (te in this case)

Test it from your browser:
Try opening https://my.automationsdr.com/mcp/te/sse — it should stay “loading” or give text/event-stream (not 404 or 500).


4. Your AI Agent Must Have the Tool Connected Correctly

The Calculator tool must be attached to the MCP Trigger node’s ai_tool port, which looks OK in your JSON.

Also, ensure your MCP Client connects to that path only after the MCP Server is active. The failure may occur if the server didn’t initialize yet.


TL;DR - Fix Summary

  1. :white_check_mark: Add N8N_FEATURE_FLAG_MCP=true to your Docker env
  2. :white_check_mark: Activate the MCP Server Trigger workflow
  3. :white_check_mark: Confirm the /mcp/te/sse path is externally reachable
  4. :white_check_mark: Double-check your AI Agent setup
  5. :repeat: Restart the container after setting the env variable

Let me know if you want a working MCP server + client setup template — happy to share a minimal working example you can build from!

1 Like

Please share ure workflow like this

n8n attach workflow
Once u click the code button, just hit paste and it will format okay.

Also, there is a community mcp, and if on latest version of N8N built in package.

I would try this first, calling the mcp trigger, via a mcp client in the same workflow, this helps confirm everything is all good.

Where are you calling the MCP server? in another workflow or outside n8n like in a ide?

check this out

see video for details.

offical vid from n8n https://www.youtube.com/watch?v=45WPU7P-1QQ&t=231s&pp=ygUHbWNwIG44bg%3D%3D

shows how to test workflow and use externally

1 Like

Thank you for your advice. I added that variable in coolify.:

But unfortunately it still doesn’t work:

Can you please explain what you mean with that?:

" In self-hosted setups, MCP support is tied to **agent mode **…" What is the agent mode?

" check that your container is started with: N8N_FEATURE_FLAG_MCP=true"

How can I check that the container ist started with that? Unfortunately I don’t know how to do that.

Hi guys. i found a solution. About my n8n setup - I hosted with Hetzner via Coolify dashboard. The error is in the gzip compression. You have to disable it for the mcp-server to work. have a look at my screenshots.

Have a great day! :slight_smile:

Here is what you need to do:

  1. uncheck gzip
  2. save
  3. rerun…
2 Likes

Olá amigo!
Você saberia compartilhar essa solução através do painel do EasyPanel?
Utilizo ele e por lá não consegui encontrar.

@Carlos_Aniceto lamento, mas não utilizo o easypanel. Não sei como o posso ajudar.

Perguntei ao chatgpt. Ele dá o seguinte conselho:

Editar o Caddyfile:

A localização depende da configuração do seu contentor ou aplicação. Normalmente encontra-se em /etc/caddy/Caddyfile ou dentro da configuração da sua aplicação no EasyPanel.

Adicione ou remova a diretiva encode gzip dentro do bloco do site relevante.

Exemplo para ativar:

caddy
Copiar
Editar

example.com {
 encode gzip
 reverse_proxy localhost:5678
}

Exemplo para desativar:

caddy
Copiar
Editar

exemplo.com {
    # no encode directive disables gzip
 reverse_proxy localhost:5678
}

Reinicie o Caddy (ou o contentor da aplicação) através do EasyPanel ou da CLI.

Se o EasyPanel usar o NGINX (menos comum):
Aceda ao ficheiro de configuração do NGINX para a sua aplicação. Provavelmente em /etc/nginx/sites-available/your-app ou através de montagens de volume de contentor.

Habilite ou desabilite o GZIP com:

Para ativar:

nginx
Copiar
Editar

gzip on;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;

Para desativar:

nginx
Copy
Edit
gzip off;
Reload NGINX.

Traduzido com a versão gratuita do tradutor - DeepL.com

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.