Google Custom Search

by limklister

15 stars
Not rated
GitHub

About

Integrates the Google Custom Search API to enable web searches for retrieving and analyzing online content.

Details

Author
limklister
Repository
limklister/mcp-google-custom-search-server
GitHub stars
15
License
MIT License
Categories
Developer Tools, Design, AI, Media, Search, Frontend, API, Infrastructure, Knowledge Base

- Seamless integration with Google Custom Search API
- Model Context Protocol (MCP) compliant server implementation
- Type-safe implementation using TypeScript
- Environment variable configuration
- Input validation using Zod
- Configurable search results (up to 10 per query)
- Formatted search results including titles, URLs, and descriptions
- Error handling and validation
- Compatible with Claude Desktop and other MCP clients

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name Google Custom Search
    Command (node, npx, python, etc.) node
    Arguments
    • Argument 1 /absolute/path/to/mcp-google-custom-search-server/build/index.js
    Environment
    • GOOGLE_API_KEY your-api-key
    • GOOGLE_SEARCH_ENGINE_ID your-search-engine-id

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

1. Clone the repository:

   git clone https://github.com/limklister/mcp-google-custom-search-server.git
   cd mcp-google-custom-search-server
   

2. Install dependencies:

   npm install
   

3. Create a .env file:

   GOOGLE_API_KEY=your-api-key
   GOOGLE_SEARCH_ENGINE_ID=your-search-engine-id
   

4. Build the server:

   npm run build
   

5. Start the server:

   npm start

| Variable | Description | Required |
| ----------------------- | --------------------------------- | -------- |
| GOOGLE_API_KEY | Your Google Custom Search API key | Yes |
| GOOGLE_SEARCH_ENGINE_ID | Your Custom Search Engine ID | Yes |

search

Performs a web search using Google Custom Search API. Parameters: query (string, required) - The search query to execute, numResults (number, optional) - Number of results to return (default: 5, maximum: 10).

search

Performs a web search using Google Custom Search API.

Parameters:

- query (string, required): The search query to execute
- numResults (number, optional): Number of results to return
- Default: 5
- Maximum: 10

Example Response:

```
Result 1:

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "google custom search": {
            "env": {
                "GOOGLE_API_KEY": "your-api-key",
                "GOOGLE_SEARCH_ENGINE_ID": "your-search-engine-id"
            },
            "args": [
                "/absolute/path/to/mcp-google-custom-search-server/build/index.js"
            ],
            "command": "node"
        }
    }
}

Linux

{
    "env": {
        "GOOGLE_API_KEY": "your-api-key",
        "GOOGLE_SEARCH_ENGINE_ID": "your-search-engine-id"
    },
    "args": [
        "/absolute/path/to/mcp-google-custom-search-server/build/index.js"
    ],
    "command": "node"
}

Macos

{
    "env": {
        "GOOGLE_API_KEY": "your-api-key",
        "GOOGLE_SEARCH_ENGINE_ID": "your-search-engine-id"
    },
    "args": [
        "/absolute/path/to/mcp-google-custom-search-server/build/index.js"
    ],
    "command": "node"
}

Windows

{
    "env": {
        "GOOGLE_API_KEY": "your-api-key",
        "GOOGLE_SEARCH_ENGINE_ID": "your-search-engine-id"
    },
    "args": [
        "/absolute/path/to/mcp-google-custom-search-server/build/index.js"
    ],
    "command": "node"
}

MCP Google Custom Search Server

A Model Context Protocol (MCP) server that provides web search capabilities through Google's Custom Search API. This server enables Language Learning Models (LLMs) to perform web searches using a standardized interface.

🌟 Features

- Seamless integration with Google Custom Search API
- Model Context Protocol (MCP) compliant server implementation
- Type-safe implementation using TypeScript
- Environment variable configuration
- Input validation using Zod
- Configurable search results (up to 10 per query)
- Formatted search results including titles, URLs, and descriptions
- Error handling and validation
- Compatible with Claude Desktop and other MCP clients

πŸ“‹ Prerequisites

Before you begin, ensure you have:

1. A Google Cloud Project with Custom Search API enabled

- Visit Google Cloud Console
- Enable the Custom Search API
- Create API credentials

2. A Custom Search Engine ID

- Visit Programmable Search Engine
- Create a new search engine
- Get your Search Engine ID

3. Local development requirements:
- Node.js (v18 or higher)
- npm (comes with Node.js)

πŸš€ Quick Start

1. Clone the repository:

   git clone https://github.com/limklister/mcp-google-custom-search-server.git
   cd mcp-google-custom-search-server
   

2. Install dependencies:

   npm install
   

3. Create a .env file:

   GOOGLE_API_KEY=your-api-key
   GOOGLE_SEARCH_ENGINE_ID=your-search-engine-id
   

4. Build the server:

   npm run build
   

5. Start the server:

   npm start

πŸ”§ Configuration

Environment Variables

| Variable | Description | Required |
| ----------------------- | --------------------------------- | -------- |
| GOOGLE_API_KEY | Your Google Custom Search API key | Yes |
| GOOGLE_SEARCH_ENGINE_ID | Your Custom Search Engine ID | Yes |

Claude Desktop Integration

Add this configuration to your Claude Desktop config file (typically located at ~/Library/Application Support/Claude/claude_desktop_config.json):

{
  "mcpServers": {
    "google-search": {
      "command": "node",
      "args": [
        "/absolute/path/to/mcp-google-custom-search-server/build/index.js"
      ],
      "env": {
        "GOOGLE_API_KEY": "your-api-key",
        "GOOGLE_SEARCH_ENGINE_ID": "your-search-engine-id"
      }
    }
  }
}

πŸ“– API Reference

Available Tools

search

Performs a web search using Google Custom Search API.

Parameters:

- query (string, required): The search query to execute
- numResults (number, optional): Number of results to return
- Default: 5
- Maximum: 10

Example Response:

```
Result 1:

No reviews yet β€” be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.