X

mcp-web-search

Information

Web Search MCP 服务器 提供 Google 搜索功能和网页内容查看的 MCP 服务器,并具有高级机器人检测规避功能。 功能 带有高级过滤的 Google 自定义搜索 网页内容查看并转换为 Markdown 格式 速率限制和缓存 浏览器实例池 使用 rebrowser-puppeteer 避免机器人检测 先决条件 Bun 运行时 v1.0 或更高版本 Google API 凭证(API 密钥和搜索引擎 ID) 安装 # Install dependencies bun install # Build the TypeScript files bun run build 配置 Cookie 设置 为了进行认证站点访问,您需要: 安装 Get cookies.txt LOCALLY Chrome 扩展程序 访问您想要认证的网站并登录 使用扩展程序将您的 cookie 导出为 JSON 格式 将导出的 cookie 文件存储在安全位置 设置 BROWSER_COOKIES_PATH 环境变量为您 cookie 文件的绝对路径 MCP 服务器配置 将服务器配置添加到您的 MCP 设置文件中: 对于 Cline: %APPDATA%\Code\User\globalStorage\rooveterinaryinc.roo-cline\settings\cline_mcp_settings.json 对于 Claude Desktop: MacOS/Linux: ~/Library/Application Support/Claude/claude_desktop_config.json Windows: %APPDATA%\Claude\claude_desktop_config.json \{ "mcpServers": \{ "web-search": \{ "command": "bun", "args": [ "run", "/ABSOLUTE/PATH/TO/web_search_mcp/dist/index.js" ], "env": \{ "GOOGLE_API_KEY": "your_api_key", "GOOGLE_SEARCH_ENGINE_ID": "your_search_engine_id", "MAX_CONCURRENT_BROWSERS": "3", "BROWSER_TIMEOUT": "30000", "RATE_LIMIT_WINDOW": "60000", "RATE_LIMIT_MAX_REQUESTS": "60", "SEARCH_CACHE_TTL": "3600", "VIEW_URL_CACHE_TTL": "7200", "MAX_CACHE_ITEMS": "1000", "BROWSER_POOL_MIN": "1", "BROWSER_POOL_MAX": "5", "BROWSER_POOL_IDLE_TIMEOUT": "30000", "REBROWSER_PATCHES_RUNTIME_FIX_MODE": "addBinding", "REBROWSER_PATCHES_SOURCE_URL": "jquery.min.js", "REBROWSER_PATCHES_UTILITY_WORLD_NAME": "util", "REBROWSER_PATCHES_DEBUG": "0", "BROWSER_COOKIES_PATH": "C:\\path\\to\\cookies.json", "LOG_LEVEL": "info", "NO_COLOR": "0", "BUN_FORCE_COLOR": "1", "FORCE_COLOR": "1" \} \} \} \} 将 /ABSOLUTE/PATH/TO/web_search_mcp 替换为您的服务器目录的绝对路径。 日志配置 以下环境变量控制日志行为: LOG_LEVEL: 设置日志级别(error, warn, info, debug)。默认:info NO_COLOR: 当设置为 "1" 时禁用彩色输出 BUN_FORCE_COLOR: 控制 Bun 运行时中的彩色输出(设置为 "0" 以禁用) FORCE_COLOR: 全局控制彩色输出(设置为 "0" 以禁用) 机器人检测规避 此服务器使用 rebrowser-puppeteer 来避免机器人检测: Runtime.Enable 泄漏预防: 使用 addBinding 技术来避免 Runtime.Enable 检测 适用于 web workers 和 iframes 维持对主世界上下文的访问 源 URL 掩盖: 更改 Puppeteer 的 sourceURL 使其看起来像合法脚本 有助于避免自动化工具的检测 工具世界名称: 使用通用的工具世界名称 通过世界名称模式防止检测 浏览器启动配置: 禁用自动化标志 使用优化的 Chrome 参数 配置视口和窗口设置 与 Claude Desktop 一起使用 确保你已安装并更新到最新版本的 Claude Desktop。 打开你的 Claude Desktop 配置文件: MacOS/Linux: ~/Library/Application Support/Claude/claude_desktop_config.json Windows: %APPDATA%\Claude\claude_desktop_config.json 按照上面配置部分所示添加服务器配置。 重启 Claude Desktop 查找锤子图标 ,以确认工具可用 可用工具 1. 搜索工具 \{ name: "search", params: \{ query: string; trustedDomains?: string[]; excludedDomains?: string[]; resultCount?: number; safeSearch?: boolean; dateRestrict?: string; \} \} 2. 查看 URL 工具 \{ name: "view_url", params: \{ url: string; includeImages?: boolean; includeVideos?: boolean; preserveLinks?: boolean; formatCode?: boolean; \} \} 故障排除 Claude Desktop 集成问题 检查日志: # MacOS/Linux tail -n 20 -f ~/Library/Logs/Claude/mcp*.log # Windows type %APPDATA%\Claude\Logs\mcp*.log 常见问题: 服务器未显示:检查配置文件语法和路径 工具调用失败:检查服务器日志并重启 Claude Desktop 路径问题:确保使用绝对路径 有关更详细的故障排除,请参阅MCP调试指南。 开发 # Run in development mode with watch bun --watch run dev # Run tests bun run test # Run linter bun run lint 重要注意事项 机器人检测: 机器人检测规避功能有助于防止大多数常见的检测方法 但是,可能还需要采取额外措施,如使用正确的代理和用户代理 某些网站仍可能通过其他方式检测自动化 性能: 浏览器实例会被池化并重用 空闲浏览器会自动清理 资源限制防止过载 许可证 MIT

Prompts

Reviews

Tags

Write Your Review

Detailed Ratings

ALL
Correctness
Helpfulness
Interesting
Upload Pictures and Videos

Name
Size
Type
Download
Last Modified
  • Community

Add Discussion

Upload Pictures and Videos