Google Custom Search MCP Server

Google Custom Search MCP Server

google-custom-search-mcp•byfbettag

An async Python Model Context Protocol server exposing a Google Custom Search tool, authenticated via Google service accounts.

License: MIT License•Runtime: Awaiting documentation review•Category: search web

WHAT IT DOES

  • •Exposes a google_search tool that runs Google Custom Search queries with an optional result count between 1 and 100, defaulting to 10.
  • •Returns results containing title, link, snippet and display link, along with total results and search time.
  • •Authenticates using Google Service Account credentials, supplied either as a JSON file path or as a base64-encoded value.
  • •Supports STDIO and HTTP transport modes, and ships as an Alpine-based Docker image running in HTTP mode on port 3000 by default.

BEST FOR

  • •Enabling MCP clients such as Claude Desktop to perform Google Custom Search queries through a configured search engine.
  • •Deployments in containers or Kubernetes where the search server runs as an HTTP web service with service account credentials from secrets.
  • •CI/CD environments that supply service account credentials as a base64-encoded environment variable rather than a file.

ABOUT GOOGLE-CUSTOM-SEARCH-MCP

Google Custom Search MCP Server is cataloged as an MCP server attributed to fbettag. An async Python Model Context Protocol server exposing a Google Custom Search tool, authenticated via Google service accounts. It is categorized under search web. See the capability inspector for recorded interfaces and their independent review status; consult upstream documentation for the current interface.

HOW TO INSTALL

Installation configuration is not reviewed. No executable setup is offered for this entry; inspect the source repository before proceeding.

LICENSE

Catalog license label: MIT License. Check the source repository's current license and terms before using, modifying or distributing this software.

Capability inspector

Capability definitions are not reviewed. Unreviewed imports are not exposed as trusted interfaces.

Tools (0)

No reviewed records to display. This does not establish that upstream lacks this capability.

Resources (0)

No reviewed records to display. This does not establish that upstream lacks this capability.

Prompts (0)

No reviewed records to display. This does not establish that upstream lacks this capability.

NEWSLETTER - COMING LATER

Newsletter subscriptions are not open yet

Email delivery is not connected. This page does not collect email addresses or create subscriptions.

Browse the registry for current listings instead.

Community Reviews

Coming later

Reviews for Google Custom Search MCP Server are not available yet

Review publishing and storage are not connected. This page does not collect or publish ratings or comments, including after sign-in.

FREQUENTLY ASKED QUESTIONS

How does the server authenticate with Google?

It uses Google Service Account authentication, provided either as a JSON key file path or as base64-encoded credentials.

What transport modes are available?

The server supports STDIO mode, the default for Claude Desktop and command-line use, and HTTP mode for containers or web service deployment.

Are there limits on Google Custom Search usage?

The Google Custom Search API provides 100 search queries per day for free, with additional queries requiring billing setup.

Upstream README

View this exact version on GitHub

README.md · 321c7e1d5fd1 · Fetched 2026-11-13 13:41:10 UTC

Original upstream text, without AI rewriting. Scripts, forms and unsafe links are filtered for safety.

Showing the last retrieved documentation snapshot; check the source for current changes.

Google Custom Search MCP Server

An async Python MCP (Model Context Protocol) server that provides access to Google Custom Search API using service account authentication.

Features

  • google_search: Perform Google Custom Search queries with configurable result count
  • Service Account Auth: Uses Google Service Account authentication (required since API keys are deprecated)
  • Dual Authentication Support: File path for local dev, base64 for CI/CD
  • Live Integration Tests: Real tests against Google Custom Search API
  • FastMCP Integration: Uses the latest FastMCP Python SDK
  • Docker Support: Alpine Linux-based Docker image for minimal footprint
  • UV Compatibility: Modern Python packaging with UV

Quick Start

Prerequisites

  1. Google Service Account: Create a service account in Google Cloud Console
  2. Custom Search Engine ID: Create a Custom Search Engine at Programmable Search Engine
  3. Enable Custom Search API: Enable the API for your Google Cloud project

Installation

# Clone the repository
git clone <your-repo-url>
cd google-custom-search-mcp

# Install with UV
uv sync

# Set environment variables
export GOOGLE_SERVICE_ACCOUNT_FILE=/path/to/your/service-account-key.json
export GOOGLE_SEARCH_ENGINE_ID=your-search-engine-id

# Run the server
uv run google-custom-search-mcp

For CI/CD (Base64 encoded service account)

# Encode your service account JSON file to base64
base64 -i your-service-account-key.json -w 0 > service-account-base64.txt

# Use base64 encoded credential
export GOOGLE_SERVICE_ACCOUNT_BASE64=$(cat service-account-base64.txt)
export GOOGLE_SEARCH_ENGINE_ID=your-search-engine-id

# Run the server
uv run google-custom-search-mcp

Quick Setup with Claude CLI

