Google Programmable Search Engine MCP server

Integrates with Google Programmable Search Engine to enable web search capabilities with support for pagination, result size, language restrictions, and safe search filtering
Back to servers
Setup instructions
Provider
Rendy Febry
Release date
May 23, 2025
Language
Go
Stats
8 stars

This server implements the Model Context Protocol (MCP) for Google Programmable Search Engine (PSE), allowing you to search the web using Google Custom Search from MCP-compatible clients like VSCode, Copilot, and Claude Desktop.

Getting Started

Prerequisites

To use this MCP server, you'll need:

  • A Google Cloud account with access to the Programmable Search Engine API
  • An API key for Google Custom Search
  • A custom search engine ID (cx)
  • An MCP-compatible client (VSCode, Copilot, Claude Desktop)

Installation

No manual installation is required. Your MCP client will automatically install and launch the server once you've added the proper configuration.

VS Code Copilot Configuration

Open Command Palette → Preferences: Open Settings (JSON), then add:

{
  "mcp": {
    "servers": {
      "google-pse-mcp": {
        "command": "npx",
        "args": [
          "-y",
          "google-pse-mcp",
          "https://www.googleapis.com/customsearch",
          "<api_key>",
          "<cx>",
          "<siteRestricted>"
        ]
      }
    }
  }
}

Cline MCP Configuration

If you're using Cline, add this to your cline_mcp_settings.json:

{
  "mcpServers": {
    "google-pse-mcp": {
      "disabled": false,
      "timeout": 60,
      "command": "npx",
      "args": [
        "-y",
        "google-pse-mcp",
        "https://www.googleapis.com/customsearch",
        "<api_key>",
        "<cx>",
        "<siteRestricted>"
      ],
      "transportType": "stdio"
    }
  }
}

Configuration Parameters

Be sure to replace the following in your configuration:

  • <api_key>: Your Google API key
  • <cx>: Your custom search engine ID
  • <siteRestricted>: Optional flag (true/false) that controls which Google Custom Search endpoint is used (defaults to true if omitted)

Using the Search Tool

The MCP server provides a single tool named search with these parameters:

  • q (string, required): Your search query
  • page (integer, optional): Page number for pagination
  • size (integer, optional): Number of results per page (1-10)
  • sort (string, optional): Sort expression (only 'date' is supported)
  • safe (boolean, optional): Enable safe search filtering
  • lr (string, optional): Restrict results to a specific language (e.g., lang_en)
  • siteRestricted (boolean, optional): Override the default siteRestricted setting

Example Usage

# Search for "artificial intelligence"
result = await use_mcp_tool(
    server_name="google-pse-mcp",
    tool_name="search",
    arguments={
        "q": "artificial intelligence",
        "size": 5,
        "safe": True
    }
)

Additional Resources

For more information about Google Programmable Search Engine, visit:

For more about Model Context Protocol servers:

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-pse-mcp" '{"command":"npx","args":["-y","google-pse-mcp","https://www.googleapis.com/customsearch","<api_key>","<cx>"]}'

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-pse-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "google-pse-mcp",
                "https://www.googleapis.com/customsearch",
                "<api_key>",
                "<cx>"
            ]
        }
    }
}

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-pse-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "google-pse-mcp",
                "https://www.googleapis.com/customsearch",
                "<api_key>",
                "<cx>"
            ]
        }
    }
}

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