API: utils/config

better-web-search-mcp


better-web-search-mcp / utils/config

utils/config#

Interfaces#

AppConfig#

Defined in: src/utils/config.ts:33

Properties#

PropertyTypeDefined in
braveApiKeystring | undefinedsrc/utils/config.ts:34
browserEnabledbooleansrc/utils/config.ts:39
cacheEnabledbooleansrc/utils/config.ts:37
cachePathstringsrc/utils/config.ts:38
serpApiKeystring | undefinedsrc/utils/config.ts:36
tavilyApiKeystring | undefinedsrc/utils/config.ts:35

ProviderStatus#

Defined in: src/utils/config.ts:113

Shape for the provider banner (pure, testable).

Properties#

PropertyTypeDefined in
enabledbooleansrc/utils/config.ts:115
hint?stringsrc/utils/config.ts:117
keylessbooleansrc/utils/config.ts:116
namestringsrc/utils/config.ts:114

Functions#

defaultCachePath()#

defaultCachePath(env?, platform?): string

Defined in: src/utils/config.ts:56

Where the cache lives when nothing overrides it.

The default used to be the relative path data/cache.db, which resolves against the working directory. An MCP client spawns the server from wherever it happens to be, so that scattered data/cache.db files around the filesystem — two were sitting in the home and Downloads folders — and meant the domain profiles and page cache never accumulated, because every launch directory got its own empty database. A per-user location is stable across launches and keeps the writes inside a directory meant for them.

BETTER_WEB_SEARCH_CACHE_PATH still overrides, and a relative override is still honoured for anyone who wants a project-local cache.

Parameters#

ParameterTypeDefault value
envProcessEnvprocess.env
platformstringprocess.platform

Returns#

string


formatBanner()#

formatBanner(pkg, cfg): string

Defined in: src/utils/config.ts:143

Parameters#

ParameterType
pkg{ name: string; version: string; }
pkg.namestring
pkg.versionstring
cfgAppConfig

Returns#

string


loadConfig()#

loadConfig(): AppConfig

Defined in: src/utils/config.ts:84

Returns#

AppConfig


providerStatuses()#

providerStatuses(cfg): ProviderStatus[]

Defined in: src/utils/config.ts:120

Parameters#

ParameterType
cfgAppConfig

Returns#

ProviderStatus[]