Enhanced Google Search MCP

Enhanced Google Search MCP

A powerful Model Context Protocol (MCP) server that provides enhanced Google search capabilities with advanced anonymization and anti-detection features.

Category
访问服务器

README

Enhanced Google Search MCP Server

smithery badge

<a href="https://glama.ai/mcp/servers/@kongyo2/Google-Search-MCP"> <img width="380" height="200" src="https://glama.ai/mcp/servers/@kongyo2/Google-Search-MCP/badge" alt="Enhanced Google Search MCP server" /> </a>

Ask DeepWiki

⚠️ EXPERIMENTAL PROJECT - USE AT YOUR OWN RISK

This is an experimental Google search MCP server that uses web scraping techniques. Please be aware of the following:

  • Rate Limiting: Google may block or rate-limit requests from this server
  • Reliability: Search results may be inconsistent due to Google's anti-scraping measures

🔍 RECOMMENDED ALTERNATIVES

For production use, we strongly recommend using official search APIs or established MCP servers:

  • DuckDuckGo MCP Servers: More reliable and ToS-compliant alternatives
  • Bing Search API: Microsoft's official search API with MCP integration
  • Google Custom Search API: Google's official search API (requires API key)
  • SearXNG MCP: Privacy-focused meta-search engine integration

Use this experimental server only if you understand the risks and limitations.


A powerful Model Context Protocol (MCP) server that provides enhanced Google search capabilities with advanced anonymization and anti-detection features.

Features

🔍 Enhanced Search Capabilities

  • Advanced Query Support: Handle complex search queries with quotes, operators, and filters
  • Configurable Results: Limit results (1-10), set language, region, safe search, and time range
  • Multiple Parsing Strategies: Robust result extraction with fallback mechanisms

🛡️ Advanced Anonymization

  • Realistic Browser Fingerprinting: Rotating user agents that mimic real browsers (Chrome, Firefox, Safari, Edge)
  • Dynamic Headers: Randomized Accept-Language, Accept-Encoding, and security headers
  • Session Randomization: Unique session IDs and request fingerprints
  • Request Timing: Random delays to avoid detection patterns

🚀 Reliability Features

  • Smart Retry Logic: Exponential backoff with jitter for failed requests
  • Rate Limit Handling: Automatic detection and graceful handling of rate limits
  • Error Recovery: Comprehensive error handling with user-friendly messages
  • Timeout Management: Configurable timeouts with proper error reporting

🔧 Technical Improvements

  • Multiple Result Selectors: Adapts to Google's changing HTML structure
  • URL Cleaning: Proper handling of Google's redirect URLs
  • Content Validation: Ensures all results have valid URLs and content
  • Comprehensive Logging: Detailed logging for debugging and monitoring

Installation

Installing via Smithery

To install google-search-mcp for Claude Desktop automatically via Smithery:

npx -y @smithery/cli install @kongyo2/google-search-mcp --client claude

Manual Installation

npm install

Usage

Development Mode

Start the server in development mode with interactive CLI:

npm run dev

Production Mode

Start the server for production use:

npm run start

Testing

Run the comprehensive test suite:

npm run test

For continuous testing during development:

npm run test:watch

MCP Tool: search

The server provides a single, powerful search tool with the following parameters:

Parameters

  • query (required): Search query to execute
  • limit (optional): Maximum number of results (1-10, default: 5)
  • language (optional): Language code (e.g., 'en', 'es', 'fr', 'de', 'ja')
  • region (optional): Region code (e.g., 'us', 'uk', 'ca', 'au')
  • safeSearch (optional): Filter level ('off', 'moderate', 'strict')
  • timeRange (optional): Time filter ('hour', 'day', 'week', 'month', 'year')

Example Usage

{
  "name": "search",
  "arguments": {
    "query": "Model Context Protocol MCP",
    "limit": 5,
    "language": "en",
    "region": "us",
    "safeSearch": "moderate",
    "timeRange": "week"
  }
}

Configuration with Claude Desktop

Add this configuration to your Claude Desktop MCP settings:

{
  "mcpServers": {
    "enhanced-google-search": {
      "command": "npx",
      "args": ["tsx", "/path/to/your/project/src/server.ts"]
    }
  }
}

Architecture

Core Components

  1. UserAgentGenerator: Creates realistic browser fingerprints
  2. RequestAnonymizer: Handles request anonymization and timing
  3. SearchParameterBuilder: Constructs optimized search parameters
  4. ResultParser: Robust HTML parsing with multiple strategies

Anti-Detection Features

  • Browser Fingerprint Rotation: Cycles through realistic user agents
  • Header Randomization: Varies request headers to avoid patterns
  • Timing Randomization: Adds random delays between requests
  • Session Management: Generates unique session identifiers
  • Parameter Variation: Adds random search parameters

Error Handling

The server provides comprehensive error handling for:

  • Rate limiting by Google
  • Network timeouts and connectivity issues
  • Access denied/blocked requests
  • Invalid or empty responses
  • Parsing failures with fallback strategies

Development

Project Structure

src/
├── server.ts          # Main MCP server implementation
├── search.ts          # Enhanced search functionality
├── search.test.ts     # Comprehensive test suite
└── types.ts           # TypeScript type definitions

Code Quality

The project includes:

  • TypeScript: Full type safety and IntelliSense support
  • ESLint: Code linting with TypeScript rules
  • Prettier: Consistent code formatting
  • Vitest: Fast and reliable testing framework

Scripts

  • npm run build: Compile TypeScript to JavaScript
  • npm run start: Start the server in production mode
  • npm run dev: Start in development mode with CLI
  • npm run test: Run the test suite
  • npm run test:watch: Run tests in watch mode
  • npm run lint: Check code quality and types
  • npm run format: Format code with Prettier

Testing

The test suite covers:

  • Basic search functionality
  • Parameter validation and handling
  • Language and region filtering
  • Safe search and time range filters
  • Complex query handling
  • Error scenarios and edge cases
  • URL validation and result formatting

All tests use real Google search requests to ensure functionality works in practice.

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes with tests
  4. Run npm run lint and npm run test
  5. Submit a pull request

License

MIT License - see LICENSE file for details.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选