Fire in da houseTop Tip:Paying $100+ per month for Perplexity, MidJourney, Runway, ChatGPT and other tools is crazy - get all your AI tools in one site starting at $15 per month with Galaxy AI Fire in da houseCheck it out free

mcp-google-search

MCP.Pizza Chef: adenot

mcp-google-search is a Model Context Protocol server that integrates Google Custom Search API to provide powerful web search capabilities and extracts webpage content for enhanced context. It enables real-time retrieval of search results and detailed webpage data, facilitating dynamic information access within AI workflows. Setup requires Google Cloud API key and Custom Search Engine ID configuration.

Use This MCP server To

Perform real-time web searches within AI workflows Extract and summarize webpage content dynamically Integrate Google search results into chatbots or assistants Enable context-aware responses using live web data Automate information retrieval from the internet Combine search results with other MCP data sources Support research tasks with up-to-date web content Enhance AI models with external web knowledge

README

mcp-google-server A MCP Server for Google Custom Search and Webpage Reading

smithery badge

A Model Context Protocol server that provides web search capabilities using Google Custom Search API and webpage content extraction functionality.

Setup

Getting Google API Key and Search Engine ID

  1. Create a Google Cloud Project:

    • Go to Google Cloud Console
    • Create a new project or select an existing one
    • Enable billing for your project
  2. Enable Custom Search API:

    • Go to API Library
    • Search for "Custom Search API"
    • Click "Enable"
  3. Get API Key:

    • Go to Credentials
    • Click "Create Credentials" > "API Key"
    • Copy your API key
    • (Optional) Restrict the API key to only Custom Search API
  4. Create Custom Search Engine:

    • Go to Programmable Search Engine
    • Enter the sites you want to search (use www.google.com for general web search)
    • Click "Create"
    • On the next page, click "Customize"
    • In the settings, enable "Search the entire web"
    • Copy your Search Engine ID (cx)

Development

Install dependencies:

npm install

Build the server:

npm run build

For development with auto-rebuild:

npm run watch

Features

Search Tool

Perform web searches using Google Custom Search API:

  • Search the entire web or specific sites
  • Control number of results (1-10)
  • Get structured results with title, link, and snippet

Webpage Reader Tool

Extract content from any webpage:

  • Fetch and parse webpage content
  • Extract page title and main text
  • Clean content by removing scripts and styles
  • Return structured data with title, text, and URL

Installation

Installing via Smithery

To install Google Custom Search Server for Claude Desktop automatically via Smithery:

npx -y @smithery/cli install @adenot/mcp-google-search --client claude

To use with Claude Desktop, add the server config with your Google API credentials:

On MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json On Windows: %APPDATA%/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "google-search": {
      "command": "npx",
      "args": [
        "-y",
        "@adenot/mcp-google-search"
      ],
      "env": {
        "GOOGLE_API_KEY": "your-api-key-here",
        "GOOGLE_SEARCH_ENGINE_ID": "your-search-engine-id-here"
      }
    }
  }
}

Usage

Search Tool

{
  "name": "search",
  "arguments": {
    "query": "your search query",
    "num": 5  // optional, default is 5, max is 10
  }
}

Webpage Reader Tool

{
  "name": "read_webpage",
  "arguments": {
    "url": "https://example.com"
  }
}

Example response from webpage reader:

{
  "title": "Example Domain",
  "text": "Extracted and cleaned webpage content...",
  "url": "https://example.com"
}

Debugging

Since MCP servers communicate over stdio, debugging can be challenging. We recommend using the MCP Inspector, which is available as a package script:

npm run inspector

The Inspector will provide a URL to access debugging tools in your browser.

mcp-google-search FAQ

How do I obtain the Google API key for mcp-google-search?
Create a Google Cloud project, enable the Custom Search API, then generate an API key in the credentials section.
What is required to configure the Custom Search Engine ID?
You must create a Custom Search Engine in Google Custom Search Console and obtain its unique Search Engine ID.
Can mcp-google-search extract full webpage content?
Yes, it can fetch and extract readable content from webpages returned by Google search results.
Is billing required to use the Google Custom Search API?
Yes, Google Cloud projects require billing enabled to access the Custom Search API.
How does mcp-google-search handle API key security?
It is recommended to restrict the API key usage to only the Custom Search API to enhance security.
Can this server be used with multiple LLM providers?
Yes, it is provider-agnostic and works with OpenAI, Anthropic Claude, and Google Gemini models.
What happens if the search quota is exceeded?
Google Custom Search API enforces quotas; exceeding them will result in errors until quota resets.
Does mcp-google-search support searching specific sites or domains?
Yes, by configuring the Custom Search Engine, you can restrict searches to specific sites or domains.