跳过到主要内容
成长装备

ValueSerp MCP 服务器 - 实惠的谷歌搜索

Stefan-Lucian Deleanu

直截了当地说,如果你在使用Claude进行任何严肃的事情,你就会遇到知识截止的墙。该模型的训练数据在某个日期停止,你不得不向客户解释为什么你的AI助手认为现在还是2023年或其他时间。

ValueSerp MCP 服务器通过直接访问 Google 的搜索结果来解决这个问题。无需网络爬虫,无需处理 HTML 解析的噩梦——只需干净的 API 调用,返回结构化数据。

GitHub - Incorporo/valueserp-googlesearch-mcp: 访问 valueserp(经济实惠的 Google 搜索 API)的 MCP 服务器
MCP服务器用于访问valueserp(经济实惠的Google搜索API) - Incorporo/valueserp-googlesearch-mcp

您实际获得的内容

这是一个模型上下文协议(MCP)服务器,充当Claude与ValueSerp搜索API之间的桥梁。它提供四个搜索端点:

  • google_search - Standard web search
  • google_news_search - News-specific results
  • google_images_search - Image search with filtering
  • google_videos_search - Video content search

每个端点返回 Claude 可以解析并在响应中使用的 JSON 数据。没有 iframe 嵌入,没有 JavaScript 执行——只有数据。

技术实施

服务器是基于 TypeScript 构建的,并使用 MCP SDK。以下是核心架构:

// Client handles API communication
export class ValueSerpClient {
  private async makeRequest(endpoint: string, params: Record<string, any>): Promise<ValueSerpResponse> {
    const url = this.buildUrl(endpoint, params);
    const response = await fetch(url, {
      method: 'GET',
      headers: {
        'Accept': 'application/json',
        'User-Agent': 'ValueSerp-MCP-Server/1.0.0'
      }
    });
    // Error handling and response parsing
  }
}

有趣的部分是参数验证。谷歌的搜索API有数十个参数,发送无效组合会返回难以理解的错误。服务器在发出请求之前会验证所有内容:


// Parameter validation with Zod schemas
const searchParamsSchema = z.object({
  q: z.string().describe("Search query (required)"),
  num: z.number().min(1).max(100).default(10).optional(),
  time_period: z.enum(["last_hour", "last_day", "last_week", "last_month", "last_year", "custom"]).optional(),
  // ... 20+ more parameters
});

性能与限制

让我们谈谈真正重要的数字:

  • 响应时间: 根据查询复杂性,响应时间为200-000毫秒
  • 速率限制: 取决于您的ValueSerp计划(通常为每月1000-10000个请求)
  • 结果质量: 与谷歌的公共API相同——没有特别的调料
  • 地理定位: 支持所有Google域名和位置参数

它不做的事情:

  • 在结果页面上执行JavaScript
  • 绕过付费墙或登录墙
  • 缓存结果(每个查询都访问API)
  • 处理私密内容的身份验证

实际有效的真实案例

忘掉企业的空话。开发者实际上是用这个来做什么的:

技术文档助理


User: "What breaking changes were introduced in React 19?"
Claude: [Searches for recent React 19 documentation and changelog]
       "Based on the official React blog post from [actual date], React 19 introduces..."

2. 安全事件响应


User: "Check if CVE-2024-XXXXX affects our stack"
Claude: [Searches vulnerability databases and security advisories]
       "This CVE was published 3 hours ago. It affects Node.js versions..."

3. 竞争分析自动化


User: "What features did Competitor X announce this week?"
Claude: [Searches news and company blogs]
       "According to their blog post from Monday, they're launching..."

无需过多指导的设置

假设您可以处理基本的 npm 命令:


# Clone and build
git clone https://github.com/valueserp/mcp-server
cd mcp-server
npm install && npm run build

# Set your API key
export VALUESERP_API_KEY=your_key_here

# Add to Claude config
# Edit: ~/Library/Application Support/Claude/claude_desktop_config.json
{
  "mcpServers": {
    "valueserp": {
      "command": "node",
      "args": ["/path/to/valueserp-mcp/dist/server.js"]
    }
  }
}

高级参数使用

真正的力量来自于参数组合。这是大多数教程不会告诉你的:


// Time-boxed news search with duplicate filtering
await claude.use_tool('google_news_search', {
  q: 'kubernetes vulnerability',
  time_period: 'last_day',
  sort_by: 'date',
  show_duplicates: false,  // Requires sort_by: 'date'
  num: 50
});

// Location-specific results with auto-configuration
await claude.use_tool('google_search', {
  q: 'restaurant reviews',
  location: 'Tokyo, Japan',
  location_auto: true,  // Auto-sets gl, hl, and google_domain
  order_online: true    // Includes delivery/pickup data
});

// Academic image search
await claude.use_tool('google_images_search', {
  q: 'cell mitosis diagram',
  images_usage: 'non_commercial_reuse_with_modification',
  images_type: 'line_drawing',
  images_size: 'large'
});

成本分析

让我们对经济情况保持透明:

  • 每次搜索的费用: 每月$0.0025或更低(在计划中)
  • 盈亏平衡点: 每天约20次搜索与手动研究时间的对比

大多数SERP的替代方案更昂贵,因此对于那些预算有限且愿意容忍更多延迟的人来说,这是一个不错的选择。

错误处理与边缘情况

服务器优雅地处理常见故障模式:


// Built-in retry logic for transient failures
if (!response.ok) {
  const errorText = await response.text();
  throw new Error(`ValueSerp API error: ${response.status} ${response.statusText} - ${errorText}`);
}

// Parameter validation prevents most 400 errors
if (params.show_duplicates && params.sort_by !== 'date') {
  throw new ValidationError('show_duplicates requires sort_by=date');
}

底线

这个工具只做一件事:它让Claude访问当前的搜索结果。它并不革命性,也不是“人工智能驱动的搜索”——它只是两个服务之间的一个良好实现的桥梁。

如果您需要Claude了解其训练截止日期后发生的事情,这样做是可行的。如果您需要它搜索您的内部文件或访问经过身份验证的内容,请另寻他处。

代码在 GitHub 上,遵循 GPL-3.0 许可证。你可以分叉它、改进它,或者抱怨它——由你选择。

资源