G-搜索 MCP
强大的 Google 搜索 MCP 服务器,可同时使用多个关键字进行并行搜索。
该项目由google-search修改而来。
优势
- 并行搜索:支持在Google上同时使用多个关键字进行搜索,提高搜索效率
- 浏览器优化:在单个浏览器实例中打开多个选项卡,以实现高效的并行搜索
- 自动验证处理:智能检测验证码,并在需要时启用可见浏览器模式进行用户验证
- 用户行为模拟:模拟真实用户浏览模式,降低被搜索引擎检测到的可能性
- 结构化数据:以 JSON 格式返回结构化搜索结果,以便于处理和分析
- 可配置参数:支持各种参数配置,如搜索结果限制、超时设置、区域设置等。
快速入门
直接用npx运行:
首次设置 - 通过在终端中运行以下命令来安装所需的浏览器:
npx playwright install chromium
调试模式
使用--debug
选项以调试模式运行(显示浏览器窗口):
npx -y g-search-mcp --debug
配置 MCP
在 Claude Desktop 中配置此 MCP 服务器:
MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%/Claude/claude_desktop_config.json
{
"mcpServers": {
"g-search": {
"command": "npx",
"args": ["-y", "g-search-mcp"]
}
}
}
特征
search
- 使用多个关键字执行 Google 搜索并返回结果- 使用 Playwright 浏览器进行搜索
- 支持以下参数:
queries
:要执行的搜索查询数组(必需参数)limit
:每个查询返回的最大结果数,默认值为 10timeout
:页面加载超时时间(毫秒),默认为 60000(60 秒)noSaveState
:是否避免保存浏览器状态,默认为 falselocale
:搜索结果的语言环境设置,默认为 en-USdebug
:是否启用调试模式(显示浏览器窗口),覆盖命令行中的 --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
标志,也会设置debug: true
。
安装
先决条件
- Node.js 18 或更高版本
- NPM 或 Yarn
从源安装
- 克隆存储库:
git clone https://github.com/jae-jae/g-search-mcp.git
cd g-search-mcp
- 安装依赖项:
- 安装 Playwright 浏览器:
- 构建服务器:
发展
自动重建(开发模式)
使用 MCP Inspector 进行调试
相关项目
- fetcher-mcp :一款功能强大的 MCP 服务器,可使用 Playwright 无头浏览器抓取网页内容。它具备智能内容提取、并行处理、资源优化等功能,是理想的网页内容抓取工具。
执照
根据MIT 许可证授权