Google Search MCP Server

Google Search MCP Server

This phrase describes a system with the following capabilities: * **Google search capabilities:** Can perform searches on Google. * **Web content extraction:** Can extract content from websites. * **Screenshot functionality:** Can take screenshots of web pages. * **Advanced bot detection avoidance:** Designed to avoid being detected as a bot. * **MCP protocol:** Uses the MCP protocol (likely a custom or internal protocol) for these functions. Here's the translation into Chinese: **提供谷歌搜索功能、网页内容提取、截图功能,并通过MCP协议实现高级的机器人检测规避。** Here's a breakdown of the translation: * **提供 (Tígōng):** Provides / Offers * **谷歌搜索功能 (Gǔgē sōusuǒ gōngnéng):** Google search capabilities * **网页内容提取 (Wǎngyè nèiróng tíqǔ):** Web content extraction * **截图功能 (Jiétú gōngnéng):** Screenshot functionality * **并通过 (Bìng tōngguò):** And through / And by using * **MCP协议 (MCP xiéyì):** MCP protocol * **实现 (Shíxiàn):** Achieve / Implement * **高级的 (Gāojí de):** Advanced * **机器人检测规避 (Jīqìrén jiǎncè guībì):** Bot detection avoidance Therefore, the entire translation accurately conveys the meaning of the original English phrase.

远程shell执行
媒体内容处理
内容获取
访问服务器

README

Web Search MCP 服务器

一个提供 Google 搜索功能和网页内容查看的 MCP 服务器,具有高级的机器人检测规避功能。

功能

  • 具有高级过滤功能的 Google 自定义搜索
  • 具有 Markdown 转换的网页内容查看
  • 速率限制和缓存
  • 浏览器实例池
  • 使用 rebrowser-puppeteer 规避机器人检测

前提条件

  • Bun 运行时 v1.0 或更高版本
  • Google API 凭据(API 密钥和搜索引擎 ID)

安装

# 安装依赖
bun install

# 构建 TypeScript 文件
bun run build

配置

Cookie 设置

对于需要身份验证的站点访问,您需要:

  1. 安装 Get cookies.txt LOCALLY Chrome 扩展
  2. 访问您想要进行身份验证的站点并登录
  3. 使用该扩展程序以 JSON 格式导出您的 cookies
  4. 将导出的 cookies 文件存储在安全的位置
  5. BROWSER_COOKIES_PATH 环境变量设置为您的 cookies 文件的绝对路径

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 来避免机器人检测:

  1. Runtime.Enable 泄漏预防:

    • 使用 addBinding 技术来避免 Runtime.Enable 检测
    • 适用于 Web Workers 和 Iframe
    • 保持对主世界上下文的访问
  2. 来源 URL 掩蔽:

    • 更改 Puppeteer 的 sourceURL,使其看起来像一个合法的脚本
    • 帮助避免检测自动化工具
  3. 实用程序世界名称:

    • 使用通用的实用程序世界名称
    • 通过世界名称模式防止检测
  4. 浏览器启动配置:

    • 禁用自动化标志
    • 使用优化的 Chrome 参数
    • 配置视口和窗口设置

与 Claude Desktop 一起使用

  1. 确保您已安装 Claude Desktop 并更新到最新版本

  2. 打开您的 Claude Desktop 配置文件:

    • MacOS/Linux:~/Library/Application Support/Claude/claude_desktop_config.json
    • Windows:%APPDATA%\Claude\claude_desktop_config.json
  3. 如上面的 配置 部分所示,添加服务器配置。

  4. 重新启动 Claude Desktop

  5. 查找锤子图标 以确认这些工具可用

可用工具

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 集成问题

  1. 检查日志:

    # MacOS/Linux
    tail -n 20 -f ~/Library/Logs/Claude/mcp*.log
    
    # Windows
    type %APPDATA%\Claude\Logs\mcp*.log
    
  2. 常见问题:

    • 服务器未显示:检查配置文件语法和路径
    • 工具调用失败:检查服务器日志并重新启动 Claude Desktop
    • 路径问题:确保您使用的是绝对路径

有关更详细的故障排除,请参阅 MCP 调试指南

开发

# 在开发模式下运行并进行监视
bun --watch run dev

# 运行测试
bun run test

# 运行 linter
bun run lint

重要提示

  1. 机器人检测:

    • 机器人检测规避功能有助于防止最常见的检测方法
    • 但是,可能需要其他措施,例如适当的代理和用户代理
    • 某些网站可能仍然通过其他方式检测到自动化
  2. 性能:

    • 浏览器实例被池化和重用
    • 空闲浏览器会自动清理
    • 资源限制可防止过载

许可证

MIT

推荐服务器

e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
mult-fetch-mcp-server

mult-fetch-mcp-server

一个多功能的、符合 MCP 规范的网页内容抓取工具,支持多种模式(浏览器/Node)、格式(HTML/JSON/Markdown/文本)和智能代理检测,并提供双语界面(英语/中文)。

精选
本地
AIO-MCP Server

AIO-MCP Server

🚀 集成了 AI 搜索、RAG 和多服务(GitLab/Jira/Confluence/YouTube)的一体化 MCP 服务器,旨在增强 AI 驱动的开发工作流程。来自 Folk。

精选
本地
Knowledge Graph Memory Server

Knowledge Graph Memory Server

为 Claude 实现持久性记忆,使用本地知识图谱,允许 AI 记住用户的信息,并可在自定义位置存储,跨对话保持记忆。

精选
本地
Hyperbrowser

Hyperbrowser

欢迎来到 Hyperbrowser,人工智能的互联网。Hyperbrowser 是下一代平台,旨在增强人工智能代理的能力,并实现轻松、可扩展的浏览器自动化。它专为人工智能开发者打造,消除了本地基础设施和性能瓶颈带来的麻烦,让您能够:

精选
本地
https://github.com/Streen9/react-mcp

https://github.com/Streen9/react-mcp

react-mcp 与 Claude Desktop 集成,能够根据用户提示创建和修改 React 应用程序。

精选
本地
any-chat-completions-mcp

any-chat-completions-mcp

将 Claude 与任何 OpenAI SDK 兼容的聊天完成 API 集成 - OpenAI、Perplexity、Groq、xAI、PyroPrompts 等。

精选
Exa MCP Server

Exa MCP Server

一个模型上下文协议服务器,它使像 Claude 这样的人工智能助手能够以安全和受控的方式,使用 Exa AI 搜索 API 执行实时网络搜索。

精选
MCP Web Research Server

MCP Web Research Server

一个模型上下文协议服务器,使 Claude 能够通过集成 Google 搜索、提取网页内容和捕获屏幕截图来进行网络研究。

精选
mcp-perplexity

mcp-perplexity

Perplexity API 的 MCP 服务器。

精选