{
  "name": "Intelligent web & local search with Brave Search API and Google Gemini MCP Server",
  "nodes": [
    {
      "id": "74edac39-0775-4a4d-a007-43e8853b6ff4",
      "name": "Google Gemini Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatGoogleGemini",
      "position": [
        200,
        400
      ]
    },
    {
      "id": "980cab3a-cc95-4e93-b334-7659d86e535d",
      "name": "Simple Memory",
      "type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
      "position": [
        700,
        520
      ]
    },
    {
      "id": "530a8f53-88ff-42e2-84df-75c2e053c0ad",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3000,
        -1280
      ],
      "parameters": {
        "width": 980,
        "height": 440,
        "content": "## 📞 MCP Client Configuration\n### For Roo Code, Cline, etc.\nTo use this Brave Search AI Agent in your MCP client:\n\n```json\n\"n8n-brave-search-agent\": {\n  \"url\": \"https://YOUR_N8N_INSTANCE/mcp/cc8cc827-"
      }
    },
    {
      "id": "0e22c1e6-8bc2-40a1-9bdf-d498e39c8184",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -360,
        -1140
      ],
      "parameters": {
        "width": 680,
        "height": 440,
        "content": "## 📡 Brave Search MCP Server Trigger\nThis node is the **public entry point** for the Brave Search AI Agent service. It exposes an MCP (Multi-Agent Collaboration Protocol) SSE (Server-Sent Events) endp"
      }
    },
    {
      "id": "1f2b2e2d-b05c-4721-9603-4b7911763f7e",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -360,
        -680
      ],
      "parameters": {
        "width": 680,
        "height": 340,
        "content": "## ➡️ call_brave_search_agent (Tool Workflow Node)\nThis node represents the **tool** (`call_brave_search_agent`) that external clients call via the MCP Server Trigger.\n\n### Functionality:\n*   **🚀 Acti"
      }
    },
    {
      "id": "32123f13-3b04-4245-b757-9dc128fa1ff9",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2060,
        -660
      ],
      "parameters": {
        "width": 860,
        "height": 600,
        "content": "## 🗺️ Main MCP Server Workflow Overview\n### Brave Search AI Agent Gateway 🔎\nThis workflow acts as the public gateway for the Brave Search AI Agent.\n\n### 1. `Brave Search MCP Server Trigger` 📡\n*   Rece"
      }
    },
    {
      "id": "14df63dc-d419-435b-9214-68dfb550d3b3",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -220,
        -280
      ],
      "parameters": {
        "width": 540,
        "height": 500,
        "content": "## 🏁 Sub-Workflow Start: Brave Search Logic\nThis is the entry point for the **Brave Search AI Agent** sub-workflow.\n\n*   **📥 Receives:**\n    *   `query`: The user's natural language search query from "
      }
    },
    {
      "id": "f43df2ce-59d4-4e6e-a9aa-bf1cb6740ca1",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        760,
        -280
      ],
      "parameters": {
        "width": 740,
        "height": 500,
        "content": "## 🧠 Brave Search AI Agent (Core Logic)\nThis is the primary AI unit.\n\n### Components:\n*   **🤖 Model:** Google Gemini (`models/gemini-2.5-flash-preview-05-20`)\n*   **📜 System Prompt:** Instructs the AI"
      }
    },
    {
      "id": "505ec39d-e687-4a5c-b0c0-c906e35cc830",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        500,
        640
      ],
      "parameters": {
        "width": 500,
        "height": 240,
        "content": "## 💾 Agent Memory (Simple Memory)\nProvides conversational memory for the AI Agent.\n\n*   **📋 Type:** Window Buffer Memory (keeps a sliding window of recent messages).\n*   **🔑 Session Key:** `{{ $execut"
      }
    },
    {
      "id": "aa198f9b-5fcf-4d7d-a597-5aa12c67e122",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1040,
        640
      ],
      "parameters": {
        "width": 540,
        "height": 420,
        "content": "## 🛠️ Tool: brave_web_search (MCP Client)\nCalls the external **Brave Web Search** MCP tool via Smithery.\n\n### Details:\n*   **🔗 Connection:** Uses the 'smithery brave search' credential.\n*   **🎯 Purpos"
      }
    },
    {
      "id": "39f4dff5-2086-4663-9238-e0749f74cfe4",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1620,
        640
      ],
      "parameters": {
        "width": 520,
        "height": 420,
        "content": "## 🛠️ Tool: brave_local_search (MCP Client)\nCalls the external **Brave Local Search** MCP tool via Smithery.\n\n### Details:\n*   **🔗 Connection:** Uses the 'smithery brave search' credential.\n*   **🎯 Pu"
      }
    },
    {
      "id": "f5a49518-9373-4791-ac04-5ee8c2956c7f",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        780,
        -1580
      ],
      "parameters": {
        "width": 720,
        "height": 660,
        "content": "## 💡 n8n AI Agent as an MCP Service\n### Brave Search Example 🔎\n**🎯 What This Sub-Workflow Does:**\nTransforms an AI agent specialized in **Brave Search** into a callable \"skill\" for the main MCP server"
      }
    },
    {
      "id": "4dbcdda3-c1c6-4e7b-a58c-dd7216934f13",
      "name": "Brave Search MCP Server Trigger",
      "type": "@n8n/n8n-nodes-langchain.mcpTrigger",
      "position": [
        120,
        -820
      ]
    },
    {
      "id": "64cd0750-4f06-49ce-93f3-4fd97e37a94f",
      "name": "call_brave_search_agent",
      "type": "@n8n/n8n-nodes-langchain.toolWorkflow",
      "position": [
        280,
        -460
      ]
    },
    {
      "id": "b58d3462-db63-4007-8faa-83fafac2e2fe",
      "name": "brave_web_search",
      "type": "n8n-nodes-mcp.mcpClientTool",
      "position": [
        1280,
        480
      ]
    },
    {
      "id": "4578b0da-6a61-4b60-b178-7614139559eb",
      "name": "brave_local_search",
      "type": "n8n-nodes-mcp.mcpClientTool",
      "position": [
        1840,
        480
      ]
    },
    {
      "id": "4a481f1a-ddb6-4ddc-8c80-789a20369516",
      "name": "Brave Search AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        1000,
        80
      ]
    },
    {
      "id": "f811a9ae-4b05-4409-8f80-56e468c07111",
      "name": "Brave Search Workflow Start",
      "type": "n8n-nodes-base.executeWorkflowTrigger",
      "position": [
        -20,
        80
      ]
    },
    {
      "id": "0bff9d79-dc48-45e5-b5c4-a05832999e77",
      "name": "Sticky Note10",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2060,
        -1280
      ],
      "parameters": {
        "width": 860,
        "height": 400,
        "content": "## 🧪 Testing this MCP Endpoint\nYou can test this agent externally using tools like Postman, curl, or an MCP client.\n\n### Request Details:\n*   **Method:** `POST`\n*   **URL:** `https://YOUR_N8N_INSTANCE"
      }
    },
    {
      "id": "69d177f9-777d-4348-897e-5eabc0e314c9",
      "name": "Sticky Note12",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -20,
        540
      ],
      "parameters": {
        "width": 480,
        "height": 340,
        "content": "## ⚙️ Key LLM & Agent Settings\n### Core Configuration:\n*   **🤖 LLM Model:** `models/gemini-2.5-flash-preview-05-20`\n*   **📜 Agent System Prompt:**\n    *   Defined in the **'Brave Search AI Agent'** no"
      }
    },
    {
      "id": "d3b3c2b9-5ddf-4ac1-a2e7-a50f7fdc6da1",
      "name": "Sticky Note13",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        340,
        -280
      ],
      "parameters": {
        "width": 400,
        "height": 500,
        "content": "## 🎯 Sub-Workflow: Brave Search AI Agent Core Logic\n### Purpose:\nTo process a user's search query, intelligently decide between web or local Brave search, execute the search via Smithery MCP tools, an"
      }
    },
    {
      "id": "e00f2870-ff34-4d5d-926f-93ed191f7b22",
      "name": "Sticky Note14",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2060,
        -860
      ],
      "parameters": {
        "width": 860,
        "height": 180,
        "content": "## 🛠️ Troubleshooting Tips (Sub-Workflow)\n1.  **📜 Agent Logs:** Check execution logs of the **'Brave Search AI Agent'** node for its \"thought process\" and tool calls.\n2.  **🔎 MCP Client Tools:** Verif"
      }
    },
    {
      "id": "3eed4f4b-d7c1-42b8-b6a1-86e005454624",
      "name": "Sticky Note15",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -360,
        -1580
      ],
      "parameters": {
        "width": 680,
        "height": 200,
        "content": "## 📄 Workflow Information\n*   **Workflow:** Brave Search Smithery AI Agent MCP Server (Main Gateway)\n*   **Version:** 1.0.0\n*   **Last Updated:** 2025-06-01\n*   **👤 Author:** Jeremy Dawes, Jezweb ([ww"
      }
    },
    {
      "id": "cb0b44b4-2a47-4908-9ec3-81d6736b27d5",
      "name": "Sticky Note16",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -360,
        -1360
      ],
      "parameters": {
        "width": 680,
        "height": 200,
        "content": "## ✅ TODO / Future Enhancements\n*   [ ] Add more detailed error handling for specific tool failures.\n*   [ ] Explore caching results for common queries.\n*   [ ] Refine system prompt for ambiguous loca"
      }
    },
    {
      "id": "56163ca6-2bad-495c-b486-54f36a3b4e75",
      "name": "Sticky Note11",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        3000,
        -800
      ],
      "parameters": {
        "width": 990,
        "height": 1120,
        "content": "## Example prompt and response in Roo Code\n\n![Source example](https://www.jezweb.com.au/wp-content/uploads/2025/06/brave-search-mcp-server-agent-roo-code.png#full-width)\n\n### Much less context wasted "
      }
    },
    {
      "id": "b268e31a-72f8-4ed5-b9da-55bfcae49b2d",
      "name": "Sticky Note17",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        4040,
        -780
      ],
      "parameters": {
        "width": 1460,
        "height": 1320,
        "content": "## Example raw output that Roo Code would receive direct from the Brave Search MCP\n\n![Example raw output that Roo Code would receive direct from the Brave Search MCP](https://www.jezweb.com.au/wp-cont"
      }
    }
  ],
  "connections": {
    "Simple Memory": {
      "ai_memory": [
        [
          {
            "node": "Brave Search AI Agent",
            "type": "ai_memory",
            "index": 0
          }
        ]
      ]
    },
    "brave_web_search": {
      "ai_tool": [
        [
          {
            "node": "Brave Search AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "brave_local_search": {
      "ai_tool": [
        [
          {
            "node": "Brave Search AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "call_brave_search_agent": {
      "ai_tool": [
        [
          {
            "node": "Brave Search MCP Server Trigger",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Google Gemini Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Brave Search AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Brave Search Workflow Start": {
      "main": [
        [
          {
            "node": "Brave Search AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}