Introduction¶
When an Agent connects to a single web search API, the search often fails directly when the monthly quota is exhausted, rate limits are hit, or there is network jitter. Worse, some implementations hide failures as empty results. The model then interprets this as “no relevant information online” and answers confidently based on training data.
The search-failover introduced below aggregates multiple search sources into a single MCP web_search tool, attempting them in order of priority; and clearly documents in the return value which sources were tried and why each was skipped. The maintainer is crisweb1994. The repository is crisweb1994/search-failover, the npm package version is 0.4.0, and the license is MIT. As a plugin package within the DeepSeek Harness (DSH) ecosystem, it can also be integrated via DSH’s plugin mechanism; the community directory SkillHub has no official affiliation with DeepSeek or High-Flyer, serving as a community distribution channel.
What is it¶
search-failover is a Web Search MCP Service: primarily exposing the web_search and web_search_status tools. By default, the chain covers up to 10 sources (Bocha, Tavily, Brave, Exa, SearXNG, DuckDuckGo, etc.; Zhipu, DeepSeek, Qianfan, Serper require explicit enabling). It communicates via stdio for local hosts and Streamable HTTP for platforms that only support remote MCPs. The artifact is a single file built with esbuild; npx cold start has no runtime dependencies. It requires Node ≥ 20.10.
Core Capabilities¶
Automatic Failover and Readable Decision Chain¶
The default priority is: Bocha → Tavily → Brave → Exa → SearXNG → DuckDuckGo. Only sources with credentials configured and included in the default chain participate; DuckDuckGo uses no key as a fallback. The process ends when the first source returns a non-empty result; it does not retry on the same source, switching to the next one immediately upon failure.
The return value includes results and meta: provider_used, fallback_chain (each provider’s outcome and detail), cache_hit, and elapsed_ms. Only if all sources in the chain return no_results does it mean nothing was found; if there is an error or a strategy skip, MCP marks isError: true, distinguishing it from a failed search.
Classification and Cooling Based on Upstream Signals¶
Each source has a dedicated adapter. Errors are aggregated into 8 categories (e.g., quota_exhausted, rate_limited, auth_failure, no_results, etc.) with corresponding cooling or blocking strategies. The total budget for the entire search is 30 seconds by default, with a per-source request limit of 10 seconds.
Configuration and Cost Control¶
Credentials can be written in a user-level config file or using environment variables (environment variables take precedence):
// ~/.config/search-failover/config.json (Windows: %APPDATA%\search-failover\config.json)
{
"credentials": {
"BOCHA_API_KEY": "...",
"TAVILY_API_KEY": "..."
}
}
It is recommended to execute chmod 600 on this file. For paid or one-time quota sources (Zhipu, DeepSeek, Qianfan, Serper), having a key does not automatically include them in the chain; they must be explicitly listed in SEARCH_FAILOVER_PROVIDERS or the providers field in the config file. The gateway also maintains local request budgets and rate limits for most sources to prevent over-subscription under concurrency.
Transport Methods¶
- stdio: Suitable for local MCP hosts like Claude Code, Cursor, Codex, etc.
- HTTP Mode: Start Streamable HTTP with
--httpto allow clients that only support remote MCPs to share quota counting, cooling, and caching.
Regarding proxies, it reads HTTPS_PROXY / HTTP_PROXY / NO_PROXY (to compensate for Node.js’ built-in fetch not reading these variables).
Search Sources Overview¶
| Source | Config Variable | Default in Chain |
|---|---|---|
| Bocha | BOCHA_API_KEY |
Yes |
| Tavily | TAVILY_API_KEY |
Yes |
| Brave Search | BRAVE_API_KEY |
Yes |
| Exa | EXA_API_KEY |
Yes |
| SearXNG | SEARXNG_URL |
Yes |
| DuckDuckGo | No config needed | Yes |
| Zhipu | ZHIPU_API_KEY |
No (must be listed explicitly) |
| DeepSeek | DEEPSEEK_API_KEY |
No (must be listed explicitly) |
| Baidu Qianfan | QIANFAN_API_KEY |
No (must be listed explicitly) |
| Serper | SERPER_API_KEY |
No (must be listed explicitly) |
It can run without any keys configured, though the chain usually consists only of DuckDuckGo (domestic networks often require a proxy). SearXNG requires adding json to the search.formats in the instance’s settings.yml, otherwise the API may return a 403.
Installation and Usage¶
General MCP (npx)¶
The README’s quick start has three steps: prepare credentials → connect to host → self-check with web_search_status. Using Claude Code as an example, the connection command is:
claude mcp add search-failover -- npx -y search-failover
Codex, Cursor, VS Code, ZCode, OpenCode, Claude Desktop, etc., can choose mcp.json, the plugin marketplace, or their respective CLIs following the “Connect to Host” section in the README. The core startup method is consistent: npx -y search-failover, no global installation required.
DeepSeek Harness¶
package.json declares engines.dsh as >=0.2.0-rc.2 <0.3.0-0, and the package provides a bundle patch via dsh/cordis.patch.yml inside. The README outlines two connection methods:
- Install the plugin package using
dsh plugin add(the npm packagesearch-failoveris bundled according to Agent Plugins 1.0). - Or manually write the MCP entry in
cordis.patch.yml(marked as developer preview; documentation records it was tested on dsh 0.2.2-rc.3).
The SkillHub directory page currently has no additional installation shell command; follow the installation plan read by the Harness or the repository README during installation. Do not manually concatenate the missing dsh plugin add github:… form without checking the documentation first.
Typical Usage¶
Initiating a Search¶
The Agent calls web_search with a query term; optional parameters include max_results, freshness, include_domains, use_cache, etc. An example of a successful search (excerpt):
// web_search({ "query": "mcp stdio transport" })
{
"results": [
{
"title": "Example: stdio transport",
"url": "https://example.com/mcp/transports",
"snippet": "Clients launch the server as a subprocess and talk JSON-RPC over stdin/stdout.",
"publishedDate": "2026-09-18T00:00:00",
"provider": "brave"
}
],
"meta": {
"provider_used": "brave",
"fallback_chain": [
{ "provider": "bocha", "outcome": "quota_exhausted", "detail": "http_403 You do not have enough money", "elapsedMs": 13 },
{ "provider": "tavily", "outcome": "rate_limited", "detail": "http_429", "elapsedMs": 0 }
],
"cache_hit": false,
"elapsed_ms": 14
}
}
Checking Source Status¶
After installing and configuring credentials, instruct the Agent to call web_search_status: to see if each source is active, unconfigured, disabled, or blocked, along with the config file path and error messages, facilitating troubleshooting of which providers actually participate in the chain.
Remote HTTP (Optional)¶
Platforms that only support remote MCPs can start the service using --http following the “HTTP Mode” section in the README, allowing multiple clients to share the same in-process state.
Use Cases and Notes¶
Who is this for: DSH / various MCP host users who need stable web retrieval; scenarios where users already have multiple search API credentials and want to unify them into one tool while clearly seeing the failover process; teams that want DuckDuckGo as a fallback while having explicit switches for paid sources.
Usage Notes:
- The plugin/MCP process runs with the permissions of the current DSH or host user. Please read the source code and the MIT license before installing, and keep your
config.jsonand keys in environment variables safe. - DuckDuckGo relies on HTML scraping, is key-free but subject to anti-scraping and domestic network restrictions; DeepSeek search is billed for successful requests according to the official documentation, please verify the pricing and quotas before enabling.
- Status (cooling, local budget, cache) is stored in process memory and resets on restart; there are no databases or background probe tasks.
Conclusion¶
search-failover converges “total failure if one goes down” into “fallback by chain + writing decisions into JSON”, making it more auditable for the Agent side. If installed via DSH, follow SkillHub and the Harness section in the repository README; if using a manually written MCP, remember that a single line npx -y search-failover is often sufficient.
- Directory: https://www.skillhub.cn/plugins/crisweb1994/search-failover
- GitHub: https://github.com/crisweb1994/search-failover