MetaSearchMCP
Open-source metasearch backend for MCP, AI agents, and LLM workflows.
MetaSearchMCP aggregates results from multiple search providers, normalizes them into a stable JSON schema, and exposes both an HTTP API and an MCP server for agent tooling.
Positioning
- MCP-first metasearch backend
- Structured search API for AI pipelines
- Multi-provider search orchestration with deduplication and fallback
- Python FastAPI alternative to browser-first metasearch projects
Why It Exists
Most search aggregators are designed around browser UX: HTML pages, pagination, and interactive result cards. Agents and LLM workflows need a different contract: predictable JSON, stable field names, partial-failure tolerance, and provider-level execution metadata.
MetaSearchMCP is built for that machine-consumable workflow. The design is centered on search orchestration, normalized contracts, and MCP integration.
Core Features
- Concurrent multi-provider aggregation
- Unified result schema for web, academic, developer, and knowledge sources
- Provider-level timeout isolation and partial-failure handling
- Result deduplication across engines
- Provider selection by explicit names or semantic tags such as
web,academic,code, andgoogle - Final result caps for agent-friendly payload sizing
- HTTP API with OpenAPI docs
- MCP server over stdio for Claude Desktop, Cline, Continue, and similar clients
- Configurable provider allowlist via environment variables
Google Support
Google support now includes a direct scraper provider implemented inside this project.
The direct Google implementation uses browser-like requests, consent cookie handling, locale-aware query parameters, and resilient HTML result parsing. It is implemented locally in this repository.
Currently supported Google providers:
Provider priority for /search/google is now google first, then google_serpbase, then google_serper.
Supported Providers
Web Search
Knowledge And Reference
Places And Geocoding
Education Sources
Nature And Biodiversity
Natural Hazards And Seismology
Developer Sources
Academic Sources
Health Sources
Legal Sources
Nonprofit Sources
Patent Sources
Open Data Portals
Government Sources
Development Sources
News Sources
Social Sources
Media Sources
Space Sources
Finance Sources
Deals And Shopping
Installation
One-command local install:
python scripts/install.py
Install, run tests, and start the HTTP API:
python scripts/install.py --dev --test --run
Deploy with Docker Compose:
python scripts/install.py --mode docker
The installer creates .env from .env.example when .env does not already exist. Existing .env files are kept unless --force-env is passed.
Manual install:
git clone https://github.com/gefsikatsinelou/MetaSearchMCP
cd MetaSearchMCP
pip install -e ".[dev]"
Or with uv:
uv pip install -e ".[dev]"
Configuration
Copy .env.example to .env and configure any providers you want to enable.
cp .env.example .env
Key settings:
HOST=0.0.0.0
PORT=8000
DEFAULT_TIMEOUT=10
AGGREGATOR_TIMEOUT=15
SERPBASE_API_KEY=
SERPER_API_KEY=
BRAVE_API_KEY=
YDC_API_KEY=
GITHUB_TOKEN=
STACKEXCHANGE_API_KEY=
REDDIT_CLIENT_ID=
REDDIT_CLIENT_SECRET=
NCBI_API_KEY=
SEMANTIC_SCHOLAR_API_KEY=
ALPHA_VANTAGE_API_KEY=
FINNHUB_API_KEY=
ENABLED_PROVIDERS=
ALLOW_UNSTABLE_PROVIDERS=false
MAX_RESULTS_PER_PROVIDER=10
To enable You.com, set YDC_API_KEY and either let it participate in the default web-provider pool or explicitly target it with providers: ["youcom"].
curl -X POST http://localhost:8000/search \
-H "Content-Type: application/json" \
-d '{
"query": "playwright locator best practices",
"providers": ["youcom"],
"params": {"num_results": 5}
}'
Running
HTTP API
python -m metasearchmcp.server
# or
metasearchmcp
The API starts on http://localhost:8000.
MCP Server
python -m metasearchmcp.broker
# or
metasearchmcp-mcp
The MCP server communicates over stdio.
Docker
docker build -t metasearchmcp .
docker run --rm -p 8000:8000 --env-file .env metasearchmcp
Or with Compose:
docker compose up --build
HTTP API
POST /search
Aggregate across all enabled providers or a selected provider subset.
curl -X POST http://localhost:8000/search \
-H "Content-Type: application/json" \
-d '{
"query": "rust async runtime",
"providers": ["duckduckgo", "wikipedia"],
"params": {"num_results": 5, "max_total_results": 8, "language": "en"}
}'
You can also narrow providers by tags:
curl -X POST http://localhost:8000/search \
-H "Content-Type: application/json" \
-d '{
"query": "transformer attention",
"tags": ["academic", "knowledge"],
"params": {"num_results": 5, "max_total_results": 6}
}'
When multiple tags are provided, the default behavior is tag_match="any".
Set tag_match to "all" when you want providers that satisfy every requested tag:
curl -X POST http://localhost:8000/search \
-H "Content-Type: application/json" \
-d '{
"query": "npm cli argument parser",
"tags": ["code", "packages"],
"tag_match": "all",
"params": {"num_results": 5, "max_total_results": 6}
}'
num_results controls how many results each provider can contribute. max_total_results caps the final merged response after deduplication.
POST /search/google
Search Google through the configured Google provider chain. If ALLOW_UNSTABLE_PROVIDERS=true, MetaSearchMCP will prefer the direct google provider automatically.
curl -X POST http://localhost:8000/search/google \
-H "Content-Type: application/json" \
-d '{"query": "site:github.com rust tokio"}'
To force the direct Google route explicitly:
curl -X POST http://localhost:8000/search/google \
-H "Content-Type: application/json" \
-d '{"query": "site:github.com rust tokio", "provider": "google"}'
POST /search/batch
Run several queries in a single round-trip against the same provider/tag filters.
curl -X POST http://localhost:8000/search/batch \
-H "Content-Type: application/json" \
-d '{
"queries": ["rust async runtime", "python asyncio"],
"providers": ["duckduckgo", "wikipedia"],
"params": {"num_results": 3, "max_total_results": 5}
}'
Queries (1-20) are executed concurrently and each yields its own SearchReport. A per-query error (e.g. an aborted provider) does not fail the other queries; the response is {"count": N, "queries": [...], "results": [...]}, where each entry is either a report or {"query": ..., "error": ...}.
POST /search/bio
Run a search across biomedical/life-science providers tagged bio (UniProt, ClinicalTrials.gov, PubMed, Europe PMC).
curl -X POST http://localhost:8000/search/bio \
-H "Content-Type: application/json" \
-d '{"query": "BRCA1 protein structure", "params": {"num_results": 5}}'
It honors the same provider/tag filters as the aggregate /search endpoint; when no tags are supplied it defaults to ["bio"].
GET /search/suggest
Query autocomplete suggestions for a partial search term. Uses the public DuckDuckGo autocomplete endpoint — no API key required.
curl "http://localhost:8000/search/suggest?q=python&limit=5"
Returns query, suggestions, count, and source (duckduckgo). limit defaults to 8 and is capped at 20.
GET /providers
Return the currently available provider catalog.
The response includes provider descriptions and a tag-to-provider index for quick discovery.
You can filter the catalog by tag:
curl "http://localhost:8000/providers?tag=academic&tag=web"
Use tag_match=all to require every tag instead of the default any-match behavior:
curl "http://localhost:8000/providers?tag=code&tag=packages&tag_match=all"
GET /health
Simple health check endpoint. Returns service status, version, provider count, and the current provider name list.
GET /health/providers
Actively probe providers with a single, minimal live search request each. Unlike GET /health (which only lists what is loaded) and the configuration-level provider_health MCP tool (which only checks whether a provider could run, e.g. an API key is present), this endpoint proves the upstream API is reachable.
curl "http://localhost:8000/health/providers?tag=academic&limit=5&timeout=5"
Query parameters:
Probes run concurrently. Each entry in providers reports name, status (ok, error, timeout, or unavailable), available, latency_ms, result_count, error, description, and tags. The top level reports status (ok when nothing failed, otherwise degraded), total, probed, ok_count, failed_count, unavailable_count, and skipped.
GET /cache/stats
Inspect the shared in-memory search result cache (used by the orchestrator to avoid re-hitting external providers for identical requests within the TTL window).
curl "http://localhost:8000/cache/stats"
Returns enabled, entries (live cached results), max_entries (capacity), ttl_seconds, and insertions (total keys written since process start — a monotonic counter unaffected by expiry or eviction).
Response Schema
Every aggregated response includes:
enginequeryresultsrelated_searchessuggestionsanswer_boxtiming_msproviderserrors
Every result item includes:
titleurlsnippetsourcerankproviderpublished_dateextra
Example response:
{
"engine": "metasearchmcp",
"query": "rust async runtime",
"results": [
{
"title": "Tokio - An asynchronous Rust runtime",
"url": "https://tokio.rs",
"snippet": "Tokio is an event-driven, non-blocking I/O platform...",
"source": "tokio.rs",
"rank": 1,
"provider": "duckduckgo",
"published_date": null,
"extra": {}
}
],
"related_searches": [],
"suggestions": [],
"answer_box": null,
"timing_ms": 843.2,
"providers": [
{
"name": "duckduckgo",
"success": true,
"result_count": 10,
"latency_ms": 840.1,
"error": null
}
],
"errors": []
}
MCP Tools
MetaSearchMCP exposes these MCP tools:
search_websearch_googlesearch_academicsearch_githubcompare_enginessearch_financesearch_codesearch_newssearch_socialsearch_imagessearch_videossearch_biolist_providersprovider_health
search_web also accepts optional tags so agents can limit search to categories such as web, academic, code, or google. When multiple tags are present, tag_match="all" requires a provider to satisfy the full set.
All search tools accept max_total_results to keep the final payload compact.
Example Claude Desktop config:
{
"mcpServers": {
"MetaSearchMCP": {
"command": "metasearchmcp-mcp",
"env": {
"ALLOW_UNSTABLE_PROVIDERS": "true",
"SERPBASE_API_KEY": "your_key",
"SERPER_API_KEY": "your_key"
}
}
}
}
Development
pip install -e ".[dev]"
pytest
uvicorn metasearchmcp.server:app --reload
Architecture
The public package is organized around these modules:
contracts.py: request/response data models (Pydantic schemas)config.py: application settings loaded from environment variablescatalog.py: provider discovery, filtering, and selection by name or tagsorchestrator.py: concurrent search execution across providers and result assemblymerge.py: URL canonicalization and cross-engine result deduplicationranking.py: optional consensus/relevance result re-ranking (opt-in viaRANK_RESULTS)health.py: active provider probes (minimal live search per provider, used by/health/providers)server.py: FastAPI application and Uvicorn server entrypointbroker.py: MCP server exposing search tools over stdioapi/routes.py: HTTP endpoint handlers (search, suggest, health, providers catalog)cli.py: interactive first-run setup wizard (metasearchmcp-setup)
Entry-point wrappers (main.py for HTTP, mcp_server.py for MCP) and legacy
compatibility shims (aggregator.py, dedup.py, schema.py) are kept for
backwards compatibility.
Roadmap
- Caching and provider-aware query reuse
- Better scoring and ranking signals across providers
- Streaming aggregation responses
- Provider health telemetry
- More first-party API integrations where they improve reliability
License
MIT