> ## Agent Instructions
>
> Base URL: https://api.anysite.io
> Authentication: send the `access-token` header. Do NOT use `Authorization: Bearer`.
> Full endpoint catalog: https://app.anysite.io/docs
# n8n MCP 工具示例

在 n8n 中使用 Anysite MCP 的实际工作流程示例

## 概述

这些示例演示了如何在 n8n 工作流程中使用 Anysite MCP 工具来提取和处理社交媒体数据。

## 示例 1：LinkedIn 个人资料增强

自动使用 LinkedIn 个人资料信息增强联系人数据。

### 工作流程结构

```mermaid
graph LR
    A[Webhook 触发器] --> B[MCP Client]
    B --> C[AI Agent]
    C --> D[处理数据]
    D --> E[存储到数据库]
```

### 配置

  
#### 设置 Webhook 触发器

    配置接受 LinkedIn 个人资料 URL 的 webhook：
    ```json
    {
      "linkedin_url": "https://linkedin.com/in/username"
    }
    ```
  

  
#### 配置 MCP Client

    - 添加 MCP Client 节点
    - 将端点设置为您的 Anysite 直接 URL
    - 包含 `linkedin_user` 工具
  

  
#### 添加 AI Agent 节点

    配置 AI agent 使用 MCP 工具：
    ```
    从以下链接提取详细的个人资料信息：{{ $json.linkedin_url }}

    使用 linkedin_user 工具获取：
    - 全名和头衔
    - 当前职位和公司
    - 工作经历
    - 教育背景
    - 技能
    ```
  

  
#### 处理结果

    使用 Code 节点构建提取的数据：
    ```javascript
    const profile = $input.item.json;

    return {
      name: profile.full_name,
      headline: profile.headline,
      current_company: profile.current_position?.company,
      location: profile.location,
      skills: profile.skills,
      profile_url: profile.linkedin_url
    };
    ```
  

### 用例
- CRM 数据增强
- 潜在客户资格评估
- 候选人筛选
- 联系人数据库更新

---

## 示例 2：Reddit 内容监控

监控 Reddit 帖子并提取详细信息用于内容分析。

### 工作流程结构

```mermaid
graph LR
    A[计划触发器] --> B[Reddit URLs]
    B --> C[MCP Client]
    C --> D[AI Agent]
    D --> E[情绪分析]
    E --> F[发送警报]
```

### 配置

  
#### 设置计划触发器

    每小时运行一次检查新的 Reddit 帖子：
    ```
    Cron: 0 * * * *
    ```
  

  
#### 提供 Reddit URLs

    使用 Set 节点设置目标帖子 URL 或从数据库获取。
  

  
#### 配置 MCP Client

    - 包含 `reddit_post` 工具
    - 设置为处理多个项目
  

  
#### 提取帖子数据

    AI agent 提示：
    ```
    分析此 Reddit 帖子：{{ $json.reddit_url }}

    提取：
    - 帖子标题和内容
    - 作者信息
    - 点赞数和评论数
    - 热门评论
    - 发布时间
    ```
  

  
#### 分析情绪

    添加另一个 AI 节点分析情绪：
    ```
    分析此帖子及其热门评论的情绪。
    分类为：正面、负面或中立
    提取关键话题和主题。
    ```
  

### 用例
- 品牌提及监控
- 社区情绪追踪
- 竞争对手分析
- 趋势识别

---

## 示例 3：Instagram 个人资料分析

提取和比较 Instagram 个人资料用于网红研究。

### 工作流程配置

  
#### 输入 Instagram URLs

    Webhook 或手动触发器带有个人资料 URL：
    ```json
    {
      "profiles": [
        "https://instagram.com/influencer1",
        "https://instagram.com/influencer2"
      ]
    }
    ```
  

  
#### MCP Client 设置

    - 包含 `instagram_profile` 工具
    - 启用批量处理
  

  
#### 提取个人资料数据

    AI agent 指令：
    ```
    对于每个 Instagram 个人资料，提取：
    - 用户名和全名
    - 粉丝数和互动率
    - 简介和联系信息
    - 最近帖子数
    - 账户类型（商业/个人）
    ```
  

  
#### 比较和排名

    使用 Code 节点比较个人资料：
    ```javascript
    const profiles = $input.all().map(item => item.json);

    // 计算互动分数
    profiles.forEach(profile => {
      profile.engagement_score =
        (profile.avg_likes + profile.avg_comments) /
        profile.followers * 100;
    });

    // 按互动排序
    profiles.sort((a, b) =>
      b.engagement_score - a.engagement_score
    );

    return profiles;
    ```
  

