Skip to content

Configuration

Pummelchen edited this page Sep 12, 2026 · 7 revisions

Home · Installation · Compatibility · Tools Reference · Architecture · Providers · Configuration · Reliability · Security · Self-Hosting · Monitor · 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 Reader Not a search provider: only raises the web_open Reader fallback's 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.


Answer synthesis

These configure the optional web_answer tool. None of them is a search provider. Setting them changes nothing about provider selection, fusion or ranking — a test asserts that the provider order and enabled set are identical with and without DEEPSEEK_API_KEY.

Variable Default Effect
DEEPSEEK_API_KEY — Enables web_answer. Without it the tool returns results only
DEEPSEEK_BASE_URL https://api.deepseek.com/v1 OpenAI-compatible base; /chat/completions is appended
DEEPSEEK_MODEL deepseek-flash deepseek-flash is DeepSeek-V4.1-Flash; deepseek-v4-pro is the larger sibling
SEARCH_SYNTHESIS_TIMEOUT_MS 45000 Budget for one generation. Separate from the search timeout on purpose
SEARCH_SYNTHESIS_REASONING false Thinking mode. See the warning below

Leave SEARCH_SYNTHESIS_REASONING off unless you have measured it. Thinking is enabled by default by the API, so the server disables it explicitly rather than relying on a default. With it on, the reasoning pass shares the output-token budget and can consume all of it: measured, a request returned completion=4000, reasoning=4000, content="" with finish_reason: length — an HTTP 200 carrying no answer at all. If an answer still comes back empty, the server retries once with thinking disabled rather than returning nothing.

The model itself has no web access, which is why it is only ever given results that were already fetched. See Tools Reference for the grounding rules.


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. 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_REQUEST_TIMEOUT_MS 10000 Bound on one request attempt

Budgets apply to a whole search, not to individual providers. There is deliberately no separate connect-timeout setting: the transport exposes no connect-only deadline, and a stalled connection is bounded by SEARCH_REQUEST_TIMEOUT_MS, which covers connection establishment as well as the wait for data. See Reliability for what happens when a budget 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

# --- optional grounded answers (web_answer) --------------------------------
DEEPSEEK_API_KEY=sk-...
DEEPSEEK_MODEL=deepseek-flash
SEARCH_SYNTHESIS_TIMEOUT_MS=45000
SEARCH_SYNTHESIS_REASONING=false

# --- 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 · Compatibility · Tools Reference · Architecture · Providers · Configuration · Reliability · Security · Testing · Troubleshooting · Project Tracker

Clone this wiki locally