Get the FREE Ultimate OpenClaw Setup Guide →

google-search

MCP server from gradusnikov/google-search-mcp-server

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio gradusnikov-google-search-mcp-server python google_search_mcp_server.py \
  --env GOOGLE_CSE_ID="your_custom_search_engine_id" \
  --env GOOGLE_API_KEY="your_google_api_key"

How to use

This MCP server exposes Google Custom Search capabilities through the MCP framework. It uses the Google Custom Search API (via the google-api-python-client) to fetch search results based on user queries and returns structured results that can be consumed by MCP clients. To use it, start the server either through your MCP runner (for example, mcp run google_search_mcp_server.py) or by configuring it in your client app as a wired MCP service. Once running, you can issue search requests with a query parameter, and the server will query Google Custom Search using your API key and CSE ID, returning relevant results such as titles, snippets, URLs, and snippets ready for display in your application. The server is designed to be used as part of an MCP workflow where models or agents request search results to augment their reasoning with up-to-date information from the web.

How to install

Prerequisites:

  • Python 3.8+ installed on your system
  • Git installed
  • Internet access to install dependencies and run the server

Installation steps:

  1. Clone the repository: git clone https://github.com/gradusnikov/google-search-mpc-server.git cd google-search-mpc-server

  2. Create a Python virtual environment (optional but recommended): python -m venv venv source venv/bin/activate # on Unix/macOS .\venv\Scripts\activate # on Windows

  3. Install dependencies: pip install fastmcp google-api-python-client python-dotenv

  4. Create a .env file in the project root with your Google credentials: GOOGLE_API_KEY=your_google_api_key GOOGLE_CSE_ID=your_custom_search_engine_id

  5. Run the MCP server: mcp run google_search_mcp_server.py

Notes:

  • The Google API key and CSE ID you supply must be active and have the Custom Search API enabled.
  • If you prefer Smithery automation, you can install via Smithery as shown in the README: npx -y @smithery/cli install @gradusnikov/google-search-mcp-server --client claude

Additional notes

Tips:

  • Ensure your GOOGLE_API_KEY and GOOGLE_CSE_ID are kept secure and not checked into version control.
  • Be mindful of Google API quotas and pricing; implement caching or rate limiting as needed.
  • If you switch environments (e.g., from local to production), update the .env file accordingly.
  • The server expects a standard MCP request for a search; ensure your client provides a query parameter compatible with the server's implementation.

Common issues:

  • 401 Unauthorized: check that the GOOGLE_API_KEY is correct and has the Custom Search API enabled on the Google Cloud project.
  • 403 Quotas/Access denied: verify that the associated CSE ID is valid for the given API key and that the quota is not exceeded.
  • Network errors: ensure outbound network access from the host running the MCP server is allowed.

Related MCP Servers

Sponsor this space

Reach thousands of developers