Skip to content

Configuration

Pummelchen edited this page Sep 11, 2026 · 7 revisions

Home · Installation · Tools Reference · Architecture · Providers · Configuration · Reliability · Security · Testing · Troubleshooting · Project Tracker


How configuration is resolved

Configuration is resolved once at boot from two sources:

  1. An optional KEY=VALUE config file.
  2. Environment variables.

Environment variables always win. SEARCH_CONFIG_FILE selects an explicit config file; without it, only the environment is read.

export SEARCH_CONFIG_FILE=/etc/mcps-search.env

The file format is a minimal KEY=VALUE parser supporting # comments, an optional export prefix, and optional single or double quotes around values.

The server never refuses to start over missing configuration. With no credentials at all it boots normally and reports what is missing through web_search_status.

example.env in the repository is a fully commented template.


Provider credentials

Variable Provider Notes
TAVILY_API_KEY Tavily Preferred first choice
BRAVE_SEARCH_API_KEY Brave Search Broad independent index
MOJEEK_API_KEY Mojeek Paid API; supplies index diversity
EXA_API_KEY Exa Semantic retrieval and highlights
JINA_API_KEY Jina Only raises the Reader rate limit
SEARXNG_BASE_URL SearXNG Instance must have JSON enabled
OPEN_WEB_SEARCH_URL Open Web Search Aggregation endpoint
PARALLEL_MCP_URL Parallel Search MCP Defaults to https://search.parallel.ai/mcp

No variable is mandatory. At least one provider must be configured for web_search to return results.


Selection and policy

Variable Default Effect
SEARCH_PROVIDER_ORDER all nine, Tavily first Preference order for provider=auto
SEARCH_DISABLED_PROVIDERS — Comma-separated providers to switch off entirely
SEARCH_MAX_RESULTS 8 Default result count; clamped to 1–20
SEARCH_ENABLE_SCRAPERS false Enable DuckDuckGo and Startpage
SEARCH_ENABLE_PARALLEL false Enable the upstream Parallel MCP adapter
SEARCH_ENABLE_JINA_READER true Use Jina Reader as the web_open fallback
SEARCH_CACHE_TTL_SECONDS 120 In-memory cache lifetime; 0 disables

Every search provider remains reachable even when SEARCH_PROVIDER_ORDER names only some of them: unnamed providers are appended in the default order, minus the fetch-only provider. An unrecognised provider name is ignored rather than fatal.


Timeouts

Variable Default Effect
SEARCH_FAST_TIMEOUT_MS 12000 Whole-search budget, fast mode
SEARCH_BALANCED_TIMEOUT_MS 15000 Whole-search budget, balanced mode
SEARCH_THOROUGH_TIMEOUT_MS 20000 Whole-search budget, thorough mode
SEARCH_CONNECT_TIMEOUT_MS 3000 Connection timeout
SEARCH_REQUEST_TIMEOUT_MS 10000 Per-request timeout

Budgets apply to a whole search, not to individual providers. See Reliability for what happens when one expires.


HTTP

Variable Default Effect
SEARCH_MAX_RETRIES 2 Retries after the first attempt; idempotent requests only
SEARCH_USER_AGENT SwiftWebSearchMCP/1.0 (+https://example.invalid/project) Outbound User-Agent

The default user agent identifies the project honestly. The server does not impersonate a browser to defeat bot controls.


Logging

Variable Default Effect
SEARCH_LOG_LEVEL info trace, debug, info, warning, error, none
SEARCH_LOG_QUERIES false Log queries verbatim instead of a stable hash

All logs are written to stderr. stdout carries JSON-RPC framing only, and the test suite asserts nothing else appears there.

Log lines carry a timestamp, level, message and structured fields such as provider, latency, result count and error category. They never contain API keys, authorization headers, raw page bodies, or URLs carrying credentials. Query text is replaced by a stable hash unless SEARCH_LOG_QUERIES is explicitly enabled.


Security-related settings

Variable Default Effect
SEARCH_ALLOW_PRIVATE_NETWORK false Lifts the SSRF restrictions for web_open

Only enable this for a deliberately internal deployment. See Security.


Complete example

# --- providers -------------------------------------------------------------
TAVILY_API_KEY=tvly-...
BRAVE_SEARCH_API_KEY=...
SEARXNG_BASE_URL=https://searx.example.com

# --- selection and policy --------------------------------------------------
SEARCH_PROVIDER_ORDER=tavily,brave,searxng
SEARCH_MAX_RESULTS=8
SEARCH_ENABLE_SCRAPERS=false
SEARCH_CACHE_TTL_SECONDS=120

# --- timeouts --------------------------------------------------------------
SEARCH_FAST_TIMEOUT_MS=12000
SEARCH_BALANCED_TIMEOUT_MS=15000
SEARCH_THOROUGH_TIMEOUT_MS=20000

# --- http ------------------------------------------------------------------
SEARCH_MAX_RETRIES=2

# --- logging ---------------------------------------------------------------
SEARCH_LOG_LEVEL=info
SEARCH_LOG_QUERIES=false

Home · Installation · Tools Reference · Architecture · Providers · Configuration · Reliability · Security · Testing · Troubleshooting · Project Tracker

Clone this wiki locally