### 用例
- 网红选择
- 活动规划
- 竞争分析
- 受众研究

---

## 示例 4：多平台数据聚合

从多个社交平台收集数据进行全面分析。

### 工作流程概述

为个人或品牌组合 LinkedIn、Instagram 和 Reddit 数据。

  
#### 设置输入

    提供多个社交媒体 URL：
    ```json
    {
      "linkedin": "https://linkedin.com/in/username",
      "instagram": "https://instagram.com/username",
      "reddit": "https://reddit.com/user/username"
    }
    ```
  

  
#### 并行处理

    将工作流程分成并行分支：
    - 分支 1：LinkedIn 数据提取
    - 分支 2：Instagram 数据提取
    - 分支 3：Reddit 数据提取

    每个分支使用带有适当工具的 MCP Client。
  

  
#### 合并结果

    使用 Merge 节点合并所有数据：
    ```
    模式：Combine All
    输出：包含所有社交数据的单个项目
    ```
  

  
#### 生成报告

    AI agent 创建统一分析：
    ```
    基于 LinkedIn、Instagram 和 Reddit 的社交媒体数据：

    1. 总结专业背景
    2. 分析内容主题和兴趣
    3. 评估受众互动
    4. 识别关键见解和模式
    ```
  

### 用例
- 全面背景调查
- 品牌存在分析
- 内容策略研究
- 跨平台见解

---

## 示例 5：自动化 LinkedIn 公司研究

从列表中自动研究公司。

### 配置

  
#### 输入公司列表

    通过 webhook 或电子表格提供公司 LinkedIn URL：
    ```json
    {
      "companies": [
        "https://linkedin.com/company/company1",
        "https://linkedin.com/company/company2"
      ]
    }
    ```
  

  
#### MCP Client

    使用 `linkedin_company` 工具进行数据提取。
  

  
#### 提取公司数据

    ```
    对于每家公司，提取：
    - 公司名称和行业
    - 规模和位置
    - 描述和专业领域
    - 员工数量
    - 最近的更新和帖子
    ```
  

  
#### 导出结果

    格式化并导出到：
    - Google Sheets
    - Airtable
    - CSV 文件
    - 数据库
  

### 用例
- 市场研究
- 潜在客户生成
- 竞争情报
- 合作机会

---

## 最佳实践

  
#### 错误处理

    添加 Error Trigger 节点以优雅地处理 API 失败并实现重试逻辑。
  

  
#### 速率限制

    在 MCP 调用之间使用 Wait 节点以避免达到 API 速率限制。
  

  
#### 数据验证

    在处理之前验证提取的数据以确保质量和完整性。
  

  
#### 日志记录

    记录所有 MCP 操作以便调试和审计。
  

## 优化技巧

1. **批量处理**：将多个 URL 分组在一起以减少工作流程执行时间
2. **缓存**：存储频繁访问的数据以最小化 API 调用
3. **并行执行**：使用 Split In Batches 节点处理大型数据集
4. **错误恢复**：为失败的 API 调用实现回退机制
5. **监控**：设置工作流程失败或数据异常的通知

## 高级模式

### 模式 1：条件工具选择

使用 IF 节点根据 URL 类型动态选择使用哪个 MCP 工具：

```javascript
// 从 URL 检测平台
const url = $json.social_url;

if (url.includes('linkedin.com/in/')) {
  return { tool: 'linkedin_user' };
} else if (url.includes('linkedin.com/company/')) {
  return { tool: 'linkedin_company' };
} else if (url.includes('instagram.com')) {
  return { tool: 'instagram_profile' };
}
```

### 模式 2：增量更新

追踪并仅更新已更改的数据：

```javascript
// 与现有数据比较
const existing = $('Database').first().json;
const fresh = $json;

const changes = {};
if (existing.followers !== fresh.followers) {
  changes.followers = fresh.followers;
  changes.follower_growth = fresh.followers - existing.followers;
}

return changes.followers ? changes : null;
```

### 模式 3：数据增强管道

链接多个 MCP 工具以进行全面增强：

```
LinkedIn 用户 → 获取公司 → 获取公司员工 → 分析网络
```

## 资源

- [查看所有可用的 MCP 工具](/docs/mcp-server/tools?lang=zh)
- [n8n MCP 工具安装](/docs/mcp-server/n8n-tool/installation?lang=zh)
- [n8n 官方文档](https://docs.n8n.io/)
- [Anysite API 参考](/docs/api)

## 需要帮助？

#### 获取支持

  联系我们的支持团队获取 n8n MCP 集成帮助
