谷歌搜索结果抓取服务

一个作为模型上下文协议(MCP)服务器的谷歌搜索结果抓取工具,支持指纹轮换和多种搜索参数配置。

  • by LiranYoffe
  • Python
  • 本地部署
  • 6 星标
  • 更新于
在 GitHub 查看 LiranYoffe/serp-mcp

使用说明

SERP MCP服务器

Google SERP scraper作为具有指纹旋转的模型上下文协议(MCP)服务器。


赞助

Quercle - Stop wasting tokens on junk. Get exactly what your LLM needs.
Web Fetch & Search API that strips navigation, ads, and footers. Handles JS sites. Returns clean, cited content.

特性

  • 根据请求自动旋转指纹
  • 请求阻止(只允许www.google.com/search)
  • 精简模式,流量减少50%(仅限自然结果,默认)
  • 全模式提取:有机结果、网站链接、PAA、相关搜索、知识图谱
  • 通过protobuf进行位置编码(UULE格式)
  • 已验证的国家/语言代码

安装

克劳德代码

claude mcp add serp-mcp -- uvx serp-mcp

开源代码

添加到您的 ~/.config/opencode/opencode.jsonc:

{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "serp-mcp": {
      "type": "local",
      "command": ["uvx", "serp-mcp"],
      "enabled": true
    }
  }
}

手动使用

# Run with uvx (automatically installs and runs the latest version)
uvx serp-mcp

发展

git clone https://github.com/LiranYoffe/serp-mcp
cd serp-mcp
uv sync
uv run serp-mcp

工具

搜索

搜索谷歌并提取SERP数据。

参数:

  • query (必填):搜索查询
  • country (默认:“us”):国家代码(us、uk、fr、de等)
  • language (默认:“en”):语言代码(en、fr、de、es等)
  • location (可选):本地结果的位置(例如,“纽约州纽约市”)
  • time_range (可选):时间过滤器(小时、天、周、月、年)
  • autocorrect (默认值:true):启用查询自动更正
  • page (默认值:1):页码
  • lite (默认值:true):精简模式(仅限自然结果,流量减少50%)

示例用法:

Search for "python tutorial" with default settings
Search for "python tutorial" in France with lite mode
Search for "restaurants" in New York with 7-day time filter

国家代码

有效的ISO 3166-1 alpha-2代码:us、uk、fr、de、es、it、jp、kr、cn、in、br等。(243个代码)

语言代码

有效的谷歌语言代码:en、fr、de、es、it、pt、ru、ja、ko、zh-cn、zh-tw、ar、hi等。(78个代码)

时间范围

  • hour:过去一小时
  • day:过去24小时
  • week:上周
  • month:上个月
  • year:去年

建筑

  • 指纹旋转:每个请求的浏览器指纹自动轮换
  • MCP协议:具有stdio传输的模型上下文协议服务器
  • 阻塞:为了提高效率,所有非谷歌请求都被阻止

发展

运行测试

uv run pytest

再生原蟾蜍

uv run python -m grpc_tools.protoc \
  --python_out=serp_mcp \
  -Iserp_mcp \
  serp_mcp/uule.proto

许可证

麻省理工学院