{
  "id": "DTa0EWl9cqgHmtr0",
  "name": "Mineu MCP \u5bf9\u8bdd\u6d41\u7a0b\u5c55\u793a",
  "tags": [],
  "nodes": [
    {
      "id": "7c2da246-19a8-420f-8cd9-651e00937607",
      "name": "If \u8fd8\u6ca1\u904d\u5386\u7ed3\u675f",
      "type": "n8n-nodes-base.if",
      "position": [
        220,
        580
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "or",
          "conditions": [
            {
              "id": "4893fc89-9a8b-4f8d-8f11-3e937d6f8f3d",
              "operator": {
                "type": "number",
                "operation": "lt"
              },
              "leftValue": "={{ $json.index }}",
              "rightValue": "={{ $('When chat message received').item.binary.values().length}}"
            }
          ]
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "dae9bcd0-2b1e-4091-bbd4-591af5e26a95",
      "name": "\u521d\u59cb\u5316files",
      "type": "n8n-nodes-base.set",
      "position": [
        0,
        580
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "4ff468f4-ee0a-40c2-af55-43013882284c",
              "name": "files",
              "type": "array",
              "value": "={{ [] }}"
            },
            {
              "id": "7251c904-f32a-486f-9e41-77d76de784ae",
              "name": "index",
              "type": "number",
              "value": 0
            }
          ]
        },
        "includeOtherFields": true
      },
      "typeVersion": 3.4
    },
    {
      "id": "28758f62-e99d-4025-a487-0150ca60e2c7",
      "name": "MCP Client",
      "type": "@n8n/n8n-nodes-langchain.mcpClientTool",
      "position": [
        600,
        400
      ],
      "parameters": {
        "include": "selected",
        "sseEndpoint": "http://127.0.0.1:8001/sse"
      },
      "typeVersion": 1
    },
    {
      "id": "2e4a3ba3-a040-4a99-a71f-867c11255a58",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        460,
        400
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4o-mini",
          "cachedResultName": "gpt-4o-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "d2942fd4-d799-47e9-ac24-0eff094c27c2",
      "name": "AI Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        440,
        180
      ],
      "parameters": {
        "text": "=\n---\n\u4ee5\u4e0b\u4e3a\u7528\u6237\u7684\u5bf9\u8bdd\u4fe1\u606f\uff1a\n{{ $('When chat message received').item.json.chatInput }}\n\n",
        "options": {
          "systemMessage": "=\u4f60\u662f\u4e00\u4e2a\u5177\u5907\u6587\u4ef6\u9605\u8bfb\u80fd\u529b\u7684AI\uff0c\u7528\u6237\u5982\u679c\u8bf7\u6c42\u5bf9\u4e8e\u6587\u4ef6\u8fdb\u884c\u5904\u7406\uff0c\u5c31\u8bf7\u4f7f\u7528\u7cfb\u7edf\u4e2d\u5df2\u6709\u7684\u6587\u6863\u89e3\u6790\u5de5\u5177\u8fdb\u884c\u89e3\u6790\u540e\uff0c\u6309\u7167\u7528\u6237\u8981\u6c42\u8fdb\u884c\u5904\u7406\n---\n\u4e0b\u9762\u4e3a\u7528\u6237\u4e0a\u4f20\u7684\u6587\u4ef6\u5217\u8868\uff1a\n{{ $json.files }}"
        },
        "promptType": "define"
      },
      "typeVersion": 1.9
    },
    {
      "id": "895ff140-8a3e-48af-b0bb-d23c8c8d119d",
      "name": "When chat message received",
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "position": [
        -280,
        580
      ],
      "parameters": {
        "options": {
          "allowFileUploads": true,
          "allowedFilesMimeTypes": "*"
        }
      },
      "typeVersion": 1.1
    },
    {
      "id": "1e410edb-5434-40ab-8cdd-2a25574fcccc",
      "name": "\u6dfb\u52a0\u6587\u4ef6\u8def\u5f84\u5230",
      "type": "n8n-nodes-base.set",
      "position": [
        820,
        660
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "232ad617-f398-434f-b138-a76b0adbf55b",
              "name": "files",
              "type": "array",
              "value": "={{ $json.files.append($json.fileName) }}"
            },
            {
              "id": "765fde8c-6212-4a70-9e67-eb1dbb3a152c",
              "name": "index",
              "type": "number",
              "value": "={{ $json.index + 1 }}"
            }
          ]
        },
        "includeOtherFields": true
      },
      "typeVersion": 3.4
    },
    {
      "id": "ebdf5ef1-45f2-478e-abad-6235b260dee9",
      "name": "\u6587\u4ef6\u4fdd\u5b58\u5230\u672c\u5730",
      "type": "n8n-nodes-base.readWriteFile",
      "position": [
        520,
        580
      ],
      "parameters": {
        "options": {},
        "fileName": "=/Users/adrianwang/Documents/ailab/minerU-mcp/downloads/file_{{$now.toMillis()}}.{{ $('When chat message received').item.binary.values()[$json.index].fileName.split('.').pop()}}",
        "operation": "write",
        "dataPropertyName": "=data{{ $json.index }}"
      },
      "notesInFlow": false,
      "typeVersion": 1,
      "alwaysOutputData": true
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "88a5af39-f11f-4dd1-a374-623a1d4c8f8d",
  "connections": {
    "MCP Client": {
      "ai_tool": [
        [
          {
            "node": "AI Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "\u521d\u59cb\u5316files": {
      "main": [
        [
          {
            "node": "If \u8fd8\u6ca1\u904d\u5386\u7ed3\u675f",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "If \u8fd8\u6ca1\u904d\u5386\u7ed3\u675f": {
      "main": [
        [
          {
            "node": "\u6587\u4ef6\u4fdd\u5b58\u5230\u672c\u5730",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "AI Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u6587\u4ef6\u4fdd\u5b58\u5230\u672c\u5730": {
      "main": [
        [
          {
            "node": "\u6dfb\u52a0\u6587\u4ef6\u8def\u5f84\u5230",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "\u6dfb\u52a0\u6587\u4ef6\u8def\u5f84\u5230": {
      "main": [
        [
          {
            "node": "If \u8fd8\u6ca1\u904d\u5386\u7ed3\u675f",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When chat message received": {
      "main": [
        [
          {
            "node": "\u521d\u59cb\u5316files",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}