Serper Search and Scrape MCP Server
This package provides a TypeScript-based Model Context Protocol (MCP) server that offers web search and webpage scraping capabilities using the Serper API. Currently at version 0.1.2, it is in early development with an assumed infrequent release cadence, typical for community-driven MCP server implementations. Its core function is to allow AI assistants, such as those within Claude Desktop, to perform structured Google searches and extract content from web pages programmatically. Key differentiators include rich search results (organic, knowledge graph, 'people also ask'), advanced search operators, region/language targeting, and comprehensive page scraping with plain text, markdown, JSON-LD, and metadata extraction, all while integrating seamlessly with MCP-compatible AI clients to enhance their real-time data access and tool-use capabilities.
Common errors
-
Error: SERPER_API_KEY environment variable is not set.
cause The `SERPER_API_KEY` environment variable, required for authenticating with the Serper API, is missing or incorrectly configured.fixEnsure `SERPER_API_KEY` is set in your environment (e.g., in a `.env` file or directly in the MCP client configuration) with a valid API key. Example: `SERPER_API_KEY=your_actual_key_here`. -
TypeError: require() of ES Module ... not supported. Instead change the require to a dynamic import() ...
cause This server is a modern TypeScript-based project likely using ESM, but it is being imported or run in a CommonJS context.fixEnsure your Node.js environment is configured for ESM (e.g., by using `"type": "module"` in your `package.json` or by using `.mjs` file extensions). For running the server, stick to the `npx` command as shown in the quickstart. -
Node.js version must be >= 18. Current version is 16.x.x.
cause The Node.js version running the server is older than the minimum required version (18).fixUpgrade your Node.js installation to version 18 or newer. Tools like `nvm` (Node Version Manager) can help manage multiple Node.js versions (e.g., `nvm install 18 && nvm use 18`).
Warnings
- gotcha This package requires Node.js version 18 or higher to run. Older Node.js versions are not supported and will prevent the server from starting.
- gotcha A `SERPER_API_KEY` environment variable is mandatory for the server to function. Without a valid key, the Serper API calls for search and scraping will fail.
- gotcha Debugging MCP servers can be challenging due to stdio-based communication. The project recommends using the Model Context Protocol Inspector tool for effective debugging.
- breaking As this package is in an early development phase (version 0.1.2), its API and internal structure are subject to frequent, potentially breaking changes without major version bumps.
Install
-
npm install serper-search-scrape-mcp-server -
yarn add serper-search-scrape-mcp-server -
pnpm add serper-search-scrape-mcp-server
Imports
- startMcpServer
import { startMcpServer } from 'serper-search-scrape-mcp-server'; - GoogleSearchTool
import { GoogleSearchTool } from 'serper-search-scrape-mcp-server'; - ScrapeTool
import { ScrapeTool } from 'serper-search-scrape-mcp-server';
Quickstart
{
"mcpServers": {
"serper-search": {
"command": "npx",
"args": [
"-y",
"serper-search-scrape-mcp-server"
],
"env": {
"SERPER_API_KEY": "your_api_key_here"
}
}
}
}