- renderer: plain-fetch escalation when the browser render is blocked (4xx) or fails — some sites 403 automated browsers but serve plain HTTP clients - orchestrator: blocked (>=400), empty, and thin results now appear in failed_urls and the degraded trace list instead of passing silently; blocked/thin results are never cached - extractor: thin threshold raised to 500 chars (env: MIN_TEXT_CHARS) so block/challenge interstitials are flagged instead of passing as content Outcome on TechPowerUp (fingerprints Chromium AND Firefox, JS-challenges plain clients): still blocked — accepted per PRD §9 — but results are now flagged thin/degraded so the calling LLM knows to rely on other sources. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> |
||
|---|---|---|
| config | ||
| searxng | ||
| services | ||
| .env.example | ||
| .gitignore | ||
| docker-compose.yml | ||
| PRD.md | ||
| README.md | ||
Local Web Search Stack (LWSS)
Self-hosted, private web search + page retrieval for local LLMs — a functional replacement for Tavily/Serper/Firecrawl, exposed as an MCP server. No SaaS in the request path, no per-call fees, no LLM anywhere in the stack (the calling model does its own ranking/filtering; extraction is purely mechanical).
See PRD.md for full requirements and architecture.
Quick start
cp .env.example .env # optional; defaults work
docker compose up --build
The orchestrator is the only exposed service, on port 8000.
MCP (primary interface)
Streamable HTTP endpoint: http://localhost:8000/mcp
Claude Code:
claude mcp add --transport http local-web-search http://localhost:8000/mcp
Tools:
| Tool | Args | Returns |
|---|---|---|
web_search |
query, max_results=5, include_content=true |
ranked results: url, title, snippet (+ cleaned page text) |
fetch_url |
url |
cleaned text, title, metadata for one page |
REST (debug / non-MCP clients)
curl -X POST localhost:8000/search -d '{"query":"..."}' -H 'content-type: application/json'
curl -X POST localhost:8000/search/contents -d '{"query":"...","max_results":5}' -H 'content-type: application/json'
curl -X POST localhost:8000/scrape -d '{"url":"https://..."}' -H 'content-type: application/json'
curl localhost:8000/health
Every REST response includes a trace: per-stage timings, cache hit/miss, and
a degraded list naming stages that fell back or partially failed.
Architecture
MCP client → orchestrator (REST+MCP) → searcher → searxng (local)
→ renderer (Playwright)
→ extractor (Trafilatura + readability)
redis: search / rendered-HTML / extracted-text caches
- searcher — queries the SearXNG pool (file-based list in
config/instances.yml, failover mode; add instances there for rotation later), normalizes + dedups results. - renderer — always renders via headless Chromium; single browser, pooled contexts, concurrency cap + queue; per-domain rate limiting (Redis token window); render retry with DNS-failure fast-fail; Redis HTML cache.
- extractor — mechanical extraction only: Trafilatura (precision → recall) then readability-lxml fallback; flags thin content.
- orchestrator — sequencing, per-URL parallelism, partial-result
degradation, scrape-result cache, aggregated
/health.
Configuration
All knobs are env vars (see .env.example): cache TTLs, renderer concurrency
and timeouts, per-domain rate limit, stage timeouts, SearXNG secret. The
SearXNG instance pool lives in config/instances.yml (hand-editable; reloaded
on change without restart).
Development
Python services run directly with uvicorn (--app-dir services/<name>), the
renderer with node services/renderer/src/server.js. Everything degrades
gracefully without Redis (caching disabled). Each service is curl-able in
isolation on its own port: searcher 8001, renderer 8002, extractor 8003.