{
  "name": "16 Agent that uses an MCP server",
  "nodes": [
    {
      "id": "056b0361-5b1e-4bb1-9927-d6a7cdd17eab",
      "name": "Question in",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        0,
        300
      ],
      "parameters": {
        "httpMethod": "POST",
        "path": "ask-via-mcp",
        "responseMode": "responseNode",
        "options": {}
      },
      "webhookId": "d2053e60-26c5-51ac-a09a-895217f0b07e"
    },
    {
      "id": "de94a721-adc1-4dca-8f68-1a8e13d9f503",
      "name": "Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 3.1,
      "position": [
        240,
        300
      ],
      "parameters": {
        "promptType": "define",
        "text": "={{ $json.body.question }}",
        "options": {
          "systemMessage": "You answer questions about the books of a small business using the tools of the MCP server. Take amounts and days from the tool, do not calculate yourself. Answer briefly in English.",
          "maxIterations": 5
        }
      }
    },
    {
      "id": "abb67f7f-8a92-4815-9b73-bf5b1900e461",
      "name": "Chat model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOllama",
      "typeVersion": 1,
      "position": [
        240,
        520
      ],
      "parameters": {
        "model": "qwen2.5:7b",
        "options": {
          "temperature": 0.2
        }
      }
    },
    {
      "id": "fbf8aea5-aa81-4733-92c7-77af88ed3296",
      "name": "MCP client",
      "type": "@n8n/n8n-nodes-langchain.mcpClientTool",
      "typeVersion": 1.2,
      "position": [
        460,
        520
      ],
      "parameters": {
        "endpointUrl": "http://localhost:5678/mcp/books",
        "serverTransport": "httpStreamable",
        "authentication": "bearerAuth",
        "include": "all",
        "options": {}
      },
      "notes": "Talks to workflow 15 over MCP",
      "notesInFlow": true
    },
    {
      "id": "ec9b130e-58d4-4e1d-9b77-0141d33b4847",
      "name": "Send answer",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.1,
      "position": [
        480,
        300
      ],
      "parameters": {
        "respondWith": "json",
        "responseBody": "={{ { \"answer\": $json.output } }}",
        "options": {}
      }
    },
    {
      "id": "3db84288-cbd1-40d9-bf34-42ec4edf9fcd",
      "name": "Read me",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -40,
        -160
      ],
      "parameters": {
        "content": "## Agent that uses an MCP server\nTested on November 11, 2026, with n8n 2.47.3 and qwen2.5:7b: 2 of 3 questions fully right.\n\n**Fill in:** your MCP server URL and the same Bearer credential in 'MCP client', plus a chat model.\n\nAsk questions with a POST to the webhook: {\"question\": \"...\"}.",
        "height": 220,
        "width": 520,
        "color": 7
      }
    }
  ],
  "connections": {
    "Question in": {
      "main": [
        [
          {
            "node": "Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Agent": {
      "main": [
        [
          {
            "node": "Send answer",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Chat model": {
      "ai_languageModel": [
        [
          {
            "node": "Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "MCP client": {
      "ai_tool": [
        [
          {
            "node": "Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  },
  "meta": {
    "templateCredsSetupCompleted": false
  },
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  }
}