Google Custom Search MCP server

Integrates Google Custom Search API to enable web searches for fact-checking, research, and content generation tasks.
Back to servers
Setup instructions
Provider
Allan Denot
Release date
Feb 01, 2025
Language
TypeScript
Package
Stats
4.2K downloads
30 stars

This MCP server provides web search capabilities using Google Custom Search API and webpage content extraction, allowing you to integrate Google search results and webpage reading capabilities into your AI assistant workflows.

Setup Google API Credentials

Before using the server, you'll need to obtain API credentials from Google:

  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)

Installation

The easiest way to install is 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"
      }
    }
  }
}

Using the Server

Search Tool

The search tool allows you to perform web searches using Google Custom Search API:

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

The search results will include:

  • Title of each result
  • Link to the webpage
  • Text snippet from the page

Webpage Reader Tool

The webpage reader extracts and cleans content from any URL:

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

The response will contain:

  • title: The webpage title
  • text: Extracted and cleaned main content
  • url: The original URL requested

Example response:

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

Troubleshooting

If you encounter issues:

  • Verify your Google API Key and Search Engine ID are correct
  • Ensure your Google Cloud Project has billing enabled
  • Check that the Custom Search API is enabled in your project
  • For Claude Desktop users, confirm the config file is properly formatted

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "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"}}'

See the official Claude Code MCP documentation for more details.

For Cursor

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.

Adding an MCP server to Cursor globally

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",
                "@adenot/mcp-google-search"
            ],
            "env": {
                "GOOGLE_API_KEY": "your-api-key-here",
                "GOOGLE_SEARCH_ENGINE_ID": "your-search-engine-id-here"
            }
        }
    }
}

Adding an MCP server to a project

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.

How to use the MCP server

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.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

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

2. Add this to your configuration file:

{
    "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"
            }
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later