Prepare for public release: AGPL license, curl installer, bearer-token auth
- LICENSE: AGPL-3.0 - install.sh: curl-pipeable bootstrap for Linux/macOS (VPS/LXC) — installs Docker if missing, clones, generates strong LWSS_API_KEY + SearXNG secret, compose up, prints the ready-to-run 'claude mcp add' command; idempotent and preserves .env on re-run - auth: optional bearer token (LWSS_API_KEY) on all orchestrator MCP + REST requests via middleware; /health exempt; empty key disables auth (LAN only); constant-time compare - compose: configurable bind address (ORCHESTRATOR_BIND, default 0.0.0.0) so the endpoint can stay localhost-only behind a tunnel; API key plumbed through - docker-compose.override.yml pattern (gitignored) + .example for machine-local config like LAN SearXNG extra_hosts - README: install one-liner, auth + security (SSRF/tunnel) notes, license - PRD: auth documented in §8; multi-tenant non-goal clarified Verified: auth rejects unauthenticated REST + MCP (401), passes with a valid bearer token, /health stays open; full dockerized stack healthy; MCP client connects only with the Authorization header. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
4bcbe8daff
commit
e6c2cc1e8c
11 changed files with 949 additions and 11 deletions
61
README.md
61
README.md
|
|
@ -7,23 +7,47 @@ model does its own ranking/filtering; extraction is purely mechanical).
|
|||
|
||||
See [PRD.md](PRD.md) for full requirements and architecture.
|
||||
|
||||
## Quick start
|
||||
## Install (VPS / LXC / any Linux or macOS host)
|
||||
|
||||
One command — installs Docker if missing, clones the repo, generates a strong
|
||||
API key + SearXNG secret, and brings the stack up:
|
||||
|
||||
```bash
|
||||
cp .env.example .env # optional; defaults work
|
||||
curl -fsSL https://git.neilbantoc.dev/neil/local-web-search/raw/branch/main/install.sh | bash
|
||||
```
|
||||
|
||||
When it finishes it prints your MCP endpoint, the generated API key, and the
|
||||
exact `claude mcp add` command to run on your client machine. Re-running the
|
||||
installer updates the checkout and restarts the stack, preserving your `.env`
|
||||
(and API key). Useful overrides: `LWSS_DIR`, `LWSS_PORT`, `LWSS_BIND`,
|
||||
`LWSS_BRANCH` (see the top of [`install.sh`](install.sh)).
|
||||
|
||||
## Quick start (manual / development)
|
||||
|
||||
```bash
|
||||
cp .env.example .env
|
||||
# set LWSS_API_KEY to a strong value (or `openssl rand -hex 32`); empty disables auth
|
||||
docker compose up --build
|
||||
```
|
||||
|
||||
The orchestrator is the only exposed service, on port 8000.
|
||||
|
||||
### Authentication
|
||||
|
||||
If `LWSS_API_KEY` is set (the installer always sets it), every request to the
|
||||
MCP and REST endpoints must carry `Authorization: Bearer <key>`. `/health` is
|
||||
always exempt so healthchecks/monitors work. An empty key disables auth —
|
||||
only do that on trusted/LAN networks.
|
||||
|
||||
### MCP (primary interface)
|
||||
|
||||
Streamable HTTP endpoint: `http://localhost:8000/mcp`
|
||||
Streamable HTTP endpoint: `http://<host>:8000/mcp`
|
||||
|
||||
Claude Code:
|
||||
|
||||
```bash
|
||||
claude mcp add --transport http local-web-search http://localhost:8000/mcp
|
||||
claude mcp add --transport http local-web-search http://<host>:8000/mcp \
|
||||
--header "Authorization: Bearer <your-api-key>"
|
||||
```
|
||||
|
||||
Tools:
|
||||
|
|
@ -36,10 +60,11 @@ Tools:
|
|||
### REST (debug / non-MCP clients)
|
||||
|
||||
```bash
|
||||
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
|
||||
AUTH='-H "Authorization: Bearer <your-api-key>"' # omit if auth is disabled
|
||||
curl -X POST localhost:8000/search -d '{"query":"..."}' -H 'content-type: application/json' -H "Authorization: Bearer <key>"
|
||||
curl -X POST localhost:8000/search/contents -d '{"query":"...","max_results":5}' -H 'content-type: application/json' -H "Authorization: Bearer <key>"
|
||||
curl -X POST localhost:8000/scrape -d '{"url":"https://..."}' -H 'content-type: application/json' -H "Authorization: Bearer <key>"
|
||||
curl localhost:8000/health # no auth needed
|
||||
```
|
||||
|
||||
Every REST response includes a `trace`: per-stage timings, cache hit/miss, and
|
||||
|
|
@ -72,9 +97,29 @@ 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).
|
||||
|
||||
## Security notes
|
||||
|
||||
When exposed beyond a trusted LAN, the API key is the only thing gating your
|
||||
renderer — anyone with the key (or with the port open and auth disabled) can
|
||||
drive it to fetch arbitrary URLs. Guidance:
|
||||
|
||||
- **Always keep `LWSS_API_KEY` set** on any internet-reachable host.
|
||||
- **Prefer a private tunnel.** Set `ORCHESTRATOR_BIND=127.0.0.1` and reach the
|
||||
box over Tailscale / WireGuard / Cloudflare Tunnel rather than opening the
|
||||
port. That keeps the endpoint off the public internet entirely.
|
||||
- **Renderer SSRF surface:** `fetch_url` / `/scrape` will fetch any URL given to
|
||||
it, including internal addresses reachable from the container. Don't run this
|
||||
where it can reach sensitive internal services you wouldn't want proxied.
|
||||
- Rotate the key by editing `.env` and `docker compose up -d orchestrator`.
|
||||
|
||||
## 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.
|
||||
|
||||
## License
|
||||
|
||||
[AGPL-3.0](LICENSE). If you run a modified version as a network service, the
|
||||
license requires you to make your modified source available to its users.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue