MCP - Dejo de funcionar nodo

Problem with AI Agent and MCP Client in n8n

Hello n8n community,

I’m experiencing a persistent error in my workflow involving an AI agent and MCP connectivity. I hope you can help me solve it.

The problem

When I try to connect an AI Agent node with an MCP Client node, I constantly receive the error “Problem in node ‘AI Agent’: Provider returned error”. However, when I connect the AI Agent directly to Google Sheets, it works correctly.

My current setup

I’ve created two workflows:

  1. Main flow (with error):
  • A “When chat message received” trigger node
  • An “AI Agent” node configured as an assistant for product availability queries
  • Connections to:
    • “OpenRouter Chat Model” (using gpt-4.1-mini)
    • “Simple Memory”
    • “MCP Client” (this is where the error occurs)
  1. Secondary flow (works correctly):
  • “MCP Server Trigger”
  • “Google Sheets” node to query data

Technical details

Here’s the JSON of my main flow:

json

{
  "name": "test",
  "nodes": [
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "typeVersion": 1.1,
      "position": [
        -540,
        -140
      ],
      "id": "ed8a6b6e-77a8-48c2-b4da-5df41dfb6f20",
      "name": "When chat message received",
      "webhookId": "a6c03ae6-4f2a-4ccf-96b2-59b800c7a0c1"
    },
    {
      "parameters": {
        "options": {
          "systemMessage": "eres un asistente con una tool de google sheets llamada Data donde puedes chequear la disponibilidad de productos"
        }
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 1.8,
      "position": [
        -160,
        -140
      ],
      "id": "0e562d16-7ada-4ee0-bcc7-26a6c02a023d",
      "name": "AI Agent"
    },
    {
      "parameters": {
        "model": "openai/gpt-4.1-mini",
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenRouter",
      "typeVersion": 1,
      "position": [
        -260,
        80
      ],
      "id": "36d56090-fa4d-4db8-9bed-0590166988f5",
      "name": "OpenRouter Chat Model"
    },
    {
      "parameters": {},
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "typeVersion": 1.3,
      "position": [
        -80,
        80
      ],
      "id": "396cc0ca-eb07-454e-a6b8-3093efc9de14",
      "name": "Simple Memory"
    }
    // Note: The MCP Client node has been replaced with Google Sheets for testing
  ]
}

What I’ve tried

  • I’ve verified that when connecting the AI Agent directly to the Google Sheets node (instead of using MCP Client), the flow works correctly
  • I also have a separate flow (“server”) where an MCP Server Trigger connects to the Google Sheets node and works without problems

Questions

  1. Why is the connection between AI Agent and MCP Client specifically failing?
  2. Is there any known compatibility issue between these nodes?
  3. Is there any specific configuration I should make in the MCP Client to work with AI Agent?
  4. Would it be better to use an intermediate node (like Function) to transform the data between these two nodes?

I appreciate any guidance you can provide. If you need additional information, please let me know.

Thanks in advance!

  1. Why is the connection between AI Agent and MCP Client specifically failing?
    The connection fails because the AI ​​Agent node is probably generating output that is not compatible with the format expected by the MCP Client. Complex data structures (such as tool_calls, nested objects, or arrays) that the MCP Client cannot interpret.

  2. Is there any known compatibility issue between these nodes?
    To date, there is no official n8n documentation indicating a formal incompatibility between AI Agent and MCP Client nodes, but the AI ​​Agent node is part of the LangChain ecosystem in n8n, which can generate complex outputs designed to interact with specific tools. The MCP Client node may not be designed to interpret these types of complex outputs automatically.

  3. Is there any specific configuration I should make in the MCP Client to work with AI Agent?
    It depends on the purpose of the MCP Client, but in general you should: Ensure the MCP Client input field is properly configured to receive only the information it needs (e.g., plain text, simple JSON, or a command).
    Check if the MCP Client node expects a specific data schema. If so, you can transform the AI ​​Agent output with a Function or Set node before sending it.

  4. Would it be better to use an intermediate node (like Function) to transform the data between these two nodes?
    Yes, definitely. Using an intermediate node like a Function or Set is a best practice when connecting nodes with different data format expectations. This allows you to filter, cleanse, or restructure the AI ​​Agent’s output. Ensure the MCP Client receives exactly what it needs. Avoid ambiguous errors like “Provider returned error.”

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