> ## Documentation Index
> Fetch the complete documentation index at: https://docs.anysite.io/llms.txt
> Use this file to discover all available pages before exploring further.

# MCP 服务器示例

> Anysite MCP 服务器的实际示例和用例

## 概述

本页面提供使用 Anysite MCP 服务器与各种 AI 工具和 IDE 的实际示例。每个示例都演示了真实世界的用例和预期输出。

## Claude Desktop 示例

### LinkedIn 潜在客户生成

**提示：**

> 在旧金山的科技公司中找到营销经理，获取他们的个人资料和最近的帖子

**MCP 服务器响应：**
服务器将使用多个工具来完成此请求：

1. **linkedin\_search\_users** - 在旧金山科技公司中查找营销经理
2. **linkedin\_user\_profile** - 获取每个人的详细资料
3. **linkedin\_user\_posts** - 检索最近的帖子和活动

**预期输出：**

```
在旧金山的科技公司中找到 15 名营销经理：

1. Sarah Chen - Stripe 高级营销经理
   - 8 年以上 B2B SaaS 营销经验
   - 最近帖子："2024 年支付技术的未来"
   - 个人资料：https://linkedin.com/in/sarahchen-marketing

2. Michael Rodriguez - Airbnb 营销副总裁
   - 增长营销和用户获取专家
   - 最近帖子："建立社区驱动的营销活动"
   - 个人资料：https://linkedin.com/in/mrodriguez-growth

[... 更多结果 ...]
```

### 竞争分析

**提示：**

> 分析我们的竞争对手本周在 LinkedIn 和 Instagram 上发布的内容

**MCP 服务器响应：**

```
竞争分析 - [日期] 周

LinkedIn 活动：
• 竞争对手 A (TechCorp)：12 个帖子，平均 240 次互动
  - 热门帖子："企业中的 AI 转型"（450 赞）
  - 内容主题：产品更新（40%），思想领导力（60%）

• 竞争对手 B (DataFlow)：8 个帖子，平均 180 次互动
  - 热门帖子："新合作伙伴公告"（320 赞）
  - 内容主题：合作伙伴关系（50%），案例研究（50%）

Instagram 活动：
• 竞争对手 A：6 个帖子，平均 890 赞
  - 幕后内容表现良好
  - 故事精选：产品演示、团队文化

• 竞争对手 B：4 个帖子，平均 650 赞
  - 客户成功故事推动互动
  - 大量使用轮播帖子
```

## Cursor IDE 示例

### 代码文档增强

**提示：**

> 研究类似 API 如何处理速率限制，并为我们的文档建议改进

**MCP 服务器响应：**
MCP 服务器将搜索速率限制最佳实践并分析竞争对手 API：

```typescript theme={null}
// 基于研究的建议改进：

interface RateLimitConfig {
  // 标准头部（在研究的 85% API 中发现）
  headers: {
    'X-RateLimit-Limit': number;
    'X-RateLimit-Remaining': number;
    'X-RateLimit-Reset': number;
    'X-RateLimit-Window': string; // 例如 "1hour", "15min"
  };

  // 渐进退避（Stripe、GitHub、Twitter 使用）
  backoffStrategy: {
    initial: number;    // 1000ms
    multiplier: number; // 2.0
    maximum: number;    // 30000ms
  };

  // 突发容量（在 LinkedIn、Reddit API 中发现）
  burst: {
    enabled: boolean;
    limit: number;
    window: string;
  };
}
```

### 市场研究自动化

**提示：**

> 在 Reddit 和 Twitter 上查找关于 AI 编码助手的最新讨论

**MCP 服务器响应：**

```
AI 编码助手讨论 - 过去 7 天

Reddit 分析：
• r/programming（234 次提及）
  - 热门帖子："GitHub Copilot vs ChatGPT 编码"（1.2k 赞）
  - 情绪：60% 正面，25% 中立，15% 负面
  - 关键关注点：代码质量、学习影响、定价

• r/MachineLearning（89 次提及）
  - 关注代码生成模型
  - 讨论针对特定语言的微调

Twitter 分析：
• 1,247 条推文提及"AI 编码助手"
• 热门影响者：@programmer_dev、@ml_engineer、@tech_lead
• 热门话题：#CodeGeneration、#DeveloperProductivity
• 情绪趋势：本周内逐渐变得更加正面
```

