The Google Search MCP server integrates Google Search functionality into Claude Desktop and other MCP clients with automatic API key rotation and intelligent quota management. It allows you to perform web searches directly through Claude, with features like multi-language support, advanced filters, and SafeSearch content filtering.
# Install the package globally
npm install -g @kyaniiii/google-search-mcp
# Run interactive setup
google-search-setup
This will:
git clone https://github.com/Fabien-desablens/google-search-mcp.git
cd google-search-mcp
npm install
npm run build
npm run setup
# Remove the package
npm uninstall -g @kyaniiii/google-search-mcp
# Remove from Claude Code
claude mcp remove google-search
# Remove configuration file (if desired)
npm run clean
Note: Configuration file (~/.google-search-mcp.json
) is preserved during updates and uninstallation to protect your API keys. Use npm run clean
only if you want to completely remove your configuration.
The setup tool creates a global configuration file at:
%USERPROFILE%\.google-search-mcp.json
~/.google-search-mcp.json
This file contains:
{
"keys": [
{
"id": "key_1",
"apiKey": "AIzaSy...",
"searchEngineId": "abc123...",
"dailyUsage": 45,
"dailyLimit": 100,
"lastReset": "2024-07-30",
"isActive": true
}
],
"lastUpdated": "2024-07-30T15:30:00Z",
"version": "1.0.0"
}
⚠️ Important: If you manually edit the configuration file, you must restart Claude Desktop for the changes to take effect.
*
to search the entire webAfter running the setup, the server is automatically configured in Claude Code:
User: "Search for latest AI news from this week"
Claude: I'll search for the latest AI news using Google Search...
The server exposes a google_search
tool with these parameters:
query
(string): Search querynum
(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){
"query": "artificial intelligence news"
}
{
"query": "machine learning",
"num": 10,
"lr": "lang_en",
"gl": "us",
"dateRestrict": "m1",
"fileType": "pdf"
}
{
"query": "typescript tutorial",
"siteSearch": "stackoverflow.com",
"siteSearchFilter": "i"
}
The server provides real-time quota information in each response:
{
"results": [...],
"metadata": {
"quotaStatus": {
"totalUsed": 15,
"totalLimit": 300,
"keysStatus": [
{
"id": "key_1",
"used": 15,
"limit": 100,
"remaining": 85,
"active": true
}
]
}
}
}
The server gracefully handles various error scenarios:
To add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "google-search" '{"command":"npx","args":["-y","@kyaniiii/google-search-mcp"]}'
See the official Claude Code MCP documentation for more details.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"google-search": {
"command": "npx",
"args": [
"-y",
"@kyaniiii/google-search-mcp"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
2. Add this to your configuration file:
{
"mcpServers": {
"google-search": {
"command": "npx",
"args": [
"-y",
"@kyaniiii/google-search-mcp"
]
}
}
}
3. Restart Claude Desktop for the changes to take effect