--- description: How to search the web with MillionShort (API and MCP) in this project alwaysApply: false --- # Web search with MillionShort MillionShort is a search API and MCP server on its own independent index: the web, plus news, discussions, podcasts, academic and other specialist sources. ## Calling it - With the `millionshort` MCP server connected: tools `search`, `get_domain_info`, `list_sources`. All three only read. - Over HTTP: `POST https://api.millionshort.com/v1/search` with the header `Authorization: Bearer $MILLIONSHORT_API_KEY`. - The key lives in the environment variable `MILLIONSHORT_API_KEY`. Do not write it into source, configuration that is committed, or logs. ## Request fields - `query` (required, up to 400 characters) - `sources` (up to 5, default `["web"]`): `web`, `news`, `smallweb`, `discussions`, `hn`, `social`, `communities`, `podcasts`, `academic`, `medical`, `law`, `finance`, `contracts` - `num_results` (1 to 50, default 10) - `remove_top_sites` (0 to 1,000,000): leaves out the N most popular sites - `only_top_sites` (0 to 1,000,000): keeps only the N most popular sites; not with `remove_top_sites` - `include_domains`, `exclude_domains`, `boost_domains`, `bury_domains` (up to 25 each) - `page_types`, `topics`: values from `GET /v1/sources` - `safe_search`: `off`, `moderate` (default), `strict` - `max_chars_per_result` (0 to 2000, default 800) ## Response - `data.results[]`: `title`, `url`, `site`, `source`, `snippet`, `published_date`, `popularity` (`rank`, `bucket`), `position` - `data.summary`: how many results were returned and how many were removed, by reason - `usage`: credits and dollars charged; `request_id`: quote it when reporting a problem - Errors carry `error.code` and `error.message`. `RATE_LIMITED` and `CAPACITY` (both `429`) and `SEARCH_UNAVAILABLE` (`502`) set `Retry-After`. `INSUFFICIENT_CREDITS` is also a `429` and must not be retried. ## In code - Read the base address from configuration (default `https://api.millionshort.com`). - Set a request timeout. Retry once, after `Retry-After`, on `RATE_LIMITED`, `CAPACITY` and `SEARCH_UNAVAILABLE` only. Decide by `error.code`, not by the status alone. - Keep the `url` of each result that is used, so answers can cite their sources. Reference: https://millionshort.com/docs/search/parameters