Serper MCP Server

repository·main·Indexed 41 days ago

https://github.com/marcopesani/mcp-server-serper

A TypeScript-based Model Context Protocol (MCP) server that provides web search and webpage scraping capabilities using the Serper API. It includes tools for performing Google searches with advanced operators (google_search) and extracting content from URLs (scrape), designed for integration with AI clients like Claude Desktop, Cline, and Cursor. Version 0.2.0.

Tokens
5.1K
Snippets
18
Records
25
Agent score
51%

What's inside Serper MCP Server

  1. Overview of Serper Search and Scrape MCP Server

    main
    The Serper Search and Scrape MCP Server is a TypeScript-based Model Context Protocol (MCP) server that enables web search and content extraction. It uses the Serper API to provide tools for performing Google searches and scraping webpage content, making it useful for AI agents that need real-time web access.
  2. Configure Cursor for Serper MCP Server

    main

    To add the server to Cursor:

    1. Open Cursor settings.
    2. Go to "Features" settings.
    3. In the "MCP Servers" section, click "Add new MCP Server".
    4. Set the name and choose "command" as the "Type".
    5. Enter the following command in the "Command" field:
    env SERPER_API_KEY=your_api_key_here npx -y serper-search-scrape-mcp-server
  3. Configure Cline for Serper MCP Server

    main

    To use the server in the Cline extension:

    1. Open Cline extension settings.
    2. Open the "MCP Servers" tab.
    3. Click "Configure MCP Servers".
    4. Add the following configuration. You can use disabled to toggle the server and autoApprove to allow specific tools to run without explicit user permission.
    {
      "mcpServers": {
        "github.com/marcopesani/mcp-server-serper": {
          "command": "npx",
          "args": ["-y", "serper-search-scrape-mcp-server"],
          "env": {
            "SERPER_API_KEY": "your_api_key_here"
          },
          "disabled": false,
          "autoApprove": ["google_search", "scrape"]
        }
      }
    }
  4. Run Serper MCP Server via Docker

    main

    You can run the server using Docker.

    Build the image:

    docker build -t mcp-server-serper .

    Run the container with an API key:

    docker run -e SERPER_API_KEY=your_api_key_here mcp-server-serper

    Run using a .env file:

    docker run --env-file .env mcp-server-serper

    Run for development (mounting source code):

    docker run -v $(pwd):/app --env-file .env mcp-server-serper
    docker build -t mcp-server-serper .
    docker run -e SERPER_API_KEY=your_api_key_here mcp-server-serper
  5. Configure Claude Desktop manually

    main

    To manually add the server to Claude Desktop, edit your configuration file:

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

    Add the following configuration object to the mcpServers section:

    {
      "mcpServers": {
        "serper-search": {
          "command": "npx",
          "args": ["-y", "serper-search-scrape-mcp-server"],
          "env": {
            "SERPER_API_KEY": "your_api_key_here"
          }
        }
      }
    }
  6. Available Tools: google_search and scrape

    main

    The server provides two primary tools:

    1. google_search: Performs web searches via the Serper API. It returns rich results including organic results, knowledge graph, "people also ask", and related searches. It supports region/language targeting and advanced search operators.

    2. scrape: Extracts content from a specific URL. It provides plain text and optional markdown content, including JSON-LD and head metadata, while preserving document structure.

  7. Reference: google_search advanced search operators

    main

    The google_search tool supports the following advanced search operators to refine results:

    • site: Limit results to a specific domain
    • filetype: Limit to specific file types (e.g., 'pdf', 'doc')
    • inurl: Search for pages with a specific word in the URL
    • intitle: Search for pages with a specific word in the title
    • related: Find similar websites
    • cache: View Google's cached version of a specific URL
    • before: Date before in YYYY-MM-DD format
    • after: Date after in YYYY-MM-DD format
    • exact: Exact phrase match
    • exclude: Terms to exclude from search results
    • or: Alternative terms (OR operator)
  8. List available Serper prompt templates

    main

    Call listPrompts() on a SerperPrompts instance to retrieve a list of all available prompt templates. Each prompt object includes a name, a description, and an optional array of arguments that define what inputs the prompt expects.

    const { prompts } = await serperPrompts.listPrompts();