WA 

web-agent-master/google-search 是从 https://github.com/web-agent-master/google-search. 导入的 MCP 服务器候选服务器。
概览
web-agent-master/google-search 是从 https://github.com/web-agent-master/google-search. 导入的 MCP 服务器候选服务器。
概述(AI 翻译)
一款基于Playwright的Node.js工具,绕过搜索引擎的反抓取机制,执行Google搜索并提取结果。它可以直接作为命令行工具使用,也可以作为模型上下文协议(MCP)服务器,为像Claude这样的AI助手提供实时搜索功能。
中文文档
主要特色
- 本地SERP API替代方案:无需依赖付费搜索引擎结果API服务,所有搜索均本地执行
- 先进的反机器人检测绕过技术:
- 模拟真实用户行为的智能浏览器指纹管理
- 自动保存和恢复浏览器状态以减少验证频率
- 智能无头/头模式切换,在需要验证时自动切换到头模式
- 随机化设备和区域设置以降低检测风险
- 原始HTML检索:能够获取搜索结果页面的原始HTML(去除CSS和JavaScript),以便在谷歌页面结构变化时进行分析和调试
- 页面截图:保存HTML内容时自动截取并保存整页截图
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
Google Search Tool
A Playwright-based Node.js tool that bypasses search engine anti-scraping mechanisms to execute Google searches and extract results. It can be used directly as a command-line tool or as a Model Context Protocol (MCP) server to provide real-time search capabilities to AI assistants like Claude.
Key Features
- Local SERP API Alternative: No need to rely on paid search engine results API services, all searches are executed locally
- Advanced Anti-Bot Detection Bypass Techniques:
- Intelligent browser fingerprint management that simulates real user behavior
- Automatic saving and restoration of browser state to reduce verification frequency
- Smart headless/headed mode switching, automatically switching to headed mode when verification is needed
- Randomization of device and locale settings to reduce detection risk
- Raw HTML Retrieval: Ability to fetch the raw HTML of search result pages (with CSS and JavaScript removed) for analysis and debugging when Google’s page structure changes
- Page Screenshot: Automatically captures and saves a full-page screenshot when saving HTML content
- MCP Server Integration: Provides real-time search capabilities to AI assistants like Claude without requiring additional API keys
- Completely Open Source and Free: All code is open source with no usage restrictions, freely customizable and extensible
Technical Features
- Developed with TypeScript, providing type safety and better development experience
- Browser automation based on Playwright, supporting multiple browser engines
- Command-line parameter support for search keywords
- MCP server support for AI assistant integration
- Returns search results with title, link, and snippet
- Option to retrieve raw HTML of search result pages for analysis
- JSON format output
- Support for both headless and headed modes (for debugging)
- Detailed logging output
- Robust error handling
- Browser state saving and restoration to effectively avoid anti-bot detection
Installation
# Install from source
git clone https://github.com/web-agent-master/google-search.git
cd google-search
# Install dependencies
npm install
# Or using yarn
yarn
# Or using pnpm
pnpm install
# Compile TypeScript code
npm run build
# Or using yarn
yarn build
# Or using pnpm
pnpm build
# Link package globally (required for MCP functionality)
npm link
# Or using yarn
yarn link
# Or using pnpm
pnpm link
Windows Environment Notes
This tool has been specially adapted for Windows environments:
.cmdfiles are provided to ensure command-line tools work properly in Windows Command Prompt and PowerShell- Log files are stored in the system temporary directory instead of the Unix/Linux
/tmpdirectory
安装
npx google-search-mcp配置
{
"mcpServers": {
"google-search": {
"command": "npx",
"args": ["google-search-mcp"]
}
}
}