API: providers
better-web-search-mcp / providers
providers#
Variables#
PROVIDER_TIMEOUT_MS#
constPROVIDER_TIMEOUT_MS:10000=10_000
Defined in: src/providers/index.ts:33
Wall-clock budget for a single provider, in milliseconds.
Functions#
aggregateSearch()#
aggregateSearch(
query,opts?):Promise<SearchResult[]>
Defined in: src/providers/index.ts:69
Aggregate search across all enabled providers.
Uses Promise.allSettled so one failing provider never aborts the others,
and caps each provider at PROVIDER_TIMEOUT_MS so one hung provider
cannot gate the whole search — the others’ results are still returned.
Rejected and timed-out providers are logged as warnings and skipped;
fulfilled results are flattened into a single array.
Parameters#
| Parameter | Type |
|---|---|
query | string |
opts | SearchOptions |
Returns#
Promise<SearchResult[]>
enabledProviders()#
enabledProviders():
SearchProvider[]
Defined in: src/providers/index.ts:17
Build the list of enabled providers based on environment keys.
- Brave: enabled when
BRAVE_API_KEY(or BETTER_WEB_SEARCH_BRAVE_API_KEY) is set. - Tavily: enabled when
TAVILY_API_KEY(or BETTER_WEB_SEARCH_TAVILY_API_KEY) is set. - DuckDuckGo: always enabled (keyless free fallback) — zero-config.
SerpApi is deliberately absent: SerpApiProvider is still a stub, so
including it only added a no-op call to every aggregation.