# Using file path (local development)
claude mcp add google-custom-search \
  -s user \
  uv run google-custom-search-mcp \
  -e GOOGLE_SERVICE_ACCOUNT_FILE=/path/to/service-account-key.json \
  -e GOOGLE_SEARCH_ENGINE_ID=your-search-engine-id

# Using base64 (CI/CD)
claude mcp add google-custom-search \
  -s user \
  uv run google-custom-search-mcp \
  -e GOOGLE_SERVICE_ACCOUNT_BASE64=your-base64-encoded-json \
  -e GOOGLE_SEARCH_ENGINE_ID=your-search-engine-id

Claude Desktop Setup (Manual)

Add to your Claude Desktop configuration:

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

{
  "mcpServers": {
    "google-custom-search": {
      "command": "uv",
      "args": ["run", "google-custom-search-mcp"],
      "env": {
        "GOOGLE_SERVICE_ACCOUNT_FILE": "/path/to/your/service-account-key.json",
        "GOOGLE_SEARCH_ENGINE_ID": "your-search-engine-id"
      }
    }
  }
}

CLI Usage

The server supports different transport modes:

STDIO Mode (Default)

For use with Claude Desktop or command-line interaction:

python server.py  # Uses STDIO transport by default

HTTP Mode

For deployment in containers or as a web service:

python server.py --transport http --host 0.0.0.0 --port 3000

CLI Arguments

  • --transport: Transport mode (stdio or http, default: stdio)
  • --host: HTTP host to bind to (default: 0.0.0.0)
  • --port: HTTP port to listen on (default: 3000)

Examples

# Run in STDIO mode (for Claude Desktop)
python server.py

# Run as HTTP server on default port
python server.py --transport http

# Run on custom port
python server.py --transport http --port 8080

# Run on specific interface
python server.py --transport http --host 127.0.0.1 --port 5000

Setting Up Google Service Account

1. Create Google Cloud Project

  1. Go to Google Cloud Console
  2. Create a new project or select an existing one
  3. Enable the Custom Search API

2. Create Service Account

  1. Navigate to "IAM & Admin" > "Service Accounts"
  2. Click "Create Service Account"
  3. Fill in name and description
  4. Grant appropriate roles (Custom Search API needs CSE role)
  5. Click "Create Key" and download JSON key file

3. Create Custom Search Engine

  1. Go to Programmable Search Engine
  2. Click "Add" to create a new search engine
  3. Configure your search preferences
  4. Get the Search Engine ID from the control panel

4. Set Environment Variables

Local Development (File Path):

export GOOGLE_SERVICE_ACCOUNT_FILE=/path/to/your/service-account-key.json
export GOOGLE_SEARCH_ENGINE_ID=your_actual_search_engine_id_here

CI/CD (Base64 Encoded):

# Encode service account JSON to base64
base64 -i your-service-account-key.json -w 0 > service-account-base64.txt

export GOOGLE_SERVICE_ACCOUNT_BASE64=$(cat service-account-base64.txt)
export GOOGLE_SEARCH_ENGINE_ID=your_actual_search_engine_id_here

Available Functions

google_search({
  query: "Your search query",
  num_results?: 10  # Optional, 1-100 (default: 10)
})

Response Format:

{
  "results": [
    {
      "title": "Result Title",
      "link": "https://example.com",
      "snippet": "Result description...",
      "display_link": "example.com"
    }
  ],
  "total_results": 100,
  "search_time": 0.5
}

Docker Usage

The Docker image automatically runs in HTTP mode on port 3000.

Build Image

docker build -t google-custom-search-mcp .

Run Container

The container runs in HTTP mode by default on port 3000:

# Using file mount
docker run -d \
  -p 3000:3000 \
  -v /path/to/service-account-key.json:/app/service-account-key.json \
  -e GOOGLE_SERVICE_ACCOUNT_FILE=/app/service-account-key.json \
  -e GOOGLE_SEARCH_ENGINE_ID=your-engine-id \
  google-custom-search-mcp

# Using base64 environment variable (recommended for production)
docker run -d \
  -p 3000:3000 \
  -e GOOGLE_SERVICE_ACCOUNT_BASE64=your-base64-encoded-json \
  -e GOOGLE_SEARCH_ENGINE_ID=your-engine-id \
  google-custom-search-mcp

The server will be available at http://localhost:3000 for MCP clients.

Kubernetes Deployment with Helm

The Helm chart allows you to deploy the MCP server to Kubernetes easily.

Quick Install

# Clone the repository
git clone https://github.com/fbettag/google-custom-search-mcp.git
cd google-custom-search-mcp

# Install using Helm
helm install google-custom-search-mcp ./charts/google-custom-search-mcp \
  --set google.searchEngineId="your-search-engine-id" \
  --set serviceAccount.base64.value="$(base64 -w 0 < your-service-account.json)" \
  --set serviceAccount.base64.enabled=true

Upgrade Deployment

