Serper MCP Server
repository·main·Indexed 41 days ago
https://github.com/marcopesani/mcp-server-serperA 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.
What's inside Serper MCP Server
- 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.
Configure Cursor for Serper MCP Server
mainTo add the server to Cursor:
- Open Cursor settings.
- Go to "Features" settings.
- In the "MCP Servers" section, click "Add new MCP Server".
- Set the name and choose "command" as the "Type".
- Enter the following command in the "Command" field:
env SERPER_API_KEY=your_api_key_here npx -y serper-search-scrape-mcp-serverConfigure Cline for Serper MCP Server
mainTo use the server in the Cline extension:
- Open Cline extension settings.
- Open the "MCP Servers" tab.
- Click "Configure MCP Servers".
- Add the following configuration. You can use
disabledto toggle the server andautoApproveto 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"] } } }Run Serper MCP Server via Docker
mainYou 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-serperRun using a .env file:
docker run --env-file .env mcp-server-serperRun for development (mounting source code):
docker run -v $(pwd):/app --env-file .env mcp-server-serperdocker build -t mcp-server-serper . docker run -e SERPER_API_KEY=your_api_key_here mcp-server-serperConfigure Claude Desktop manually
mainTo 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
mcpServerssection:{ "mcpServers": { "serper-search": { "command": "npx", "args": ["-y", "serper-search-scrape-mcp-server"], "env": { "SERPER_API_KEY": "your_api_key_here" } } } }- MacOS:
Requirements for Serper MCP Server
mainTo use this server, you must meet the following requirements:
- Node.js: Version 18 or higher.
- Serper API Key: You must obtain a key from Serper and provide it via the
SERPER_API_KEYenvironment variable.
Install via Smithery for Claude Desktop
mainYou can automatically install the server for Claude Desktop using the Smithery CLI:
npx -y @smithery/cli install @marcopesani/mcp-server-serper --client claudeDebug the MCP Server using MCP Inspector
mainSince MCP servers communicate over
stdio, debugging can be difficult. Use the MCP Inspector to debug in your browser by running:npm run inspectorAvailable Tools: google_search and scrape
mainThe server provides two primary tools:
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.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.
Configure the SERPER_API_KEY environment variable
mainTo use this MCP server, you must provide a valid Serper API key via theSERPER_API_KEYenvironment variable. The server will fail to start if this variable is not set.Reference: google_search advanced search operators
mainThe
google_searchtool supports the following advanced search operators to refine results:site: Limit results to a specific domainfiletype: Limit to specific file types (e.g., 'pdf', 'doc')inurl: Search for pages with a specific word in the URLintitle: Search for pages with a specific word in the titlerelated: Find similar websitescache: View Google's cached version of a specific URLbefore: Date before inYYYY-MM-DDformatafter: Date after inYYYY-MM-DDformatexact: Exact phrase matchexclude: Terms to exclude from search resultsor: Alternative terms (OR operator)
List available Serper prompt templates
mainCall
listPrompts()on aSerperPromptsinstance to retrieve a list of all available prompt templates. Each prompt object includes aname, adescription, and an optional array ofargumentsthat define what inputs the prompt expects.const { prompts } = await serperPrompts.listPrompts();