{
  "name": "MCP Agent",
  "nodes": [
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "typeVersion": 1.1,
      "position": [
        0,
        0
      ],
      "id": "d9bc6ad2-4c19-4306-b321-cd253b34e615",
      "name": "When chat message received",
      "webhookId": "ae230ac8-1803-4da9-9f43-cc0209845049"
    },
    {
      "parameters": {
        "options": {
          "systemMessage": "You are an AI Agent with access to MCP Servers.\n\nAvailable Tools:\nBrave List Tools – Use this to retrieve a list of available tools.\n\nBrave Tool – Executes a function based on the tool name retrieved from Brave List Tools.\n\nInstructions:\nAlways use Brave List Tools first to fetch the available tools.\n\nExtract the correct tool name from the response.\n\nUse the retrieved tool name when executing Brave Tool."
        }
      },
      "type": "@n8n/n8n-nodes-langchain.agent",
      "typeVersion": 1.7,
      "position": [
        220,
        0
      ],
      "id": "e7fa6f42-79cb-49a9-8160-4a57bc6a2396",
      "name": "AI Agent"
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini"
        },
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "typeVersion": 1.2,
      "position": [
        140,
        180
      ],
      "id": "4c9a91cf-7432-4c1d-ba90-04ad0b1c8c0b",
      "name": "OpenAI Chat Model",
      "credentials": {
        "openAiApi": {
          "id": "93xE6AjL9aBUKFRc",
          "name": "OpenAi account"
        }
      }
    },
    {
      "parameters": {},
      "type": "n8n-nodes-mcp.mcpClientTool",
      "typeVersion": 1,
      "position": [
        360,
        240
      ],
      "id": "014130ff-7fd4-4d9e-9bd1-98304da1a176",
      "name": "Brave List Tools",
      "credentials": {
        "mcpClientApi": {
          "id": "aCPjFmKipW3e4Kyj",
          "name": "MCP Brave"
        }
      }
    },
    {
      "parameters": {
        "operation": "executeTool",
        "toolName": "={{ $fromAI(\"tool\", \"the selected tool to use\") }}",
        "toolParameters": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Tool_Parameters', ``, 'json') }}"
      },
      "type": "n8n-nodes-mcp.mcpClientTool",
      "typeVersion": 1,
      "position": [
        540,
        220
      ],
      "id": "481410a5-792e-4468-b62b-14c1fe510d7b",
      "name": "Brave Tool",
      "credentials": {
        "mcpClientApi": {
          "id": "aCPjFmKipW3e4Kyj",
          "name": "MCP Brave"
        }
      }
    }
  ],
  "pinData": {},
  "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
          }
        ]
      ]
    },
    "Brave List Tools": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Brave Tool": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "a25f8b6e-2ae2-432e-9720-d570c4f7f377",
  "meta": {
    "templateCredsSetupCompleted": true,
    "instanceId": "ecdef1040f6bd571ec6fa8c7212bfcd8325e97e10218f37827695953a4752e43"
  },
  "id": "0vFzk64MJ7gCDo6H",
  "tags": []
}