No description
Find a file
User 64ffeabd49 M5: hardening — retries, per-domain rate limiting, resource limits, docs
- renderer: per-domain politeness limiter (Redis fixed window, in-memory
  fallback; over-limit requests wait bounded, 429 past deadline); render retry
  with DNS-failure fast-fail
- orchestrator: one retry on connection-level stage failures (not timeouts)
- compose: per-container CPU/memory limits; all hardening knobs env-driven
  and documented in .env.example
- README: quick start, MCP + REST usage, architecture, config, dev workflow

Verified: rate limit window enforced (3rd request waited for reset), full
scrape + MCP web_search smoke green.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-05 22:11:28 -07:00
config M3: search — SearXNG container, searcher service, orchestrator /search 2026-07-05 22:07:10 -07:00
searxng M3: search — SearXNG container, searcher service, orchestrator /search 2026-07-05 22:07:10 -07:00
services M5: hardening — retries, per-domain rate limiting, resource limits, docs 2026-07-05 22:11:28 -07:00
.env.example M5: hardening — retries, per-domain rate limiting, resource limits, docs 2026-07-05 22:11:28 -07:00
.gitignore M1: scrape spine — renderer, extractor, orchestrator /scrape, compose, health, render cache 2026-07-05 22:02:38 -07:00
docker-compose.yml M5: hardening — retries, per-domain rate limiting, resource limits, docs 2026-07-05 22:11:28 -07:00
PRD.md PRD v4: MCP-first, no in-stack LLM, mechanical extraction only 2026-07-05 21:57:46 -07:00
README.md M5: hardening — retries, per-domain rate limiting, resource limits, docs 2026-07-05 22:11:28 -07:00

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.