8
n8n 中文网amn8n.com

💥🛠️ 使用GPT-4o和MCP Brave Search构建网络搜索聊天机器人

中级

这是一个自动化工作流,包含 15 个节点。主要使用 McpClientTool, Agent, ChatTrigger, LmChatOpenAi, MemoryBufferWindow 等节点。 💥🛠️ 基于GPT-4o和MCP Brave Search构建网络搜索聊天机器人

前置要求
  • OpenAI API Key

分类

-
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "6MRJ2tfl8c2f3AuE",
  "meta": {
    "instanceId": "31e69f7f4a77bf465b805824e303232f0227212ae922d12133a0f96ffeab4fef"
  },
  "name": "💥🛠️使用 GPT-4o 和 MCP Brave Search 构建网络搜索聊天机器人",
  "tags": [],
  "nodes": [
    {
      "id": "b6e5eaa8-ddb3-4c13-8069-ce360bf4a945",
      "name": "AI 代理",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        240,
        -180
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 1.8
    },
    {
      "id": "dde0154e-f7c2-4778-abcc-f79406db5e6b",
      "name": "当收到聊天消息时",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        -260,
        -180
      ],
      "webhookId": "68e54e15-548a-44df-ad06-7fb9e4e912a9",
      "parameters": {
        "options": {}
      },
      "typeVersion": 1.1
    },
    {
      "id": "877ce640-4d08-4ba7-b1d3-bcfc79600d2c",
      "name": "MCP 获取 Brave 工具",
      "type": "n8n-nodes-mcp.mcpClientTool",
      "position": [
        200,
        280
      ],
      "parameters": {},
      "credentials": {
        "mcpClientApi": {
          "id": "t2IDYWq0EcqBWvMA",
          "name": "MCP Client (STDIO) account 2"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "fb3ce3c2-a809-43e5-92d0-82db0d78a971",
      "name": "MCP 执行 Brave 搜索",
      "type": "n8n-nodes-mcp.mcpClientTool",
      "position": [
        460,
        280
      ],
      "parameters": {
        "toolName": "={{ $fromAI('tool', 'Set this with the specific tool name') }}",
        "operation": "executeTool",
        "toolParameters": "={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Tool_Parameters', ``, 'json') }}"
      },
      "credentials": {
        "mcpClientApi": {
          "id": "t2IDYWq0EcqBWvMA",
          "name": "MCP Client (STDIO) account 2"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "357bde6a-66d0-48dc-972d-d0b35e3868ed",
      "name": "简单记忆",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        -120,
        280
      ],
      "parameters": {},
      "typeVersion": 1.3
    },
    {
      "id": "3eba14c5-e4ed-4c4f-8f1d-2b5671b462cc",
      "name": "gpt-4o",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -380,
        280
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o",
          "cachedResultName": "gpt-4o"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "jEMSvKmtYfzAkhe6",
          "name": "OpenAi account"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "781e5d92-6e9d-4874-93fc-5ea17d11f67f",
      "name": "便签",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        120,
        160
      ],
      "parameters": {
        "color": 4,
        "height": 280,
        "content": "## 1️⃣ MCP 获取 Brave 工具"
      },
      "typeVersion": 1
    },
    {
      "id": "78a52697-352f-47ed-a7d2-3a65c9641fd7",
      "name": "便签3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        380,
        160
      ],
      "parameters": {
        "color": 4,
        "height": 280,
        "content": "## 2️⃣ MCP 执行 Brave 搜索"
      },
      "typeVersion": 1
    },
    {
      "id": "876003d5-7d90-4865-af36-3c0e504b02e7",
      "name": "便签4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -200,
        160
      ],
      "parameters": {
        "color": 3,
        "height": 280,
        "content": "## 短期聊天记忆"
      },
      "typeVersion": 1
    },
    {
      "id": "9f64f499-73d7-414f-a3d3-02c0417368a6",
      "name": "便签5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -460,
        160
      ],
      "parameters": {
        "color": 5,
        "height": 280,
        "content": "## 云端LLM"
      },
      "typeVersion": 1
    },
    {
      "id": "fc423452-832c-4377-9bde-04ab6d5c89aa",
      "name": "便签6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -500,
        -400
      ],
      "parameters": {
        "color": 7,
        "width": 1200,
        "height": 920,
        "content": "# 💥🛠️您的首个简易 MCP AI 聊天机器人(使用 Brave Search)"
      },
      "typeVersion": 1
    },
    {
      "id": "5c6c7307-3283-4698-9104-c80df8a62888",
      "name": "便签7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        80,
        40
      ],
      "parameters": {
        "width": 580,
        "height": 440,
        "content": "## 🛠️ MCP 工具箱"
      },
      "typeVersion": 1
    },
    {
      "id": "9d1bb515-f8fa-4d48-bbf5-c083f5efd89d",
      "name": "便签8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -360,
        -240
      ],
      "parameters": {
        "color": 4,
        "width": 300,
        "height": 240,
        "content": "## 👍试试我!"
      },
      "typeVersion": 1
    },
    {
      "id": "b093a455-aee7-4822-b079-7d9cbac783c2",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1060,
        -400
      ],
      "parameters": {
        "width": 520,
        "height": 1040,
        "content": "### **适用对象**"
      },
      "typeVersion": 1
    },
    {
      "id": "8fb4f215-da26-43ad-b187-9b52ed6485ba",
      "name": "便签2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        80,
        -280
      ],
      "parameters": {
        "width": 580,
        "height": 280,
        "content": "## 🤖 带工具的 AI Agent"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "a555f325-abd3-44bd-ac48-8b0f6910824e",
  "connections": {
    "gpt-4o": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "MCP Get Brave Tools": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "MCP Execute Brave Search": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "When chat message received": {
      "main": [
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

复制上方的 JSON 配置代码,在您的 n8n 实例中创建新工作流并选择「从 JSON 导入」,粘贴配置后根据需要修改凭证设置即可。

这个工作流适合什么场景?

中级

需要付费吗?

本工作流完全免费,您可以直接导入使用。但请注意,工作流中使用的第三方服务(如 OpenAI API)可能需要您自行付费。

工作流信息
难度等级
中级
节点数量15
分类-
节点类型6
难度说明

适合有一定经验的用户,包含 6-15 个节点的中等复杂度工作流

作者
Joseph LePage

Joseph LePage

@joe

As an AI Automation consultant based in Canada, I partner with forward-thinking organizations to implement AI solutions that streamline operations and drive growth.

外部链接
在 n8n.io 查看

分享此工作流