Provides Google Search functionality with automatic API key rotation, intelligent quota management, multi-language support, geolocation capabilities, and advanced search filters (date, file type, site-specific).
Integrates with Google Cloud's Custom Search API, managing API keys across Google Cloud projects to maximize free search quotas while providing persistent quota tracking and automatic daily reset.
Google Search MCP Server
A Model Context Protocol (MCP) server that provides Google Search functionality with automatic API key rotation and intelligent quota management.
Features
- Official Google Custom Search API integration
- Automatic API key rotation for increased daily limits
- Persistent quota tracking across sessions and directories
- Multi-language and geolocation support
- Advanced search filters (date, file type, site-specific)
- SafeSearch content filtering
- Global configuration - works from anywhere
- Compatible with Claude Desktop and other MCP clients
Installation
Quick Setup (Recommended)
This will:
- ✅ Configure your Google API keys interactively
- ✅ Set up global configuration file
- ✅ Automatically integrate with Claude Code
- ✅ Enable 100+ free searches per day per API key
Advanced Installation
Uninstallation
Complete Removal
Note: Configuration file (~/.google-search-mcp.json
) is always preserved during updates and uninstallation to protect your API keys. Use npm run clean
only if you want to completely remove your configuration.
Configuration
The setup tool creates a global configuration file at:
- Windows:
%USERPROFILE%\.google-search-mcp.json
- Linux/macOS:
~/.google-search-mcp.json
This file contains:
- ✅ Your API keys and search engine IDs
- ✅ Persistent quota tracking (survives restarts)
- ✅ Automatic daily reset at midnight UTC
- ✅ Cross-directory usage (works from anywhere)
Example Configuration
⚠️ Important: If you manually edit the configuration file (~/.google-search-mcp.json
), you must restart Claude Desktop for the changes to take effect.
Getting Google API Credentials
1. Create a Google Cloud Project
- Go to Google Cloud Console
- Create a new project or select existing
- Enable the "Custom Search API"
2. Generate API Key
- Navigate to "APIs & Services" > "Credentials"
- Click "Create Credentials" > "API Key"
- Copy the generated key
3. Create Custom Search Engine
- Visit Google Programmable Search Engine
- Click "Get started" or "Add"
- For "Sites to search", enter
*
to search the entire web - Copy the Search Engine ID
4. Scale with Multiple Keys
- Each Google Cloud project provides 100 free searches/day
- Create multiple projects for more quota (e.g., 3 projects = 300 searches/day)
- The server automatically rotates between available keys
Usage with Claude Code
After running the setup, the server is automatically configured in Claude Code. You can immediately use it:
The server exposes a google_search
tool with these parameters:
Required Parameters
query
(string): Search query
Optional Parameters
num
(number): Number of results (1-10, default: 5)start
(number): Starting index for resultssafe
(string): SafeSearch level ('off', 'active')lr
(string): Language restriction (e.g., 'lang_en', 'lang_fr')gl
(string): Geolocation (country code: 'us', 'fr', 'uk')dateRestrict
(string): Time period ('d1', 'w1', 'm1', 'y1')fileType
(string): File type filter ('pdf', 'doc', 'ppt')siteSearch
(string): Search specific sitesiteSearchFilter
(string): Include ('i') or exclude ('e') sitecr
(string): Country restriction ('countryUS', 'countryFR')exactTerms
(string): Exact phrase to includeexcludeTerms
(string): Terms to excludeorTerms
(string): Alternative terms (OR search)sort
(string): Sort by date ('date')searchType
(string): Search type ('image' for image search)
Examples
Basic Search
Advanced Search
Site-Specific Search
Quota Management
The server provides real-time quota information in each response:
Quota Features
- Automatic daily reset at midnight UTC
- Intelligent key rotation when limits are reached
- Disabled keys automatically reactivate after reset
- Persistent tracking across server restarts
- No charges - stops at free tier limits
Error Handling
The server gracefully handles various error scenarios:
- Quota Exceeded: Automatically rotates to next available key
- All Keys Exhausted: Returns clear error message with quota status
- Invalid API Key: Disables the key and continues with others
- Network Errors: Returns detailed error information
Development
Prerequisites
- Node.js 18+
- TypeScript
- Google Cloud account
Scripts
Project Structure
Contributing
Contributions are welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
License
MIT License - see LICENSE file for details
Support
For issues, questions, or contributions, please visit: https://github.com/Fabien-desablens/google-search-mcp
This server cannot be installed
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
An MCP server that provides Google Search functionality with automatic API key rotation and intelligent quota management, enabling natural language search queries with advanced filtering options.
Related MCP Servers
- AsecurityAlicenseAqualityA powerful MCP server that enables parallel Google searching with multiple keywords simultaneously, providing structured results while handling CAPTCHAs and simulating user browsing patterns.Last updated -1645186TypeScriptMIT License
- -securityFlicense-qualityAn MCP server that provides access to Google's API Discovery Service, allowing agents to discover and interact with Google APIs through natural language commands.Last updated -Python
- -securityFlicense-qualityAn MCP server that enables interacting with Google's Indexing API, allowing agents to submit URLs to Google for indexing or removal from search results through natural language commands.Last updated -Python
- -securityFlicense-qualityAn MCP Server that provides access to Google's Search Console API, allowing users to interact with website search performance data and manage search presence through natural language.Last updated -Python