## 集成示例

### 自动化内容管道

创建用于内容创作的自动化管道：

<CodeGroup>
  ```python Python 脚本 theme={null}
  import asyncio
  from hdw_mcp_client import HDWMCPClient

  async def create_content_pipeline():
      client = HDWMCPClient()

      # 步骤 1：研究热门话题
      reddit_trends = await client.reddit_search_posts({
          "query": "artificial intelligence",
          "subreddit": "technology",
          "sort": "hot",
          "limit": 10
      })

      # 步骤 2：找到讨论这些话题的思想领袖
      linkedin_leaders = await client.linkedin_search_users({
          "query": "AI executive OR AI researcher",
          "filters": {"industry": "Technology"},
          "limit": 20
      })

      # 步骤 3：分析他们最近的内容
      content_analysis = []
      for leader in linkedin_leaders:
          posts = await client.linkedin_user_posts({
              "user_id": leader["id"],
              "limit": 5
          })
          content_analysis.append({
              "leader": leader["name"],
              "posts": posts,
              "engagement": sum(p["reactions"] for p in posts)
          })

      return {
          "trending_topics": reddit_trends,
          "thought_leaders": content_analysis,
          "content_opportunities": analyze_gaps(reddit_trends, content_analysis)
      }

  # 运行管道
  results = asyncio.run(create_content_pipeline())
  ```

  ```javascript Node.js theme={null}
  const { HDWMCPClient } = require('@horizondatawave/mcp-client');

  async function socialMediaMonitoring() {
    const client = new HDWMCPClient({
      apiKey: process.env.HDW_API_KEY
    });

    // 在多个平台监控品牌提及
    const [linkedinMentions, twitterMentions, redditMentions] = await Promise.all([
      client.linkedinSearchPosts({
        query: "YourBrandName OR @YourHandle",
        limit: 50
      }),
      client.twitterSearchPosts({
        query: "YourBrandName OR @YourHandle",
        resultType: "recent",
        limit: 100
      }),
      client.redditSearchPosts({
        query: "YourBrandName",
        sort: "new",
        limit: 25
      })
    ]);

    // 分析情绪和互动
    const analysis = {
      totalMentions: linkedinMentions.length + twitterMentions.length + redditMentions.length,
      platforms: {
        linkedin: { count: linkedinMentions.length, avgEngagement: calculateEngagement(linkedinMentions) },
        twitter: { count: twitterMentions.length, avgEngagement: calculateEngagement(twitterMentions) },
        reddit: { count: redditMentions.length, avgEngagement: calculateEngagement(redditMentions) }
      },
      topMentions: getTopMentions([...linkedinMentions, ...twitterMentions, ...redditMentions])
    };

    return analysis;
  }
  ```
</CodeGroup>

### 潜在客户资格评估工作流程

自动化潜在客户研究和资格评估：

```bash CLI 使用 theme={null}
# 研究潜在客户
hdw-mcp research-company "Acme Corp" \
  --include-employees \
  --include-recent-posts \
  --include-company-updates \
  --output leads/acme-corp-research.json

# 找到决策者
hdw-mcp find-decision-makers "Acme Corp" \
  --roles "CTO,VP Engineering,Head of Product" \
  --seniority senior \
  --location "San Francisco Bay Area"

# 分析他们的内容以获取热情介绍机会
hdw-mcp analyze-content leads/acme-corp-research.json \
  --find-connection-opportunities \
  --suggest-conversation-starters
```

## 高级用例

### 招聘管道

**场景：** 查找和研究潜在求职者

