搜索与内容提取服务器

一个提供Google搜索和图像搜索功能,支持内容提取和AI分析的模型上下文协议(MCP)服务器。

  • by hinsmoment
  • JavaScript
  • 本地部署
  • 3 星标
  • 更新于
在 GitHub 查看 hinsmoment/google-search-mcp

使用说明

谷歌搜索MCP服务器

一个强大的模型上下文协议(MCP)服务器,为Claude Code提供谷歌搜索和图像搜索功能


特性

🌐 谷歌文本搜索

  • 使用可定制的结果计数搜索谷歌
  • 提取标题、链接和描述
  • 支持多种语言

📄 Web内容提取

  • 从任何网页提取主要内容
  • 智能内容过滤(广告、导航已删除)
  • 批量提取支持

🔍 组合搜索和提取

  • 搜索并自动提取多个结果
  • 一键式深度内容检索

🖼️ 基于AI分析的图像搜索⭐

  • 双平台搜索:谷歌图片+Pinterest
  • 多模型AI可视化分析:支持GLM-4.6V、GPT-4O、Claude 3.5等
  • 质量评分系统:S/A/B/C分级
  • 非常适合查找产品参考图像

安装

先决条件

  • Node.js>=18.0.0
  • 支持MCP的Claude代码

设置

  1. 克隆存储库
git clone https://github.com/hinsmoment/google-search-mcp.git
cd google-search-mcp
  1. 安装依赖项
npm install
  1. 配置Claude代码

添加到您的Claude配置(~/.claude.json 或通过设置):

{
  "mcpServers": {
    "google-search": {
      "type": "stdio",
      "command": "node",
      "args": ["/path/to/google-search-mcp/server.js"]
    }
  }
}
  1. 重新启动Claude代码

用法

1.谷歌搜索

Search Google for "Claude Code AI assistant"

2.提取网页内容

Extract content from https://example.com

3.批量提取URL

Extract content from these URLs:
- https://github.com/topic1
- https://github.com/topic2
- https://github.com/topic3

4.图片搜索(产品参考)

Find similar products using this image: /path/to/product.jpg

MCP工具

工具 说明 参数
google_search 谷歌文本搜索 query, maxResults (1-25)
fetch_url 提取网页内容 url
batch_fetch_urls 批量提取多个URL urls (数组)
search_and_extract 搜索+提取结果 query, maxResults (1-10)
search_by_image 基于图像的产品搜索 image_path, max_results, enable_ai_analysis

图像搜索详细信息

运作原理

┌─────────────────┐
│  Upload Image   │
└────────┬────────┘
         ↓
┌─────────────────┐
│  AI Analysis    │
│  (Multi-Model)   │
│  - Product type │
│  - Keywords     │
└────────┬────────┘
         ↓
    ┌────┴────┐
    ↓         ↓
┌───────┐  ┌───────┐
│Google │  │Pinterest│
│Images │  │Search  │
└───┬───┘  └───┬───┘
    └────┬────┘
         ↓
┌─────────────────┐
│  Merge & Score  │
│  S/A/B/C Grades │
└─────────────────┘

质量评分

成绩 分数 来源
S 85-100 天猫香港、天猫、京东商城、品牌网站
A. 75-84 京东、亚马逊、淘宝、Pinterest
B 60-74 其他电子商务网站
C <60 一般网站

技术架构

浏览器自动化

  • 操纵者 主要的,重要的
  • 剧作家 (自动回退)

关键依赖

{
  "puppeteer": "^22.15.0"
}

模块结构

google-search-mcp/
├── server.js           # MCP server implementation
├── lib/
│   └── image-search.js # Image search module with AI analysis
├── package.json
└── README.md

配置

可选:AI分析API密钥

为了增强图像分析,请设置GLM API密钥:

# Linux/macOS
export GLM_API_KEY=your_api_key_here

# Windows (PowerShell)
$env:GLM_API_KEY="your_api_key_here"

# Windows (CMD)
set GLM_API_KEY=your_api_key_here

备注:基于回退关键字的搜索在没有API关键字的情况下工作。


例子

示例1:电子商务产品研究

Find similar products to: ./images/dinosaur-pencil-case.jpg
Return top 15 results with AI analysis enabled

输出包括:

  • 产品形象分析
  • 已提取关键字
  • 双平台结果(谷歌+Pinterest)
  • 质量分数与等级

示例2:内容研究

Search for "MCP protocol Model Context"
Extract full content from top 5 results

贡献

欢迎投稿!请随时提交拉取请求。

开发设置

# Install dependencies
npm install

# Run tests
npm test

# Start MCP server (for debugging)
node server.js

编码标准

  • 遵循现有代码样式
  • 为复杂逻辑添加注释
  • 彻底测试您的更改

故障排除

Puppeter Chrome下载问题

如果Puppeteer未能下载Chrome:

# Skip Chrome download and use system Chrome
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true npm install puppeteer

MCP服务器未启动

  1. 检查Node.js版本: node --version (要求>=18.0.0)
  2. 验证Claude配置中的文件路径
  3. 检查克劳德代码日志是否有错误

图像搜索不返回任何结果

  • 验证图像路径是否正确
  • 检查互联网连接
  • 如果API出现关键问题,请尝试禁用AI分析

局限性

  • 谷歌搜索可能会受到反抓取措施的影响
  • Pinterest直接抓取是有限的(使用谷歌 site:pinterest.com 过滤器)
  • 基于API的人工智能分析需要单独的GLM API密钥

路线图

  • []添加更多图像搜索平台(Behance、Dribbble)
  • []实现局部图像相似性匹配(CLIP/DINOv2)
  • []添加结果缓存
  • []支持更多AI视觉模型

许可证

此项目根据MIT许可证获得许可-请参阅 许可证 文件以获取详细信息。


致谢


作者

由...创建 成哥

特别感谢:在Claude Code的协助下开发


支持


⭐ 如果对你有帮助,请在这个仓库上签名!

制作于❤️ 开源社区