SerpApi Google Search MCP server

Integrates with the SerpApi Google Search API to enable access to structured search results data for SEO tools, market research, or data aggregation services.
Back to servers
Setup instructions
Provider
Ilya Zub
Release date
Mar 05, 2025
Language
Python
Stats
10 stars

This MCP server integrates with SerpApi to perform searches across various search engines including Google, Bing, Yahoo, and more. It provides a convenient way to retrieve both live and archived search results through a standardized Model Context Protocol interface.

Installation

To set up the SerpApi MCP server, install the required Python packages:

pip install mcp serpapi python-dotenv

You'll also need to obtain a SerpApi API key by signing up at SerpApi.

Configuration

Create a .env file in your project directory and add your SerpApi API key:

SERPAPI_API_KEY=your_api_key_here

Running the Server

Save the server code to a file (e.g., server.py) and start it with:

python server.py

For debugging purposes, you can run it in development mode with the MCP Inspector:

mcp dev server.py

Integrating with MCP Clients

Claude for Desktop

To connect the server with Claude for Desktop:

  1. Update your Claude_desktop_config.json file:
{
  "mcpServers": {
    "serpapi": {
      "command": "python",
      "args": ["path/to/server.py"]
    }
  }
}
  1. Restart Claude for Desktop to load the server
  2. Use the hammer icon to explore and test available tools

Using the Search Tool

The server provides a search tool that allows you to query different search engines:

result = await session.call_tool("search", {
    "query": "coffee",
    "engine": "google",
    "location": "Austin, TX"
})
print(result)

Supported Engines

The server supports these search engines:

  • Google
  • Google Light
  • Bing
  • Walmart
  • Yahoo
  • eBay
  • YouTube
  • DuckDuckGo
  • Yandex
  • Baidu

Using Resources

The server also provides resources like location data:

locations = await session.read_resource("locations")
print(locations)

This helps you find valid Google location parameters for your searches.

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 "serpapi" '{"command":"python","args":["path/to/server.py"]}'

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": {
        "serpapi": {
            "command": "python",
            "args": [
                "path/to/server.py"
            ]
        }
    }
}

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": {
        "serpapi": {
            "command": "python",
            "args": [
                "path/to/server.py"
            ]
        }
    }
}

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