## Web search (MillionShort)

This project uses MillionShort for web search: an API and an MCP server on MillionShort's own
independent index (the web, plus news, discussions, podcasts, academic and other specialist
sources).

- Key: the environment variable `MILLIONSHORT_API_KEY`. Never write the key into a file.
- MCP: when the `millionshort` server is connected, its tools are `search`,
  `get_domain_info` and `list_sources`. All three only read.
- HTTP: `POST https://api.millionshort.com/v1/search` with
  `Authorization: Bearer $MILLIONSHORT_API_KEY` and a JSON body such as
  `{"query": "...", "sources": ["web"], "num_results": 10}`.
- `remove_top_sites: N` leaves out results from the N most popular sites (for example
  `1000` or `100000`). `only_top_sites: N` keeps only those. They cannot be combined.
- `sources` takes up to 5 of: `web`, `news`, `smallweb`, `discussions`, `hn`, `social`,
  `communities`, `podcasts`, `academic`, `medical`, `law`, `finance`, `contracts`.
- Results are in `data.results[]` (`title`, `url`, `site`, `snippet`, `published_date`,
  `popularity`). Cite the `url` of a result you rely on.
- Each source searched costs 1 credit for up to 10 results, and 0.5 credits for each
  further 10. `usage` in the response states the cost.
- Errors carry `error.code`. On `RATE_LIMITED`, `CAPACITY` or `SEARCH_UNAVAILABLE`, wait for
  `Retry-After` and try once more. On `INSUFFICIENT_CREDITS` do not retry: tell the user.
- Reference: https://millionshort.com/docs/search/parameters
  Set-up steps: https://millionshort.com/docs/auth.md