<Tabs>
  <Tab title="Claude 对话">
    ```
    用户：在纽约找到发布关于机器学习内容的高级 Python 开发人员

    MCP 服务器：我将搜索具有 ML 兴趣的纽约高级 Python 开发人员...

    找到 25 名合格候选人：

    1. Alex Thompson - Meta 高级 ML 工程师
       • 6 年以上 Python 经验，专注于 NLP
       • 最近帖子："使用 FastAPI 构建生产级 ML 管道"
       • 开放机会（LinkedIn 状态：#OpenToWork）

    2. Maria Gonzalez - Spotify 首席数据科学家
       • 推荐系统专家
       • 最近帖子："为什么特征存储是游戏规则改变者"
       • 活跃于 ML 社区，在会议上演讲

    [更多候选人...]

    您是否希望我：
    • 获取任何特定候选人的详细资料？
    • 找到他们的联系信息？
    • 分析他们与您职位要求的技能重叠？
    ```
  </Tab>

  <Tab title="自动化脚本">
    ```python theme={null}
    # recruitment_pipeline.py
    async def find_candidates(job_requirements):
        # 在多个平台搜索
        candidates = []

        # LinkedIn 搜索
        linkedin_candidates = await client.linkedin_search_users({
            "query": f"{job_requirements.skills} {job_requirements.location}",
            "filters": {
                "current_company": "exclude_competitors",
                "experience_level": job_requirements.seniority
            }
        })

        # GitHub 活动分析
        for candidate in linkedin_candidates:
            if candidate.get("github_username"):
                github_activity = await client.github_user_activity(
                    candidate["github_username"]
                )
                candidate["github_score"] = score_github_activity(github_activity)

        return rank_candidates(linkedin_candidates, job_requirements)
    ```
  </Tab>
</Tabs>

### 市场情报仪表板

创建全面的市场情报系统：

```json theme={null}
{
  "dashboardConfig": {
    "updateFrequency": "daily",
    "sources": [
      "linkedin_company_updates",
      "twitter_competitor_mentions",
      "reddit_industry_discussions",
      "google_news_alerts"
    ],
    "competitors": [
      "Competitor A",
      "Competitor B",
      "Competitor C"
    ],
    "keywords": [
      "market trends",
      "product launches",
      "funding news",
      "partnership announcements"
    ]
  }
}
```

## 错误处理示例

### 健壮的请求处理

```typescript theme={null}
async function robustApiCall(toolName: string, params: any) {
  const maxRetries = 3;
  let attempt = 0;

  while (attempt < maxRetries) {
    try {
      const result = await mcpServer.call(toolName, params);
      return result;
    } catch (error) {
      attempt++;

      if (error.code === 'RATE_LIMIT_EXCEEDED') {
        // 等待并重试
        const waitTime = Math.pow(2, attempt) * 1000; // 指数退避
        await new Promise(resolve => setTimeout(resolve, waitTime));
        continue;
      }

      if (error.code === 'INVALID_CREDENTIALS') {
        throw new Error('API credentials need to be updated');
      }

      if (attempt === maxRetries) {
        throw error;
      }
    }
  }
}
```

## 性能技巧

### 批量操作

尽可能使用批量操作而不是单个调用：

```javascript theme={null}
// ❌ 低效 - 多个单独调用
for (const user of users) {
  const profile = await client.linkedinUserProfile({ userId: user.id });
  profiles.push(profile);
}

// ✅ 高效 - 批量操作
const profiles = await client.linkedinBatchUserProfiles({
  userIds: users.map(u => u.id),
  batchSize: 10
});
```

### 缓存策略

```javascript theme={null}
const cache = new Map();
const CACHE_TTL = 3600000; // 1 小时

async function cachedApiCall(toolName, params) {
  const cacheKey = `${toolName}:${JSON.stringify(params)}`;
  const cached = cache.get(cacheKey);

  if (cached && Date.now() - cached.timestamp < CACHE_TTL) {
    return cached.data;
  }

  const result = await mcpServer.call(toolName, params);
  cache.set(cacheKey, { data: result, timestamp: Date.now() });

  return result;
}
```

## 下一步

* [安装指南](/mcp-server/installation) - 开始使用 MCP 服务器
* [可用工具](/mcp-server/tools) - 探索所有 20+ 个可用工具
* [配置](/mcp-server/configuration) - 详细配置选项
