Google Search MCP

Google Search MCP

Enables Large Language Models to perform real-time web searches using Google Custom Search API. Integrates with Claude Desktop to retrieve current information from the internet.

Category
Visit Server

README

google-search-mcp

A Model Context Protocol (MCP) server that utilizes Google Custom Search (CSE) to retrieve information from the internet. By leveraging this MCP, the Large Language Model (LLM) is enabled to perform real-time Web searches.

Prerequisites

A Google Custom Search API key and Custom Search Engine ID are required:

  1. Get a Google API Key from the Google Cloud Console
  2. Create a Custom Search Engine at Programmable Search Engine

Installation

pip install google-search-mcp

Or install from source:

pip install .

Configuration

Create a .env file in the project root directory:

cp .env.example .env

Then edit the .env file and add your credentials:

GOOGLE_API_KEY=your-api-key
GOOGLE_CSE_ID=your-custom-search-engine-id

Alternatively, you can set environment variables directly:

export GOOGLE_API_KEY="your-api-key"
export GOOGLE_CSE_ID="your-custom-search-engine-id"

Usage

As a CLI

google-search-mcp

With Claude Desktop

Add the following to your Claude Desktop configuration file:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json Windows: %APPDATA%\Claude\claude_desktop_config.json

For macOS/Linux:

{
  "mcpServers": {
    "google-search": {
      "command": "python",
      "args": ["-m", "google_search_mcp"],
      "env": {
        "GOOGLE_API_KEY": "your-api-key",
        "GOOGLE_CSE_ID": "your-custom-search-engine-id"
      }
    }
  }
}

For Windows:

If python is in your PATH (check with where python), you can use the same configuration as macOS/Linux:

{
  "mcpServers": {
    "google-search": {
      "command": "python",
      "args": ["-m", "google_search_mcp"],
      "env": {
        "GOOGLE_API_KEY": "your-api-key",
        "GOOGLE_CSE_ID": "your-custom-search-engine-id"
      }
    }
  }
}

If you need to use a specific Python installation, find the full path with:

python -c "import sys; print(sys.executable)"

Then use the full path in the configuration:

{
  "mcpServers": {
    "google-search": {
      "command": "C:\\Users\\YOUR_USERNAME\\AppData\\Local\\Microsoft\\WindowsApps\\PythonSoftwareFoundation.Python.3.13_qbz5n2kfra8p0\\python.exe",
      "args": ["-m", "google_search_mcp"],
      "env": {
        "GOOGLE_API_KEY": "your-api-key",
        "GOOGLE_CSE_ID": "your-custom-search-engine-id"
      }
    }
  }
}

Note: Environment variables must be set in the Claude Desktop config env section for the server to access them.

Tools

search

Search the web using Google Custom Search.

Parameters:

  • query (string, required): The search query string
  • num_results (integer, optional): Number of results to return (1-10, default 10)

Development

Running Tests

Install development dependencies:

pip install -e ".[dev]"

Run the test suite:

pytest

Run tests with verbose output:

pytest -v

Run tests with coverage:

pytest --cov=google_search_mcp --cov-report=html

Test Coverage

The test suite includes comprehensive tests for:

  • Successful search requests
  • Environment variable validation
  • API error handling
  • JSON parsing errors
  • Empty search results
  • Input parameter validation (num_results clamping)
  • Result formatting
  • Request parameter verification

License

MIT License - see LICENSE for details.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured