并行谷歌搜索服务

G-Search MCP是一款支持多关键词并行搜索的谷歌搜索服务,提供结构化数据返回和浏览器优化功能,适用于高效信息检索和数据分析场景。

  • by jae-jae
  • TypeScript
  • 本地部署
  • 273 星标
  • 更新于
在 GitHub 查看 jae-jae/g-search-mcp

使用说明

G-搜索MCP

一个功能强大的MCP服务器,用于谷歌搜索,可以同时使用多个关键字进行并行搜索。

此项目修改自 谷歌搜索.

🌟 推荐: 奥拉曼 -强大的Olama AI模型管理器。

优势

  • 并行搜索:支持在谷歌上同时使用多个关键字进行搜索,提高搜索效率
  • 浏览器优化:在单个浏览器实例中打开多个选项卡,以实现高效的并行搜索
  • 自动验证处理:智能检测验证码,并在需要时启用可见浏览器模式进行用户验证
  • 用户行为模拟:模拟真实的用户浏览模式,以降低被搜索引擎检测到的可能性
  • 结构化数据:以JSON格式返回结构化搜索结果,便于处理和分析
  • 可配置参数:支持各种参数配置,如搜索结果限制、超时设置、区域设置等。

快速开始

直接使用npx运行:

npx -y g-search-mcp

首次设置-在终端中运行以下命令安装所需的浏览器:

npx playwright install chromium

调试模式

使用 --debug 在调试模式下运行的选项(显示浏览器窗口):

npx -y g-search-mcp --debug

配置MCP

在Claude Desktop中配置此MCP服务器:

MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json 窗户: %APPDATA%/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "g-search": {
      "command": "npx",
      "args": ["-y", "g-search-mcp"]
    }
  }
}

特性

  • search -使用多个关键字执行谷歌搜索并返回结果
    • 使用Playwright浏览器执行搜索
    • 支持以下参数:
      • queries:要执行的搜索查询数组(必需参数)
      • limit:每个查询返回的最大结果数,默认值为10
      • timeout:页面加载超时(毫秒),默认值为60000(60秒)
      • noSaveState:是否避免保存浏览器状态,默认为false
      • locale:搜索结果的区域设置,默认为en-US
      • debug:是否启用调试模式(显示浏览器窗口),覆盖命令行中的--debug标志

示例用法:

Use the search tool to search for "machine learning" and "artificial intelligence" on Google

示例响应:

{
  "searches": [
    {
      "query": "machine learning",
      "results": [
        {
          "title": "What is Machine Learning? | IBM",
          "link": "https://www.ibm.com/topics/machine-learning",
          "snippet": "Machine learning is a branch of artificial intelligence (AI) and computer science which focuses on the use of data and algorithms to imitate the way that humans learn, gradually improving its accuracy."
        },
        ...
      ]
    },
    {
      "query": "artificial intelligence",
      "results": [
        {
          "title": "What is Artificial Intelligence (AI)? | IBM",
          "link": "https://www.ibm.com/topics/artificial-intelligence",
          "snippet": "Artificial intelligence leverages computers and machines to mimic the problem-solving and decision-making capabilities of the human mind."
        },
        ...
      ]
    }
  ]
}

使用技巧

处理特殊网站场景

调整搜索参数

  • 搜索结果数量:有关更多搜索结果:

    Please return the top 20 search results for each keyword
    

    这将设置 limit: 20 参数。

  • 增加超时时间:对于慢速加载情况:

    Please set the page loading timeout to 120 seconds
    

    这将调整 timeout 参数设置为120000毫秒。

区域设置调整

  • 更改搜索区域:指定其他区域设置:
    Please use Chinese locale (zh-CN) for searching
    
    这将设置 locale: "zh-CN" 参数。

调试和故障排除

启用调试模式

  • 动态调试激活:要在特定搜索操作期间显示浏览器窗口,请执行以下操作:
    Please enable debug mode for this search operation
    
    这套 debug: true 即使服务器启动时没有 --debug 旗帜。

安装

先决条件

  • Node.js 18或更高版本
  • NPM或纱线

从源代码安装

  1. 克隆存储库:
git clone https://github.com/jae-jae/g-search-mcp.git
cd g-search-mcp
  1. 安装依赖项:
npm install
  1. 安装Playwright浏览器:
npm run install-browser
  1. 构建服务器:
npm run build

发展

自动重建(开发模式)

npm run watch

使用MCP检查器进行调试

npm run inspector

相关项目

  • 菲彻mcp:一个强大的MCP服务器,用于使用Playwright无头浏览器获取网页内容。具有智能内容提取、并行处理、资源优化等功能,使其成为网络内容抓取的理想工具。

许可证

根据 MIT许可证