helm upgrade google-custom-search-mcp ./charts/google-custom-search-mcp \
  --set google.searchEngineId="your-search-engine-id" \
  --set serviceAccount.base64.value="$(base64 -w 0 < your-service-account.json)" \
  --set serviceAccount.base64.enabled=true

Uninstall

helm uninstall google-custom-search-mcp

Using Values File

Create a values-prod.yaml file:

# values-prod.yaml
replicaCount: 2

google:
  searchEngineId: "your-search-engine-id"

serviceAccount:
  base64:
    enabled: true
    value: "your-base64-encoded-service-account-json"

resources:
  requests:
    memory: "128Mi"
    cpu: "100m"
  limits:
    memory: "256Mi"
    cpu: "200m"

Install with values file:

helm install google-custom-search-mcp . -f values-prod.yaml

Upgrade Existing Deployment

helm upgrade google-custom-search-mcp . \
  --set google.searchEngineId="your-search-engine-id" \
  --set serviceAccount.base64.value="$(base64 -i your-service-account.json -w 0)"

Uninstall

helm uninstall google-custom-search-mcp

Chart Configuration

The Helm chart supports various configuration options:

ParameterDescriptionDefault
replicaCountNumber of replicas1
image.repositoryDocker image repositoryyour-username/google-custom-search-mcp
image.tagDocker image taglatest
google.searchEngineIdGoogle Custom Search Engine ID""
serviceAccount.base64.enabledUse base64 encoded service accounttrue
serviceAccount.base64.valueBase64 encoded service account JSON""
serviceAccount.existingFile.enabledUse file mount for service accountfalse
serviceAccount.existingFile.pathPath to service account file""
service.typeKubernetes service typeClusterIP
service.portService port3000
resources.requestsResource requestsmemory: 64Mi, cpu: 50m
resources.limitsResource limitsmemory: 128Mi, cpu: 100m

GitHub CI/CD Setup

Repository Secrets

Add these secrets to your GitHub repository:

  1. GOOGLE_SERVICE_ACCOUNT_BASE64: Base64 encoded service account JSON file
  2. GOOGLE_SEARCH_ENGINE_ID: Your Custom Search Engine ID

Encoding Service Account for GitHub

# Encode service account JSON to base64 (no line wraps)
base64 -i your-service-account-key.json -w 0

# Copy the output and add as GitHub secret GOOGLE_SERVICE_ACCOUNT_BASE64

Development

Setup Development Environment

# Clone and setup
uv sync --dev

# Run live integration tests (requires valid credentials)
uv run pytest tests/ -v

# Run with coverage
uv run pytest tests/ --cov=server --cov-report=html

# Linting
uv run ruff check .
uv run ruff format .

# Type checking
uv run mypy server.py

Testing

Tests perform live integration testing with the actual Google Custom Search API. You must set:

export GOOGLE_SERVICE_ACCOUNT_BASE64=your-base64-encoded-json
export GOOGLE_SEARCH_ENGINE_ID=your-search-engine-id

Environment Variables

VariableDescriptionRequired
GOOGLE_SERVICE_ACCOUNT_FILEPath to service account JSON fileEither this or base64
GOOGLE_SERVICE_ACCOUNT_BASE64Base64 encoded service account JSONEither this or file path
GOOGLE_SEARCH_ENGINE_IDCustom Search Engine IDYes

API Limits and Pricing

  • Google Custom Search API provides 100 search queries per day for free
  • Additional queries require billing setup
  • Service accounts have the same quota limits as user accounts
  • Refer to Google Custom Search Pricing

Contributing

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Commit changes: git commit -m 'Add amazing feature'
  4. Push to branch: git push origin feature/amazing-feature
  5. Open a Pull Request

License

MIT License - see LICENSE file for details.

Support

For issues and questions:

  1. Check the Google Custom Search documentation
  2. Review existing GitHub issues
  3. Create a new issue with detailed information

Install configuration

Are you the maintainer?

Claim this server with your GitHub account to request manual ownership verification.

README Embed Badge
Markdown

Link to the catalog listing for Google Custom Search MCP Server from your README. This badge does not certify ownership, compatibility or security.

[![MCP catalog listing](https://img.shields.io/badge/MCP-awesome--mcp-orange?style=flat-square)](https://awesome-mcp.com/servers/google-custom-search-mcp)

REPOSITORY STATS

GitHub StarsUnavailable
ForksUnavailable

Public repository statistics could not be verified. Check the configured source address; unavailable counts are not zero.

Downloads and pulls

Separate sources, scopes and periods. Never combined or treated as installations, active users or security reviews.

No reviewed package or image identity; download statistics are not listed yet.

Related search web MCP Servers

Alternative and complementary servers in the same category

View all in search web →

An MCP server that merges Google Search Console history with a live first-party crawl of your site to produce a prioritised, evidence-backed technical SEO audit inside Claude, complete with paste-ready fixes.

Repository stats unavailable
Search & Web Research

An MCP server that offers intelligent web search using OpenAI reasoning models, with support for fast iterations and deep research.

94
Search & Web Research