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:
- 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)
- 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
- Why is the connection between AI Agent and MCP Client specifically failing?
- Is there any known compatibility issue between these nodes?
- Is there any specific configuration I should make in the MCP Client to work with AI Agent?
- 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!