8
n8n 中文网amn8n.com

使用 AI 分析和 MCP 工具监控网站

高级

这是一个DevOps, AI Summarization领域的自动化工作流,包含 19 个节点。主要使用 If, Set, Merge, Slack, Switch 等节点。 使用 GPT-4 Mini、MCP 工具和多渠道提醒自动化网站监控

前置要求
  • Slack Bot Token 或 Webhook URL
  • Google Sheets API 凭证
  • OpenAI API Key
工作流预览
可视化展示节点连接关系,支持缩放和平移
导出工作流
复制以下 JSON 配置到 n8n 导入,即可使用此工作流
{
  "id": "h8LUhXgUTopnys7n",
  "meta": {
    "instanceId": "f31c8cf0f30c343fde4e229f596b53099ee0496367bfd39c53458e5afe95e91e"
  },
  "name": "使用 AI 分析和 MCP 工具监控网站",
  "tags": [],
  "nodes": [
    {
      "id": "95d1b83e-a5d1-4604-a052-cebe570bf35b",
      "name": "网站监控触发器",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -560,
        736
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "minutes"
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "2ec72ca1-0e51-4ed5-ac71-7daba88af146",
      "name": "配置变量",
      "type": "n8n-nodes-base.set",
      "position": [
        -336,
        736
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "0b5e5e4a-7429-438e-a5e0-fa8d7b8b5be5",
              "name": "config",
              "type": "object",
              "value": {
                "websites": [
                  "https://example.com",
                  "https://example.org"
                ],
                "mcpServers": {
                  "mcpRecon": "={{$env.MCP_RECON_URL || 'http://localhost:8002'}}",
                  "browserTools": "={{$env.MCP_BROWSER_TOOLS_URL || 'http://localhost:8001'}}"
                },
                "monitoring": {
                  "batchSize": 10,
                  "responseTimeWarning": 3000,
                  "responseTimeCritical": 5000,
                  "sslExpiryWarningDays": 30,
                  "performanceScoreThreshold": 80
                },
                "notifications": {
                  "fromEmail": "={{$env.FROM_EMAIL}}",
                  "alertEmail": "={{$env.ALERT_EMAIL}}",
                  "enableEmail": true,
                  "enableSlack": true,
                  "slackChannel": "={{$env.SLACK_CHANNEL || '#alerts'}}"
                }
              }
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "86441b58-b62b-4e41-a236-0444500ecd2c",
      "name": "加载网站列表",
      "type": "n8n-nodes-base.googleSheets",
      "onError": "continueRegularOutput",
      "position": [
        -112,
        736
      ],
      "parameters": {
        "options": {},
        "filtersUI": {
          "values": []
        },
        "sheetName": {
          "mode": "name",
          "value": "Websites"
        },
        "documentId": {
          "mode": "id",
          "value": "={{$env.GOOGLE_SHEET_ID}}"
        },
        "authentication": "serviceAccount"
      },
      "credentials": {
        "googleApi": {
          "id": "UD5OjKiVkvWF1KEV",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "8553b2d7-bc89-4e8f-a1cc-3101477cb5ae",
      "name": "合并分析结果",
      "type": "n8n-nodes-base.merge",
      "position": [
        1248,
        736
      ],
      "parameters": {
        "mode": "combine",
        "options": {},
        "combineBy": "combineAll"
      },
      "typeVersion": 3
    },
    {
      "id": "dd498eee-406a-4539-82ca-944e1049852c",
      "name": "警报严重性路由器",
      "type": "n8n-nodes-base.switch",
      "position": [
        1472,
        720
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "ccba5bef-efa2-49f8-9a88-e1bdd4c90f13",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.severity }}",
                    "rightValue": "critical"
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "91721c80-38de-4443-9bba-72d2fc5cbbdb",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.severity }}",
                    "rightValue": "warning"
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 2,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "80702517-1472-4b88-b503-1df62fe22572",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.severity }}",
                    "rightValue": "info"
                  }
                ]
              }
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3.2
    },
    {
      "id": "b0feb330-f6b7-4f36-9822-5a6744bd2689",
      "name": "严重 Slack 警报",
      "type": "n8n-nodes-base.slack",
      "onError": "continueRegularOutput",
      "position": [
        1696,
        448
      ],
      "webhookId": "a32f458a-16f3-4aef-8ccc-e0a1e065e3fd",
      "parameters": {
        "text": "=🚨 **CRITICAL WEBSITE ISSUE** 🚨\n\n**Website:** {{ $json.url }}\n**Severity:** CRITICAL\n**Performance Score:** {{ $json.performanceScore }}%\n**Response Time:** {{ $json.responseTime }}ms\n**SSL Status:** {{ $json.sslStatus }}\n\n**Issues Found:**\n{{ $json.issues.map(issue => '• ' + issue).join('\\n') }}\n\n**Security Score:** {{ $json.securityScore || 'N/A' }}\n\n_Generated by n8n MCP Monitoring System_",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "name",
          "value": "={{$('Configuration Variables').item.json.config.notifications.slackChannel}}"
        },
        "otherOptions": {}
      },
      "typeVersion": 2.3
    },
    {
      "id": "1c703878-ad45-4a94-97d1-b2ae7ece6a36",
      "name": "严重电子邮件警报",
      "type": "n8n-nodes-base.emailSend",
      "onError": "continueRegularOutput",
      "position": [
        1696,
        640
      ],
      "webhookId": "e234630d-efc3-41d4-bc08-2574da0c5c10",
      "parameters": {
        "html": "=<h2>🚨 Critical Website Issue Detected</h2>\n<p><strong>Website:</strong> {{ $json.url }}</p>\n<p><strong>Severity:</strong> CRITICAL</p>\n\n<h3>Issues Detected:</h3>\n<ul>\n{{ $json.issues.map(issue => '<li>' + issue + '</li>').join('') }}\n</ul>\n\n<h3>Performance Metrics:</h3>\n<ul>\n<li><strong>Performance Score:</strong> {{ $json.performanceScore }}%</li>\n<li><strong>Response Time:</strong> {{ $json.responseTime }}ms</li>\n<li><strong>SSL Status:</strong> {{ $json.sslStatus || 'Unknown' }}</li>\n<li><strong>Security Score:</strong> {{ $json.securityScore || 'N/A' }}</li>\n</ul>\n\n<p><em>Generated by n8n MCP Monitoring System at {{ new Date().toISOString() }}</em></p>",
        "options": {},
        "subject": "🚨 CRITICAL: Website Issue - {{ $json.url }}",
        "toEmail": "={{$('Configuration Variables').item.json.config.notifications.alertEmail}}",
        "fromEmail": "={{$('Configuration Variables').item.json.config.notifications.fromEmail}}"
      },
      "typeVersion": 2.1
    },
    {
      "id": "a29080d1-68fd-4bef-97c5-89feebb4cc01",
      "name": "警告 Slack 警报",
      "type": "n8n-nodes-base.slack",
      "onError": "continueRegularOutput",
      "position": [
        1696,
        1024
      ],
      "webhookId": "6a3af096-566b-4c09-b6ac-7a2861e529ec",
      "parameters": {
        "text": "=⚠️ **Website Warning** ⚠️  **Website:** {{ $json.url }} **Severity:** WARNING **Performance Score:** {{ $json.performanceScore }}% **Response Time:** {{ $json.responseTime }}ms **SSL Status:** {{ $json.sslStatus }}  **Issues Found:** {{ $json.issues.map(issue => '• ' + issue).join('\\n') }}  _Generated by n8n MCP Monitoring System_",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "name",
          "value": "={{$('Configuration Variables').item.json.config.notifications.slackChannel}}"
        },
        "otherOptions": {}
      },
      "typeVersion": 2.3
    },
    {
      "id": "b373b04d-4c21-49aa-a584-96a1b6e515c9",
      "name": "记录到 Google Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "onError": "continueRegularOutput",
      "position": [
        2064,
        992
      ],
      "parameters": {
        "columns": {
          "value": {
            "url": "={{ $json.url }}",
            "issues": "={{ $json.issues.join(', ') }}",
            "severity": "={{ $json.severity }}",
            "sslStatus": "={{ $json.sslStatus }}",
            "timestamp": "={{ new Date().toISOString() }}",
            "responseTime": "={{ $json.responseTime }}",
            "securityScore": "={{ $json.securityScore }}",
            "recommendations": "={{ $json.recommendations ? $json.recommendations.join(', ') : '' }}",
            "performanceScore": "={{ $json.performanceScore }}"
          },
          "mappingMode": "defineBelow"
        },
        "options": {},
        "operation": "append",
        "sheetName": {
          "mode": "name",
          "value": "Monitoring Log"
        },
        "documentId": {
          "mode": "id",
          "value": "={{$env.GOOGLE_SHEET_ID}}"
        },
        "authentication": "serviceAccount"
      },
      "credentials": {
        "googleApi": {
          "id": "UD5OjKiVkvWF1KEV",
          "name": "Google Sheets account"
        }
      },
      "typeVersion": 4.6
    },
    {
      "id": "e5fe4dce-b766-4f90-8a62-8e822e1d9804",
      "name": "检查网站来源",
      "type": "n8n-nodes-base.if",
      "position": [
        112,
        736
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
              "operator": {
                "type": "object",
                "operation": "empty",
                "singleValue": true
              },
              "leftValue": "={{ $('Load Website List').item.json }}",
              "rightValue": ""
            }
          ]
        },
        "looseTypeValidation": true
      },
      "typeVersion": 2.1
    },
    {
      "id": "f9c90d31-261b-42d6-afe2-ee559f32c722",
      "name": "格式化默认网站",
      "type": "n8n-nodes-base.set",
      "position": [
        336,
        816
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "website-urls",
              "name": "url",
              "type": "string",
              "value": "={{ $item }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "848b85ae-eaf0-4fa3-a87a-e8711becbee0",
      "name": "批量网站 URL",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        560,
        736
      ],
      "parameters": {
        "options": {},
        "batchSize": "={{$('Configuration Variables').item.json.config.monitoring.batchSize}}"
      },
      "typeVersion": 3
    },
    {
      "id": "cde9e03b-6090-45cd-9b00-60c2c0e13f45",
      "name": "网站分析代理",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        816,
        624
      ],
      "parameters": {
        "text": "=Analyze the following websites for performance and security issues. For each website in the batch:\n\nWebsites to analyze:\n{{ $json.url }}\n\nUse the available MCP tools to:\n1. Run browser-tools-mcp to analyze performance, SEO, and accessibility\n2. Run mcp-recon to check SSL certificates and security headers\n\nBased on the analysis, determine the severity level:\n- CRITICAL: Site down, SSL expired/invalid, performance score <50%, response time >{{ $('Configuration Variables').item.json.config.monitoring.responseTimeCritical }}ms\n- WARNING: SSL expiring within {{ $('Configuration Variables').item.json.config.monitoring.sslExpiryWarningDays }} days, performance score <{{ $('Configuration Variables').item.json.config.monitoring.performanceScoreThreshold }}%, response time >{{ $('Configuration Variables').item.json.config.monitoring.responseTimeWarning }}ms, missing critical security headers\n- INFO: Minor issues or optimization suggestions\n\nReturn a JSON object for each website with this structure:\n{\n  \"url\": \"website URL\",\n  \"severity\": \"critical|warning|info\",\n  \"performanceScore\": number (0-100),\n  \"responseTime\": number (milliseconds),\n  \"sslStatus\": \"valid|expiring|expired|invalid\",\n  \"securityScore\": number (0-100),\n  \"issues\": [\"array of specific issues found\"],\n  \"recommendations\": [\"array of improvement suggestions\"]\n}\n\nFocus on actionable issues that require immediate attention. Be concise but specific about problems found.",
        "options": {},
        "promptType": "define"
      },
      "typeVersion": 2.1
    },
    {
      "id": "56992e24-7b12-4113-aff4-e36665dd8947",
      "name": "Browser-Tools-MCP",
      "type": "@n8n/n8n-nodes-langchain.mcpClientTool",
      "position": [
        960,
        848
      ],
      "parameters": {
        "sseEndpoint": "http://localhost:8001"
      },
      "typeVersion": 1
    },
    {
      "id": "f67ff2bb-f799-46b3-961b-3f449b2ca519",
      "name": "mcp-recon",
      "type": "@n8n/n8n-nodes-langchain.mcpClientTool",
      "position": [
        1104,
        848
      ],
      "parameters": {
        "sseEndpoint": "http://localhost:8002"
      },
      "typeVersion": 1
    },
    {
      "id": "98f9489d-30c4-4ef4-9154-e6c488572b2f",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        784,
        848
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "id": "M2qgdRuw59w2LPE1",
          "name": "OpenAi account 2"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "5d997a64-b0e2-4648-aa9d-f443a8d2fca8",
      "name": "便签1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1920,
        528
      ],
      "parameters": {
        "width": 400,
        "height": 624,
        "content": "📊 Google Sheets 配置"
      },
      "typeVersion": 1
    },
    {
      "id": "404d6215-ebd1-42c2-908d-fdab20957aaf",
      "name": "便签 2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -640,
        32
      ],
      "parameters": {
        "color": 5,
        "width": 496,
        "height": 592,
        "content": "🛠️ AI 驱动的网站监控系统"
      },
      "typeVersion": 1
    },
    {
      "id": "2db4a3c7-17af-410a-bbf6-2a2a9bfaff47",
      "name": "便签 3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -32,
        32
      ],
      "parameters": {
        "color": 2,
        "width": 528,
        "height": 592,
        "content": "### 🔧 必需的 MCP 服务器"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "7f54edc1-cbf3-4654-b986-edc06518d77c",
  "connections": {
    "mcp-recon": {
      "ai_tool": [
        [
          {
            "node": "Website Analysis Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Browser-Tools-MCP": {
      "ai_tool": [
        [
          {
            "node": "Website Analysis Agent",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Load Website List": {
      "main": [
        [
          {
            "node": "Check Website Source",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Website Analysis Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Batch Website URLs": {
      "main": [
        [
          {
            "node": "Website Analysis Agent",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Combine Analysis Results",
            "type": "main",
            "index": 1
          }
        ]
      ]
    },
    "Check Website Source": {
      "main": [
        [
          {
            "node": "Format Default Websites",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Batch Website URLs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Alert Severity Router": {
      "main": [
        [
          {
            "node": "Critical Slack Alert",
            "type": "main",
            "index": 0
          },
          {
            "node": "Critical Email Alert",
            "type": "main",
            "index": 0
          },
          {
            "node": "Log to Google Sheets",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Warning Slack Alert",
            "type": "main",
            "index": 0
          },
          {
            "node": "Log to Google Sheets",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Log to Google Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Website Analysis Agent": {
      "main": [
        [
          {
            "node": "Combine Analysis Results",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Configuration Variables": {
      "main": [
        [
          {
            "node": "Load Website List",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Default Websites": {
      "main": [
        [
          {
            "node": "Batch Website URLs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Website Monitor Trigger": {
      "main": [
        [
          {
            "node": "Configuration Variables",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Combine Analysis Results": {
      "main": [
        [
          {
            "node": "Alert Severity Router",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
常见问题

如何使用这个工作流?

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

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

高级 - 开发运维, AI 摘要总结

需要付费吗?

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

工作流信息
难度等级
高级
节点数量19
分类2
节点类型13
难度说明

适合高级用户,包含 16+ 个节点的复杂工作流

外部链接
在 n8n.io 查看

分享此工作流