SerpApi MCP Server
Retrieve parsed search engine results using the SerpApi.
SerpApi MCP Server
Build an MCP server that:
- Get parsed search engines results pages via SerpApi using an API key, fast
This MCP (Model Context Protocol) server integrates with SerpApi to perform searches across various search engines and retrieve both live and archived results. It exposes tools and resources for seamless interaction with MCP clients or hosts, such as Grok or Claude for Desktop.
Installation
To set up the SerpApi MCP server, install the required Python libraries:
pip install mcp serpapi python-dotenv
You’ll also need a SerpApi API key. Sign up at SerpApi to get one.
Quick Start
-
Save the Server Code: Place the server code in a file, e.g., server.py.
-
Configure the API Key: Create a .env file in the same directory with your SerpApi API key:
SERPAPI_API_KEY=your_api_key_here
- Run the Server: Start the server with:
python server.py
- Integrate with an MCP Client: Connect the server to an MCP client or host (e.g., Claude for Desktop). For Claude, update Claude_desktop_config.json:
{
"mcpServers": {
"serpapi": {
"command": "python",
"args": ["path/to/server.py"]
}
}
}
Restart the client to load the server.
Features
-
Supported Engines: Google, Google Light, Bing, Walmart, Yahoo, eBay, YouTube, DuckDuckGo, Yandex, Baidu
-
Tools:
- search: Perform a search on a specified engine with a query and optional parameters.
- Resources:
- locations: Find Google Locations.
Usage Examples
These examples assume an MCP client (e.g., written in Python using the MCP client SDK) is connected to the server. Listing Supported Engines Retrieve the list of supported search engines:
engines = await session.read_resource("locations")
print(engines)
Performing a Search Search for "coffee" on Google with a location filter:
result = await session.call_tool("search", {
"query": "coffee",
"engine": "google",
"location": "Austin, TX"
})
print(result)
Configuration
API Key: Set your SerpApi API key in the .env
file as SERPAPI_API_KEY
.
Running the Server
Production Mode: Launch the server with:
python server.py
Development Mode: Use the MCP Inspector for debugging:
mcp dev server.py
Testing
Test the server using the MCP Inspector or an MCP client. For Claude for Desktop, configure the server in Claude_desktop_config.json
, restart the app, and use the hammer icon to explore and test available tools.
Related Servers
RagDocs
A server for RAG-based document search and management using Qdrant vector database with Ollama or OpenAI embeddings.
Google Maps MCP Server
Integrates Google Maps for route planning, traffic analysis, and cost estimation.
Perplexity Search
Access the Perplexity search API for real-time information and answers.
Amadeus MCP Server
Search for flight offers using the Amadeus Flight Offers Search API.
Agora MCP
Search and buy products across thousands of online stores using the SearchAgora universal product search engine.
Unsplash
Search for pictures on Unsplash using the Unsplash API.
Enhanced Documentation Search
Provides real-time access to documentation, library popularity data, and career insights using the Serper API.
Weather
Provides weather data using the US National Weather Service (NWS) API. Built with pure JavaScript ES Modules.
Semiconductor Supply Chain MCP Server
Access semiconductor B2B platforms like AnySilicon and DesignReuse for IP core and ASIC service procurement.
Higress AI-Search MCP Server
Provides an AI search tool to enhance AI model responses with real-time search results from various search engines using the Higress ai-search feature.