grokify/metasearch-mcp-server
If you are the rightful owner of metasearch-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
The Multi-Search MCP Server is a Go-based implementation of a Model Context Protocol server that provides Google search functionality through multiple search engine APIs using a plugin-based architecture.
Multi-Search MCP Server
A Model Context Protocol (MCP) server implementation in Go that provides Google search functionality via multiple search engine APIs through a plugin-based architecture. Currently supporting:
- Serper
- SerpApi
Features
This server provides comprehensive Google search capabilities through the following tools:
google_search
- General web searchgoogle_search_news
- News articles searchgoogle_search_images
- Image searchgoogle_search_videos
- Video searchgoogle_search_places
- Places and location searchgoogle_search_maps
- Maps searchgoogle_search_reviews
- Reviews searchgoogle_search_shopping
- Product/shopping searchgoogle_search_scholar
- Academic papers searchgoogle_search_lens
- Visual searchgoogle_search_autocomplete
- Search suggestionswebpage_scrape
- Web page content extraction
Supported Search Engines
Serper API (Default)
- API: serper.dev
- Environment Variable:
SERPER_API_KEY
- All tools supported
SerpAPI
- API: serpapi.com
- Environment Variable:
SERPAPI_API_KEY
- Most tools supported (note:
google_search_lens
falls back to image search)
Prerequisites
- Go 1.24.5 or later
- API Key for your chosen search engine:
- Serper API Key - Get one from serper.dev
- SerpAPI Key - Get one from serpapi.com
Installation
Option 1: Install via go install
go install github.com/grokify/metasearch-mcp-server@latest
Option 2: Build from source
- Clone or download this repository
- Set your API key(s) as environment variables:
# For Serper (default) export SERPER_API_KEY="your_serper_api_key_here" # For SerpAPI (optional) export SERPAPI_API_KEY="your_serpapi_key_here" # Choose which engine to use (optional, defaults to "serper") export SEARCH_ENGINE="serper" # or "serpapi"
- Install dependencies:
go mod tidy
- Build the server:
go build -o multi-search-mcp-server
Usage
Running the Server
# Use default engine (Serper)
./multi-search-mcp-server
# Or explicitly choose an engine
SEARCH_ENGINE=serpapi ./multi-search-mcp-server
The server runs using stdio transport and follows the MCP specification.
Tool Parameters
All search tools accept the following parameters:
query
(required) - The search query stringlocation
(optional) - Search location/regionlanguage
(optional) - Language code (e.g., "en", "es", "fr")country
(optional) - Country code (e.g., "us", "uk", "ca")num_results
(optional) - Number of results to return (1-100, default: 10)
The webpage_scrape
tool accepts:
url
(required) - The URL to scrape
Example Tool Calls
Basic Web Search
{
"name": "google_search",
"arguments": {
"query": "artificial intelligence trends 2024",
"num_results": 5
}
}
Location-specific News Search
{
"name": "google_search_news",
"arguments": {
"query": "climate change",
"location": "New York",
"language": "en",
"country": "us"
}
}
Web Scraping
{
"name": "webpage_scrape",
"arguments": {
"url": "https://example.com/article"
}
}
Configuration with MCP Clients
Claude Desktop
Add to your Claude Desktop configuration file:
{
"mcpServers": {
"multi-search": {
"command": "/path/to/multi-search-mcp-server",
"env": {
"SEARCH_ENGINE": "serper",
"SERPER_API_KEY": "your_serper_api_key_here",
"SERPAPI_API_KEY": "your_serpapi_key_here"
}
}
}
}
Or for a specific engine only:
{
"mcpServers": {
"search-serper": {
"command": "/path/to/multi-search-mcp-server",
"env": {
"SEARCH_ENGINE": "serper",
"SERPER_API_KEY": "your_serper_api_key_here"
}
},
"search-serpapi": {
"command": "/path/to/multi-search-mcp-server",
"env": {
"SEARCH_ENGINE": "serpapi",
"SERPAPI_API_KEY": "your_serpapi_key_here"
}
}
}
}
Other MCP Clients
This server is compatible with any MCP-compliant client. Configure it according to your client's documentation, ensuring the appropriate API key environment variables are set.
API Response Format
All search tools return JSON responses containing:
- Search results with titles, URLs, and snippets
- Knowledge graph information (when available)
- Related searches and suggestions
- Metadata about the search
The webpage_scrape
tool returns:
- Extracted text content
- Page metadata
- Structured data (when available)
Error Handling
The server provides detailed error messages for:
- Missing or invalid API keys
- Invalid search parameters
- Network connectivity issues
- API rate limits or quota exceeded
- Invalid URLs for scraping
Architecture
This server uses a plugin-based architecture with the external github.com/grokify/metasearch
package:
/
āāā main.go # Main server and tool registration
Metasearch Package
The server leverages the external github.com/grokify/metasearch
package which provides:
- Core interfaces (
Engine
,Registry
) for implementing search engines - Common types (
SearchParams
,ScrapeParams
,SearchResult
) - Engine implementations for various search providers
- Registry management for discovering and selecting engines
Adding New Search Engines
To add a new search engine, contribute to the github.com/grokify/metasearch
package:
- Fork the metasearch repository
- Create a new engine implementation following the existing patterns
- Submit a pull request to the metasearch repository
Using the Metasearch Package
The github.com/grokify/metasearch
package can be used in your own projects:
import "github.com/grokify/metasearch"
registry := metasearch.NewRegistry()
engine, err := metasearch.GetDefaultEngine(registry)
if err != nil {
log.Fatal(err)
}
result, err := engine.Search(ctx, metasearch.SearchParams{
Query: "golang web scraping",
})
Development
Building from Source
git clone <repository-url>
cd metasearch-mcp-server
go mod tidy
go build -o multi-search-mcp-server
Testing
go test ./...
Testing with Different Engines
# Test with Serper
SEARCH_ENGINE=serper SERPER_API_KEY=your_key ./multi-search-mcp-server
# Test with SerpAPI
SEARCH_ENGINE=serpapi SERPAPI_API_KEY=your_key ./multi-search-mcp-server
License
This project is licensed under the MIT License.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Support
For issues related to:
- Serper API: Contact serper.dev
- SerpAPI: Contact serpapi.com
- MCP Specification: See Model Context Protocol documentation
- This Implementation: Open an issue in this repository