# MillionShort documentation: full text > MillionShort is a search API and a hosted MCP server for AI agents, on our own independent index: the web (Billions+ pages) plus news, discussions, podcasts, academic and other specialist sources. One parameter removes the most popular sites from the results, so an agent can reach the long tail of the web. Index of these pages: https://millionshort.com/docs/llms.txt --- Source: https://millionshort.com/docs/quickstart Section: Get started # Quickstart Get a key, send one request, read the results. MillionShort searches the web and 13 sources in all from one endpoint, on our own independent index. This page takes you from nothing to a first result. ## 1. Get a key Create a key in the [dashboard](https://millionshort.com/app/). The Free plan needs no card. A key starts with `ms-` and is shown once, so copy it when it appears. Keep the key in an environment variable so it stays out of your code: ```bash export MILLIONSHORT_API_KEY="ms-YOUR_API_KEY" ``` An agent that cannot sign up can ask for a short-lived trial key instead. See [Authentication](https://millionshort.com/docs/authentication#trial-key-for-agents). ## 2. Send a search This asks for five results from the web with the 10,000 most popular sites removed: ```bash curl https://api.millionshort.com/v1/search \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "query": "restoring a cast iron skillet", "remove_top_sites": 10000, "num_results": 5 }' ``` The same call with the Python SDK: ```python import os from millionshort import MillionShort client = MillionShort(api_key=os.environ["MILLIONSHORT_API_KEY"]) r = client.search( "restoring a cast iron skillet", remove_top_sites=10000, num_results=5, ) for hit in r.results: print(hit["position"], hit["title"], hit["url"]) print(r.usage.credits, r.request_id) ``` And with the TypeScript SDK: ```ts import { MillionShort } from 'millionshort'; const client = new MillionShort({ apiKey: process.env.MILLIONSHORT_API_KEY }); const r = await client.search('restoring a cast iron skillet', { removeTopSites: 10000, numResults: 5, }); for (const hit of r.results) { console.log(hit.position, hit.title, hit.url); } console.log(r.usage?.credits, r.requestId); ``` The same call as a tool of the MCP server: ```json { "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "search", "arguments": { "query": "restoring a cast iron skillet", "remove_top_sites": 10000, "num_results": 5 } } } ``` The SDKs install with `pip install millionshort` and `npm install millionshort`. **Neither package is published yet**, so until they are, use `curl` or any HTTP client as above. The SDK pages cover both: [Python](https://millionshort.com/docs/sdks/python), [TypeScript](https://millionshort.com/docs/sdks/typescript). ## 3. Read the response Every success has the same four parts: `data`, `usage`, `warnings` and `request_id`. ```json { "data": { "results": [ { "title": "Restoring a rusted skillet: notes from thirty years at a foundry", "url": "https://example.org/skillet-restoration", "site": "example.org", "source": "web", "snippet": "Strip the old seasoning down to bare iron before you start...", "highlights": ["Strip the old seasoning down to bare iron before you start..."], "published_date": null, "page_type": "articles", "topic": "home", "popularity": { "rank": null, "bucket": "long-tail" }, "risk": null, "position": 1, "score": 1.0, "extra": {} } ], "summary": { "returned": 5, "removed": { "popularity": 41, "blocked": 0, "duplicates": 2, "risk": 0, "safe_search": 0 } }, "warnings": [] }, "usage": { "credits": 1, "cost_usd": 0.001, "breakdown": { "search": 1 } }, "warnings": [], "request_id": "req_..." } ``` The values above are an illustration, and the list is cut to one result. `popularity.bucket` says how popular the result's site is, and `summary.removed.popularity` counts results the popularity cut took out of the list (for some sources, `web` and `news` among them, the cut is applied before results are counted and this stays 0). The SDKs unwrap `data`, so `results` and `summary` sit directly on the object they return. ## 4. Try more - Search several sources at once: `"sources": ["web", "news", "academic"]`. The [Sources](https://millionshort.com/docs/api-reference/sources) page lists all of them. - Keep only the most popular sites instead, with `only_top_sites`. - Add `"explain": true` to see why each result is where it is. It is free. - Give the same search to an agent through the [MCP server](https://millionshort.com/docs/mcp). The [Search reference](https://millionshort.com/docs/search/parameters) has every field. [Credits and limits](https://millionshort.com/docs/credits-and-limits) says what a call costs. --- Source: https://millionshort.com/docs/endpoints Section: Get started # The endpoints Six endpoints, one key. Search, Extract, Monitor, Map (with Crawl), Places and Agent are all available. MillionShort is built around six endpoints. Crawl is the job form of Map and has a section of its own. They share one key, one credit balance, one error shape and one answer envelope, so learning one teaches you the rest. These docs have a section for each, and every section has the same parts in the same order: an overview, a quickstart, the parameters, guides, pricing and limits, and errors. | Endpoint | What it does | Stage | |---|---|---| | [**Search**](https://millionshort.com/docs/search) | One ranked list from one to five of our 13 sources, with filters other search APIs do not have | **Available** | | [**Extract**](https://millionshort.com/docs/extract) | URLs in, each page back as clean text an agent can read | **Available** | | [**Monitor**](https://millionshort.com/docs/monitor) | Watch a search or a page and be told only when something changed | **Available** | | [**Map**](https://millionshort.com/docs/map), with [**Crawl**](https://millionshort.com/docs/crawl) | The addresses of a site in one call, and with Crawl, its pages as clean text, as a job | **Available** | | [**Places**](https://millionshort.com/docs/places) | Businesses and points of interest by what they are and where, as data | **Available** | | [**Agent**](https://millionshort.com/docs/agent) | A question in, an answer out in which every statement carries a checked quote from a page the run read | **Available** | ## Search Search the web and the specialist sources from one call, and say what kind of web you want: remove the most popular sites, keep or leave out kinds of page and topics, steer by site, and read each result's popularity and risk. Start at the [Search overview](https://millionshort.com/docs/search) or go straight to the [quickstart](https://millionshort.com/docs/quickstart). Two smaller calls belong with it: [`GET /v1/sources`](https://millionshort.com/docs/api-reference/sources) lists what a search accepts, and [`POST /v1/domain`](https://millionshort.com/docs/api-reference/domain) returns popularity and risk for any site. ## Extract Give it URLs and get each page back as clean text, with its title, metadata, links and labels that say what the page is. It honours robots.txt, identifies itself to sites, and charges only for pages that succeed. The [Extract section](https://millionshort.com/docs/extract) has the parameters and the prices. When the copy we hold is enough, a search can return the page text of web and news results itself, with [`include_content`](https://millionshort.com/docs/search/highlights). ## Monitor Save a search or a page, choose an interval, and be told only when something changed: new results for a search, or new text on a page. Events are delivered to a signed [webhook](https://millionshort.com/docs/webhooks) or pulled. The [Monitor section](https://millionshort.com/docs/monitor) has the parameters and the prices, and the [news monitoring guide](https://millionshort.com/docs/monitor/guides/news-monitoring) shows the job both ways: with a monitor, and with a scheduled search. ## Map Give it a site and get the addresses of its pages in one call, from the site's sitemaps, the links of the page you name and our own index, which adds titles and labels. With Crawl, get the pages themselves as clean text, as a job you poll: every page comes back as an Extract result with its labels. Both fetch the way Extract does: as our declared bot, within robots.txt, politely, and there is no option to ignore robots.txt. The [Map section](https://millionshort.com/docs/map) and the [Crawl section](https://millionshort.com/docs/crawl) have the parameters and the prices. To search only the pages of a site that we hold, a search takes `include_domains`. ## Places Find businesses and points of interest by what they are and where they are: "bike repair near the station", by a place name, a point or a box. Each place comes back as data, with its name, category, address, coordinates, phone number and website. There is no map and there are no tiles. Coverage is worldwide and uneven, opening hours are known for few places, and there are no ratings or reviews. The [Places section](https://millionshort.com/docs/places) has the parameters, the coverage and the price. A person can search the same places on the Maps tab of the [search site](https://millionshort.com/). ## Agent Ask a question and get a written answer assembled from several searches and the pages they lead to, as a job with a spending cap you set. Every statement carries a quote from a page the run read, and a statement whose quote is not in that page is removed. With a JSON Schema the answer comes back as data, with citations per field. It needs a language model at request time, so it is slower than a search, it is metered, and it can be wrong in ways a list of results cannot. The [Agent section](https://millionshort.com/docs/agent) has the parameters, the prices and the per-run cap of each plan. To assemble cited context for a model of your own instead, the [RAG guide](https://millionshort.com/docs/search/guides/rag) shows how. ## Building blocks, not endpoints - [**Spaces**](https://millionshort.com/docs/search/spaces) are saved scopes for a search, passed as `space`. They are free. The [Spaces API](https://millionshort.com/docs/spaces) manages them. - [**Webhooks**](https://millionshort.com/docs/webhooks) are where monitors, batches, crawls and agent runs deliver events. - The [**MCP server**](https://millionshort.com/docs/mcp) gives an agent the endpoints as tools, with or without a key. ## Not planned for now Some things other search and web-data APIs offer are not on our list today. We would rather say so than leave you guessing: - Screenshots. - A generated answer returned by the search call itself. ([Agent](https://millionshort.com/docs/agent) is a separate call.) - Find-similar: results like a page you name. - Stored collections of results that are enriched and refreshed. - A date filter on web pages. Web pages carry no date; the date filters work on the sources that do. - Ratings, reviews and photos of places. If one of these would decide whether you use MillionShort, [tell us](https://millionshort.com/contact). It changes what we build next. --- Source: https://millionshort.com/docs/search Section: Endpoints / Search # Search One call, one to five sources, one ranked list, and filters that say what kind of web you want. ```text POST https://api.millionshort.com/v1/search ``` Search is live. It answers from our own independent index: the web, Billions+ pages, and twelve specialist sources beside it. One request names one to five sources and gets back one ranked list in one shape, whichever sources answered. ```bash curl https://api.millionshort.com/v1/search \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "query": "sourdough starter hydration", "remove_top_sites": 10000 }' ``` ```python import os import requests r = requests.post( "https://api.millionshort.com/v1/search", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, json={ "query": "sourdough starter hydration", "remove_top_sites": 10000 }, timeout=30, ) r.raise_for_status() for hit in r.json()["data"]["results"]: print(hit["position"], hit["title"], hit["url"]) ``` ```ts const res = await fetch('https://api.millionshort.com/v1/search', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ "query": "sourdough starter hydration", "remove_top_sites": 10000 }), }); if (!res.ok) throw new Error(`POST /v1/search failed: ${res.status}`); const { data } = (await res.json()) as { data: { results: { position: number; title: string; url: string }[] }; }; for (const hit of data.results) console.log(hit.position, hit.title, hit.url); ``` The same call as a tool of the MCP server: ```json { "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "search", "arguments": { "query": "sourdough starter hydration", "remove_top_sites": 10000 } } } ``` ## What it is for - **Grounding a model.** Results come with long snippets, the passages that best answer the query, and for web and news the page text we hold, so many jobs need no second call. - **Reaching past the usual sites.** `remove_top_sites` takes the most popular sites out of the results. What is left is the long tail: specialists, primary sources, small sites. - **Asking the right specialist.** Papers, court opinions, filings, forum threads, podcasts and news each have a source built for them, and one call can ask up to five. - **Judging a result before reading it.** Every result says how popular its site is and whether it carries a risk label. ## In this section | Part | Page | |---|---| | Quickstart | [A first search, then one filter at a time](https://millionshort.com/docs/search/quickstart) | | Parameters | [Every request field and the whole response](https://millionshort.com/docs/search/parameters) | | Guides | [RAG, agent tool use, long-tail research](https://millionshort.com/docs/search/guides), and the [filter recipes](https://millionshort.com/docs/search/filters#agent-recipes) | | Pricing and limits | [What a search costs and how many you can run](https://millionshort.com/docs/search/pricing) | | Errors | [The errors and warnings of a search](https://millionshort.com/docs/search/errors) | ## What a search can do | Page | What it covers | |---|---| | [Sources](https://millionshort.com/docs/search/sources) | The 13 sources, a page each: what it holds, what its results carry, queries to try | | [Mixture of Experts](https://millionshort.com/docs/search/mixture-of-experts) | Why the sources are separate specialists, and how one call asks several | | [Filters](https://millionshort.com/docs/search/filters) | Every filter on one page, with recipes for agents | | [Remove top sites](https://millionshort.com/docs/search/remove-top-sites) | The popularity cut: `remove_top_sites` and `only_top_sites` | | [Lenses](https://millionshort.com/docs/search/lenses) | Boost, bury, block, or search only named sites | | [Spaces](https://millionshort.com/docs/search/spaces) | A saved scope, passed as `space` | | [Topics and page types](https://millionshort.com/docs/search/topics-and-page-types) | 24 subjects and 23 kinds of page to keep or leave out | | [Popularity and risk](https://millionshort.com/docs/search/popularity-and-risk) | What each result says about its site | | [Site signals](https://millionshort.com/docs/search/site-signals) | Traffic trend, where a site is popular, what it is built with | | [Freshness](https://millionshort.com/docs/search/freshness) | How current each source is, and how to read dates | | [Highlights and page text](https://millionshort.com/docs/search/highlights) | The best passages of each result, and the text of the page itself | ## Beside the API The same search is a tool of the hosted [MCP server](https://millionshort.com/docs/mcp), with or without a key, and a method of the [Python](https://millionshort.com/docs/sdks/python) and [TypeScript](https://millionshort.com/docs/sdks/typescript) SDKs. Two smaller calls go with it: [`GET /v1/sources`](https://millionshort.com/docs/api-reference/sources) lists the sources, page types and topics a search accepts, and [`POST /v1/domain`](https://millionshort.com/docs/api-reference/domain) returns popularity and risk for any site. ## With the other endpoints Search finds pages. [Extract](https://millionshort.com/docs/extract) reads them, [Monitor](https://millionshort.com/docs/monitor) watches a search for new results, [Map](https://millionshort.com/docs/map) and [Crawl](https://millionshort.com/docs/crawl) find and read the pages of one site, and [Places](https://millionshort.com/docs/places) finds businesses and points of interest. [Agent](https://millionshort.com/docs/agent) runs several searches to answer one question, with a checked quote for every statement. [The endpoints](https://millionshort.com/docs/endpoints) has all six at a glance. --- Source: https://millionshort.com/docs/search/quickstart Section: Endpoints / Search # Search quickstart A first search, then one more field at a time until it is the search you want. You need a key in `MILLIONSHORT_API_KEY`. The [Quickstart](https://millionshort.com/docs/quickstart) gets you one in a minute, and the Free plan needs no card. Each step below is a complete request. ## 1. Search the web ```bash curl https://api.millionshort.com/v1/search \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "query": "restoring a cast iron skillet" }' ``` ```python import os import requests r = requests.post( "https://api.millionshort.com/v1/search", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, json={ "query": "restoring a cast iron skillet" }, timeout=30, ) r.raise_for_status() for hit in r.json()["data"]["results"]: print(hit["position"], hit["title"], hit["url"]) ``` ```ts const res = await fetch('https://api.millionshort.com/v1/search', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ "query": "restoring a cast iron skillet" }), }); if (!res.ok) throw new Error(`POST /v1/search failed: ${res.status}`); const { data } = (await res.json()) as { data: { results: { position: number; title: string; url: string }[] }; }; for (const hit of data.results) console.log(hit.position, hit.title, hit.url); ``` The same call as a tool of the MCP server: ```json { "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "search", "arguments": { "query": "restoring a cast iron skillet" } } } ``` With no `sources`, the search asks `web`. The answer is `data.results`: each result has a `title`, a `url`, a `snippet`, the `source` it came from, and the `popularity` and `risk` of its site. `usage` says what the call cost. ## 2. Leave out the most popular sites ```bash curl https://api.millionshort.com/v1/search \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "query": "restoring a cast iron skillet", "remove_top_sites": 10000 }' ``` ```python import os import requests r = requests.post( "https://api.millionshort.com/v1/search", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, json={ "query": "restoring a cast iron skillet", "remove_top_sites": 10000 }, timeout=30, ) r.raise_for_status() for hit in r.json()["data"]["results"]: print(hit["position"], hit["title"], hit["url"]) ``` ```ts const res = await fetch('https://api.millionshort.com/v1/search', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ "query": "restoring a cast iron skillet", "remove_top_sites": 10000 }), }); if (!res.ok) throw new Error(`POST /v1/search failed: ${res.status}`); const { data } = (await res.json()) as { data: { results: { position: number; title: string; url: string }[] }; }; for (const hit of data.results) console.log(hit.position, hit.title, hit.url); ``` The same call as a tool of the MCP server: ```json { "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "search", "arguments": { "query": "restoring a cast iron skillet", "remove_top_sites": 10000 } } } ``` The 10,000 most popular sites are gone from the list, and what is left is what usually sits beneath them. [Remove top sites](https://millionshort.com/docs/search/remove-top-sites) says how to choose the number. ## 3. Ask the specialists ```bash curl https://api.millionshort.com/v1/search \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "query": "transformer interpretability", "sources": ["web", "academic", "hn"], "num_results": 20 }' ``` ```python import os import requests r = requests.post( "https://api.millionshort.com/v1/search", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, json={ "query": "transformer interpretability", "sources": [ "web", "academic", "hn" ], "num_results": 20 }, timeout=30, ) r.raise_for_status() for hit in r.json()["data"]["results"]: print(hit["position"], hit["title"], hit["url"]) ``` ```ts const res = await fetch('https://api.millionshort.com/v1/search', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ "query": "transformer interpretability", "sources": [ "web", "academic", "hn" ], "num_results": 20 }), }); if (!res.ok) throw new Error(`POST /v1/search failed: ${res.status}`); const { data } = (await res.json()) as { data: { results: { position: number; title: string; url: string }[] }; }; for (const hit of data.results) console.log(hit.position, hit.title, hit.url); ``` The same call as a tool of the MCP server: ```json { "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "search", "arguments": { "query": "transformer interpretability", "sources": [ "web", "academic", "hn" ], "num_results": 20 } } } ``` Up to five [sources](https://millionshort.com/docs/search/sources) in one call, merged into one list. Each source searched costs one credit. ## 4. Keep only the kinds of page you want ```bash curl https://api.millionshort.com/v1/search \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "query": "rate limiting with a token bucket", "page_types": ["tutorials", "documentation"] }' ``` ```python import os import requests r = requests.post( "https://api.millionshort.com/v1/search", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, json={ "query": "rate limiting with a token bucket", "page_types": [ "tutorials", "documentation" ] }, timeout=30, ) r.raise_for_status() for hit in r.json()["data"]["results"]: print(hit["position"], hit["title"], hit["url"]) ``` ```ts const res = await fetch('https://api.millionshort.com/v1/search', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ "query": "rate limiting with a token bucket", "page_types": [ "tutorials", "documentation" ] }), }); if (!res.ok) throw new Error(`POST /v1/search failed: ${res.status}`); const { data } = (await res.json()) as { data: { results: { position: number; title: string; url: string }[] }; }; for (const hit of data.results) console.log(hit.position, hit.title, hit.url); ``` The same call as a tool of the MCP server: ```json { "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "search", "arguments": { "query": "rate limiting with a token bucket", "page_types": [ "tutorials", "documentation" ] } } } ``` [Topics and page types](https://millionshort.com/docs/search/topics-and-page-types) lists the slugs. Filters are free and combine. ## 5. Get the passages, or the page ```bash curl https://api.millionshort.com/v1/search \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "query": "sourdough starter hydration", "num_results": 5, "max_highlights": 3, "include_content": true, "max_characters": 4000 }' ``` ```python import os import requests r = requests.post( "https://api.millionshort.com/v1/search", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, json={ "query": "sourdough starter hydration", "num_results": 5, "max_highlights": 3, "include_content": True, "max_characters": 4000 }, timeout=30, ) r.raise_for_status() for hit in r.json()["data"]["results"]: print(hit["position"], hit["title"], hit["url"]) ``` ```ts const res = await fetch('https://api.millionshort.com/v1/search', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ "query": "sourdough starter hydration", "num_results": 5, "max_highlights": 3, "include_content": true, "max_characters": 4000 }), }); if (!res.ok) throw new Error(`POST /v1/search failed: ${res.status}`); const { data } = (await res.json()) as { data: { results: { position: number; title: string; url: string }[] }; }; for (const hit of data.results) console.log(hit.position, hit.title, hit.url); ``` The same call as a tool of the MCP server: ```json { "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "search", "arguments": { "query": "sourdough starter hydration", "num_results": 5, "max_highlights": 3, "include_content": true, "max_characters": 4000 } } } ``` `max_highlights` returns the passages of each result that best answer the query, free. `include_content` adds the page text we hold for web and news results, for 1 credit a call, which covers up to 10 results. See [Highlights and page text](https://millionshort.com/docs/search/highlights). ## Next - [Parameters](https://millionshort.com/docs/search/parameters): every field, and the whole response. - [Filters](https://millionshort.com/docs/search/filters): all of them on one page, with recipes for agents. - [Guides](https://millionshort.com/docs/search/guides): retrieval for a model, search as an agent's tool, long-tail research. - [MCP server](https://millionshort.com/docs/mcp): the same search as a tool, with no code. --- Source: https://millionshort.com/docs/search/parameters Section: Endpoints / Search # Search parameters Every field of a search request, and everything that comes back. ```text POST https://api.millionshort.com/v1/search ``` Searches one to five sources and returns one ranked list. Results from several sources are merged by rank and duplicates are removed. The call is synchronous. It needs an [API key](https://millionshort.com/docs/authentication). ## Request A JSON body. Only `query` is required. A field that is not listed here is refused with `400 INVALID_PARAM`. | Field | Type | Default | Notes | |---|---|---|---| | `query` | string, 1 to 400 characters | | Required. | | `sources` | array of `web`, `news`, `smallweb`, `discussions`, `hn`, `social`, `communities`, `podcasts`, `academic`, `medical`, `law`, `finance`, `contracts`, 1 to 5 items | `["web"]` | Sources to search. Each source searched costs 1 credit. | | `num_results` | integer, 1 to 50 | `10` | How many results to return in total. With several sources this is the length of the one merged list, not a count per source. | | `remove_top_sites` | integer, 0 to 1,000,000 | `0` | Remove results from the N most popular sites. 0 keeps everything. Free. | | `only_top_sites` | integer, 0 to 1,000,000 | `0` | Keep only results from the N most popular sites. Cannot be combined with `remove_top_sites`. | | `include_domains` | array of strings, up to 25 | | Return results from these sites only. | | `exclude_domains` | array of strings, up to 25 | | Never return results from these sites. | | `boost_domains` | array of strings, up to 25 | | Move results from these sites ahead of the rest. | | `bury_domains` | array of strings, up to 25 | | Move results from these sites to the end. | | `only_domains` | array of strings, up to 25 | | Another name for `include_domains`. Both sent are merged. | | `block_domains` | array of strings, up to 25 | | Another name for `exclude_domains`. Both sent are merged. | | `page_types` | array of `research`, `directories`, `creative-writing`, `support`, `comments`, `faqs`, `reference`, `legal`, `listicles`, `news`, `articles`, `companies`, `press-releases`, `profiles`, `blogs`, `products`, `forums`, `spam`, `data`, `documentation`, `transcripts`, `tutorials`, `reviews` | | Keep only these kinds of page, for example `[tutorials, documentation]`. Applied by `web` and `news`; other sources in the call get a `filter_not_applied` warning. | | `exclude_page_types` | array of `research`, `directories`, `creative-writing`, `support`, `comments`, `faqs`, `reference`, `legal`, `listicles`, `news`, `articles`, `companies`, `press-releases`, `profiles`, `blogs`, `products`, `forums`, `spam`, `data`, `documentation`, `transcripts`, `tutorials`, `reviews` | | Never return these kinds of page, for example `[listicles, spam]`. | | `boost_page_types` | array of `research`, `directories`, `creative-writing`, `support`, `comments`, `faqs`, `reference`, `legal`, `listicles`, `news`, `articles`, `companies`, `press-releases`, `profiles`, `blogs`, `products`, `forums`, `spam`, `data`, `documentation`, `transcripts`, `tutorials`, `reviews` | | Move these kinds of page ahead of the rest, for example `[documentation]`. | | `bury_page_types` | array of `research`, `directories`, `creative-writing`, `support`, `comments`, `faqs`, `reference`, `legal`, `listicles`, `news`, `articles`, `companies`, `press-releases`, `profiles`, `blogs`, `products`, `forums`, `spam`, `data`, `documentation`, `transcripts`, `tutorials`, `reviews` | | Move these kinds of page to the end, for example `[forums]`. | | `topics` | array of `adult`, `art`, `programming`, `law`, `education`, `hardware`, `entertainment`, `social-life`, `fashion`, `business`, `food`, `games`, `health`, `history`, `home`, `industry`, `literature`, `politics`, `religion`, `science`, `software`, `sports`, `transport`, `travel` | | Keep only these topics, for example `[science, health]`. Applied by `web` and `news`; other sources in the call get a `filter_not_applied` warning. | | `exclude_topics` | array of `adult`, `art`, `programming`, `law`, `education`, `hardware`, `entertainment`, `social-life`, `fashion`, `business`, `food`, `games`, `health`, `history`, `home`, `industry`, `literature`, `politics`, `religion`, `science`, `software`, `sports`, `transport`, `travel` | | Never return these topics, for example `[adult]`. | | `boost_topics` | array of `adult`, `art`, `programming`, `law`, `education`, `hardware`, `entertainment`, `social-life`, `fashion`, `business`, `food`, `games`, `health`, `history`, `home`, `industry`, `literature`, `politics`, `religion`, `science`, `software`, `sports`, `transport`, `travel` | | Move these topics ahead of the rest, for example `[programming]`. | | `bury_topics` | array of `adult`, `art`, `programming`, `law`, `education`, `hardware`, `entertainment`, `social-life`, `fashion`, `business`, `food`, `games`, `health`, `history`, `home`, `industry`, `literature`, `politics`, `religion`, `science`, `software`, `sports`, `transport`, `travel` | | Move these topics to the end, for example `[entertainment]`. | | `popularity_buckets` | array of `top-100`, `top-1k`, `top-10k`, `top-100k`, `top-1m`, `long-tail` | | Keep results whose site is in one of these popularity buckets, for example `[long-tail, top-1m]`. See also `remove_top_sites` and `only_top_sites`. | | `traffic_trend` | array of `rising`, `spiking`, `steady`, `falling`, `dropped`, `new` | | Keep results whose site's traffic is moving this way, for example `[rising, spiking]`. Each result says its own in `traffic_trend`. The site filters are checked on the best matches for the query, and sites on the move are rare: expect a short list. | | `popular_in` | array of strings, 1 to 10 items | | Keep results whose site is popular in any of these countries, for example `[DE, AT]`. Each result lists its own in `popular_in`. | | `site_tech` | array of strings (each 1 to 40 characters), 1 to 10 items | | Keep results whose site is built with any of these, for example `[wordpress, woocommerce]`. Names are matched without regard to case against what results return in `site_tech`. A name is letters, digits, spaces and `. + # / -`, starting with a letter or digit. | | `exclude_risky` | boolean | `false` | Drop results whose site carries a risk label (`risk` is not null). | | `start_date` | string or null | | Results published on or after this day (`YYYY-MM-DD`). Applied by `news`, `hn`, `social`, `communities`, `podcasts`, `academic`, `medical`, `law`, `finance` and `contracts`. `web` pages carry no date: a `filter_not_applied` warning says so. | | `end_date` | string or null | | Results published on or before this day (`YYYY-MM-DD`). Same sources as `start_date`. | | `time_range` | `day`, `week`, `month`, `year` or null | | The last 1, 7, 30 or 365 days. Cannot be combined with `start_date` or `end_date`. | | `language` | string or null | | A two-letter language code such as `en` or `de`. Applied by `news`, `hn`, `social`, `communities`, `podcasts` and `academic`, which store a language. `web` stores none: the language of each web result is detected from its text, the filter is applied to the best matches, and a `language_detected` warning says so. | | `country` | string or null | | Results from this country. `web` and `news`: sites with the country's domain ending (`.de`, `.co.uk`; for `US` also `.gov`, `.edu` and `.mil`). `finance`: the filer's country. `contracts`: `US` or `CA`. Other sources get a `filter_not_applied` warning. | | `max_highlights` | integer, 0 to 5 | `0` | Return up to this many passages per result that best answer the query, in `highlights`, with `highlight_spans`. 0 keeps `highlights` as the snippet alone. Free. | | `highlight_characters` | integer, 100 to 600 | `300` | Target length of one highlight. Needs `max_highlights`. | | `include_content` | boolean | `false` | Add `content` to each result: the text of the page as we hold it, for `web` and `news` results. No request is made to the site. 1 credit per call, covering up to 10 results that come back with content; each further 10 (or part) 1 more; nothing when none comes back with content. | | `max_characters` | integer, 500 to 50,000 | `10000` | Longest `content.text` to return. Needs `include_content`. | | `safe_search` | `off`, `moderate`, `strict` | `"moderate"` | | | `max_chars_per_result` | integer, 0 to 2,000 | `800` | Longest snippet to return per result, in characters. 0 returns no snippets. | | `explain` | boolean | `false` | Add `why` and `signals` to every result. Free. | Notes: - **Sources.** `sources` takes the slugs on the [Sources](https://millionshort.com/docs/api-reference/sources) page. Each source searched costs 1 credit. - **Number of results.** `num_results` is the length of the one merged list, for the whole call. It is not a number per source. - **Popularity.** `remove_top_sites: 10000` removes every result whose site is among the 10,000 most popular, which is how you reach the long tail. `only_top_sites` does the opposite. Sending both with a value above 0 is a `400`. - **Domain lists.** A leading `www.`, a scheme or a path in an entry is ignored. `include_domains` and `exclude_domains` filter; `boost_domains` and `bury_domains` only change the order. - **Snippets.** `max_chars_per_result` sets the longest snippet. `0` returns no snippets. Every filter below is free. ### Boost, bury, block, only Four verbs, and they work on sites, on page types and on topics: | Verb | Sites | Page types | Topics | |---|---|---|---| | Keep only | `include_domains` (or `only_domains`) | `page_types` | `topics` | | Never return | `exclude_domains` (or `block_domains`) | `exclude_page_types` | `exclude_topics` | | Move ahead | `boost_domains` | `boost_page_types` | `boost_topics` | | Move to the end | `bury_domains` | `bury_page_types` | `bury_topics` | ```json { "query": "rust lifetime elision", "page_types": ["tutorials", "documentation"], "bury_page_types": ["forums"], "exclude_page_types": ["listicles"] } ``` ### Page types and topics Web and news results carry a page type (what kind of page it is) and a topic (what it is about); either can be `null` when it is not known. The page-type and topic lists act on `web` and `news` only. Another source in the same call gets a warning, even where its results carry the labels. The two lists: - **Page types:** `research`, `directories`, `creative-writing`, `support`, `comments`, `faqs`, `reference`, `legal`, `listicles`, `news`, `articles`, `companies`, `press-releases`, `profiles`, `blogs`, `products`, `forums`, `spam`, `data`, `documentation`, `transcripts`, `tutorials`, `reviews` - **Topics:** `adult`, `art`, `programming`, `law`, `education`, `hardware`, `entertainment`, `social-life`, `fashion`, `business`, `food`, `games`, `health`, `history`, `home`, `industry`, `literature`, `politics`, `religion`, `science`, `software`, `sports`, `transport`, `travel` ```json { "query": "creatine", "boost_topics": ["science", "health"], "exclude_topics": ["sports"] } ``` ### Popularity `remove_top_sites` and `only_top_sites` cut by rank. `popularity_buckets` keeps the buckets you name: `top-100`, `top-1k`, `top-10k`, `top-100k`, `top-1m`, `long-tail`. `popular_in` keeps sites that are popular in at least one of the countries you name, and each result lists its own countries in `popular_in`. ```json { "query": "heat pump grant", "popular_in": ["GB", "IE"] } ``` ### Traffic trend Each result says how visits to its site are moving, in `traffic_trend`: `rising`, `spiking`, `steady`, `falling`, `dropped`, `new`. `rising` is growing, `spiking` jumped sharply in the last days, `falling` is shrinking, `dropped` fell sharply, `new` appeared recently, `steady` shows no clear change. Send `traffic_trend` to keep only the sites moving the way you name. Most sites are steady, and many small sites have no trend at all (`null`). A filter for `rising` or `spiking` therefore keeps few results and often none: use it with a broad query, ask for 20 or more results, and expect a short list, sometimes an empty one (the response then carries a `short_results` warning). To see the trend without filtering, read `traffic_trend` on each result. ```json { "query": "best running shoes", "traffic_trend": ["rising", "spiking", "new"], "num_results": 20 } ``` ### Site technology Each result lists what its site is built with in `site_tech`, for example `["WordPress", "WooCommerce"]`. Send `site_tech` to keep only sites built with one of the names you give. Names are matched without regard to case. ```json { "query": "handmade ceramic mugs", "site_tech": ["woocommerce"], "page_types": ["products"] } ``` ### Risk A result whose site carries a risk label says so in `risk`. `exclude_risky: true` drops those results. ```json { "query": "free vpn comparison", "popularity_buckets": ["long-tail", "top-1m"], "exclude_risky": true } ``` ### Dates, language and country `start_date` and `end_date` are days written `YYYY-MM-DD`; both days are included. `time_range` is a shorthand for the last day, week, month or year and cannot be combined with the two dates. `language` is a two-letter language code and `country` a two-letter country code. ```json { "query": "Bundestag Haushalt", "sources": ["news"], "time_range": "week", "language": "de" } ``` German pages from the web source. Web stores no language, so each result's language is detected from its text; the results say `"language": "de"` and the response carries a `language_detected` warning: ```json { "query": "wärmepumpe förderung", "language": "de" } ``` A web result whose language cannot be told has `language: null` and does not pass a `language` filter. The filter is checked on the best matches for the query, not on the whole index, so the list can be short. ```json { "query": "planning permission loft conversion", "country": "GB" } ``` Not every source can apply every one of these. **A filter is never ignored silently:** where a source cannot apply it, that source's results come back as if the filter had not been sent, and the response carries a `filter_not_applied` warning that names the filter and the sources. Three cases are more exact than that: `hn` and `social` hold the last 30 days, so a date range that ends earlier returns nothing from them, and the warning says so; a filter that is not available right now carries no `sources` and was applied nowhere; and `include_content` on a source without stored page text is reported the same way. | Filter | Applied by | Elsewhere | |---|---|---| | `start_date`, `end_date`, `time_range` | `news`, `hn`, `social`, `communities`, `podcasts`, `academic`, `medical`, `law`, `finance`, `contracts` | `web` pages carry no date of their own, so `web` gets a warning. So do `smallweb` and `discussions` | | `language` | `news`, `hn`, `social`, `communities`, `podcasts`, `academic`. `web` stores no language (it is mostly English, with pages in other languages too): the language of each web result is detected from its text, the filter is applied to the best matches, and a `language_detected` warning says so | a warning | | `country` | `web` and `news`: sites with the country's domain ending, such as `.de` or `.co.uk` (for `US` also `.gov`, `.edu` and `.mil`). `finance`: the filer's country. `contracts`: `US` or `CA` | a warning | | `page_types`, `topics` | `web`, `news` | a warning | | `exclude_page_types`, `boost_page_types`, `bury_page_types` and the three topic lists | `web`, `news` | a warning | | The domain lists, `remove_top_sites`, `only_top_sites`, `popularity_buckets`, `traffic_trend`, `popular_in`, `site_tech`, `exclude_risky` | every source. A result with no site of its own, such as a post on a platform, has no site facts and does not pass a site filter | | `GET /v1/sources` returns the same table as data: each source lists the filters it applies. ### Highlights `max_highlights` (0 to 5; 0 is off) returns the passages of each result that best answer the query, best first, in `highlights`. `highlight_characters` sets how long one passage should be. Highlights are free. Each highlight has a span in `highlight_spans`, in the same order: | Field | Type | Notes | |---|---|---| | `start` | integer, 0 or more or null | Character offset (in Unicode code points) of the highlight in `content.text` as this result returns it. Null when there is nothing to point into: `include_content` was not sent, the highlight lies past the `max_characters` cut, or we hold no page text for the result. | | `end` | integer or null | The offset just past the highlight. Null with `start`. | | `score` | number, 0 to 1 | 1.0 is a full-length passage of plain prose that holds every word of the query. | ```json { "query": "sourdough starter hydration", "max_highlights": 3 } ``` Without `max_highlights`, `highlights` is the snippet as a one-item list, as before. ### Page content `include_content: true` adds `content` to each `web` and `news` result: the text of the page as we hold it. We do not hold text for every result: those have `content: null`, are not charged, and the response carries a `content_partial` warning. No request is made to the site, so it is fast and it cannot be blocked. `max_characters` cuts the text (500 to 50,000, default 10,000). | Field | Type | Notes | |---|---|---| | `text` | string | The page's text: menus and page chrome removed, e-mail addresses and phone numbers redacted, cut at `max_characters`. | | `characters` | integer | Length of `text`. | | `truncated` | boolean | True when the page is longer than `text`. | | `captured_from` | string | The earliest day this copy can have been taken. Treat the page as being this old. | | `captured_to` | string | The latest day this copy can have been taken. The same day as `captured_from` for news. | The text is cleaned: menus and page chrome are taken out, and e-mail addresses and phone numbers are replaced with `[email]` and `[phone]`. It is the page as it was when we captured it: for a web result `captured_from` and `captured_to` give the window, and you should treat the page as being as old as `captured_from`; for a news result both are the day the article was collected. A result we hold no text for has `content: null`. ```json { "query": "sourdough starter hydration", "num_results": 5, "include_content": true, "max_characters": 4000 } ``` Content adds 1 credit to the call, which covers the page text of up to 10 results; each further 10 results that come back with text (or part of 10) add 1 more. A call where every `content` is `null` is not charged for content. ### Rules between fields Each of these is a `400 INVALID_PARAM`: a value in both `page_types` and `exclude_page_types` (or in both `topics` and `exclude_topics`); more than 25 domains in `include_domains` and `only_domains` together (the same for `exclude_domains` and `block_domains`); a date outside the years 1000 to 2100; `time_range` together with `start_date` or `end_date`; `max_characters` without `include_content`; `highlight_characters` without `max_highlights`. ### A saved scope: `space` `space` searches with a saved scope from [Spaces](https://millionshort.com/docs/spaces). | Field | Type | Default | Notes | |---|---|---|---| | `space` | string, up to 80 characters | | The [Space](https://millionshort.com/docs/search/spaces) to search with: its id (`spc_` and 26 characters), a slug of your team, or `curated:` and the slug of a curated Space | ```json { "query": "sourdough hydration", "space": "baking" } ``` A Space is a saved set of the fields above: sites, the popularity cut, page types, topics, a lens, site filters, default sources and `safe_search`. A field you send in the request replaces the Space's value for that setting; everything you do not send comes from the Space. The answer then carries `data.space`, which names the Space, lists the settings it supplied (`applied`) and the request fields that replaced one (`overridden`). A Space costs nothing: the search costs what it would cost without it. A Space that searches inside a list of sites applies its first 50; a longer list is cut and the answer carries a `space_sites_cut` warning. A Space that does not exist is a `404 SPACE_NOT_FOUND`. [Using a Space on a search](https://millionshort.com/docs/spaces#using-a-space-on-a-search) has the table of which field replaces which setting, the shape of `data.space` and how such a search is counted. ### Accepted for older clients These fields are accepted so that existing clients keep working. | Field | Type | Notes | |---|---|---| | `index_level` | `full`, `top100`, `top1k`, `top10k`, `top100k`, `top1m` | Earlier spelling of `remove_top_sites`: `top10k` means `remove_top_sites: 10000`, `full` means 0. | | `mode` | `standard` | There is one mode. The field is accepted so existing clients keep working. | ## Examples The web without its 10,000 most popular sites: ```bash curl https://api.millionshort.com/v1/search \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "query": "sourdough starter hydration", "remove_top_sites": 10000 }' ``` ```python import os import requests r = requests.post( "https://api.millionshort.com/v1/search", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, json={ "query": "sourdough starter hydration", "remove_top_sites": 10000 }, timeout=30, ) r.raise_for_status() for hit in r.json()["data"]["results"]: print(hit["position"], hit["title"], hit["url"]) ``` ```ts const res = await fetch('https://api.millionshort.com/v1/search', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ "query": "sourdough starter hydration", "remove_top_sites": 10000 }), }); if (!res.ok) throw new Error(`POST /v1/search failed: ${res.status}`); const { data } = (await res.json()) as { data: { results: { position: number; title: string; url: string }[] }; }; for (const hit of data.results) console.log(hit.position, hit.title, hit.url); ``` The same call as a tool of the MCP server: ```json { "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "search", "arguments": { "query": "sourdough starter hydration", "remove_top_sites": 10000 } } } ``` Three sources, twenty results, with the reasons for each result: ```bash curl https://api.millionshort.com/v1/search \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "query": "transformer interpretability", "sources": ["web", "academic", "hn"], "num_results": 20, "explain": true }' ``` ```python import os import requests r = requests.post( "https://api.millionshort.com/v1/search", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, json={ "query": "transformer interpretability", "sources": [ "web", "academic", "hn" ], "num_results": 20, "explain": True }, timeout=30, ) r.raise_for_status() for hit in r.json()["data"]["results"]: print(hit["position"], hit["title"], hit["url"]) ``` ```ts const res = await fetch('https://api.millionshort.com/v1/search', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ "query": "transformer interpretability", "sources": [ "web", "academic", "hn" ], "num_results": 20, "explain": true }), }); if (!res.ok) throw new Error(`POST /v1/search failed: ${res.status}`); const { data } = (await res.json()) as { data: { results: { position: number; title: string; url: string }[] }; }; for (const hit of data.results) console.log(hit.position, hit.title, hit.url); ``` The same call as a tool of the MCP server: ```json { "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "search", "arguments": { "query": "transformer interpretability", "sources": [ "web", "academic", "hn" ], "num_results": 20, "explain": true } } } ``` Tutorials and documentation only, with two sites left out and one moved up: ```bash curl https://api.millionshort.com/v1/search \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "query": "rate limiting with a token bucket", "page_types": ["tutorials", "documentation"], "exclude_domains": ["example.com", "example.net"], "boost_domains": ["example.org"], "safe_search": "strict", "max_chars_per_result": 300 }' ``` ```python import os import requests r = requests.post( "https://api.millionshort.com/v1/search", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, json={ "query": "rate limiting with a token bucket", "page_types": [ "tutorials", "documentation" ], "exclude_domains": [ "example.com", "example.net" ], "boost_domains": [ "example.org" ], "safe_search": "strict", "max_chars_per_result": 300 }, timeout=30, ) r.raise_for_status() for hit in r.json()["data"]["results"]: print(hit["position"], hit["title"], hit["url"]) ``` ```ts const res = await fetch('https://api.millionshort.com/v1/search', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ "query": "rate limiting with a token bucket", "page_types": [ "tutorials", "documentation" ], "exclude_domains": [ "example.com", "example.net" ], "boost_domains": [ "example.org" ], "safe_search": "strict", "max_chars_per_result": 300 }), }); if (!res.ok) throw new Error(`POST /v1/search failed: ${res.status}`); const { data } = (await res.json()) as { data: { results: { position: number; title: string; url: string }[] }; }; for (const hit of data.results) console.log(hit.position, hit.title, hit.url); ``` The same call as a tool of the MCP server: ```json { "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "search", "arguments": { "query": "rate limiting with a token bucket", "page_types": [ "tutorials", "documentation" ], "exclude_domains": [ "example.com", "example.net" ], "boost_domains": [ "example.org" ], "safe_search": "strict", "max_chars_per_result": 300 } } } ``` ## Response ```json { "data": { "results": [ { "title": "Hydration levels for a sourdough starter, measured", "url": "https://example.org/starter-hydration", "site": "example.org", "source": "web", "snippet": "At 100% hydration the starter peaks in four to six hours...", "highlights": ["At 100% hydration the starter peaks in four to six hours..."], "published_date": null, "page_type": "articles", "topic": "food", "popularity": { "rank": null, "bucket": "long-tail" }, "risk": null, "position": 1, "score": 1.0, "extra": { "author": "A. Baker" }, "language": "en", "traffic_trend": "steady", "popular_in": null, "site_tech": ["WordPress"] } ], "summary": { "returned": 10, "removed": { "popularity": 37, "blocked": 0, "duplicates": 3, "risk": 0, "safe_search": 0, "filters": 0 } }, "warnings": [] }, "usage": { "credits": 1, "cost_usd": 0.001, "breakdown": { "search": 1 } }, "warnings": [], "request_id": "req_..." } ``` The values are an illustration and the list is cut to one result; the shape is exact. ### A result | Field | Type | Notes | |---|---|---| | `title` | string | | | `url` | string | | | `site` | string or null | The host name | | `source` | `web`, `news`, `smallweb`, `discussions`, `hn`, `social`, `communities`, `podcasts`, `academic`, `medical`, `law`, `finance`, `contracts` | A source slug. `GET /v1/sources` describes each one. | | `snippet` | string | The passage of the page that matches the query. | | `highlights` | array of strings | The snippet as a one-item list. With `max_highlights`: up to that many passages that best answer the query, best first. | | `highlight_spans` | array of objects | Only with `max_highlights`: one entry per highlight, in the same order. | | `content` | object or null | Only with `include_content`: the page's text, or null when we hold none for this result. | | `language` | string or null | The result's language as a two-letter code, or null when not known. Stored by the source for `news`, `hn`, `social`, `podcasts` and `academic`; detected from the result's text for `web`, where a result whose language cannot be told has null and does not pass a `language` filter. | | `traffic_trend` | `rising`, `spiking`, `steady`, `falling`, `dropped`, `new` or null | How visits to the result's site are moving, or null when not known. | | `popular_in` | array of strings, up to 12 or null | The countries (two-letter codes) where the result's site is among the popular sites, or null when not known. | | `site_tech` | array of strings, up to 8 or null | What the result's site is built with, for example `[WordPress, WooCommerce]`. An empty list when we looked and recognised nothing; null when we have not looked. | | `published_date` | string or null | `YYYY-MM-DD`, or a year, when the source knows it. Web results have no date. | | `page_type` | string or null | A page-type slug from `GET /v1/sources`. | | `topic` | string or null | A topic slug from `GET /v1/sources`. | | `popularity` | object | | | `risk` | object or null | | | `position` | integer, 1 or more | | | `score` | number | Rank-based, from 1.0 for the first result downwards. Not comparable across calls. | | `extra` | object | A few fields that only some sources have, such as `authors`, `venue`, `year`, `citations`, `points` or `filer`. Values are strings, numbers or booleans. | | `why` | array of strings | Only with `explain`: why this result is here, at this position. | | `signals` | object | Only with `explain`. | `popularity`: | Field | Type | Notes | |---|---|---| | `rank` | integer or null | The site's popularity rank (1 is the most popular), or null when it is outside the top 1,000,000 or unknown. | | `bucket` | `top-100`, `top-1k`, `top-10k`, `top-100k`, `top-1m`, `long-tail`, `unknown` | | `risk` is `null` for most sites. When a site carries a risk label: | Field | Type | Notes | |---|---|---| | `level` | `labelled`, `demoted`, `blocked` | | | `categories` | array of strings | | `signals`, present only with `explain`: | Field | Type | Notes | |---|---|---| | `text_rank` | integer or null | Position by text relevance alone. | | `link_authority` | number, 0 to 10 or null | How well linked the site is, 0 to 10. Null when the source has none for the result. | | `words` | integer or null | Length of the page in words. | ### Summary `data.summary.returned` is the number of results in the list. `data.summary.removed` counts what was taken out, by reason: | Field | Type | Notes | |---|---|---| | `popularity` | integer | Removed by `remove_top_sites` or `only_top_sites`. | | `blocked` | integer | Removed by `exclude_domains` (`block_domains`), `exclude_page_types` or `exclude_topics`. | | `duplicates` | integer | | | `risk` | integer | | | `safe_search` | integer | | | `filters` | integer | Removed by `popularity_buckets`, `traffic_trend`, `popular_in`, `site_tech` or `exclude_risky`. | For some sources, `web` and `news` among them, the popularity cut and the domain lists are applied before results are counted, so `popularity` and `blocked` can be 0 when the filter plainly worked. Judge by the results that came back. ### Usage | Field | Type | Notes | |---|---|---| | `credits` | number | Credits charged for this call. | | `cost_usd` | number | The same amount in US dollars. | | `breakdown` | object | Credits by line item, for example `search` and `additional_results`. | ### Warnings A warning is a notice that did not fail the call. The same list appears as `data.warnings` and as the top-level `warnings`. | Field | Type | Notes | |---|---|---| | `code` | `option_not_supported`, `source_unavailable`, `short_results`, `filter_not_applied`, `language_detected`, `content_partial`, `content_unavailable` | | | `message` | string | | | `option` | string | | | `source` | string | | | `filter` | string | The request field that was not applied. | | `sources` | array of strings | The sources it was not applied to. Absent when it was not applied at all. | | `requested` | integer | | | `returned` | integer | | | `with_content` | integer | | A search with a [`space`](https://millionshort.com/docs/spaces#warnings) can also carry a `space_sites_cut` warning or a `space_setting_not_applied` warning. ## Freshness Most sources are kept current: `social` and `hn` within minutes, `news` every hour, `podcasts` twice a day, and `academic`, `medical`, `contracts` and `communities` every day; `law` statutes and regulations every day and court opinions every quarter; `finance` in batches, so its newest filings can be some days old. Results from those sources carry a `published_date` when the source knows it, and the date filters work on them. The web source is different. It is a large snapshot that is rebuilt from time to time, not continuously. A page that changed recently may show its earlier text, and a page published after the snapshot is not there yet. Web results carry no date: `published_date` is `null`. For recent material, add a source that is kept current to the same call. [`GET /v1/sources`](https://millionshort.com/docs/api-reference/sources) says how fresh each source is, and for the web source the dates between which its pages were captured, when they are published. ## Cost 1 credit per source searched, which covers the first 10 results of the call. Each further 10 results, or part of 10, adds 0.5. `explain`, highlights and every filter are free. `include_content` adds 1 for the page text of up to 10 results, and 1 more for each further 10 with text. A call that fails or is refused costs nothing. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the worked examples. ## Errors `400 INVALID_PARAM`, `400 UNSUPPORTED_OPTION`, `401`, `429` (`RATE_LIMITED`, `CAPACITY` or `INSUFFICIENT_CREDITS`) and `502 SEARCH_UNAVAILABLE`. With `space`, also `404 SPACE_NOT_FOUND` for a Space that does not exist. See [Errors](https://millionshort.com/docs/errors). --- Source: https://millionshort.com/docs/search/sources Section: Endpoints / Search # The sources What each source contains, what it is good for, and what its results carry. A search asks one to five sources, named in `sources`. This section has one page per source. [Mixture of Experts](https://millionshort.com/docs/search/mixture-of-experts) explains the idea, and [`GET /v1/sources`](https://millionshort.com/docs/api-reference/sources) returns the same list to a program. - [Web](https://millionshort.com/docs/search/sources/web): The general web: Billions+ pages on our own independent index. - [News](https://millionshort.com/docs/search/sources/news): News articles, refreshed through the day. - [Small web](https://millionshort.com/docs/search/sources/smallweb): Personal sites, blogs and small independent publishers. - [Discussions](https://millionshort.com/docs/search/sources/discussions): Forum threads and community conversations in one search. - [Tech discussion](https://millionshort.com/docs/search/sources/hn): Technology links and the comment threads around them. - [Social](https://millionshort.com/docs/search/sources/social): Recent public posts. - [Communities](https://millionshort.com/docs/search/sources/communities): Public chat communities, by name, topic and size. - [Podcasts](https://millionshort.com/docs/search/sources/podcasts): Podcast shows and episodes. - [Academic](https://millionshort.com/docs/search/sources/academic): Scholarly papers and preprints. - [Medical](https://millionshort.com/docs/search/sources/medical): Biomedical and clinical literature. - [Law](https://millionshort.com/docs/search/sources/law): Statutes, regulations and court opinions (United States). - [Finance](https://millionshort.com/docs/search/sources/finance): Public-company filings and disclosures. - [Contracts](https://millionshort.com/docs/search/sources/contracts): Government contracts, grants and opportunities. ## At a glance | Source | Dates on results | Page type and topic | Fields in `extra` | Heavy | |---|---|---|---|---| | `web` | No | Yes | | Yes | | `news` | Yes | Yes | `publisher`, `author` | | | `smallweb` | Some | Yes | | Yes | | `discussions` | Rarely | Forum results only | `kind`, and sometimes `members`, `online`, `points`, `comments`, `links_to` | Yes | | `hn` | Yes | No | `kind`, `author`, `points`, `comments`, `links_to` | Yes | | `social` | Yes | No | `kind`, `author`, `likes`, `replies`, `links_to` | Yes | | `communities` | No | No | `kind`, `members`, `online` | | | `podcasts` | Yes | Topic only | `podcast`, `publisher`, `audio_url` | | | `academic` | Yes | Yes | `authors`, `venue`, `year`, `citations`, `doi`, `open_access` | | | `medical` | Yes | No | `authors`, `venue`, `year`, `doi`, `pmid`, `evidence` | | | `law` | Opinions | No | `record_type`, `citation`, `citations` | | | `finance` | Yes | No | `filer`, `form`, `record_type` | | | `contracts` | No | No | `record_type`, `agency`, `recipient`, `amount`, `currency` | | "Heavy" sources have their own per-minute limit on each plan; see [Credits and limits](https://millionshort.com/docs/credits-and-limits#rate-limits). Every source costs the same: 1 credit per search. The `extra` keys are what each source returns today. They can grow, and any one of them can be missing on a given result, so read them defensively. --- Source: https://millionshort.com/docs/search/sources/web Section: Endpoints / Search # Web The general web: Billions+ pages on our own independent index. ```text "sources": ["web"] ``` The `web` source is the general web, Billions+ pages on our own independent index. It is the default: a search that names no source asks `web`. It is also where the popularity cut matters most, because the most popular sites take most of the first page for most queries. ## Good for - General questions where you do not know in advance what kind of site holds the answer. - Reaching the long tail: set `remove_top_sites` and what is left is the sites below the ones everybody already knows. - Narrowing by kind of page (`page_types`: tutorials, documentation, reviews, forums and so on) or by `topics`. - Checking what the well-known sites say, with `only_top_sites`. ## Not the place for - Anything from the last few days. The web source is refreshed periodically, not continuously, and its results carry no date, so a date filter is not applied to this source. Add `news`, `social` or `hn` to the same call. - Papers, filings, statutes and contract notices. The specialist sources know their fields; `web` only knows pages. ## What a result carries Every result has the same fields whatever the source; the [Search reference](https://millionshort.com/docs/search/parameters#a-result) lists them. What differs is which of them are filled in: | Field | In this source | |---|---| | `published_date` | Always `null`. Web results carry no date. | | `page_type`, `topic` | Set on almost every result. | | `popularity` | Set on every result. This is the source where the rank spreads widest, from `top-100` to `long-tail`. | | `signals` (with `explain`) | `text_rank`, `link_authority` and `words` are all set. | | `extra` | Usually empty. | The `extra` keys are what this source returns today. Treat every one of them as optional: read it if it is there. ## Example queries - `restoring a cast iron skillet` - `mechanical watch servicing intervals` - `how to season a carbon steel pan` The web without its 10,000 most popular sites, tutorials and blogs only: ```bash curl https://api.millionshort.com/v1/search \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "query": "restoring a cast iron skillet", "remove_top_sites": 10000, "page_types": ["tutorials", "blogs"] }' ``` ```python import os from millionshort import MillionShort client = MillionShort(api_key=os.environ["MILLIONSHORT_API_KEY"]) r = client.search( "restoring a cast iron skillet", remove_top_sites=10000, page_types=["tutorials", "blogs"], ) for hit in r.results: print(hit["position"], hit["site"], hit["popularity"]["bucket"], hit["title"]) print(r.usage.credits, "credit(s)") ``` ```ts import { MillionShort } from 'millionshort'; const client = new MillionShort({ apiKey: process.env.MILLIONSHORT_API_KEY }); const r = await client.search('restoring a cast iron skillet', { removeTopSites: 10000, pageTypes: ['tutorials', 'blogs'], }); for (const hit of r.results) { console.log(hit.position, hit.site, hit.popularity.bucket, hit.title); } console.log(r.usage?.credits, 'credit(s)'); ``` The same call as a tool of the MCP server: ```json { "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "search", "arguments": { "query": "restoring a cast iron skillet", "remove_top_sites": 10000, "page_types": [ "tutorials", "blogs" ] } } } ``` ## Combine it with `smallweb` for personal sites, `discussions` for what people say about it, `news` for what happened this week. One call can ask up to five sources and returns one merged list; each result says which source it came from in `source`. See [Mixture of Experts](https://millionshort.com/docs/search/mixture-of-experts). ## Cost and limits A search of this source costs 1 credit, like every source, and covers the first 10 results of the call. It is one of the **heavy** sources: each plan has a lower per-minute limit for searches that include it. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. With [Monitor](https://millionshort.com/docs/monitor/parameters), query monitors are not offered on this source; watch a page with a URL monitor instead. --- Source: https://millionshort.com/docs/search/sources/news Section: Endpoints / Search # News News articles, refreshed through the day. ```text "sources": ["news"] ``` The `news` source holds news articles and is refreshed through the day. It is the source to add when the question is about something that just happened, because every result carries the date it was published. ## Good for - What happened: events, announcements, results, decisions. - Following a subject over days or weeks. `time_range`, or `start_date` and `end_date`, keep the days you want, and you can sort by `published_date` in your own code. - A dated second opinion beside `web`, whose results have no date. ## Not the place for - Background and how-to material. That is `web` and `smallweb`. - Reactions and first-hand accounts. Add `social` or `discussions`. ## What a result carries Every result has the same fields whatever the source; the [Search reference](https://millionshort.com/docs/search/parameters#a-result) lists them. What differs is which of them are filled in: | Field | In this source | |---|---| | `published_date` | Set on every result. | | `page_type`, `topic` | Set on most results. `page_type` is usually `news` or `press-releases`. | | `popularity` | Set. News sites are of every size, so `remove_top_sites` is a quick way to reach local and trade publications. | | `signals` (with `explain`) | `text_rank`, `link_authority` and `words` are set. | | `extra` | `publisher`, and `author` when the article names one. | The `extra` keys are what this source returns today. Treat every one of them as optional: read it if it is there. ## Example queries - `central bank interest rate decision` - `wildfire evacuation` - `election results` Ten news results, newest first in your own code: ```bash curl https://api.millionshort.com/v1/search \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "query": "central bank interest rate decision", "sources": ["news"], "num_results": 10 }' ``` ```python import os from millionshort import MillionShort client = MillionShort(api_key=os.environ["MILLIONSHORT_API_KEY"]) r = client.search( "central bank interest rate decision", sources=["news"], num_results=10, ) for hit in sorted(r.results, key=lambda h: h["published_date"] or "", reverse=True): print(hit["published_date"], hit["extra"].get("publisher"), hit["title"]) print(r.usage.credits, "credit(s)") ``` ```ts import { MillionShort } from 'millionshort'; const client = new MillionShort({ apiKey: process.env.MILLIONSHORT_API_KEY }); const r = await client.search('central bank interest rate decision', { sources: ['news'], numResults: 10, }); const newestFirst = [...r.results].sort((a, b) => (b.published_date ?? '').localeCompare(a.published_date ?? '')); for (const hit of newestFirst) { console.log(hit.published_date, hit.extra.publisher, hit.title); } console.log(r.usage?.credits, 'credit(s)'); ``` The same call as a tool of the MCP server: ```json { "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "search", "arguments": { "query": "central bank interest rate decision", "sources": [ "news" ], "num_results": 10 } } } ``` ## Combine it with `web` for background, `social` for reactions, `finance` when the story is about a public company. One call can ask up to five sources and returns one merged list; each result says which source it came from in `source`. See [Mixture of Experts](https://millionshort.com/docs/search/mixture-of-experts). ## Cost and limits A search of this source costs 1 credit, like every source, and covers the first 10 results of the call. It is not one of the heavy sources, so only the plan's ordinary requests-per-minute limit applies. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. With [Monitor](https://millionshort.com/docs/monitor/parameters), a query monitor can watch this source, with a shortest interval of 1 hour. --- Source: https://millionshort.com/docs/search/sources/smallweb Section: Endpoints / Search # Small web Personal sites, blogs and small independent publishers. ```text "sources": ["smallweb"] ``` The `smallweb` source is personal sites, blogs and small independent publishers: pages written by one person or a small group, most of them outside the 1,000,000 most popular sites. It is the long tail as a source of its own, with no popularity cut to set. ## Good for - First-hand experience: build logs, field notes, long write-ups by the person who did the thing. - Opinions and reviews that are not written to sell. - Finding independent writers on a subject, to follow or to cite. ## Not the place for - Reference facts and official documentation. Use `web`, with `page_types` if needed. - Recency. Some results carry a date, many do not. ## What a result carries Every result has the same fields whatever the source; the [Search reference](https://millionshort.com/docs/search/parameters#a-result) lists them. What differs is which of them are filled in: | Field | In this source | |---|---| | `published_date` | Set on some results, `null` on many. | | `page_type`, `topic` | Set. `page_type` is mostly `blogs`. | | `popularity` | Mostly the `long-tail` bucket, with `rank: null`; some sites have a rank. | | `signals` (with `explain`) | `text_rank`, `link_authority` and `words` are set. | | `extra` | Usually empty. | The `extra` keys are what this source returns today. Treat every one of them as optional: read it if it is there. ## Example queries - `building a mechanical keyboard` - `home server setup` - `notes on learning to draw` Ten results from small sites, with the reasons for each: ```bash curl https://api.millionshort.com/v1/search \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "query": "building a mechanical keyboard", "sources": ["smallweb"], "num_results": 10, "explain": true }' ``` ```python import os from millionshort import MillionShort client = MillionShort(api_key=os.environ["MILLIONSHORT_API_KEY"]) r = client.search( "building a mechanical keyboard", sources=["smallweb"], num_results=10, explain=True, ) for hit in r.results: print(hit["site"], hit["title"], hit["why"]) print(r.usage.credits, "credit(s)") ``` ```ts import { MillionShort } from 'millionshort'; const client = new MillionShort({ apiKey: process.env.MILLIONSHORT_API_KEY }); const r = await client.search('building a mechanical keyboard', { sources: ['smallweb'], numResults: 10, explain: true, }); for (const hit of r.results) { console.log(hit.site, hit.title, hit.why); } console.log(r.usage?.credits, 'credit(s)'); ``` The same call as a tool of the MCP server: ```json { "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "search", "arguments": { "query": "building a mechanical keyboard", "sources": [ "smallweb" ], "num_results": 10, "explain": true } } } ``` ## Combine it with `web` with `remove_top_sites` for a wider long tail, `discussions` for the conversation around a subject. One call can ask up to five sources and returns one merged list; each result says which source it came from in `source`. See [Mixture of Experts](https://millionshort.com/docs/search/mixture-of-experts). ## Cost and limits A search of this source costs 1 credit, like every source, and covers the first 10 results of the call. It is one of the **heavy** sources: each plan has a lower per-minute limit for searches that include it. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. With [Monitor](https://millionshort.com/docs/monitor/parameters), query monitors are not offered on this source; watch a page with a URL monitor instead. --- Source: https://millionshort.com/docs/search/sources/discussions Section: Endpoints / Search # Discussions Forum threads and community conversations in one search. ```text "sources": ["discussions"] ``` The `discussions` source searches conversations: forum threads, public chat communities and technology discussion threads, together. It is a shortcut for asking what people say about something without choosing where they say it. ## Good for - Questions that start with "what do people think of" or "has anyone tried". - Finding where a subject is discussed, before you narrow to `hn` or `communities`. - Recommendations and comparisons from people who use the thing. ## Not the place for - Facts you will quote as authoritative. A thread is a lead, not a source of record. - Sorting by date: most results here carry no date. For dated threads, ask `hn` or `social`. ## What a result carries Every result has the same fields whatever the source; the [Search reference](https://millionshort.com/docs/search/parameters#a-result) lists them. What differs is which of them are filled in: | Field | In this source | |---|---| | `published_date` | Usually `null`. | | `page_type`, `topic` | Set on forum results, `null` on the others. | | `popularity` | Set for forum sites; `unknown` for the rest. | | `signals` (with `explain`) | Set for forum results only. | | `extra` | `kind` says what the result is: `forum`, `chat` or `tech-news`. A `chat` result adds `members` and `online`; a `tech-news` result may add `points`, `comments` and `links_to`. | The `extra` keys are what this source returns today. Treat every one of them as optional: read it if it is there. ## Example queries - `home espresso setup` - `learning piano as an adult` - `mechanical keyboard switches` Ten conversations, with the kind of each: ```bash curl https://api.millionshort.com/v1/search \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "query": "home espresso setup", "sources": ["discussions"], "num_results": 10 }' ``` ```python import os from millionshort import MillionShort client = MillionShort(api_key=os.environ["MILLIONSHORT_API_KEY"]) r = client.search( "home espresso setup", sources=["discussions"], num_results=10, ) for hit in r.results: print(hit["extra"].get("kind"), hit["site"], hit["title"]) print(r.usage.credits, "credit(s)") ``` ```ts import { MillionShort } from 'millionshort'; const client = new MillionShort({ apiKey: process.env.MILLIONSHORT_API_KEY }); const r = await client.search('home espresso setup', { sources: ['discussions'], numResults: 10, }); for (const hit of r.results) { console.log(hit.extra.kind, hit.site, hit.title); } console.log(r.usage?.credits, 'credit(s)'); ``` The same call as a tool of the MCP server: ```json { "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "search", "arguments": { "query": "home espresso setup", "sources": [ "discussions" ], "num_results": 10 } } } ``` ## Combine it with `web` or `smallweb` for the long-form answer the thread points at. One call can ask up to five sources and returns one merged list; each result says which source it came from in `source`. See [Mixture of Experts](https://millionshort.com/docs/search/mixture-of-experts). ## Cost and limits A search of this source costs 1 credit, like every source, and covers the first 10 results of the call. It is one of the **heavy** sources: each plan has a lower per-minute limit for searches that include it. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. With [Monitor](https://millionshort.com/docs/monitor/parameters), query monitors are not offered on this source; watch a page with a URL monitor instead. --- Source: https://millionshort.com/docs/search/sources/hn Section: Endpoints / Search # Tech discussion Technology links and the comment threads around them. ```text "sources": ["hn"] ``` The `hn` source is technology discussion: shared links and the comment threads around them, from the last 30 days. Every result carries a date, and may carry a score and a comment count. ## Good for - What the technology community is talking about this week. - Reactions to a launch, a paper, an outage or a licence change. - Finding the link a thread is about: `extra.links_to` holds it when there is one. ## Not the place for - Anything older than about a month. - Subjects outside technology. ## What a result carries Every result has the same fields whatever the source; the [Search reference](https://millionshort.com/docs/search/parameters#a-result) lists them. What differs is which of them are filled in: | Field | In this source | |---|---| | `published_date` | Set on every result. | | `page_type`, `topic` | `null`. | | `popularity` | Usually `unknown`: the result is a thread, not a site. | | `signals` (with `explain`) | `null` values. `why` still explains the position. | | `extra` | `kind` (`tech-news`), `author`, `points`, `comments`, and `links_to` when the thread is about a link. | The `extra` keys are what this source returns today. Treat every one of them as optional: read it if it is there. ## Example queries - `database migration` - `open source licensing` - `remote work` Ten threads with their date, score and comment count: ```bash curl https://api.millionshort.com/v1/search \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "query": "open source licensing", "sources": ["hn"], "num_results": 10 }' ``` ```python import os from millionshort import MillionShort client = MillionShort(api_key=os.environ["MILLIONSHORT_API_KEY"]) r = client.search( "open source licensing", sources=["hn"], num_results=10, ) for hit in r.results: print(hit["published_date"], hit["extra"].get("points"), hit["extra"].get("comments"), hit["title"]) print(r.usage.credits, "credit(s)") ``` ```ts import { MillionShort } from 'millionshort'; const client = new MillionShort({ apiKey: process.env.MILLIONSHORT_API_KEY }); const r = await client.search('open source licensing', { sources: ['hn'], numResults: 10, }); for (const hit of r.results) { console.log(hit.published_date, hit.extra.points, hit.extra.comments, hit.title); } console.log(r.usage?.credits, 'credit(s)'); ``` The same call as a tool of the MCP server: ```json { "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "search", "arguments": { "query": "open source licensing", "sources": [ "hn" ], "num_results": 10 } } } ``` ## Combine it with `web` for the documentation or post under discussion, `academic` when the thread is about a paper. One call can ask up to five sources and returns one merged list; each result says which source it came from in `source`. See [Mixture of Experts](https://millionshort.com/docs/search/mixture-of-experts). ## Cost and limits A search of this source costs 1 credit, like every source, and covers the first 10 results of the call. It is one of the **heavy** sources: each plan has a lower per-minute limit for searches that include it. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. With [Monitor](https://millionshort.com/docs/monitor/parameters), a query monitor can watch this source, with a shortest interval of 15 minutes (5 on Scale and above). --- Source: https://millionshort.com/docs/search/sources/social Section: Endpoints / Search # Social Recent public posts. ```text "sources": ["social"] ``` The `social` source is recent public posts. It is kept current: results are usually from the last few days, often the last few hours, and every one carries its date, its author and how many people reacted. ## Good for - What is being said right now about an event, a release or a place. - First-hand reports before any article exists. - Finding the people who post about a subject. ## Not the place for - Anything you need to be true. A post is one person speaking. - History. This source holds recent posts, not an archive. ## What a result carries Every result has the same fields whatever the source; the [Search reference](https://millionshort.com/docs/search/parameters#a-result) lists them. What differs is which of them are filled in: | Field | In this source | |---|---| | `published_date` | Set on every result. | | `page_type`, `topic` | `null`. | | `popularity` | Varies from result to result and is often `long-tail` or `unknown`. It is not a useful filter on this source. | | `signals` (with `explain`) | `null` values. | | `extra` | `kind` (`post`), `author`, `likes`, `replies`, and `links_to` when the post carries a link. | The `extra` keys are what this source returns today. Treat every one of them as optional: read it if it is there. ## Example queries - `solar eclipse` - `marathon training` - `open source release` Ten recent posts, with strict SafeSearch: ```bash curl https://api.millionshort.com/v1/search \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "query": "solar eclipse", "sources": ["social"], "num_results": 10, "safe_search": "strict" }' ``` ```python import os from millionshort import MillionShort client = MillionShort(api_key=os.environ["MILLIONSHORT_API_KEY"]) r = client.search( "solar eclipse", sources=["social"], num_results=10, safe_search="strict", ) for hit in r.results: print(hit["published_date"], hit["extra"].get("author"), hit["snippet"][:80]) print(r.usage.credits, "credit(s)") ``` ```ts import { MillionShort } from 'millionshort'; const client = new MillionShort({ apiKey: process.env.MILLIONSHORT_API_KEY }); const r = await client.search('solar eclipse', { sources: ['social'], numResults: 10, safeSearch: 'strict', }); for (const hit of r.results) { console.log(hit.published_date, hit.extra.author, hit.snippet.slice(0, 80)); } console.log(r.usage?.credits, 'credit(s)'); ``` The same call as a tool of the MCP server: ```json { "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "search", "arguments": { "query": "solar eclipse", "sources": [ "social" ], "num_results": 10, "safe_search": "strict" } } } ``` ## Combine it with `news` to confirm what the posts claim, `hn` for the technical crowd. One call can ask up to five sources and returns one merged list; each result says which source it came from in `source`. See [Mixture of Experts](https://millionshort.com/docs/search/mixture-of-experts). ## Cost and limits A search of this source costs 1 credit, like every source, and covers the first 10 results of the call. It is one of the **heavy** sources: each plan has a lower per-minute limit for searches that include it. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. With [Monitor](https://millionshort.com/docs/monitor/parameters), a query monitor can watch this source, with a shortest interval of 15 minutes (5 on Scale and above). --- Source: https://millionshort.com/docs/search/sources/communities Section: Endpoints / Search # Communities Public chat communities, by name, topic and size. ```text "sources": ["communities"] ``` The `communities` source finds public chat communities. A result is a community, not a message: its name, what it is about, how many members it has and how many are online. It answers "where do people who care about this gather?". ## Good for - Finding the community for a tool, a game, a language or a hobby. - Sizing a community before you join or recommend it: `extra.members` and `extra.online`. - Giving an agent somewhere to send a person for live help. ## Not the place for - Reading what was said. A result is a community and its description, not a message. - Dates, page types or site popularity: a community has none of them. ## What a result carries Every result has the same fields whatever the source; the [Search reference](https://millionshort.com/docs/search/parameters#a-result) lists them. What differs is which of them are filled in: | Field | In this source | |---|---| | `published_date` | `null`. | | `page_type`, `topic` | `null`. | | `popularity` | `unknown`. | | `signals` (with `explain`) | `null` values. | | `extra` | `kind` (`chat`), `members` and `online`. | The `extra` keys are what this source returns today. Treat every one of them as optional: read it if it is there. ## Example queries - `chess` - `language learning` - `indie game development` Ten communities with their size: ```bash curl https://api.millionshort.com/v1/search \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "query": "language learning", "sources": ["communities"], "num_results": 10 }' ``` ```python import os from millionshort import MillionShort client = MillionShort(api_key=os.environ["MILLIONSHORT_API_KEY"]) r = client.search( "language learning", sources=["communities"], num_results=10, ) for hit in r.results: print(hit["extra"].get("members"), hit["extra"].get("online"), hit["title"]) print(r.usage.credits, "credit(s)") ``` ```ts import { MillionShort } from 'millionshort'; const client = new MillionShort({ apiKey: process.env.MILLIONSHORT_API_KEY }); const r = await client.search('language learning', { sources: ['communities'], numResults: 10, }); for (const hit of r.results) { console.log(hit.extra.members, hit.extra.online, hit.title); } console.log(r.usage?.credits, 'credit(s)'); ``` The same call as a tool of the MCP server: ```json { "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "search", "arguments": { "query": "language learning", "sources": [ "communities" ], "num_results": 10 } } } ``` ## Combine it with `discussions` for threads on the same subject. One call can ask up to five sources and returns one merged list; each result says which source it came from in `source`. See [Mixture of Experts](https://millionshort.com/docs/search/mixture-of-experts). ## Cost and limits A search of this source costs 1 credit, like every source, and covers the first 10 results of the call. It is not one of the heavy sources, so only the plan's ordinary requests-per-minute limit applies. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. With [Monitor](https://millionshort.com/docs/monitor/parameters), query monitors are not offered on this source; watch a page with a URL monitor instead. --- Source: https://millionshort.com/docs/search/sources/podcasts Section: Endpoints / Search # Podcasts Podcast shows and episodes. ```text "sources": ["podcasts"] ``` The `podcasts` source searches podcast episodes. A result is one episode, with the show it belongs to, its date and a link to the audio. The snippet is the episode's description. ## Good for - Finding episodes on a subject, or interviews with a person. - Long-form expert conversation that never became an article. - Building a listening list: `extra.audio_url` is the episode's audio file. ## Not the place for - Quoting what was said in an episode. The snippet is the description the show published, not a transcript. - Breaking news. ## What a result carries Every result has the same fields whatever the source; the [Search reference](https://millionshort.com/docs/search/parameters#a-result) lists them. What differs is which of them are filled in: | Field | In this source | |---|---| | `published_date` | Set on every result. | | `page_type` | `null`. | | `topic` | Set. | | `popularity` | The popularity of the site that hosts the episode page. | | `signals` (with `explain`) | Partly set. | | `extra` | `podcast` (the show), `publisher` and `audio_url`. | The `extra` keys are what this source returns today. Treat every one of them as optional: read it if it is there. ## Example queries - `sleep science` - `history of jazz` - `startup fundraising` Ten episodes with their show and date: ```bash curl https://api.millionshort.com/v1/search \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "query": "history of jazz", "sources": ["podcasts"], "num_results": 10 }' ``` ```python import os from millionshort import MillionShort client = MillionShort(api_key=os.environ["MILLIONSHORT_API_KEY"]) r = client.search( "history of jazz", sources=["podcasts"], num_results=10, ) for hit in r.results: print(hit["published_date"], hit["extra"].get("podcast"), hit["title"]) print(r.usage.credits, "credit(s)") ``` ```ts import { MillionShort } from 'millionshort'; const client = new MillionShort({ apiKey: process.env.MILLIONSHORT_API_KEY }); const r = await client.search('history of jazz', { sources: ['podcasts'], numResults: 10, }); for (const hit of r.results) { console.log(hit.published_date, hit.extra.podcast, hit.title); } console.log(r.usage?.credits, 'credit(s)'); ``` The same call as a tool of the MCP server: ```json { "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "search", "arguments": { "query": "history of jazz", "sources": [ "podcasts" ], "num_results": 10 } } } ``` ## Combine it with `web` for show notes and transcripts published as pages. One call can ask up to five sources and returns one merged list; each result says which source it came from in `source`. See [Mixture of Experts](https://millionshort.com/docs/search/mixture-of-experts). ## Cost and limits A search of this source costs 1 credit, like every source, and covers the first 10 results of the call. It is not one of the heavy sources, so only the plan's ordinary requests-per-minute limit applies. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. With [Monitor](https://millionshort.com/docs/monitor/parameters), a query monitor can watch this source, with a shortest interval of 24 hours. --- Source: https://millionshort.com/docs/search/sources/academic Section: Endpoints / Search # Academic Scholarly papers and preprints. ```text "sources": ["academic"] ``` The `academic` source is scholarly papers and preprints across fields. A result is one paper, with its authors, where it appeared, the year, how often it has been cited and whether it is open access. ## Good for - Finding the papers on a subject, old and new. - Weighing a paper before reading it: `extra.citations`, `extra.venue` and `extra.year`. - Resolving a citation: `extra.doi` identifies the paper. ## Not the place for - Clinical questions. `medical` knows study types. - Explanations for a general reader. Add `web`. ## What a result carries Every result has the same fields whatever the source; the [Search reference](https://millionshort.com/docs/search/parameters#a-result) lists them. What differs is which of them are filled in: | Field | In this source | |---|---| | `published_date` | Set on every result. | | `page_type`, `topic` | Set. `page_type` is `research`. | | `popularity` | The popularity of the site the paper's link resolves to, so it says little here. | | `signals` (with `explain`) | `text_rank` and `words` are set; `link_authority` is usually `null`. | | `extra` | `authors`, `venue`, `year`, `citations`, `doi` and `open_access` (true or false). | The `extra` keys are what this source returns today. Treat every one of them as optional: read it if it is there. ## Example queries - `transformer interpretability` - `coral reef bleaching` - `graph neural networks` Ten papers with year, venue and citation count: ```bash curl https://api.millionshort.com/v1/search \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "query": "transformer interpretability", "sources": ["academic"], "num_results": 10 }' ``` ```python import os from millionshort import MillionShort client = MillionShort(api_key=os.environ["MILLIONSHORT_API_KEY"]) r = client.search( "transformer interpretability", sources=["academic"], num_results=10, ) for hit in r.results: print(hit["extra"].get("year"), hit["extra"].get("venue"), hit["extra"].get("citations"), hit["title"]) print(r.usage.credits, "credit(s)") ``` ```ts import { MillionShort } from 'millionshort'; const client = new MillionShort({ apiKey: process.env.MILLIONSHORT_API_KEY }); const r = await client.search('transformer interpretability', { sources: ['academic'], numResults: 10, }); for (const hit of r.results) { console.log(hit.extra.year, hit.extra.venue, hit.extra.citations, hit.title); } console.log(r.usage?.credits, 'credit(s)'); ``` The same call as a tool of the MCP server: ```json { "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "search", "arguments": { "query": "transformer interpretability", "sources": [ "academic" ], "num_results": 10 } } } ``` ## Combine it with `hn` for the discussion of a paper, `web` for write-ups and code. One call can ask up to five sources and returns one merged list; each result says which source it came from in `source`. See [Mixture of Experts](https://millionshort.com/docs/search/mixture-of-experts). ## Cost and limits A search of this source costs 1 credit, like every source, and covers the first 10 results of the call. It is not one of the heavy sources, so only the plan's ordinary requests-per-minute limit applies. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. With [Monitor](https://millionshort.com/docs/monitor/parameters), a query monitor can watch this source, with a shortest interval of 24 hours. --- Source: https://millionshort.com/docs/search/sources/medical Section: Endpoints / Search # Medical Biomedical and clinical literature. ```text "sources": ["medical"] ``` The `medical` source is biomedical and clinical literature. A result is one article, with its authors, journal and year, and a label for the kind of evidence it is, such as a randomized trial or a systematic review. ## Good for - Clinical and biomedical questions where the kind of study matters. - Finding trials and reviews: `extra.evidence` says which a result is. - Giving an agent citable literature instead of health advice pages. ## Not the place for - Advice for a patient. These are research articles, and the snippet is an abstract, not guidance. - Papers outside medicine and biology. Use `academic`. ## What a result carries Every result has the same fields whatever the source; the [Search reference](https://millionshort.com/docs/search/parameters#a-result) lists them. What differs is which of them are filled in: | Field | In this source | |---|---| | `published_date` | Set on every result. | | `page_type`, `topic` | `null`. | | `popularity` | The popularity of the site that hosts the article record, so it says little here. | | `signals` (with `explain`) | `text_rank` is set; the others are usually `null`. | | `extra` | `authors`, `venue` (the journal), `year`, `doi`, `pmid` and `evidence`, for example `randomized trial`, `meta-analysis / systematic review`, `observational / comparative` or `review / journal article`. | The `extra` keys are what this source returns today. Treat every one of them as optional: read it if it is there. ## Example queries - `statin side effects` - `migraine prophylaxis` - `vitamin d supplementation randomized trial` Ten articles with the kind of evidence each is: ```bash curl https://api.millionshort.com/v1/search \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "query": "migraine prophylaxis", "sources": ["medical"], "num_results": 10 }' ``` ```python import os from millionshort import MillionShort client = MillionShort(api_key=os.environ["MILLIONSHORT_API_KEY"]) r = client.search( "migraine prophylaxis", sources=["medical"], num_results=10, ) for hit in r.results: print(hit["extra"].get("year"), hit["extra"].get("evidence"), hit["title"]) print(r.usage.credits, "credit(s)") ``` ```ts import { MillionShort } from 'millionshort'; const client = new MillionShort({ apiKey: process.env.MILLIONSHORT_API_KEY }); const r = await client.search('migraine prophylaxis', { sources: ['medical'], numResults: 10, }); for (const hit of r.results) { console.log(hit.extra.year, hit.extra.evidence, hit.title); } console.log(r.usage?.credits, 'credit(s)'); ``` The same call as a tool of the MCP server: ```json { "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "search", "arguments": { "query": "migraine prophylaxis", "sources": [ "medical" ], "num_results": 10 } } } ``` ## Combine it with `academic` for neighbouring fields, `news` for coverage of a new result. One call can ask up to five sources and returns one merged list; each result says which source it came from in `source`. See [Mixture of Experts](https://millionshort.com/docs/search/mixture-of-experts). ## Cost and limits A search of this source costs 1 credit, like every source, and covers the first 10 results of the call. It is not one of the heavy sources, so only the plan's ordinary requests-per-minute limit applies. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. With [Monitor](https://millionshort.com/docs/monitor/parameters), a query monitor can watch this source, with a shortest interval of 24 hours. --- Source: https://millionshort.com/docs/search/sources/law Section: Endpoints / Search # Law Statutes, regulations and court opinions (United States). ```text "sources": ["law"] ``` The `law` source is United States law: statutes, regulations and court opinions. A result is one section or one opinion. ## Good for - Finding the section that governs something: on statutes and regulations `extra.citation` is the citation to quote. - Finding opinions that discuss a doctrine or a statute. - Grounding an agent's legal summary in the text itself, not in commentary. ## Not the place for - Law outside the United States. - Commentary, explainers and law-firm articles. Those are on `web`. - Legal advice. The source returns texts; it does not interpret them. ## What a result carries Every result has the same fields whatever the source; the [Search reference](https://millionshort.com/docs/search/parameters#a-result) lists them. What differs is which of them are filled in: | Field | In this source | |---|---| | `published_date` | Set on opinions; `null` on statutes and usually on regulations. | | `page_type`, `topic` | `null`. | | `popularity` | The popularity of the official site that publishes the text. | | `signals` (with `explain`) | `null` values. | | `extra` | `record_type` (`statute`, `regulation` or `opinion`), `citation` on statutes and regulations, and `citations`, how often other records cite this one. | The `extra` keys are what this source returns today. Treat every one of them as optional: read it if it is there. ## Example queries - `copyright fair use` - `data breach notification` - `clean water act` Ten records with their type and citation: ```bash curl https://api.millionshort.com/v1/search \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "query": "copyright fair use", "sources": ["law"], "num_results": 10 }' ``` ```python import os from millionshort import MillionShort client = MillionShort(api_key=os.environ["MILLIONSHORT_API_KEY"]) r = client.search( "copyright fair use", sources=["law"], num_results=10, ) for hit in r.results: print(hit["extra"].get("record_type"), hit["extra"].get("citation"), hit["title"]) print(r.usage.credits, "credit(s)") ``` ```ts import { MillionShort } from 'millionshort'; const client = new MillionShort({ apiKey: process.env.MILLIONSHORT_API_KEY }); const r = await client.search('copyright fair use', { sources: ['law'], numResults: 10, }); for (const hit of r.results) { console.log(hit.extra.record_type, hit.extra.citation, hit.title); } console.log(r.usage?.credits, 'credit(s)'); ``` The same call as a tool of the MCP server: ```json { "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "search", "arguments": { "query": "copyright fair use", "sources": [ "law" ], "num_results": 10 } } } ``` ## Combine it with `web` for explanations, `news` for a current case, `contracts` and `finance` for the documents a rule applies to. One call can ask up to five sources and returns one merged list; each result says which source it came from in `source`. See [Mixture of Experts](https://millionshort.com/docs/search/mixture-of-experts). ## Cost and limits A search of this source costs 1 credit, like every source, and covers the first 10 results of the call. It is not one of the heavy sources, so only the plan's ordinary requests-per-minute limit applies. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. With [Monitor](https://millionshort.com/docs/monitor/parameters), a query monitor can watch this source, with a shortest interval of 24 hours. --- Source: https://millionshort.com/docs/search/sources/finance Section: Endpoints / Search # Finance Public-company filings and disclosures. ```text "sources": ["finance"] ``` The `finance` source is the filings and disclosures of public companies, and the exhibits attached to them, searched in full text. A result is one filing or exhibit, with the company that filed it, the form and the date. ## Good for - What a company itself said about a risk, a contract, a customer or a number. - Finding every filer that mentions a subject. - Primary sources for an agent that would otherwise quote a summary. ## Not the place for - Prices, quotes and market data. - Analysis and commentary. Use `news` and `web`. ## What a result carries Every result has the same fields whatever the source; the [Search reference](https://millionshort.com/docs/search/parameters#a-result) lists them. What differs is which of them are filled in: | Field | In this source | |---|---| | `published_date` | Set on every result: the filing date. | | `page_type`, `topic` | `null`. | | `popularity` | The popularity of the official site that publishes the filing. | | `signals` (with `explain`) | `text_rank` and `words` are set; a filing can be very long. | | `extra` | `filer` (the company), `form` (the form type, for example an annual report) and `record_type` (a filing or an exhibit). | The `extra` keys are what this source returns today. Treat every one of them as optional: read it if it is there. ## Example queries - `annual report supply chain risk` - `lithium supply agreement` - `going concern doubt` Ten filings with the company, the form and the date: ```bash curl https://api.millionshort.com/v1/search \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "query": "lithium supply agreement", "sources": ["finance"], "num_results": 10 }' ``` ```python import os from millionshort import MillionShort client = MillionShort(api_key=os.environ["MILLIONSHORT_API_KEY"]) r = client.search( "lithium supply agreement", sources=["finance"], num_results=10, ) for hit in r.results: print(hit["published_date"], hit["extra"].get("form"), hit["extra"].get("filer")) print(r.usage.credits, "credit(s)") ``` ```ts import { MillionShort } from 'millionshort'; const client = new MillionShort({ apiKey: process.env.MILLIONSHORT_API_KEY }); const r = await client.search('lithium supply agreement', { sources: ['finance'], numResults: 10, }); for (const hit of r.results) { console.log(hit.published_date, hit.extra.form, hit.extra.filer); } console.log(r.usage?.credits, 'credit(s)'); ``` The same call as a tool of the MCP server: ```json { "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "search", "arguments": { "query": "lithium supply agreement", "sources": [ "finance" ], "num_results": 10 } } } ``` ## Combine it with `news` for the story around a filing, `law` for the rule a disclosure answers to. One call can ask up to five sources and returns one merged list; each result says which source it came from in `source`. See [Mixture of Experts](https://millionshort.com/docs/search/mixture-of-experts). ## Cost and limits A search of this source costs 1 credit, like every source, and covers the first 10 results of the call. It is not one of the heavy sources, so only the plan's ordinary requests-per-minute limit applies. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. With [Monitor](https://millionshort.com/docs/monitor/parameters), a query monitor can watch this source, with a shortest interval of 24 hours. --- Source: https://millionshort.com/docs/search/sources/contracts Section: Endpoints / Search # Contracts Government contracts, grants and opportunities. ```text "sources": ["contracts"] ``` The `contracts` source is government spending: contract and grant awards, opportunities, and the organisations that receive them. Most results are awards. A result names the agency, the recipient and, for an award, the amount and its currency. ## Good for - Who buys what: awards by subject, with agency, recipient and amount. - Finding open opportunities in a line of work. - Checking a supplier's history with public buyers. ## Not the place for - Private-sector contracts. Agreements a public company disclosed are in `finance`. - Sorting by date: results here carry no `published_date`. ## What a result carries Every result has the same fields whatever the source; the [Search reference](https://millionshort.com/docs/search/parameters#a-result) lists them. What differs is which of them are filled in: | Field | In this source | |---|---| | `published_date` | `null`. | | `page_type`, `topic` | `null`. | | `popularity` | The popularity of the official site that publishes the record. | | `signals` (with `explain`) | `text_rank` is set. | | `extra` | `record_type` (for example `Award` or `Recipient`), `agency`, `recipient`, and for awards `amount` and `currency`. | The `extra` keys are what this source returns today. Treat every one of them as optional: read it if it is there. ## Example queries - `bridge inspection services` - `road resurfacing` - `language translation services` Ten records with the agency, the recipient and the amount: ```bash curl https://api.millionshort.com/v1/search \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "query": "bridge inspection services", "sources": ["contracts"], "num_results": 10 }' ``` ```python import os from millionshort import MillionShort client = MillionShort(api_key=os.environ["MILLIONSHORT_API_KEY"]) r = client.search( "bridge inspection services", sources=["contracts"], num_results=10, ) for hit in r.results: print(hit["extra"].get("agency"), hit["extra"].get("recipient"), hit["extra"].get("amount")) print(r.usage.credits, "credit(s)") ``` ```ts import { MillionShort } from 'millionshort'; const client = new MillionShort({ apiKey: process.env.MILLIONSHORT_API_KEY }); const r = await client.search('bridge inspection services', { sources: ['contracts'], numResults: 10, }); for (const hit of r.results) { console.log(hit.extra.agency, hit.extra.recipient, hit.extra.amount); } console.log(r.usage?.credits, 'credit(s)'); ``` The same call as a tool of the MCP server: ```json { "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "search", "arguments": { "query": "bridge inspection services", "sources": [ "contracts" ], "num_results": 10 } } } ``` ## Combine it with `news` for coverage of a large award, `law` for the regulation behind a requirement. One call can ask up to five sources and returns one merged list; each result says which source it came from in `source`. See [Mixture of Experts](https://millionshort.com/docs/search/mixture-of-experts). ## Cost and limits A search of this source costs 1 credit, like every source, and covers the first 10 results of the call. It is not one of the heavy sources, so only the plan's ordinary requests-per-minute limit applies. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. With [Monitor](https://millionshort.com/docs/monitor/parameters), a query monitor can watch this source, with a shortest interval of 24 hours. --- Source: https://millionshort.com/docs/search/mixture-of-experts Section: Endpoints / Search # Mixture of Experts Specialist sources behind one endpoint. You name the experts a search should ask. MillionShort is not one index with a few filters on it. It is 13 sources, and each one is a specialist: its own index and its own ranking, built for one kind of material. News is ranked like news, papers like papers, statutes like statutes. We call the set a **Mixture of Experts**. What makes it one product is everything around the experts: - **One endpoint.** `POST /v1/search`, whatever you search. - **One key and one price.** Every source costs the same: 1 credit per source searched. - **One answer shape.** A result from any source has the same fields, so your code reads a paper, a post and a web page the same way. - **One call can ask several.** Name up to five sources and get one ranked list back. ## The experts | Slug | What it contains | Heavy | |---|---|---| | `web` | The general web: Billions+ pages on our own independent index. | Yes | | `news` | News articles, refreshed through the day. | | | `smallweb` | Personal sites, blogs and small independent publishers. | Yes | | `discussions` | Forum threads and community conversations in one search. | Yes | | `hn` | Technology links and the comment threads around them. | Yes | | `social` | Recent public posts from open social networks. | Yes | | `communities` | Public chat communities, by name, topic and size. | | | `podcasts` | Podcast shows and episodes. | | | `academic` | Scholarly papers and preprints. | | | `medical` | Biomedical and clinical literature. | | | `law` | Statutes, regulations and court opinions (United States). | | | `finance` | Public-company filings and disclosures. | | | `contracts` | Government contract opportunities and awards. | | Each source has a page of its own with what it is good for, what its results carry and queries to try: [the sources](https://millionshort.com/docs/search/sources). ## Choosing who to ask You choose the experts with `sources`. Leave it out and the search asks `web`. | The question is about | Ask | |---|---| | Anything, and you do not know where the answer lives | `web` | | Something that just happened | `news`, with `social` for first reactions | | First-hand experience and independent writing | `smallweb`, or `web` with `remove_top_sites` | | What people think of something | `discussions`; `hn` for technology | | Where a community gathers | `communities` | | Research | `academic`; `medical` for clinical and biomedical questions | | What the law says (United States) | `law` | | What a public company disclosed | `finance` | | Who the government buys from | `contracts` | | Something to listen to | `podcasts` | An agent that does not know the sources can ask for the list: `GET /v1/sources` returns each slug with a one-line description, and costs nothing. Over MCP that is the `list_sources` tool. ## One call, several experts ```bash curl https://api.millionshort.com/v1/search \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "query": "transformer interpretability", "sources": ["web", "academic", "hn"], "num_results": 15 }' ``` ```python import os from millionshort import MillionShort client = MillionShort(api_key=os.environ["MILLIONSHORT_API_KEY"]) r = client.search( "transformer interpretability", sources=["web", "academic", "hn"], num_results=15, ) for hit in r.results: print(hit["position"], hit["source"], hit["title"]) print(r.usage.credits, "credits") ``` ```ts import { MillionShort } from 'millionshort'; const client = new MillionShort({ apiKey: process.env.MILLIONSHORT_API_KEY }); const r = await client.search('transformer interpretability', { sources: ['web', 'academic', 'hn'], numResults: 15, }); for (const hit of r.results) { console.log(hit.position, hit.source, hit.title); } console.log(r.usage?.credits, 'credits'); ``` The same call as a tool of the MCP server: ```json { "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "search", "arguments": { "query": "transformer interpretability", "sources": [ "web", "academic", "hn" ], "num_results": 15 } } } ``` What comes back: - **One list.** The sources' results are merged by rank into one list, so the best of each source comes first. Duplicates are removed. - **`source` on every result** says which expert it came from. - **`num_results` is for the whole call.** Fifteen results from three sources is fifteen results, not forty-five. - **A source that does not answer does not fail the call.** The others' results are returned, the missing one is named in a `source_unavailable` warning, and it is not charged. This call costs 3 credits for the three sources, plus 0.5 for the five results beyond the first ten: 3.5 credits. ## What is the same and what differs The same for every source: the request fields, the result fields, the envelope, the errors and the price. What differs is which fields a source can fill in: - **Dates.** `news`, `hn`, `social`, `podcasts`, `academic`, `medical` and `finance` results carry a `published_date`. `web` results never do. The date filters work on these and on `law`, `communities` and `contracts`; not on `web`, `smallweb` or `discussions`. [Freshness](https://millionshort.com/docs/search/freshness) explains why. - **Page type and topic.** Filled in on `web`, `news`, `smallweb` and `academic`, and partly elsewhere. The `page_types` and `topics` **filters**, and their exclude, boost and bury forms, act on `web` and `news` results. Any other source in the call is named in a `filter_not_applied` warning. - **Date, language and country filters.** Each is applied by the sources that can apply it. A source that cannot is named in a `filter_not_applied` warning, so a filter is never ignored silently. The [Search reference](https://millionshort.com/docs/search/parameters#dates-language-and-country) has the table, and `GET /v1/sources` returns it as data. - **Page text.** `include_content` adds the text of the page as we hold it to `web` and `news` results. - **Popularity.** Meaningful where a result is a page on a site: `web`, `news`, `smallweb`. A thread or a community has no site rank of its own and usually shows `unknown`. - **`extra`.** The fields only one kind of material has: a paper's authors and citation count, a filing's form, a thread's score, a contract's agency and amount. Each source page lists its keys. ## Limits - Up to five sources per call. - `web`, `smallweb`, `discussions`, `social`, `hn` are the **heavy** sources. Each plan has a per-minute limit for searches that include them, lower than its limit for requests as a whole. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the table. - Without a key (the playground and the MCP server's no-key mode), a search asks one source. --- Source: https://millionshort.com/docs/search/filters Section: Endpoints / Search # Filters for agents The controls other search APIs do not have. Cut by popularity, steer by site, keep kinds of page and topics, and read what each result says about its site. An agent that can only type a query gets what everyone gets. These filters let it say what kind of web it wants. All of them are fields of [`POST /v1/search`](https://millionshort.com/docs/search/parameters), all of them are free, and they combine. | Filter | Field | What it does | |---|---|---| | [Remove the top sites](https://millionshort.com/docs/search/remove-top-sites) | `remove_top_sites` | Drops results from the N most popular sites, N from 0 to 1,000,000 | | [Only the top sites](https://millionshort.com/docs/search/remove-top-sites#the-reverse-only-the-top-sites) | `only_top_sites` | Keeps only results from the N most popular sites | | [Popularity buckets](https://millionshort.com/docs/search/site-signals#popularity-buckets) | `popularity_buckets` | Keeps sites in the bands you name, from `top-100` to `long-tail` | | [Boost](https://millionshort.com/docs/search/lenses#boost) | `boost_domains`, `boost_page_types`, `boost_topics` | Moves named sites, kinds of page or topics ahead of the rest | | [Bury](https://millionshort.com/docs/search/lenses#bury) | `bury_domains`, `bury_page_types`, `bury_topics` | Moves them to the end | | [Block](https://millionshort.com/docs/search/lenses#block) | `exclude_domains`, `exclude_page_types`, `exclude_topics` | Removes them | | [Only](https://millionshort.com/docs/search/lenses#only) | `include_domains`, `page_types`, `topics` | Keeps them and nothing else | | [Topics](https://millionshort.com/docs/search/topics-and-page-types#topics) | `topics` and the three lists above | 24 topics | | [Page types](https://millionshort.com/docs/search/topics-and-page-types#page-types) | `page_types` and the three lists above | 23 kinds of page: forums, tutorials, documentation, reviews and so on | | [Traffic trends](https://millionshort.com/docs/search/site-signals#traffic-trends) | `traffic_trend` | Keeps sites whose visits are rising, spiking, falling and so on; on every result too | | [Popular where](https://millionshort.com/docs/search/site-signals#popular-where) | `popular_in` | Keeps sites that are popular in the countries you name; on every result too | | [Site tech](https://millionshort.com/docs/search/site-signals#site-tech) | `site_tech` | Keeps sites built with what you name; on every result too | | [Risk](https://millionshort.com/docs/search/site-signals#exclude-risky-sites) | `exclude_risky` | Drops results whose site carries a risk label; the label is on every result | | [Popularity](https://millionshort.com/docs/search/popularity-and-risk#popularity) | on every result | The rank and band of the result's site | | [Dates](https://millionshort.com/docs/search/parameters#dates-language-and-country) | `start_date`, `end_date`, `time_range` | Results published in a range, on the sources that carry dates | | [Language and country](https://millionshort.com/docs/search/parameters#dates-language-and-country) | `language`, `country` | Results in a language, or from a country, on the sources that can tell; two-letter codes | | SafeSearch | `safe_search` | `off`, `moderate` or `strict` | Over [MCP](https://millionshort.com/docs/mcp), the `search` tool takes the same fields under the same names. A set of these filters can be saved under a name and used with one field, `space`. That is [Spaces](https://millionshort.com/docs/search/spaces). ## Agent recipes Each recipe is one request. Copy it, change the query, and give it to your agent as an example of what it can ask for. ### Long-tail forum discussions on a topic, with no product pages Keep forum and comment pages, on one topic, from outside the 10,000 most popular sites. Shops and product pages are not among the kinds kept, so they are gone. ```bash curl https://api.millionshort.com/v1/search \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "query": "sourdough starter", "page_types": ["forums", "comments"], "topics": ["food"], "remove_top_sites": 10000, "num_results": 10 }' ``` ```python import os from millionshort import MillionShort client = MillionShort(api_key=os.environ["MILLIONSHORT_API_KEY"]) r = client.search( "sourdough starter", page_types=["forums", "comments"], topics=["food"], remove_top_sites=10000, num_results=10, ) for hit in r.results: print(hit["page_type"], hit["topic"], hit["popularity"]["bucket"], hit["url"]) ``` ```ts import { MillionShort } from 'millionshort'; const client = new MillionShort({ apiKey: process.env.MILLIONSHORT_API_KEY }); const r = await client.search('sourdough starter', { pageTypes: ['forums', 'comments'], topics: ['food'], removeTopSites: 10000, numResults: 10, }); for (const hit of r.results) { console.log(hit.page_type, hit.topic, hit.popularity.bucket, hit.url); } ``` The same call as a tool of the MCP server: ```json { "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "search", "arguments": { "query": "sourdough starter", "page_types": [ "forums", "comments" ], "topics": [ "food" ], "remove_top_sites": 10000, "num_results": 10 } } } ``` What comes back, cut to one result (the values are an illustration): ```json { "data": { "results": [ { "title": "Starter sluggish after a week in the fridge", "url": "https://forum.example.org/t/starter-sluggish/4821", "site": "forum.example.org", "source": "web", "snippet": "Mine does the same every winter. Two feeds at room temperature and it is back...", "highlights": ["Mine does the same every winter. Two feeds at room temperature and it is back..."], "published_date": null, "page_type": "comments", "topic": "food", "popularity": { "rank": 412907, "bucket": "top-1m" }, "risk": null, "position": 1, "score": 1.0, "extra": {} } ], "summary": { "returned": 10, "removed": { "popularity": 0, "blocked": 0, "duplicates": 1, "risk": 0, "safe_search": 0 } }, "warnings": [] }, "usage": { "credits": 1, "cost_usd": 0.001, "breakdown": { "search": 1 } }, "warnings": [], "request_id": "req_..." } ``` ### The mainstream view and the independent view, side by side Two requests with the same query: `only_top_sites: 1000`, then `remove_top_sites: 1000`. The agent reads both and reports where they differ. Two credits. ### Tutorials and documentation only, from sources you trust first ```bash curl https://api.millionshort.com/v1/search \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "query": "rate limiting with a token bucket", "page_types": ["tutorials", "documentation"], "topics": ["programming", "software"], "boost_domains": ["docs.example.com"], "bury_domains": ["example.net"] }' ``` ```python import os import requests r = requests.post( "https://api.millionshort.com/v1/search", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, json={ "query": "rate limiting with a token bucket", "page_types": [ "tutorials", "documentation" ], "topics": [ "programming", "software" ], "boost_domains": [ "docs.example.com" ], "bury_domains": [ "example.net" ] }, timeout=30, ) r.raise_for_status() for hit in r.json()["data"]["results"]: print(hit["position"], hit["title"], hit["url"]) ``` ```ts const res = await fetch('https://api.millionshort.com/v1/search', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ "query": "rate limiting with a token bucket", "page_types": [ "tutorials", "documentation" ], "topics": [ "programming", "software" ], "boost_domains": [ "docs.example.com" ], "bury_domains": [ "example.net" ] }), }); if (!res.ok) throw new Error(`POST /v1/search failed: ${res.status}`); const { data } = (await res.json()) as { data: { results: { position: number; title: string; url: string }[] }; }; for (const hit of data.results) console.log(hit.position, hit.title, hit.url); ``` The same call as a tool of the MCP server: ```json { "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "search", "arguments": { "query": "rate limiting with a token bucket", "page_types": [ "tutorials", "documentation" ], "topics": [ "programming", "software" ], "boost_domains": [ "docs.example.com" ], "bury_domains": [ "example.net" ] } } } ``` ### A closed set of sites for a regulated answer `include_domains` with the approved sites, and `safe_search: "strict"`. Nothing outside the list can be cited. See [Only](https://millionshort.com/docs/search/lenses#only). ### Nothing risky, nothing you have already read Send the sites already in your corpus in `exclude_domains`, and `exclude_risky: true`. Every result that comes back has `risk: null`. ```json { "query": "home battery storage payback", "exclude_domains": ["example.com", "example.org"], "exclude_risky": true } ``` ### Rising sites in a niche Search the field broadly and keep the results whose site is rising. Sites on the move are rare, so use a broad query and ask for more results; the list is often short and can be empty. See [traffic trends](https://millionshort.com/docs/search/site-signals#traffic-trends). ```json { "query": "best running shoes", "traffic_trend": ["rising", "spiking", "new"], "num_results": 20 } ``` ### Sites that matter in one country `popular_in` keeps sites with an audience in the countries you name, whatever their domain ending. See [popular where](https://millionshort.com/docs/search/site-signals#popular-where). ```json { "query": "heat pump grant", "popular_in": ["GB", "IE"] } ``` ### Discussion, with no shops and no listicles ```json { "query": "standing desk wobble", "boost_page_types": ["forums", "comments"], "exclude_page_types": ["products", "listicles"] } ``` ### This week's news in one language ```json { "query": "Bundestag Haushalt", "sources": ["news"], "time_range": "week", "language": "de" } ``` ## What to tell your agent A tool description lists fields. It does not tell a model when a filter is worth using. Put this, or your own version of it, in the system prompt: ```text Search filters you can use: - remove_top_sites: N drops the N most popular sites. Use 1000 to 10000 when results are all big, familiar sites and you want specialist or first-hand pages. only_top_sites: N is the reverse. - page_types keeps kinds of page (forums, comments, tutorials, documentation, reviews, research, news, blogs and others). topics keeps subjects (programming, health, business, food and others). exclude_page_types / exclude_topics remove them; boost_ and bury_ forms reorder. Ask list_sources for the full lists. - include_domains searches only the sites named; exclude_domains removes sites; boost_domains and bury_domains reorder. - start_date, end_date or time_range (day, week, month, year) for dated sources such as news; web pages carry no date. language and country take two-letter codes. - traffic_trend keeps sites whose visits are rising, spiking, falling, dropped or new (few sites are on the move: use a broad query). popular_in keeps sites popular in the countries named. site_tech keeps sites built with what you name. exclude_risky: true drops labelled sites. - max_highlights: 1 to 5 returns the passages that answer the query. include_content: true returns the page's text for web and news results (it costs extra per result). - Every result has popularity, risk, traffic_trend, popular_in and site_tech. Say so when a source is a little-known site. Do not cite a result that carries a risk label. - If the answer has a filter_not_applied warning, a source could not apply that filter: say so or search that source another way. ``` ## Where they apply - The popularity cut and the lenses apply to every source, and are most useful on `web` and `news`. - `page_types`, `topics` and their `exclude_`, `boost_` and `bury_` forms act on `web` and `news` results. In a call that mixes sources they narrow those two and leave the rest as it is, and the response names the other sources in a `filter_not_applied` warning. - Dates work on the sources that carry dates; `web` pages carry none. Language and country work on some sources. The [search reference](https://millionshort.com/docs/search/parameters#dates-language-and-country) has the table, and `GET /v1/sources` returns it as data. - The site filters (`popularity_buckets`, `traffic_trend`, `popular_in`, `site_tech`, `exclude_risky`) apply to every source. A thread, a post or a community has no site of its own: it shows `unknown` popularity, no site facts, and does not pass a site filter. - **No filter is ignored silently.** Where a source cannot apply one, the response says so. --- Source: https://millionshort.com/docs/search/remove-top-sites Section: Endpoints / Search # Remove the top sites One number takes the most popular sites out of the results, so a search reaches the rest of the web. Most searches return the same few hundred sites. They are popular, they are well optimised, and for many questions they are not where the best answer is. `remove_top_sites` takes them out. ```text "remove_top_sites": 10000 ``` That removes every result whose site is among the 10,000 most popular sites. What is left is the long tail: specialist sites, personal sites, forums, small publishers, primary sources. This is what MillionShort is named for: the web, a million sites short. ## What the number means Every site has a popularity rank. Rank 1 is the most popular site there is. `remove_top_sites: N` removes results from sites ranked 1 to N. The value can be any whole number from 0 to 1,000,000; 0, the default, removes nothing. | Value | What goes | What is left | |---|---|---| | `100` | The giants: the largest platforms and portals | Nearly everything else | | `1000` | Plus the big publishers, retailers and reference sites | Mid-sized and smaller sites | | `10000` | Plus most sites you know by name | Specialist and independent sites. A good first value | | `100000` | Plus most commercial publishers | Small sites, clubs, personal pages | | `1000000` | Every site with a rank | Only sites outside the top million | There is no right number. Start at 10,000, look at `popularity` on what comes back, and move up or down. ## Try it ```bash curl https://api.millionshort.com/v1/search \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "query": "restoring a cast iron skillet", "remove_top_sites": 10000, "num_results": 8 }' ``` ```python import os from millionshort import MillionShort client = MillionShort(api_key=os.environ["MILLIONSHORT_API_KEY"]) r = client.search( "restoring a cast iron skillet", remove_top_sites=10000, num_results=8, ) for hit in r.results: print(hit["popularity"]["rank"], hit["popularity"]["bucket"], hit["site"]) ``` ```ts import { MillionShort } from 'millionshort'; const client = new MillionShort({ apiKey: process.env.MILLIONSHORT_API_KEY }); const r = await client.search('restoring a cast iron skillet', { removeTopSites: 10000, numResults: 8, }); for (const hit of r.results) { console.log(hit.popularity.rank, hit.popularity.bucket, hit.site); } ``` The same call as a tool of the MCP server: ```json { "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "search", "arguments": { "query": "restoring a cast iron skillet", "remove_top_sites": 10000, "num_results": 8 } } } ``` Every result that comes back has a rank above 10,000, or no rank at all. ## How to read the results Each result carries the popularity of its site, whether or not you removed anything: ```json { "data": { "results": [ { "title": "Restoring a rusted skillet: notes from thirty years at a foundry", "url": "https://example.org/skillet-restoration", "site": "example.org", "source": "web", "snippet": "Strip the old seasoning down to bare iron before you start...", "highlights": ["Strip the old seasoning down to bare iron before you start..."], "published_date": null, "page_type": "articles", "topic": "home", "popularity": { "rank": 48210, "bucket": "top-100k" }, "risk": null, "position": 1, "score": 1.0, "extra": {} } ], "summary": { "returned": 8, "removed": { "popularity": 0, "blocked": 0, "duplicates": 2, "risk": 0, "safe_search": 0 } }, "warnings": [] }, "usage": { "credits": 1, "cost_usd": 0.001, "breakdown": { "search": 1 } }, "warnings": [], "request_id": "req_..." } ``` The values are an illustration and the list is cut to one result. - `popularity.rank` is the site's rank, or `null` when the site is outside the top 1,000,000 or has no rank. - `popularity.bucket` is the same thing as a band: `top-100`, `top-1k`, `top-10k`, `top-100k`, `top-1m`, `long-tail` or `unknown`. - `summary.removed.popularity` counts results the cut took out of the list. For some sources, `web` and `news` among them, the cut is applied before results are counted, so this number can be 0 when the cut plainly worked. Judge by the `popularity` of what came back. Things worth knowing: - **Rank belongs to the site, not the page.** A page on a subdomain of a large hosting or blogging platform carries the platform's rank. Removing the top 1,000 sites therefore also removes the personal pages hosted on those platforms. The `smallweb` source is another way to reach them. - **A site with no rank is kept.** `remove_top_sites` only removes sites that have a rank inside the number. - **It is free.** The cut costs nothing extra, at any value. - **You still get a full list.** The search looks further down for results to replace the ones removed. If it cannot find enough, the call returns what there is with a `short_results` warning. ## The reverse: only the top sites `only_top_sites: N` keeps only results from the N most popular sites. Use it when you want the mainstream view, or as the other half of a comparison. ```bash curl https://api.millionshort.com/v1/search \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "query": "restoring a cast iron skillet", "only_top_sites": 1000 }' ``` ```python import os import requests r = requests.post( "https://api.millionshort.com/v1/search", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, json={ "query": "restoring a cast iron skillet", "only_top_sites": 1000 }, timeout=30, ) r.raise_for_status() for hit in r.json()["data"]["results"]: print(hit["position"], hit["title"], hit["url"]) ``` ```ts const res = await fetch('https://api.millionshort.com/v1/search', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ "query": "restoring a cast iron skillet", "only_top_sites": 1000 }), }); if (!res.ok) throw new Error(`POST /v1/search failed: ${res.status}`); const { data } = (await res.json()) as { data: { results: { position: number; title: string; url: string }[] }; }; for (const hit of data.results) console.log(hit.position, hit.title, hit.url); ``` The same call as a tool of the MCP server: ```json { "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "search", "arguments": { "query": "restoring a cast iron skillet", "only_top_sites": 1000 } } } ``` - A result whose site has no rank is removed, so on sources whose results have no site rank (`hn`, `communities`) `only_top_sites` can return nothing. The search still ran, so it still costs its credit. - Sending both `remove_top_sites` and `only_top_sites` above 0 is a `400 INVALID_PARAM`. Send one. ## Which sources it suits The cut is most useful on `web` and `news`, where the sites are of every size. On `smallweb` most results are already outside the top million. On sources whose results are threads, posts, papers or records, the site rank says little, and the cut is best left at 0. Each [source page](https://millionshort.com/docs/search/sources) says how popularity behaves there. ## Agent recipe: look under the first page 1. Search with no cut and read `popularity.bucket` on the results. 2. If most are `top-100` to `top-10k`, search again with `remove_top_sites: 10000`. 3. Keep results from both passes, drop any with a `risk` label (`exclude_risky: true` does that in the request), and tell the person which sources are well known and which are small sites. Two searches, two credits. [Long-tail research](https://millionshort.com/docs/search/guides/long-tail-research) has the code, and [Filters for agents](https://millionshort.com/docs/search/filters) has more recipes. ## With the other controls - `remove_top_sites` removes by rank. [Lenses](https://millionshort.com/docs/search/lenses) act on sites you name: remove one, keep only a few, move some up or down. - An agent can apply its own rule after the search, using `popularity` on each result. [Popularity and risk](https://millionshort.com/docs/search/popularity-and-risk) covers the signals. - [Spaces](https://millionshort.com/docs/search/spaces) save a cut together with sites, page types and topics under one name. - Older clients sent `index_level` with values such as `top10k`. It still works and means the same as `remove_top_sites: 10000`. --- Source: https://millionshort.com/docs/search/lenses Section: Endpoints / Search # Lenses Four lists of sites that shape a search. Boost, bury, block, or search only the sites you name. A lens is a list of sites that changes what a search returns. There are four, and each is one field of the search request: | Lens | Field | What it does | |---|---|---| | **Boost** | `boost_domains` | Moves results from these sites ahead of the rest | | **Bury** | `bury_domains` | Moves results from these sites to the end | | **Block** | `exclude_domains` | Removes results from these sites | | **Only** | `include_domains` | Returns results from these sites and no others | Boost and bury change the order. Block and only change what is in the list. All four are free, and each takes up to 25 sites. ## Writing a site An entry is a host name, such as `example.com`. A leading `www.`, a scheme or a path is ignored, so `https://www.example.com/blog` means `example.com`. ## Boost Use boost when you trust some sites more than the rest but still want everything else. ```bash curl https://api.millionshort.com/v1/search \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "query": "rate limiting with a token bucket", "boost_domains": ["example.org", "docs.example.com"] }' ``` ```python import os from millionshort import MillionShort client = MillionShort(api_key=os.environ["MILLIONSHORT_API_KEY"]) r = client.search( "rate limiting with a token bucket", boost_domains=["example.org", "docs.example.com"], ) for hit in r.results: print(hit["position"], hit["site"], hit["title"]) ``` ```ts import { MillionShort } from 'millionshort'; const client = new MillionShort({ apiKey: process.env.MILLIONSHORT_API_KEY }); const r = await client.search('rate limiting with a token bucket', { boostDomains: ['example.org', 'docs.example.com'], }); for (const hit of r.results) { console.log(hit.position, hit.site, hit.title); } ``` The same call as a tool of the MCP server: ```json { "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "search", "arguments": { "query": "rate limiting with a token bucket", "boost_domains": [ "example.org", "docs.example.com" ] } } } ``` A boosted site's results come first, in their own order, then everything else. Boost only reorders what the search found: it does not add results from a site that had none for this query. ## Bury Use bury for sites you would rather not read but do not want to lose: aggregators, sites that summarise other sites, a competitor's marketing pages. ```bash curl https://api.millionshort.com/v1/search \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "query": "rate limiting with a token bucket", "bury_domains": ["example.net"] }' ``` ```python import os import requests r = requests.post( "https://api.millionshort.com/v1/search", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, json={ "query": "rate limiting with a token bucket", "bury_domains": [ "example.net" ] }, timeout=30, ) r.raise_for_status() for hit in r.json()["data"]["results"]: print(hit["position"], hit["title"], hit["url"]) ``` ```ts const res = await fetch('https://api.millionshort.com/v1/search', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ "query": "rate limiting with a token bucket", "bury_domains": [ "example.net" ] }), }); if (!res.ok) throw new Error(`POST /v1/search failed: ${res.status}`); const { data } = (await res.json()) as { data: { results: { position: number; title: string; url: string }[] }; }; for (const hit of data.results) console.log(hit.position, hit.title, hit.url); ``` The same call as a tool of the MCP server: ```json { "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "search", "arguments": { "query": "rate limiting with a token bucket", "bury_domains": [ "example.net" ] } } } ``` Buried results go to the end of what the search found. With a short `num_results` they will usually fall off the list; ask for more results if you want to see them. ## Block Use block for sites you never want: a site you already have, a source your users have rejected, your own domain. ```bash curl https://api.millionshort.com/v1/search \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "query": "rate limiting with a token bucket", "exclude_domains": ["example.com", "example.net"] }' ``` ```python import os import requests r = requests.post( "https://api.millionshort.com/v1/search", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, json={ "query": "rate limiting with a token bucket", "exclude_domains": [ "example.com", "example.net" ] }, timeout=30, ) r.raise_for_status() for hit in r.json()["data"]["results"]: print(hit["position"], hit["title"], hit["url"]) ``` ```ts const res = await fetch('https://api.millionshort.com/v1/search', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ "query": "rate limiting with a token bucket", "exclude_domains": [ "example.com", "example.net" ] }), }); if (!res.ok) throw new Error(`POST /v1/search failed: ${res.status}`); const { data } = (await res.json()) as { data: { results: { position: number; title: string; url: string }[] }; }; for (const hit of data.results) console.log(hit.position, hit.title, hit.url); ``` The same call as a tool of the MCP server: ```json { "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "search", "arguments": { "query": "rate limiting with a token bucket", "exclude_domains": [ "example.com", "example.net" ] } } } ``` The list is filled from further down, so you still get `num_results` results when there are enough. ## Only Use only to search inside a set of sites: your documentation and two others, a list of journals, the sites a customer has approved. ```bash curl https://api.millionshort.com/v1/search \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "query": "token bucket", "include_domains": ["example.org", "docs.example.com"], "num_results": 20 }' ``` ```python import os import requests r = requests.post( "https://api.millionshort.com/v1/search", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, json={ "query": "token bucket", "include_domains": [ "example.org", "docs.example.com" ], "num_results": 20 }, timeout=30, ) r.raise_for_status() for hit in r.json()["data"]["results"]: print(hit["position"], hit["title"], hit["url"]) ``` ```ts const res = await fetch('https://api.millionshort.com/v1/search', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ "query": "token bucket", "include_domains": [ "example.org", "docs.example.com" ], "num_results": 20 }), }); if (!res.ok) throw new Error(`POST /v1/search failed: ${res.status}`); const { data } = (await res.json()) as { data: { results: { position: number; title: string; url: string }[] }; }; for (const hit of data.results) console.log(hit.position, hit.title, hit.url); ``` The same call as a tool of the MCP server: ```json { "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "search", "arguments": { "query": "token bucket", "include_domains": [ "example.org", "docs.example.com" ], "num_results": 20 } } } ``` Only results from the named sites come back. If those sites have little on the query, the list is short and the response carries a `short_results` warning. ## Together, and with the popularity cut The lenses combine with each other and with everything else in the request: - `remove_top_sites` removes by rank; block removes by name. Use both to drop the popular sites and two more you have seen enough of. - Boost and bury apply to what is left after the cuts. - `page_types`, `topics` and `safe_search` apply as usual. `summary.removed.blocked` counts results the block lens took out of the list. As with the popularity cut, some sources apply it before results are counted, so the number can be 0 when the lens plainly worked. ## The same four verbs for page types and topics Boost, bury, block and only also work on kinds of page and on topics, with the slugs of [topics and page types](https://millionshort.com/docs/search/topics-and-page-types): | Verb | Sites | Page types | Topics | |---|---|---|---| | Only | `include_domains` | `page_types` | `topics` | | Block | `exclude_domains` | `exclude_page_types` | `exclude_topics` | | Boost | `boost_domains` | `boost_page_types` | `boost_topics` | | Bury | `bury_domains` | `bury_page_types` | `bury_topics` | ```json { "query": "rust lifetime elision", "boost_page_types": ["documentation", "tutorials"], "bury_page_types": ["forums"], "exclude_page_types": ["listicles"] } ``` The page-type and topic lists act on `web` and `news` results; another source in the same call is named in a `filter_not_applied` warning. `only_domains` and `block_domains` are accepted as other names for `include_domains` and `exclude_domains`. ## Patterns for agents - **A standing lens per user.** Keep each user's trusted and unwanted sites in your own store and send them with every search. A lens lives in the request, or [Spaces](https://millionshort.com/docs/search/spaces) keep one for you. - **Two passes.** Search once with no lens, let the model name the sites it does not trust, and search again with those in `exclude_domains`. - **Stay off what you have.** Put the sites already in your corpus in `exclude_domains` so each search brings something new. - **A closed world.** For regulated answers, send `include_domains` with the approved sites and nothing else can be cited. - **Check a site first.** [`POST /v1/domain`](https://millionshort.com/docs/api-reference/domain) says how popular a site is and whether it carries a risk label, before you boost it. ## Saving a lens in a Space A lens can be saved. A Space holds a `lens` of three lists, `boost`, `bury` and `block`, whose entries are targets: `site:example.org`, `type:forums` or `topic:science`. Its list of sites, with `mode: only` or `mode: boost`, is the fourth verb. Save the Space once and pass its name as `space` on a search, and the lens applies without being sent again. ```json { "name": "Programming, first-hand", "mode": "boost", "sites": ["docs.example.com", "example.org"], "lens": { "boost": ["type:documentation", "type:tutorials"], "bury": ["type:forums"], "block": ["type:listicles", "site:example.net"] } } ``` A list you send in the request replaces the saved one for that search. The [Spaces reference](https://millionshort.com/docs/spaces#the-lens) has the fields, and Spaces are free. ## Over MCP and in the SDKs The `search` tool of the [MCP server](https://millionshort.com/docs/mcp) takes the same four lists with a key. The SDKs take them as `boost_domains` and so on in Python, and `boostDomains` and so on in TypeScript. In the search page for people, the same four are called boost, bury, block and only. --- Source: https://millionshort.com/docs/search/spaces Section: Endpoints / Search # Spaces A saved scope for search. Describe a corner of the web once, then search it with one parameter. A Space is a search scope with a name. It holds the things you would otherwise repeat on every request: - **sites**, to search inside or to prefer; - **the popularity cut**: remove the top N sites, or keep only them; - **page types and topics** to keep or to leave out; - **a lens**: sites, page types and topics to boost, bury or block; - **site filters**: `traffic_trend`, `popular_in`, `site_tech`, `exclude_risky`, `popularity_buckets`; - **default sources** and **safe search**. You save it once and pass its name as `space` on [`POST /v1/search`](https://millionshort.com/docs/search/parameters). Spaces are free, and a search with a Space costs what the search costs. ## A vertical search engine in one parameter A search engine for one subject is mostly a decision about scope: which sites count, which kinds of page, what to leave out. A Space is that decision, saved. The agent that uses it does not need to know the list. It sends a query and a name. ```json { "query": "sourdough hydration", "space": "baking" } ``` That is worth having when: - **The scope outlives the request.** A product about one field, an assistant for one team, a customer's approved sites. Write the scope once, and every search of every agent uses the same one. - **The scope changes, and the code should not.** Add a site to the Space and the next search has it. Nothing is deployed. - **A person chose the scope.** A Space is the same object as a Space on the MillionShort search site. What someone built there by hand can be [imported](https://millionshort.com/docs/spaces#import-from-the-search-site) and handed to an agent. - **The prompt is crowded.** A model that has to carry forty site names in its instructions spends tokens on them and still gets them wrong. A slug is one word. For a scope that is used once, send the fields on the request. A Space saves nothing there. ## Only, or boost `mode` says what the list of sites means. | `mode` | The search | Use it when | |---|---|---| | `only` | Returns results from these sites and no others. The default | The answer must come from a closed set: your documentation, approved publishers, a list of journals | | `boost` | Searches everything and moves these sites ahead | You trust some sites more but still want to hear from the rest | `only` gives a short, clean list, and an empty one when those sites have nothing on the query. `boost` never comes back empty for that reason. If you are unsure, start with `boost`: it cannot hide a good result. A Space does not need sites at all. One with no sites, `remove_top_sites: 10000` and `exclude_page_types: ["products", "listicles"]` is a scope too: the long tail, without the shops. A search inside a list uses the first 50 sites of a Space, and the answer says when a longer list was cut. The [reference](https://millionshort.com/docs/spaces#mode-only-applies-the-first-50-sites) has the detail. ## Curated Spaces Some scopes we have made ourselves: Spaces for a subject, put together and kept by us. They are the same ones the MillionShort search site offers. Everyone can read them and search with them, with or without a key, and they are read-only. ```json { "query": "cast iron seasoning", "space": "curated:home-cooking" } ``` `curated:home-cooking` stands for any curated slug; `GET /v1/spaces?scope=curated` lists the real ones. To change a curated Space, read it and create your own from its fields. ## The request wins A Space is a set of defaults. A parameter you send on the request replaces the Space's value for that setting, and everything you do not send comes from the Space. So one search can step outside the scope without changing it: ```json { "query": "sourdough hydration", "space": "baking", "remove_top_sites": 0 } ``` Here the sites still come from the Space, and its popularity cut is switched off for this call. The answer lists what the Space supplied in `data.space.applied` and what the request replaced in `data.space.overridden`, so an agent can always see the scope it searched. The [reference](https://millionshort.com/docs/spaces#the-request-wins) has the table of which parameter replaces which setting. ## A worked example A support assistant should answer from the product's documentation and two community sites, prefer tutorials, and never cite a shop page. Create the Space once: ```bash curl https://api.millionshort.com/v1/spaces \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "name": "Support", "sites": ["docs.example.com", "example.org/community", "forum.example.net"], "lens": { "boost": ["type:tutorials", "type:documentation"], "bury": ["type:forums"], "block": ["type:products"] }, "safe_search": "strict" }' ``` ```python import os import requests r = requests.post( "https://api.millionshort.com/v1/spaces", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, json={ "name": "Support", "sites": [ "docs.example.com", "example.org/community", "forum.example.net" ], "lens": { "boost": [ "type:tutorials", "type:documentation" ], "bury": [ "type:forums" ], "block": [ "type:products" ] }, "safe_search": "strict" }, timeout=30, ) r.raise_for_status() print(r.json()["data"]) ``` ```ts const res = await fetch('https://api.millionshort.com/v1/spaces', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ "name": "Support", "sites": [ "docs.example.com", "example.org/community", "forum.example.net" ], "lens": { "boost": [ "type:tutorials", "type:documentation" ], "bury": [ "type:forums" ], "block": [ "type:products" ] }, "safe_search": "strict" }), }); if (!res.ok) throw new Error(`POST /v1/spaces failed: ${res.status}`); const { data } = (await res.json()) as { data: unknown }; console.log(data); ``` The answer carries the Space with its `id` and the slug made from its name, `support`. Every search of the assistant then names it: ```bash curl https://api.millionshort.com/v1/search \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "query": "rotate an API key without downtime", "space": "support", "max_highlights": 2 }' ``` ```python import os from millionshort import MillionShort client = MillionShort(api_key=os.environ["MILLIONSHORT_API_KEY"]) r = client.search("rotate an API key without downtime", space="support", max_highlights=2) for hit in r.results: print(hit["position"], hit["site"], hit["page_type"], hit["title"]) ``` ```ts import { MillionShort } from 'millionshort'; const client = new MillionShort({ apiKey: process.env.MILLIONSHORT_API_KEY }); const r = await client.search('rotate an API key without downtime', { space: 'support', maxHighlights: 2, }); for (const hit of r.results) { console.log(hit.position, hit.site, hit.page_type, hit.title); } ``` Only those three sites are searched. Tutorials and documentation come first, forum threads last, and product pages are left out. When the documentation moves to a new host, change the Space with one `PATCH`; the assistant's code and prompt stay as they are. When a question needs the wider web, the assistant sends the same query with no `space`. The scope is a choice per search, not a setting of the key. ## With the other controls - A Space saves what the [lenses](https://millionshort.com/docs/search/lenses), the [popularity cut](https://millionshort.com/docs/search/remove-top-sites), [topics and page types](https://millionshort.com/docs/search/topics-and-page-types) and the [site signals](https://millionshort.com/docs/search/site-signals) already do on a request. It adds no new filter; it gives a set of them a name. - Over [MCP](https://millionshort.com/docs/mcp#spaces), the `search` tool takes `space`, `list_spaces` shows what there is, and `create_space` makes one with a key. - The [Spaces reference](https://millionshort.com/docs/spaces) has every field, the limits per plan, the endpoints and the errors. --- Source: https://millionshort.com/docs/search/topics-and-page-types Section: Endpoints / Search # Topics and page types Keep pages by what they are about and by what kind of page they are. 24 topics and 23 page types. Almost every page in the `web` source carries two labels: a **topic**, what it is about, and a **page type**, what kind of page it is. A search can keep pages by either or both. ```text "topics": ["food"], "page_types": ["forums", "comments"] ``` Both fields are lists. Within a list, a page needs to match any one entry. Across the two, it needs to match both: the request above keeps forum or comment pages about food. Both are free. Each has three more forms, with the same slugs: | To | Page types | Topics | |---|---|---| | Keep only | `page_types` | `topics` | | Never return | `exclude_page_types` | `exclude_topics` | | Move ahead of the rest | `boost_page_types` | `boost_topics` | | Move to the end | `bury_page_types` | `bury_topics` | ```text "boost_page_types": ["forums", "comments"], "exclude_page_types": ["products", "listicles"], "exclude_topics": ["adult"] ``` A slug cannot be in both the keep list and the exclude list of the same kind: that is a `400`. The same two labels come back on every page [Extract](https://millionshort.com/docs/extract/parameters#labels) returns and on every [Monitor](https://millionshort.com/docs/monitor/parameters#events) event, with a confidence and a `source_hint`, so an agent can filter and route a page it fetched the way it filters a page it found. ## Page types | Slug | Label | |---|---| | `articles` | Article | | `blogs` | Blog | | `comments` | Comments | | `companies` | Company page | | `creative-writing` | Creative writing | | `data` | Data | | `directories` | Directory | | `documentation` | Documentation | | `faqs` | FAQ | | `forums` | Forum | | `legal` | Legal notices | | `listicles` | Listicle | | `news` | News | | `press-releases` | Press release | | `products` | Product | | `profiles` | Profile | | `reference` | Reference | | `research` | Research | | `reviews` | Review | | `spam` | Spam & ads | | `support` | Support | | `transcripts` | Transcript | | `tutorials` | Tutorial | ## Topics | Slug | Label | |---|---| | `adult` | Adult | | `art` | Art & design | | `business` | Business & finance | | `education` | Education | | `entertainment` | Entertainment | | `fashion` | Fashion & beauty | | `food` | Food | | `games` | Games | | `hardware` | Hardware | | `health` | Health | | `history` | History | | `home` | Home & hobbies | | `industry` | Industry | | `law` | Law | | `literature` | Literature | | `politics` | Politics | | `programming` | Programming | | `religion` | Religion | | `science` | Science | | `social-life` | Social life | | `software` | Software | | `sports` | Sports | | `transport` | Transport | | `travel` | Travel | The lists above are the ones the API serves today. A program should read them from [`GET /v1/sources`](https://millionshort.com/docs/api-reference/sources), which is free, or from the `list_sources` tool over MCP, so it follows any change. A slug that is not on the list is a `400 INVALID_PARAM`. ## Example Forum and comment pages about food: ```bash curl https://api.millionshort.com/v1/search \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "query": "sourdough starter", "page_types": ["forums", "comments"], "topics": ["food"], "num_results": 10 }' ``` ```python import os from millionshort import MillionShort client = MillionShort(api_key=os.environ["MILLIONSHORT_API_KEY"]) r = client.search( "sourdough starter", page_types=["forums", "comments"], topics=["food"], num_results=10, ) for hit in r.results: print(hit["page_type"], hit["topic"], hit["title"]) ``` ```ts import { MillionShort } from 'millionshort'; const client = new MillionShort({ apiKey: process.env.MILLIONSHORT_API_KEY }); const r = await client.search('sourdough starter', { pageTypes: ['forums', 'comments'], topics: ['food'], numResults: 10, }); for (const hit of r.results) { console.log(hit.page_type, hit.topic, hit.title); } ``` The same call as a tool of the MCP server: ```json { "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "search", "arguments": { "query": "sourdough starter", "page_types": [ "forums", "comments" ], "topics": [ "food" ], "num_results": 10 } } } ``` Every result says what it is: `page_type` and `topic` hold the slugs. ## Things to know - **The labels are assigned by us, automatically, per page.** They are right most of the time and wrong some of the time. A forum thread can be labelled `comments`; a long product review can be labelled `articles`. When a filter returns less than you expected, widen it by one neighbouring type. - **The filters act on `web` and `news` results.** In a call that mixes sources they narrow those two and leave the rest as it is, and the response names the other sources in a `filter_not_applied` warning, so a filter is never ignored silently. Results from some other sources carry the labels too: filter those in your own code, on `page_type` and `topic`. - **To leave a kind of page out, use `exclude_page_types`.** To leave product pages out of a search for discussion: `"exclude_page_types": ["products"]`. To prefer discussion without losing everything else: `"boost_page_types": ["forums", "comments"]`. - **A narrow filter can run short.** If fewer pages match than `num_results`, the response carries a `short_results` warning. ## Agent recipes | The agent wants | `page_types` | Also set | |---|---|---| | What practitioners say | `forums`, `comments` | `remove_top_sites: 10000` | | How to do something | `tutorials`, `documentation`, `faqs` | | | Independent opinion on a product | `reviews`, `blogs`, `forums` | `remove_top_sites: 1000` | | The primary record | `research`, `data`, `legal`, `press-releases` | | | Who a company is | `companies`, `profiles` | | | Long-form reading | `articles`, `blogs`, `creative-writing` | `topics` for the subject | | The words that were spoken | `transcripts` | | To study low-quality pages on purpose, `spam` is a page type like any other. Leave it out of every other request simply by naming the types you want. ## Related - [Filters for agents](https://millionshort.com/docs/search/filters): every filter in one table, and more recipes. - [Remove the top sites](https://millionshort.com/docs/search/remove-top-sites) and [Lenses](https://millionshort.com/docs/search/lenses). - [Spaces](https://millionshort.com/docs/search/spaces): page types and topics saved with a list of sites under one name. - [Sources reference](https://millionshort.com/docs/api-reference/sources): the call that returns these lists. --- Source: https://millionshort.com/docs/search/popularity-and-risk Section: Endpoints / Search # Popularity and risk signals Every result says how popular its site is and whether the site carries a risk label. An agent can use both to decide what to trust. A list of links tells an agent nothing about where the links lead. MillionShort adds two facts about the site behind every result, and a way to ask for the same facts about any site. ## Popularity ```json { "rank": 48210, "bucket": "top-100k" } ``` | Field | Type | Notes | |---|---|---| | `rank` | integer or null | The site's popularity rank (1 is the most popular), or null when it is outside the top 1,000,000 or unknown. | | `bucket` | `top-100`, `top-1k`, `top-10k`, `top-100k`, `top-1m`, `long-tail`, `unknown` | | The buckets, from most to least popular: `top-100`, `top-1k`, `top-10k`, `top-100k`, `top-1m`, then `long-tail` for a site outside the top 1,000,000, and `unknown` when the result has no site rank at all (usually a thread or a community). Popularity is not quality. A `top-100` site is well known; it may or may not be right. A `long-tail` site is little known; it may be the only first-hand account there is. What the signal gives an agent is context: - **Diversity.** If every result is `top-1k`, the agent is reading the mainstream. Searching again with [`remove_top_sites`](https://millionshort.com/docs/search/remove-top-sites) shows what is underneath. - **Weighting.** For a medical or legal claim an agent may prefer well-established sites; for a product opinion it may prefer the long tail, where fewer pages are written to sell. - **Explaining itself.** "This comes from a small independent site" is a useful thing to tell a person. Rank belongs to the site, not the page: a page on a subdomain of a large hosting or blogging platform carries the platform's rank. ## Risk `risk` is `null` for most sites. When a site carries a risk label, the result says so: ```json { "level": "labelled", "categories": ["phishing"] } ``` | Field | Type | Notes | |---|---|---| | `level` | `labelled`, `demoted`, `blocked` | | | `categories` | array of strings | | | Level | What happened to the result | |---|---| | `labelled` | Nothing. It is in its place, with the label attached. The decision is yours | | `demoted` | It was moved down the list | | `blocked` | It was removed from search results. You see this level only from `POST /v1/domain` | `categories` says why, in a few short words. The example above is an illustration; read the values as text for a person or a model, and branch on `level`. `summary.removed.risk` counts results that were removed because of a risk label. A sensible default for an agent: never open or cite a `demoted` result without saying so, and treat `labelled` as a reason to look for a second source. ## SafeSearch `safe_search` is a separate control for adult content: `off`, `moderate` (the default) or `strict`. `summary.removed.safe_search` counts what it removed. It is not a risk label and does not appear on results. ## Why a result is where it is Add `"explain": true` to a search and every result gains two more fields. It is free. ```bash curl https://api.millionshort.com/v1/search \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "query": "restoring a cast iron skillet", "num_results": 5, "explain": true }' ``` ```python import os import requests r = requests.post( "https://api.millionshort.com/v1/search", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, json={ "query": "restoring a cast iron skillet", "num_results": 5, "explain": True }, timeout=30, ) r.raise_for_status() for hit in r.json()["data"]["results"]: print(hit["position"], hit["title"], hit["url"]) ``` ```ts const res = await fetch('https://api.millionshort.com/v1/search', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ "query": "restoring a cast iron skillet", "num_results": 5, "explain": true }), }); if (!res.ok) throw new Error(`POST /v1/search failed: ${res.status}`); const { data } = (await res.json()) as { data: { results: { position: number; title: string; url: string }[] }; }; for (const hit of data.results) console.log(hit.position, hit.title, hit.url); ``` The same call as a tool of the MCP server: ```json { "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "search", "arguments": { "query": "restoring a cast iron skillet", "num_results": 5, "explain": true } } } ``` `why` is a short list of reasons in plain words, such as the result's position by relevance, the query words in its title, and its site's popularity. `signals` holds three numbers: | Field | Type | Notes | |---|---|---| | `text_rank` | integer or null | Position by text relevance alone. | | `link_authority` | number, 0 to 10 or null | How well linked the site is, 0 to 10. Null when the source has none for the result. | | `words` | integer or null | Length of the page in words. | Sources whose results are not pages on sites (`hn`, `social`, `communities` and others) return `null` for some or all of the three. `why` is still filled in. ## Ask about any site `POST /v1/domain` returns the same `popularity` and `risk` for up to 25 sites in one call, for 1 credit. Use it before following a link the agent found somewhere else, or to check a list of sources. ```bash curl https://api.millionshort.com/v1/domain \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "domains": ["example.com", "blog.example.org"] }' ``` ```python import os from millionshort import MillionShort client = MillionShort(api_key=os.environ["MILLIONSHORT_API_KEY"]) info = client.get_domain_info(["example.com", "blog.example.org"]) for entry in info.domains: risk = entry["risk"]["level"] if entry["risk"] else "none" print(entry["domain"], entry["popularity"]["bucket"], "risk:", risk) ``` ```ts import { MillionShort } from 'millionshort'; const client = new MillionShort({ apiKey: process.env.MILLIONSHORT_API_KEY }); const info = await client.getDomainInfo(['example.com', 'blog.example.org']); for (const entry of info.domains) { console.log(entry.domain, entry.popularity.bucket, 'risk:', entry.risk?.level ?? 'none'); } ``` The same call as a tool of the MCP server: ```json { "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "get_domain_info", "arguments": { "domains": [ "example.com", "blog.example.org" ] } } } ``` Over MCP this is the `get_domain_info` tool. The [Domain info reference](https://millionshort.com/docs/api-reference/domain) has the fields. ## Filtering on them Two request fields do the common cases for you. `exclude_risky: true` drops every result whose site carries a risk label. `popularity_buckets` keeps the bands you name: ```json { "query": "restoring a cast iron skillet", "popularity_buckets": ["top-100k", "top-1m", "long-tail"], "exclude_risky": true } ``` Three more facts about the site are on every result and are filters as well: where it is popular, which way its traffic is moving and what it is built with. See [Site signals](https://millionshort.com/docs/search/site-signals). ## A filter of your own The signals are on every result, so an agent can also apply its own rule after the search. This keeps results from outside the 10,000 most popular sites that carry no risk label: ```python import os from millionshort import MillionShort client = MillionShort(api_key=os.environ["MILLIONSHORT_API_KEY"]) r = client.search("restoring a cast iron skillet", num_results=30) keep = [ hit for hit in r.results if hit["risk"] is None and hit["popularity"]["bucket"] in ("top-100k", "top-1m", "long-tail") ] for hit in keep: print(hit["popularity"]["bucket"], hit["url"]) ``` ```ts import { MillionShort } from 'millionshort'; const client = new MillionShort({ apiKey: process.env.MILLIONSHORT_API_KEY }); const r = await client.search('restoring a cast iron skillet', { numResults: 30 }); const keep = r.results.filter( (hit) => hit.risk === null && ['top-100k', 'top-1m', 'long-tail'].includes(hit.popularity.bucket), ); for (const hit of keep) { console.log(hit.popularity.bucket, hit.url); } ``` ## What the signals are not - They describe the **site**, not the page and not the claim. A good site can host a wrong page. - A missing risk label is not a guarantee. It means the site carries no label today. - We do not say where a rank or a label comes from, and the response never does either. --- Source: https://millionshort.com/docs/search/site-signals Section: Endpoints / Search # Site signals: popular where, traffic trends, site tech Three more facts about the site behind a result, and a filter for each. Where its audience is, whether it is rising or falling, and what it is built with. Every result says how popular its site is and whether it carries a risk label: see [Popularity and risk](https://millionshort.com/docs/search/popularity-and-risk). Three more fields complete the picture of the site, and each one is also a filter of [`POST /v1/search`](https://millionshort.com/docs/search/parameters). All of them are free. | Result field | Request filter | What it says | |---|---|---| | `popular_in` | `popular_in` | The countries where the site is among the popular sites | | `traffic_trend` | `traffic_trend` | Which way visits to the site are moving | | `site_tech` | `site_tech` | What the site is built with | | `popularity` | `popularity_buckets`, `remove_top_sites`, `only_top_sites` | How popular the site is overall | | `risk` | `exclude_risky` | Whether the site carries a risk label | ```json { "title": "Heat pump grants: what you can claim", "url": "https://example.co.uk/heat-pump-grants", "site": "example.co.uk", "popularity": { "rank": 48211, "bucket": "top-100k" }, "risk": null, "traffic_trend": "rising", "popular_in": ["GB", "IE"], "site_tech": ["WordPress"] } ``` The result is cut to the fields this page is about. Each of the three is `null` when we do not know it. ## Popular where A site's worldwide rank hides where its audience is. A regional newspaper, a national retailer or a site in one language can be large in one country and unknown elsewhere. `popular_in` on a result lists up to 12 two-letter country codes: the countries where the site is among the popular sites. As a filter, `popular_in` takes up to 10 codes and keeps the results whose site is popular in at least one of them. ```bash curl https://api.millionshort.com/v1/search \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "query": "heat pump grant", "popular_in": ["GB", "IE"] }' ``` ```python import os import requests r = requests.post( "https://api.millionshort.com/v1/search", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, json={ "query": "heat pump grant", "popular_in": [ "GB", "IE" ] }, timeout=30, ) r.raise_for_status() for hit in r.json()["data"]["results"]: print(hit["position"], hit["title"], hit["url"]) ``` ```ts const res = await fetch('https://api.millionshort.com/v1/search', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ "query": "heat pump grant", "popular_in": [ "GB", "IE" ] }), }); if (!res.ok) throw new Error(`POST /v1/search failed: ${res.status}`); const { data } = (await res.json()) as { data: { results: { position: number; title: string; url: string }[] }; }; for (const hit of data.results) console.log(hit.position, hit.title, hit.url); ``` The same call as a tool of the MCP server: ```json { "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "search", "arguments": { "query": "heat pump grant", "popular_in": [ "GB", "IE" ] } } } ``` What an agent can do with it: - Prefer sources that are well known in the user's own country. - Find sites that are strong in one country and small worldwide, the local long tail: `popular_in` with `remove_top_sites`. - Explain a source: "a major site in Portugal, little known elsewhere". `popular_in` is about the site's audience. It is not the same as `country`, which keeps sites by their country domain ending, such as `.de`. ## Traffic trends Popularity says where a site stands. A trend says which way it is moving. `traffic_trend` on a result is one of `rising`, `spiking`, `steady`, `falling`, `dropped`, `new`, or `null`: | Value | Meaning | |---|---| | `rising` | Visits are growing | | `spiking` | Visits jumped sharply in the last days | | `steady` | No clear change | | `falling` | Visits are shrinking | | `dropped` | Visits fell sharply in the last days | | `new` | The site appeared recently | As a filter, `traffic_trend` takes a list of those values and keeps the results whose site is moving that way. ```bash curl https://api.millionshort.com/v1/search \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "query": "best running shoes", "traffic_trend": ["rising", "spiking", "new"], "num_results": 20 }' ``` ```python import os import requests r = requests.post( "https://api.millionshort.com/v1/search", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, json={ "query": "best running shoes", "traffic_trend": [ "rising", "spiking", "new" ], "num_results": 20 }, timeout=30, ) r.raise_for_status() for hit in r.json()["data"]["results"]: print(hit["position"], hit["title"], hit["url"]) ``` ```ts const res = await fetch('https://api.millionshort.com/v1/search', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ "query": "best running shoes", "traffic_trend": [ "rising", "spiking", "new" ], "num_results": 20 }), }); if (!res.ok) throw new Error(`POST /v1/search failed: ${res.status}`); const { data } = (await res.json()) as { data: { results: { position: number; title: string; url: string }[] }; }; for (const hit of data.results) console.log(hit.position, hit.title, hit.url); ``` The same call as a tool of the MCP server: ```json { "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "search", "arguments": { "query": "best running shoes", "traffic_trend": [ "rising", "spiking", "new" ], "num_results": 20 } } } ``` What to expect: most sites are steady, and many small sites have no trend at all. The filter is checked on the best matches for your query, not on the whole index, so a filter for `rising` keeps few results and often none. Use it with a broad query, ask for 20 or more results, and expect a short or empty list with a `short_results` warning. To see the trend without filtering, read `traffic_trend` on each result. What an agent can do with it: - Find rising sites in a field: search it broadly and keep the results whose site is rising. Add [`remove_top_sites`](https://millionshort.com/docs/search/remove-top-sites) only when the list is long enough to cut. - Notice a falling site before relying on it. - Tell new and growing from old and fading, which rank alone cannot do. ## Site tech `site_tech` on a result lists what the site is built with, up to 8 names: the platform it runs on and the main tools it uses, for example `["WordPress", "WooCommerce"]`. An empty list means we looked and recognised nothing. `null` means we have not looked at that site. As a filter, `site_tech` takes up to 10 names and keeps the results whose site is built with at least one of them. Names are matched without regard to case, so send them as the results show them or in lower case. ```bash curl https://api.millionshort.com/v1/search \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "query": "handmade ceramic mugs", "site_tech": ["woocommerce"], "page_types": ["products"] }' ``` ```python import os import requests r = requests.post( "https://api.millionshort.com/v1/search", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, json={ "query": "handmade ceramic mugs", "site_tech": [ "woocommerce" ], "page_types": [ "products" ] }, timeout=30, ) r.raise_for_status() for hit in r.json()["data"]["results"]: print(hit["position"], hit["title"], hit["url"]) ``` ```ts const res = await fetch('https://api.millionshort.com/v1/search', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ "query": "handmade ceramic mugs", "site_tech": [ "woocommerce" ], "page_types": [ "products" ] }), }); if (!res.ok) throw new Error(`POST /v1/search failed: ${res.status}`); const { data } = (await res.json()) as { data: { results: { position: number; title: string; url: string }[] }; }; for (const hit of data.results) console.log(hit.position, hit.title, hit.url); ``` The same call as a tool of the MCP server: ```json { "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "search", "arguments": { "query": "handmade ceramic mugs", "site_tech": [ "woocommerce" ], "page_types": [ "products" ] } } } ``` What an agent can do with it: - Find sites of a kind: shops on a given shop platform, sites on a given publishing system. - Qualify leads and research markets by technology. - Read a source: a result from a site built with a wiki system is a different kind of source from a shop. ## Popularity buckets `popularity_buckets` keeps the results whose site is in one of the buckets you name: `top-100`, `top-1k`, `top-10k`, `top-100k`, `top-1m`, `long-tail`. It is the same scale as `popularity.bucket` on every result. Use it when you want a band that `remove_top_sites` and `only_top_sites` cannot describe, such as "between the top 10,000 and the top 1,000,000". ```json { "query": "restoring a cast iron skillet", "popularity_buckets": ["top-100k", "top-1m"] } ``` ## Exclude risky sites `exclude_risky: true` drops every result whose site carries a risk label, so that `risk` is `null` on all that remain. Without it, results from labelled sites come back with their label and your agent decides. ```json { "query": "free vpn comparison", "popularity_buckets": ["long-tail", "top-1m"], "exclude_risky": true } ``` ## Things to know - **These are facts about the site, not the page.** A good site can host a wrong page. - **They apply to every source.** A result with no site of its own, such as a post on a platform, has no site facts and does not pass a site filter. - **The filters are checked on the best matches for the query.** `summary.removed.filters` says how many results they took out. A narrow query with a rare filter can come back short. - **`null` is "not known", not "no".** A site with `traffic_trend: null` is not steady; we have no trend for it. - We do not say where a signal comes from, and the response never does either. ## Over MCP and in the SDKs The `search` tool of the [MCP server](https://millionshort.com/docs/mcp) takes the same fields under the same names. In the SDKs they are arguments of `search`: `popular_in`, `traffic_trend`, `site_tech`, `popularity_buckets` and `exclude_risky` in Python; `popularIn`, `trafficTrend`, `siteTech`, `popularityBuckets` and `excludeRisky` in TypeScript. ```bash curl https://api.millionshort.com/v1/search \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "query": "best running shoes", "traffic_trend": ["rising", "spiking", "new"], "num_results": 20 }' ``` ```python import os from millionshort import MillionShort client = MillionShort(api_key=os.environ["MILLIONSHORT_API_KEY"]) r = client.search("best running shoes", traffic_trend=["rising", "spiking", "new"], num_results=20) for hit in r.results: print(hit["traffic_trend"], hit["popular_in"], hit["site_tech"], hit["url"]) ``` ```ts import { MillionShort } from 'millionshort'; const client = new MillionShort({ apiKey: process.env.MILLIONSHORT_API_KEY }); const r = await client.search('best running shoes', { trafficTrend: ['rising', 'spiking', 'new'], numResults: 20, }); for (const hit of r.results) { console.log(hit.traffic_trend, hit.popular_in, hit.site_tech, hit.url); } ``` The same call as a tool of the MCP server: ```json { "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "search", "arguments": { "query": "best running shoes", "traffic_trend": [ "rising", "spiking", "new" ], "num_results": 20 } } } ``` ## Related - [Filters for agents](https://millionshort.com/docs/search/filters): every filter in one table. - [Popularity and risk](https://millionshort.com/docs/search/popularity-and-risk): the two signals these build on. - [Search reference](https://millionshort.com/docs/search/parameters): every field, with its limits. --- Source: https://millionshort.com/docs/search/freshness Section: Endpoints / Search # Freshness and dates Which sources are current, which are not, and how to get recent material into a search. Not every source is equally fresh, and the API says so openly. ## The web source is not a live feed `web` is a large index that is refreshed periodically, not continuously. That has three consequences: - A page that changed recently may show its earlier text in the snippet. - A page published in recent months may not be there yet. - Web results carry no date. `published_date` is `null` on every `web` result. For a question whose answer does not change week to week, none of this matters. For a question about this week, add a source that is kept current. ## The sources that are current | Source | How fresh | Dates on results | Date filter | |---|---|---|---| | `social` | New posts within minutes. Holds the last 30 days | Yes | Yes | | `hn` | New threads within minutes. Holds the last 30 days | Yes | Yes | | `news` | Every hour | Yes | Yes | | `podcasts` | Twice a day. Also holds years of history | Yes | Yes | | `academic`, `medical` | Every day. Also hold years of history | Yes | Yes | | `finance` | New filings are added in batches, so the newest can be some days old. Holds the last year of filings | Yes | Yes | | `law` | Statutes and regulations every day; court opinions every quarter. Opinions carry their date | Some | Yes | | `contracts`, `communities` | Every day | No | Yes | | `web` | A large snapshot, rebuilt from time to time | No | No, with a warning | | `smallweb` | Refreshed every week | Some | No, with a warning | | `discussions` | Varies | Rarely | No, with a warning | `contracts` and `communities` are filtered on a date the record holds but the result does not show. `published_date` is `YYYY-MM-DD`, or a year alone, when the source knows it, and `null` otherwise. [`GET /v1/sources`](https://millionshort.com/docs/api-reference/sources) returns this as data. Each source has a `freshness`, which is a `cadence` and a sentence, and for `web` also the dates between which its pages were captured. Each source also lists the `filters` it applies. ## Getting recent material Send a date filter. `time_range` is `day`, `week`, `month` or `year`. `start_date` and `end_date` are days written `YYYY-MM-DD`, and both days are included. `time_range` cannot be combined with the two dates. All three are free. The filter is applied by the sources whose records carry a date: `news`, `hn`, `social`, `communities`, `podcasts`, `academic`, `medical`, `law`, `finance` and `contracts`. `web` pages carry no date of their own, so a date filter is not applied to `web`. The same holds for `smallweb` and `discussions`. Their results come back as if the filter had not been sent, and the response names them in a `filter_not_applied` warning. A filter is never ignored silently. `hn` and `social` hold the last 30 days, so a date range that ends earlier returns nothing from them, and the warning says so. For a question about this week: 1. **Ask a current source in the same call.** One search can ask up to five sources. 2. **Send `time_range`.** The dated sources return only what falls inside it. 3. **Treat undated `web` results as background.** They were not filtered by date. Read `warnings` to see which sources the filter did not reach. ```bash curl https://api.millionshort.com/v1/search \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "query": "central bank interest rate decision", "sources": ["news", "social", "web"], "num_results": 30, "time_range": "week" }' ``` ```python import os from millionshort import MillionShort client = MillionShort(api_key=os.environ["MILLIONSHORT_API_KEY"]) r = client.search( "central bank interest rate decision", sources=["news", "social", "web"], num_results=30, time_range="week", ) recent = [hit for hit in r.results if hit["source"] != "web"] background = [hit for hit in r.results if hit["source"] == "web"] for hit in recent: print(hit["published_date"], hit["source"], hit["title"]) print(len(background), "undated web results kept as background") for warning in r.warnings: print("warning:", warning["code"], warning["message"]) ``` ```ts import { MillionShort } from 'millionshort'; const client = new MillionShort({ apiKey: process.env.MILLIONSHORT_API_KEY }); const r = await client.search('central bank interest rate decision', { sources: ['news', 'social', 'web'], numResults: 30, timeRange: 'week', }); const recent = r.results.filter((hit) => hit.source !== 'web'); const background = r.results.filter((hit) => hit.source === 'web'); for (const hit of recent) { console.log(hit.published_date, hit.source, hit.title); } console.log(background.length, 'undated web results kept as background'); for (const warning of r.warnings) console.log('warning:', warning.code, warning.message); ``` The same call as a tool of the MCP server: ```json { "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "search", "arguments": { "query": "central bank interest rate decision", "sources": [ "news", "social", "web" ], "num_results": 30, "time_range": "week" } } } ``` This call costs 3 credits for the three sources and 1 for the twenty results beyond the first ten. The date filter costs nothing. `language` and `country` are filters too, and each is applied by the sources that can apply it. The `web` source stores no language. It is mostly English, with pages in other languages too, so the language of each web result is detected from its text and a `language` filter is applied to that; the response says so in a `language_detected` warning. Every result carries its `language` when it is known. The [Search reference](https://millionshort.com/docs/search/parameters#dates-language-and-country) has the table. ## Being told when something new appears You can poll a search on a schedule yourself, or let [Monitor](https://millionshort.com/docs/monitor/parameters) do it for you: it runs a search on an interval and reports only the results it has not seen before. The [news monitoring guide](https://millionshort.com/docs/monitor/guides/news-monitoring) shows both. ## Reading a page as it is now A snippet is the text the index holds. So is `content`, which `include_content: true` adds to `web` and `news` results: `captured_from` and `captured_to` say when we captured the page. To read a page as it is at this moment, use [Extract](https://millionshort.com/docs/extract/parameters), which fetches a page and returns clean text with the time it was fetched. --- Source: https://millionshort.com/docs/search/highlights Section: Endpoints / Search # Highlights and page text Three sizes of text for each result: the snippet, the passages that best answer the query, and the page itself. A search result can carry three sizes of text. Choose by what the model that reads it needs, and by what you want to pay. | You want | Send | Comes back in | Cost | |---|---|---|---| | A short extract around the match | nothing, or `max_chars_per_result` (0 to 2,000) | `snippet` | Free | | The passages that best answer the query | `max_highlights` (0 to 5; 0 is off) | `highlights`, `highlight_spans` | Free | | The text of the page | `include_content: true` | `content` | 1 credit a call for the text of up to 10 results; 1 more for each further 10 with text | ## Highlights ```bash curl https://api.millionshort.com/v1/search \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "query": "sourdough starter hydration", "max_highlights": 3 }' ``` ```python import os import requests r = requests.post( "https://api.millionshort.com/v1/search", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, json={ "query": "sourdough starter hydration", "max_highlights": 3 }, timeout=30, ) r.raise_for_status() for hit in r.json()["data"]["results"]: print(hit["position"], hit["title"], hit["url"]) ``` ```ts const res = await fetch('https://api.millionshort.com/v1/search', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ "query": "sourdough starter hydration", "max_highlights": 3 }), }); if (!res.ok) throw new Error(`POST /v1/search failed: ${res.status}`); const { data } = (await res.json()) as { data: { results: { position: number; title: string; url: string }[] }; }; for (const hit of data.results) console.log(hit.position, hit.title, hit.url); ``` The same call as a tool of the MCP server: ```json { "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "search", "arguments": { "query": "sourdough starter hydration", "max_highlights": 3 } } } ``` `max_highlights` returns up to that many passages for each result, best first. `highlight_characters` sets how long one passage should be, and cannot be sent without `max_highlights`. Each highlight has a span in `highlight_spans`, in the same order: | Field | Type | Notes | |---|---|---| | `start` | integer, 0 or more or null | Character offset (in Unicode code points) of the highlight in `content.text` as this result returns it. Null when there is nothing to point into: `include_content` was not sent, the highlight lies past the `max_characters` cut, or we hold no page text for the result. | | `end` | integer or null | The offset just past the highlight. Null with `start`. | | `score` | number, 0 to 1 | 1.0 is a full-length passage of plain prose that holds every word of the query. | Without `max_highlights`, `highlights` is the snippet as a one-item list. Highlights suit an agent that reads many results and decides which to open: they cost nothing and keep the context small. ## Page text ```bash curl https://api.millionshort.com/v1/search \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "query": "sourdough starter hydration", "num_results": 5, "include_content": true, "max_characters": 4000 }' ``` ```python import os import requests r = requests.post( "https://api.millionshort.com/v1/search", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, json={ "query": "sourdough starter hydration", "num_results": 5, "include_content": True, "max_characters": 4000 }, timeout=30, ) r.raise_for_status() for hit in r.json()["data"]["results"]: print(hit["position"], hit["title"], hit["url"]) ``` ```ts const res = await fetch('https://api.millionshort.com/v1/search', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ "query": "sourdough starter hydration", "num_results": 5, "include_content": true, "max_characters": 4000 }), }); if (!res.ok) throw new Error(`POST /v1/search failed: ${res.status}`); const { data } = (await res.json()) as { data: { results: { position: number; title: string; url: string }[] }; }; for (const hit of data.results) console.log(hit.position, hit.title, hit.url); ``` The same call as a tool of the MCP server: ```json { "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "search", "arguments": { "query": "sourdough starter hydration", "num_results": 5, "include_content": true, "max_characters": 4000 } } } ``` `include_content: true` adds `content` to each `web` and `news` result: the text of the page as we hold it. `max_characters` cuts it (500 to 50,000, default 10,000) and cannot be sent without `include_content`. | Field | Type | Notes | |---|---|---| | `text` | string | The page's text: menus and page chrome removed, e-mail addresses and phone numbers redacted, cut at `max_characters`. | | `characters` | integer | Length of `text`. | | `truncated` | boolean | True when the page is longer than `text`. | | `captured_from` | string | The earliest day this copy can have been taken. Treat the page as being this old. | | `captured_to` | string | The latest day this copy can have been taken. The same day as `captured_from` for news. | Three things to know: - **No request is made to the site.** The text comes from our own copy, so it is fast and it cannot be blocked. It is also as old as that copy: for a web result, `captured_from` and `captured_to` give the window in which the page was captured, and you should treat the page as being as old as `captured_from`. - **We do not hold text for every result.** Those have `content: null`, are not charged for content, and the response carries a `content_partial` warning. - **Only `web` and `news` have it.** On another source the filter is reported in a `filter_not_applied` warning, never ignored silently. The text is cleaned: menus and page chrome are taken out, and e-mail addresses and phone numbers are replaced with `[email]` and `[phone]`. ## Which one - Deciding what to read: highlights. - Answering from a handful of pages you trust: `include_content` with a small `num_results`. - A page as it is right now, or a page a search did not return: that is what [Extract](https://millionshort.com/docs/extract) is for. The fields are listed in full under [Parameters](https://millionshort.com/docs/search/parameters#highlights), and the cost rules under [Pricing and limits](https://millionshort.com/docs/search/pricing). --- Source: https://millionshort.com/docs/search/guides Section: Endpoints / Search # Search guides Whole jobs done with Search, step by step, with code that runs. Each guide takes one job from the first request to working code. - [RAG with MillionShort](https://millionshort.com/docs/search/guides/rag): Retrieve passages from the web for a language model, keep the noise out, and cite what you used. - [Agent tool use](https://millionshort.com/docs/search/guides/agent-tool-use): Give an agent search as a tool, over MCP or as a function, and teach it when to use the parts that matter. - [Long-tail research](https://millionshort.com/docs/search/guides/long-tail-research): A method for finding what the first page of any search engine does not show you. ## Recipes Shorter than a guide: one request that solves one problem. - [Agent recipes](https://millionshort.com/docs/search/filters#agent-recipes): the filters an agent should reach for, each as a request, and [what to tell your agent](https://millionshort.com/docs/search/filters#what-to-tell-your-agent) about them. - [Examples](https://millionshort.com/docs/search/parameters#examples) on the Parameters page: several sources at once, kinds of page, sites moved up and left out. - [A vertical search engine in one parameter](https://millionshort.com/docs/search/spaces#a-vertical-search-engine-in-one-parameter): a Space as a saved scope. ## Elsewhere - [News monitoring](https://millionshort.com/docs/monitor/guides/news-monitoring) is with Monitor: the guide shows the job with a monitor and with a scheduled search. - The [use cases](https://millionshort.com/docs/use-cases) describe the problems these guides solve, and say what the API does not do for each. - The [integrations](https://millionshort.com/docs/integrations) have a page for each framework and client. --- Source: https://millionshort.com/docs/search/guides/rag Section: Endpoints / Search # RAG with MillionShort Retrieve passages from the web for a language model, keep the noise out, and cite what you used. Retrieval-augmented generation has three steps: find passages, put them in the prompt, and have the model answer from them with citations. This guide covers the first two with MillionShort, and stops where your model begins. What you get from a search is a ranked list of results, each with a **snippet**: the passage of the page that matches the query, up to 2,000 characters. That is the text you retrieve by default. When a snippet is not enough, `include_content: true` adds the text of the page as we hold it to `web` and `news` results, for 1 credit a call (up to 10 results). It is our stored copy, not a live fetch; to fetch a page as it is now, use [Extract](https://millionshort.com/docs/extract/parameters). ## 1. Search with long snippets Ask for the longest snippets when the results are going into a prompt. The default is 800 characters. ```bash curl https://api.millionshort.com/v1/search \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "query": "how does a heat pump work in cold climates", "num_results": 10, "max_chars_per_result": 2000 }' ``` ```python import os import requests r = requests.post( "https://api.millionshort.com/v1/search", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, json={ "query": "how does a heat pump work in cold climates", "num_results": 10, "max_chars_per_result": 2000 }, timeout=30, ) r.raise_for_status() for hit in r.json()["data"]["results"]: print(hit["position"], hit["title"], hit["url"]) ``` ```ts const res = await fetch('https://api.millionshort.com/v1/search', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ "query": "how does a heat pump work in cold climates", "num_results": 10, "max_chars_per_result": 2000 }), }); if (!res.ok) throw new Error(`POST /v1/search failed: ${res.status}`); const { data } = (await res.json()) as { data: { results: { position: number; title: string; url: string }[] }; }; for (const hit of data.results) console.log(hit.position, hit.title, hit.url); ``` The same call as a tool of the MCP server: ```json { "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "search", "arguments": { "query": "how does a heat pump work in cold climates", "num_results": 10, "max_chars_per_result": 2000 } } } ``` ## 2. Take the noise out before it reaches the model A model cannot ignore what is in its context. Four controls keep weak pages out of it, and all four are free: - **`remove_top_sites`** drops the most popular sites, which is where most search-optimised filler lives. Try 1,000 to 10,000. See [Remove the top sites](https://millionshort.com/docs/search/remove-top-sites). - **`page_types`** keeps kinds of page: `articles`, `documentation`, `tutorials`, `research`, `reference` and others from [`GET /v1/sources`](https://millionshort.com/docs/api-reference/sources). - **`exclude_domains`** removes sites you have learned not to trust. See [Lenses](https://millionshort.com/docs/search/lenses). - **`exclude_risky`** drops every result whose site carries a risk label, so you do not have to check `risk` yourself. Then, in your own code, keep at most two results per `site`, so one site cannot fill the context. ## 3. Build the context Number the passages, and carry the URL with each one so the model can cite it. ```python import os from millionshort import MillionShort client = MillionShort(api_key=os.environ["MILLIONSHORT_API_KEY"]) def retrieve(question, limit=6): r = client.search( question, num_results=20, remove_top_sites=1000, exclude_risky=True, max_chars_per_result=2000, ) passages, per_site = [], {} for hit in r.results: if not hit["snippet"]: continue per_site[hit["site"]] = per_site.get(hit["site"], 0) + 1 if per_site[hit["site"]] > 2: continue passages.append(hit) if len(passages) == limit: break return passages, r.usage.credits def build_prompt(question, passages): blocks = [ f"[{n}] {hit['title']}\n{hit['url']}\n{hit['snippet']}" for n, hit in enumerate(passages, start=1) ] return ( "Answer the question using only the numbered passages. " "Cite passages as [n]. If they do not contain the answer, say so.\n\n" + "\n\n".join(blocks) + f"\n\nQuestion: {question}" ) question = "how does a heat pump work in cold climates" passages, credits = retrieve(question) print(build_prompt(question, passages)[:400]) print(len(passages), "passages for", credits, "credits") ``` ```ts import { MillionShort } from 'millionshort'; const client = new MillionShort({ apiKey: process.env.MILLIONSHORT_API_KEY }); async function retrieve(question: string, limit = 6) { const r = await client.search(question, { numResults: 20, removeTopSites: 1000, excludeRisky: true, maxCharsPerResult: 2000, }); const passages: typeof r.results = []; const perSite = new Map(); for (const hit of r.results) { if (!hit.snippet) continue; const seen = (perSite.get(hit.site) ?? 0) + 1; perSite.set(hit.site, seen); if (seen > 2) continue; passages.push(hit); if (passages.length === limit) break; } return { passages, credits: r.usage?.credits }; } function buildPrompt(question: string, passages: Array<{ title: string; url: string; snippet: string }>) { const blocks = passages.map((hit, n) => `[${n + 1}] ${hit.title}\n${hit.url}\n${hit.snippet}`); return [ 'Answer the question using only the numbered passages. Cite passages as [n]. If they do not contain the answer, say so.', blocks.join('\n\n'), `Question: ${question}`, ].join('\n\n'); } const question = 'how does a heat pump work in cold climates'; const { passages, credits } = await retrieve(question); console.log(buildPrompt(question, passages).slice(0, 400)); console.log(passages.length, 'passages for', credits, 'credits'); ``` Send the prompt to the model of your choice. Nothing here depends on which one. ## 4. Ask the right experts A question about this week needs a current source; a question about a paper needs `academic`. One call can ask up to five [sources](https://millionshort.com/docs/search/sources), and each result says which it came from, so you can label passages for the model: "[3] (news, 2026-11-06) ...". | Question | `sources` | |---|---| | General knowledge, how-to | `["web"]` | | Current events | `["news", "web"]` | | A scientific claim | `["academic", "web"]`, or `["medical"]` for clinical questions | | Opinions and experience | `["discussions", "smallweb"]` | | A company's own statements | `["finance", "news"]` | Dated sources let you tell the model how old a passage is, and `time_range` or `start_date` and `end_date` keep only the passages from the days you want. `web` results have no date, so a date filter is not applied to them; see [Freshness](https://millionshort.com/docs/search/freshness). ## 5. Cite honestly - Cite the `url` of each passage the answer used, and show `site` beside it. - A snippet is part of a page. If the answer leans on one passage for something important, say that it is an excerpt. - `popularity.bucket` is worth showing to a person: a `long-tail` source and a `top-100` source read differently. ## 6. Control the cost - One search of one source is 1 credit for up to 10 results, and 0.5 more for each further 10. Twenty results from `web` cost 1.5 credits. - Every filter and `explain` are free. Long snippets and highlights cost nothing extra. Page text (`include_content`) adds 1 credit to the call for up to 10 results that come back with it. - A second source is a second credit. Add one when the question calls for it, not by default. - Cache answers in your own store by query and options. The API does not charge less for a repeated search. - Read `usage.credits` on every response and log it with your own request id. ## What this does not do - **No live fetch in a search.** Snippets are up to 2,000 characters, and `include_content` returns the page text we hold for `web` and `news` results, as it was when we captured it. To fetch a page as it is now, use [Extract](https://millionshort.com/docs/extract/parameters). - **No generated answer from a search.** Search retrieves; your model writes. For an answer written by us, [Agent](https://millionshort.com/docs/agent) is a separate, metered call: a written answer with a checked quote for every statement. - **No meaning-based matching.** Retrieval is by the words of the query, so phrase the search the way a page would say it, and try a second wording when the first is thin. - **No date filter on web pages.** `start_date`, `end_date` and `time_range` work on the dated sources, such as `news` and `academic`. Web pages carry no date, so the filter is not applied to `web`, and the response says so in a warning. ## Next - [Long-tail research](https://millionshort.com/docs/search/guides/long-tail-research): going past the first page on purpose. - [Agent tool use](https://millionshort.com/docs/search/guides/agent-tool-use): let the model decide when to search. - Use cases: [RAG](https://millionshort.com/docs/use-cases/rag) and [low-noise RAG](https://millionshort.com/docs/use-cases/low-noise-rag). --- Source: https://millionshort.com/docs/search/guides/agent-tool-use Section: Endpoints / Search # Agent tool use Give an agent search as a tool, over MCP or as a function, and teach it when to use the parts that matter. There are two ways to hand an agent MillionShort search. Use MCP when the agent runs in a client that speaks it. Use a function tool when you run the model loop yourself. | | MCP server | Function tool | |---|---|---| | You write | Nothing: one address in the client's settings | A tool definition and a small handler | | Works in | Claude, Claude Code, Cursor, ChatGPT, VS Code and other MCP clients | Any model API that supports tools | | Key | Your API key in a header, or no key at smaller limits | Your API key, on your server | | Tools | `search`, `get_domain_info`, `list_sources` | Whatever you define | ## MCP The hosted server is at one address, and needs nothing installed: ```text https://mcp.millionshort.com/mcp ``` ### Claude Code ```bash claude mcp add --transport http millionshort https://mcp.millionshort.com/mcp \ --header "Authorization: Bearer $MILLIONSHORT_API_KEY" ``` ### Cursor In `.cursor/mcp.json`: ```json { "mcpServers": { "millionshort": { "url": "https://mcp.millionshort.com/mcp", "headers": { "Authorization": "Bearer ms-YOUR_API_KEY" } } } } ``` ### Claude apps and ChatGPT Both add the server as a custom connector by its address. Neither can send an API key, so they connect in the server's no-key mode: `search` and `list_sources`, one source and up to 5 results per search, 10 free searches a day and at most 5 in a minute. Each answer says how many are left today. The [MCP page](https://millionshort.com/docs/mcp) has the exact steps for each client, the tools' arguments, and a way to check the connection with `curl`. ### What the agent sees Three search tools, all read-only and marked so, which lets a client run them without asking each time. The tools of the other endpoints are on [the MCP page](https://millionshort.com/docs/mcp#tools). | Tool | What it does | Without a key | |---|---|---| | `search` | Searches MillionShort's own independent index: the web, plus news, discussions, podcasts, academic and other specialist sources. Returns ranked results with title, URL, site, date, snippet, a popularity band, how visits to the site are moving, where it is popular and what it is built with. What sets it apart is control over which sites and pages come back: - Popularity: remove the N most popular sites to reach lesser-known ones (remove_top_sites), keep only them (only_top_sites), or pick popularity bands (popularity_buckets). - Domains: only (include_domains), block (exclude_domains), boost or bury. - Page types (formats such as tutorials, documentation, forums, listicles) and topics: keep only, exclude, boost or bury. - Site signals: sites with rising or falling visits (traffic_trend), sites popular in a country (popular_in), sites built with a given technology (site_tech), no risky sites (exclude_risky). - Date (start_date, end_date, time_range), language and country. - More text per result: highlights, the passages that answer the query (max_highlights), and the text of the page itself (include_content). A filter that a source cannot apply is reported in a note, never dropped silently; list_sources says which filters each source applies. | Yes, with smaller limits | | `get_domain_info` | Returns the popularity rank and band, and the risk level and categories, for up to 25 domains. | No | | `list_sources` | Lists the sources the search tool accepts, with a one-line description of each, how often new material arrives in it and which search filters it applies. Also lists the page types, topics, traffic trends and popularity bands. | Yes, with smaller limits | A search result arrives as short numbered text for the model, and as structured content for the client: title, URL, site, date, snippet and a popularity band. ## A function tool When you run the loop yourself, define one tool and call the API in its handler. This definition is plain JSON Schema, which every major model API accepts in some wrapper: ```json { "name": "web_search", "description": "Search the web and specialist sources. Returns ranked results with title, URL, site, date and a snippet. Set remove_top_sites to leave out the most popular sites.", "input_schema": { "type": "object", "properties": { "query": { "type": "string", "description": "What to search for, in the words a page would use." }, "sources": { "type": "array", "items": { "type": "string", "enum": ["web", "news", "smallweb", "discussions", "hn", "social", "communities", "podcasts", "academic", "medical", "law", "finance", "contracts"] }, "maxItems": 5, "description": "Which sources to ask. Default: web." }, "remove_top_sites": { "type": "integer", "minimum": 0, "maximum": 1000000, "description": "Leave out results from the N most popular sites, for example 1000 or 100000." }, "num_results": { "type": "integer", "minimum": 1, "maximum": 20 } }, "required": ["query"] } } ``` The handler turns the model's arguments into a search and returns compact text. Keep what you return short: the model pays for every character. ```python import os from millionshort import MillionShort, MillionShortError client = MillionShort(api_key=os.environ["MILLIONSHORT_API_KEY"]) ALLOWED = {"sources", "remove_top_sites", "num_results"} def web_search(arguments): """The tool handler: the model's arguments in, text for the model out.""" options = {k: v for k, v in arguments.items() if k in ALLOWED} try: r = client.search(arguments["query"], max_chars_per_result=500, **options) except MillionShortError as error: return f"Search failed ({error.code}): {error.message}" if not r.results: return "No results. Try other words, or another source." lines = [] for hit in r.results: date = hit["published_date"] or "undated" lines.append( f'{hit["position"]}. {hit["title"]}\n {hit["url"]}\n' f' {hit["source"]} | {date} | {hit["popularity"]["bucket"]}\n {hit["snippet"]}' ) return "\n\n".join(lines) print(web_search({"query": "sourdough starter hydration", "remove_top_sites": 1000, "num_results": 3})) ``` ```ts import { MillionShort, MillionShortError } from 'millionshort'; const client = new MillionShort({ apiKey: process.env.MILLIONSHORT_API_KEY }); type Arguments = { query: string; sources?: string[]; remove_top_sites?: number; num_results?: number }; /** The tool handler: the model's arguments in, text for the model out. */ async function webSearch(args: Arguments): Promise { try { const r = await client.search(args.query, { sources: args.sources, removeTopSites: args.remove_top_sites, numResults: args.num_results, maxCharsPerResult: 500, }); if (r.results.length === 0) return 'No results. Try other words, or another source.'; return r.results .map( (hit) => `${hit.position}. ${hit.title}\n ${hit.url}\n` + ` ${hit.source} | ${hit.published_date ?? 'undated'} | ${hit.popularity.bucket}\n ${hit.snippet}`, ) .join('\n\n'); } catch (error) { if (error instanceof MillionShortError) return `Search failed (${error.code}): ${error.message}`; throw error; } } console.log(await webSearch({ query: 'sourdough starter hydration', remove_top_sites: 1000, num_results: 3 })); ``` Return errors to the model as text, as above: a model that reads "Search failed (RATE_LIMITED)" can wait or tell the person, and a model that gets an exception cannot. If you use LangChain or the Vercel AI SDK, the tool is already written: see [LangChain](https://millionshort.com/docs/integrations/langchain) and [Vercel AI SDK](https://millionshort.com/docs/integrations/vercel-ai-sdk). ## Teach the agent to search well A tool description says what a tool does. It does not say when your agent should reach for it. Put that in the system prompt or the project's rules. Lines that earn their place: ```text Searching: - Search before answering anything about current events, prices, versions, or facts you are not sure of. - Ask the right source: news for this week, academic or medical for research, law for United States law, finance for company filings, discussions for opinions. Default to web. - When results are all from very popular sites and you need first-hand or specialist material, search again with remove_top_sites set to 1000 or 10000. - Web results have no date. For anything recent, include news or social and check the dates. - Cite the URL of every result you rely on. Say when a source is a small or little-known site. - Do not open or cite a result that carries a risk label without saying so. - One search usually costs one credit per source. Do not repeat a search that returned what you need. ``` For a coding agent, the same guidance ships as a block for `AGENTS.md` and as a Cursor rule: see [Set up for agents](https://millionshort.com/docs/set-up-for-agents). ## Keys and limits for agents - **Your agent, your key.** Keep the key on your server or in the client's settings. Never put it in a prompt. - **An agent with no person at hand** can get a [trial key](https://millionshort.com/docs/api-reference/agent-key): 25 credits, 24 hours. - **Rate limits are per team**, so many agents on one key share one limit. `429 RATE_LIMITED` carries the seconds to wait. - **Cap the tool, not the model.** Limit `num_results` in your tool definition, as above, so one enthusiastic call cannot cost much. ## Check that it works Ask the agent: "Use MillionShort to find three small-site write-ups about restoring a cast iron skillet, and tell me how popular each site is." A working set-up calls `search` with `remove_top_sites`, and the answer names a popularity band for each result. --- Source: https://millionshort.com/docs/search/guides/long-tail-research Section: Endpoints / Search # Long-tail research A method for finding what the first page of any search engine does not show you. The first page of results for most questions is the same few sites. Research that stops there repeats what everyone already read. This guide is a method for going past it on purpose, with working code. ## The idea Run the same query at several depths and compare what comes back: | Pass | Request | What it shows | |---|---|---| | The head | `only_top_sites: 1000` | What the well-known sites say. Your baseline | | The middle | `remove_top_sites: 1000` | Specialist publishers and trade sites | | The tail | `remove_top_sites: 100000` | Small sites, clubs, personal pages, first-hand accounts | | The small web | `sources: ["smallweb"]` | Independent writers, as a source of its own | | The conversation | `sources: ["discussions"]` | What people who did it say to each other | Each pass is one search and costs 1 credit. Five passes cost 5 credits. ## Run the passes ```python import os from millionshort import MillionShort client = MillionShort(api_key=os.environ["MILLIONSHORT_API_KEY"]) QUERY = "restoring a cast iron skillet" PASSES = { "head": {"only_top_sites": 1000}, "middle": {"remove_top_sites": 1000}, "tail": {"remove_top_sites": 100000}, "small web": {"sources": ["smallweb"]}, "conversation": {"sources": ["discussions"]}, } seen, spent = set(), 0.0 for name, options in PASSES.items(): r = client.search(QUERY, num_results=10, exclude_risky=True, **options) spent += r.usage.credits print(f"\n== {name}") for hit in r.results: if hit["url"] in seen: continue seen.add(hit["url"]) print(f'{hit["popularity"]["bucket"]:>9} {hit["site"]} {hit["title"][:70]}') print(f"\n{len(seen)} distinct pages for {spent} credits") ``` ```ts import { MillionShort } from 'millionshort'; const client = new MillionShort({ apiKey: process.env.MILLIONSHORT_API_KEY }); const QUERY = 'restoring a cast iron skillet'; const PASSES = { head: { onlyTopSites: 1000 }, middle: { removeTopSites: 1000 }, tail: { removeTopSites: 100000 }, 'small web': { sources: ['smallweb'] }, conversation: { sources: ['discussions'] }, }; const seen = new Set(); let spent = 0; for (const [name, options] of Object.entries(PASSES)) { const r = await client.search(QUERY, { numResults: 10, excludeRisky: true, ...options }); spent += r.usage?.credits ?? 0; console.log(`\n== ${name}`); for (const hit of r.results) { if (seen.has(hit.url)) continue; seen.add(hit.url); console.log(hit.popularity.bucket.padStart(9), hit.site, hit.title.slice(0, 70)); } } console.log(`\n${seen.size} distinct pages for ${spent} credits`); ``` ## Read the tail critically The long tail holds the best pages on the web and some of the worst. Less popular does not mean more true. Before you rely on a page: - **Look at `risk`.** Skip anything that carries a label unless you have a reason. `exclude_risky: true`, as in the code above, does it in the request. - **Ask why it ranked.** Add `"explain": true` and read `why` and `signals`: a page with the query in its title, a reasonable length in `words` and some `link_authority` is a different thing from a thin page that matched two words. - **Narrow by kind of page.** `page_types: ["articles", "blogs", "tutorials", "forums"]` keeps writing and drops shop pages and directories, and `exclude_page_types` names the kinds to drop instead. Both act on `web` and `news` results. `GET /v1/sources` lists the slugs. - **Find a second source.** A claim found once in the tail is a lead. Search for the claim itself, and see who else says it. - **Check the site.** [`POST /v1/domain`](https://millionshort.com/docs/api-reference/domain) returns popularity and risk for up to 25 sites in one call. ## Follow a good find When one page is clearly written by someone who knows the subject: 1. **Search that site alone**: `include_domains: ["example.org"]` with a broader query shows what else they wrote. 2. **Search around it**: put the sites you have already read in `exclude_domains` and run the query again, so each pass brings something new. 3. **Move it up**: `boost_domains` keeps a trusted site at the top of later searches on the same subject. ```bash curl https://api.millionshort.com/v1/search \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "query": "cast iron seasoning", "include_domains": ["example.org"], "num_results": 20 }' ``` ```python import os import requests r = requests.post( "https://api.millionshort.com/v1/search", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, json={ "query": "cast iron seasoning", "include_domains": [ "example.org" ], "num_results": 20 }, timeout=30, ) r.raise_for_status() for hit in r.json()["data"]["results"]: print(hit["position"], hit["title"], hit["url"]) ``` ```ts const res = await fetch('https://api.millionshort.com/v1/search', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ "query": "cast iron seasoning", "include_domains": [ "example.org" ], "num_results": 20 }), }); if (!res.ok) throw new Error(`POST /v1/search failed: ${res.status}`); const { data } = (await res.json()) as { data: { results: { position: number; title: string; url: string }[] }; }; for (const hit of data.results) console.log(hit.position, hit.title, hit.url); ``` The same call as a tool of the MCP server: ```json { "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "search", "arguments": { "query": "cast iron seasoning", "include_domains": [ "example.org" ], "num_results": 20 } } } ``` ## Primary sources For some questions the tail is not a blog but a record. Ask the source that holds it: - What a company itself said: `finance`. - What the statute or the opinion says: `law`. - Who was awarded the contract: `contracts`. - The paper, not the article about the paper: `academic` or `medical`. Each has its own page under [the sources](https://millionshort.com/docs/search/sources), with the fields its results carry. ## Limits to keep in mind - The `web` source is refreshed periodically and its results carry no date. For anything recent, add `news` or `social`. See [Freshness](https://millionshort.com/docs/search/freshness). - Popularity belongs to the site, not the page: a personal page hosted on a large platform carries the platform's rank and is removed with it. The `smallweb` pass is there to catch those. - A snippet is up to 2,000 characters of a page, not the page. `include_content: true` adds the page text we hold to `web` and `news` results, as it was when we captured it. Read the page itself before you quote it. ## Next - [Remove the top sites](https://millionshort.com/docs/search/remove-top-sites) and [Lenses](https://millionshort.com/docs/search/lenses), in full. - Use cases: [primary-source research](https://millionshort.com/docs/use-cases/primary-source-research) and [research agents](https://millionshort.com/docs/use-cases/research-agents). - Glossary: [What is long-tail search?](https://millionshort.com/docs/glossary/what-is-long-tail-search) --- Source: https://millionshort.com/docs/search/pricing Section: Endpoints / Search # Search pricing and limits One credit for each source searched. Every filter is free. ## What a search costs **1 credit = 1 search; a page is half.** 1 credit is $0.001. A search costs 1 credit for each source it asks, and that covers the first 10 results of the call. All 13 sources cost the same. | | Per 1,000 searches | Per 1,000 pages | |---|---|---| | Pay as you go | $1.00 | $0.50 | | Starter, in plan | $0.73 | $0.36 | | Growth, in plan | $0.70 | $0.35 | | Scale, in plan | $0.60 | $0.30 | | Business, in plan | $0.50 | $0.25 | | Action | Credits | |---|---| | Search, per source searched (covers the first 10 results of the call) | 1 | | Each further 10 results (or part of 10) | 0.5 | | explain (why a result ranked, with signals) | 0 | | Every filter, and highlights | 0 | | include_content, per call (covers the page text of up to 10 results; each further 10 with text adds 1) | 1 | | Domain info call (up to 25 domains) | 1 | | List sources | 0 | A call that fails or is refused costs nothing. | Call | Credits | |---|---| | 1 source, 10 results | 1 | | 1 source, 50 results | 1 + 4 × 0.5 = 3 | | 3 sources, 10 results | 3 | | 3 sources, 25 results returned | 3 + 2 × 0.5 = 4 | | 1 source, 10 results, `include_content`, 8 came back with content | 1 + 1 = 2 | | 1 source, 30 results, `include_content`, 25 came back with content | 1 + 2 × 0.5 + 3 × 1 = 5 | - The first 10 results are counted on the one merged list the call returns, not per source. - A source that did not answer is named in a `source_unavailable` warning and is not charged. - `include_content` adds 1 credit for the page text of up to 10 results, and 1 more for each further 10 with text. A call where no result has text pays nothing for it. - A call is refused with `429 INSUFFICIENT_CREDITS` before any work when the balance does not cover the most it could cost. - Every response says what it cost in `usage`: `credits`, `cost_usd` and a `breakdown`. [Credits and limits](https://millionshort.com/docs/credits-and-limits#how-a-search-is-counted) has the rules in full, and the [pricing page](https://millionshort.com/pricing#api) has the plans. ## Limits of a request | Limit | Value | |---|---| | `query` | 1 to 400 characters | | `sources` | 1 to 5 per search | | `num_results` | 1 to 50 | | Each domain list | up to 25 entries | | `max_chars_per_result` | 0 to 2,000 | | `max_highlights` | 0 to 5 | | `max_characters`, with `include_content` | 500 to 50,000 | ## Limits of a plan | Plan | Monthly | Credits a month | Extra credits, per 1,000 | Requests a minute | Heavy-source searches a minute | Searches in flight | |---|---|---|---|---|---|---| | Free | $0 | 1,000 | None: calls stop at the limit | 60 | 20 | 2 | | Starter | $29 | 40,000 | $0.90 | 180 | 60 | 4 | | Growth | $139 | 200,000 | $0.80 | 300 | 120 | 8 | | Scale | $449 | 750,000 | $0.70 | 600 | 240 | 16 | | Business | $1,499 | 3,000,000 | $0.60 | 1,200 | 480 | 32 | | Enterprise | Custom | Custom | Custom | Custom | Custom | Custom | Three limits apply to a search: requests a minute, searches of the heavy sources a minute (`web`, `smallweb`, `discussions`, `social`, `hn`), and searches in flight at once. A call over a limit answers `429 RATE_LIMITED` with a `Retry-After` header. A search inside a list of sites on `web` [counts for more](https://millionshort.com/docs/credits-and-limits#a-search-inside-a-list-of-sites) against the heavy-source limit; its price does not change. ## Without a key The [MCP server](https://millionshort.com/docs/mcp) and the playground answer a limited number of searches with no key: one source and up to 5 results a search. [Limits without a key](https://millionshort.com/docs/credits-and-limits#limits-without-a-key) has the numbers. --- Source: https://millionshort.com/docs/search/errors Section: Endpoints / Search # Search errors and warnings The few ways a search fails, which to retry, and the warnings that are not failures. A search that fails answers with the one [error shape](https://millionshort.com/docs/errors#the-error-shape) every endpoint uses, and is never charged. ## The errors of a search | Status and code | When | Do | |---|---|---| | `400 INVALID_PARAM` | A field the API does not take, a value out of range, or two fields that cannot go together | Fix the request. `error.message` names the field | | `400 UNSUPPORTED_OPTION` | An option this API version does not offer | Leave it out | | `401 AUTH_MISSING_KEY`, `401 AUTH_INVALID_KEY` | No `Authorization` header, or a key that is malformed, revoked or expired | Send a valid key | | `403 QUOTA_EXCEEDED` | The key has spent its monthly cap, or the call could cost more than the key has left | Raise the cap in the [dashboard](https://millionshort.com/docs/dashboard#monthly-cap-per-key), or use another key | | `404 SPACE_NOT_FOUND` | [Spaces](https://millionshort.com/docs/spaces): `space` names no Space you can use, because it does not exist or belongs to another team | Check the id or slug; a curated Space takes `curated:` before its slug | | `429 RATE_LIMITED` | Over one of the plan's per-minute limits | Wait `Retry-After` seconds, then retry | | `429 CAPACITY` | The service has no room at this moment, whatever your plan | Wait `Retry-After` seconds, then retry | | `429 INSUFFICIENT_CREDITS` | The balance does not cover the most the call could cost | Do not retry. Add credits | | `500 INTERNAL` | Something failed on our side | Retry with a growing pause; send us the `request_id` if it persists | | `502 SEARCH_UNAVAILABLE` | Search could not answer | Wait `Retry-After` seconds, then retry | The rules between fields that make an `INVALID_PARAM` are listed under [Parameters](https://millionshort.com/docs/search/parameters#rules-between-fields). [Errors](https://millionshort.com/docs/errors) has every code of the API, a retry loop in three languages, and the error classes of the SDKs. ## Warnings are not errors A search that worked can still have something to tell you. It answers `200`, and `warnings` lists what happened: - `source_unavailable`: a source you asked did not answer. The others did, and the missing one is not charged. - `filter_not_applied`: a source could not apply a filter you sent. Its results came back as if the filter had not been sent, and the warning names the filter and the sources. A filter is never ignored silently. - `content_partial`: with `include_content`, some results have no page text. They are not charged for it. - `language_detected`: a `language` filter on `web` was applied by reading each result's text. These are the ones met most often; [Parameters](https://millionshort.com/docs/search/parameters#warnings) lists every warning. Read `warnings` before trusting that a filter held. [Warnings are not errors](https://millionshort.com/docs/errors#warnings-are-not-errors) has the shape. ## Over MCP and in the SDKs The `search` tool of the [MCP server](https://millionshort.com/docs/mcp) reports the same codes in its answer. The [Python](https://millionshort.com/docs/sdks/python) and [TypeScript](https://millionshort.com/docs/sdks/typescript) clients raise one error class per kind of failure and retry the ones worth retrying. --- Source: https://millionshort.com/docs/extract Section: Endpoints / Extract # Extract Give it URLs and get each page back as clean text an agent can read. ```text POST https://api.millionshort.com/v1/extract ``` Extract takes up to 20 URLs and returns, for each, the page's main content as Markdown or plain text, with its title, metadata and links. The call is synchronous. Each URL succeeds or fails on its own, and a URL that fails costs nothing, except a page that does not exist in a browser mode ([pricing](https://millionshort.com/docs/extract/pricing)). ## What it is for - **Reading what a search found.** Search chooses the pages; Extract returns their text as it is now. - **Reading a page you already know.** Documentation, a product page, a filing, a PDF. - **Sorting pages without reading them.** Every page comes back with [labels](https://millionshort.com/docs/extract/labels): its topic, its kind, and the source that holds pages like it. - **Many pages at once.** A [batch](https://millionshort.com/docs/extract/batch) takes up to 1,000 URLs as one job. ## How a page is obtained One field, `mode`, decides. The modes differ in what reaches the site and in price: | Mode | What it does | Who can use it | |---|---|---| | `live` | Fetches the page now, as our declared bot, within robots.txt | Every plan | | `rendered` | Loads the page in a browser, so content built by scripts appears | Starter and up | | `unblock` | A rendered fetch for sites that refuse automated requests | Growth and up | | `stealth` | A rendered fetch for sites that refuse even `unblock` | Not switched on yet | | `cached` | Returns a copy we already hold; nothing reaches the site | Switched off | | `auto` | `cached` when a fresh enough copy exists, otherwise `live` | Behaves as `live` | We identify ourselves to sites as `MillionShortBot`, honour robots.txt in every mode, and there is no option to ignore it. A caller cannot send cookies or headers to a site. ## In this section | Part | Page | |---|---| | Quickstart | [One page as Markdown, then its failures and labels](https://millionshort.com/docs/extract/quickstart) | | Parameters | [Every request field, the modes, and the response](https://millionshort.com/docs/extract/parameters) | | Guides | [Search then read, keep only some pages, many pages](https://millionshort.com/docs/extract/guides) | | Pricing and limits | [What a page costs in each mode, and the limits](https://millionshort.com/docs/extract/pricing) | | Errors | [Per-URL errors and request errors](https://millionshort.com/docs/extract/errors) | Two more pages cover what Extract can do: [Batch](https://millionshort.com/docs/extract/batch) and [Labels](https://millionshort.com/docs/extract/labels). ## Page text without a fetch A search can also return the page text we hold for web and news results, with [`include_content`](https://millionshort.com/docs/search/highlights), and up to 2,000 characters of snippet per result with `max_chars_per_result`. No request is made to the site for either. ## With the other endpoints [Monitor](https://millionshort.com/docs/monitor) watches a page with the same fetcher and the same rules, and its events carry the same labels. [Map](https://millionshort.com/docs/map) and [Crawl](https://millionshort.com/docs/crawl) fetch the same way: a crawl is a batch that finds its own URLs, and each of its pages is an Extract result. --- Source: https://millionshort.com/docs/extract/quickstart Section: Endpoints / Extract # Extract quickstart One page as Markdown, then what a failure looks like, then the labels. ## 1. Read one page ```bash curl https://api.millionshort.com/v1/extract \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "urls": ["https://example.org/guides/tide-tables"], "mode": "live" }' ``` ```python import os import requests r = requests.post( "https://api.millionshort.com/v1/extract", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, json={ "urls": [ "https://example.org/guides/tide-tables" ], "mode": "live" }, timeout=30, ) r.raise_for_status() print(r.json()["data"]) ``` ```ts const res = await fetch('https://api.millionshort.com/v1/extract', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ "urls": [ "https://example.org/guides/tide-tables" ], "mode": "live" }), }); if (!res.ok) throw new Error(`POST /v1/extract failed: ${res.status}`); const { data } = (await res.json()) as { data: unknown }; console.log(data); ``` `live` fetches the page now. The answer has one entry per URL in `data.results`, in the order sent. A page that worked has `status: "ok"`, its `title`, and its main content in `markdown`. ## 2. Check each URL The HTTP status is `200` whenever the request itself was valid, even when every URL failed. Look at each entry. One that failed looks like this: ```text "url": "https://example.org/private", "status": "error", "error": { "code": "ROBOTS_DISALLOWED", "message": "This site's robots.txt does not allow our bot to fetch this page." } ``` A URL that fails costs nothing, except a page that does not exist in a browser mode ([pricing](https://millionshort.com/docs/extract/pricing)). [Errors](https://millionshort.com/docs/extract/errors) lists the codes and what to try next. ## 3. Choose what comes back ```bash curl https://api.millionshort.com/v1/extract \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "urls": ["https://example.org/guides/tide-tables"], "mode": "live", "formats": ["markdown", "metadata", "links"], "max_chars": 20000 }' ``` ```python import os import requests r = requests.post( "https://api.millionshort.com/v1/extract", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, json={ "urls": [ "https://example.org/guides/tide-tables" ], "mode": "live", "formats": [ "markdown", "metadata", "links" ], "max_chars": 20000 }, timeout=30, ) r.raise_for_status() print(r.json()["data"]) ``` ```ts const res = await fetch('https://api.millionshort.com/v1/extract', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ "urls": [ "https://example.org/guides/tide-tables" ], "mode": "live", "formats": [ "markdown", "metadata", "links" ], "max_chars": 20000 }), }); if (!res.ok) throw new Error(`POST /v1/extract failed: ${res.status}`); const { data } = (await res.json()) as { data: unknown }; console.log(data); ``` `formats` takes `markdown`, `text`, `links` and `metadata`. `max_chars` cuts long content, and `truncated` says when it did. ## 4. Read the labels Every page that comes back says what it is, at no charge: `topic`, `page_type` and `source_hint`, each with a confidence. A program can route a page by them without reading it. See [Labels](https://millionshort.com/docs/extract/labels). ## Next - [Parameters](https://millionshort.com/docs/extract/parameters): every field, the modes and the response. - [Batch](https://millionshort.com/docs/extract/batch): up to 1,000 URLs as one job. - [Pricing and limits](https://millionshort.com/docs/extract/pricing): what each mode costs. The SDKs do not cover this endpoint yet. Call the endpoint over HTTP as above. --- Source: https://millionshort.com/docs/extract/parameters Section: Endpoints / Extract # Extract parameters Every field of an Extract request, the modes, and everything that comes back for each URL. ```text POST https://api.millionshort.com/v1/extract ``` Takes up to 20 URLs and returns, for each, the page's main content as Markdown or plain text, with its title, metadata and links. The call is synchronous. Each URL succeeds or fails on its own, and a URL that fails costs nothing, with the one exception in [Credits](#credits). ## Request | Field | Type | Default | Notes | |---|---|---|---| | `urls` | array of strings, 1 to 20, distinct | | Required. `http` or `https`, default ports, a host name (not an address), no credentials in the URL. Up to 2,048 characters each | | `mode` | `auto`, `cached`, `live`, `rendered`, `unblock`, `stealth` | `"auto"` | How the page is obtained. See below | | `max_age_hours` | integer, 0 to 8,760 | `168` | With `auto` only: how old a stored copy may be before a live fetch is made instead | | `formats` | array of `markdown`, `text`, `links`, `metadata` | `["markdown","metadata"]` | What to return for each page | | `max_chars` | integer, 1 to 500,000 | `50000` | The longest content per page. Longer content is cut and `truncated` is `true` | | `topics` | array of topic slugs | | Keep only pages about these topics. See [Labels](https://millionshort.com/docs/extract/parameters#labels) | | `page_types` | array of page-type slugs | | Keep only pages of these kinds | | `source_hints` | array of source slugs | | Keep only pages with one of these source hints | | `json` | object with `schema` and an optional `prompt` | | Each page as JSON of your shape. Starter and up, at most 3 `urls`. See [JSON of your shape](#json-of-your-shape) | Any other field is a `400 INVALID_PARAM`. A caller cannot send cookies or headers to the site. ### Modes | Mode | What it does | Credits per page | |---|---|---| | `cached` | Returns a copy we already hold. No request reaches the site. Switched off for now | 0.25 | | `live` | Fetches the page now, as our declared bot. robots.txt is honoured | 0.5 | | `rendered` | Loads the page in a browser, so content built by scripts appears. Paid plans | 2 | | `unblock` | A rendered fetch through a residential or premium proxy, for sites that refuse automated requests. Growth plan and above | 10 | | `stealth` | A rendered fetch through the hardest-to-block proxy, for sites that refuse even `unblock`. Not switched on yet; when it is, on the plans that include it | 25 | | `auto` | `cached` when there is a stored copy younger than `max_age_hours`, otherwise `live`. While `cached` is off, `auto` is `live` | By the mode used | - `auto` never chooses `rendered`, `unblock` or `stealth`. When a live page looks like an empty shell that scripts fill in, the response carries a `looks_script_built` warning that suggests `rendered`. - `live` identifies itself as `MillionShortBot`. Site owners can address it in robots.txt. - `rendered`, `unblock` and `stealth` load the page in a browser. We check robots.txt under our own bot's name first, and none of them is ever chosen for you. - In these three modes, a page the site says does not exist (`404` or `410`) is charged at the mode's price, because the browser reached the site. It comes back with `charged: true` and the site's status in `error.target_status`. See [Credits](#credits). - There is no option to ignore robots.txt. ### JSON of your shape `json` asks for each page as an object of the shape you describe. `schema` is a JSON Schema of type `object` with `properties`, at most 8 KB. It may use `type`, `properties`, `required`, `items`, `enum` and `description`, and they are enforced in full; a schema that uses any other keyword is refused with `400 INVALID_PARAM`, so nothing you write is silently ignored. `prompt`, up to 1,000 characters, says what to look for. ```bash curl https://api.millionshort.com/v1/extract \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "urls": ["https://example.org/products/tide-clock"], "mode": "live", "json": { "schema": { "type": "object", "properties": { "name": { "type": "string" }, "price": { "type": ["number", "null"] } }, "required": ["name"] }, "prompt": "The product on the page." } }' ``` ```python import os import requests r = requests.post( "https://api.millionshort.com/v1/extract", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, json={ "urls": [ "https://example.org/products/tide-clock" ], "mode": "live", "json": { "schema": { "type": "object", "properties": { "name": { "type": "string" }, "price": { "type": [ "number", "null" ] } }, "required": [ "name" ] }, "prompt": "The product on the page." } }, timeout=30, ) r.raise_for_status() print(r.json()["data"]) ``` ```ts const res = await fetch('https://api.millionshort.com/v1/extract', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ "urls": [ "https://example.org/products/tide-clock" ], "mode": "live", "json": { "schema": { "type": "object", "properties": { "name": { "type": "string" }, "price": { "type": [ "number", "null" ] } }, "required": [ "name" ] }, "prompt": "The product on the page." } }), }); if (!res.ok) throw new Error(`POST /v1/extract failed: ${res.status}`); const { data } = (await res.json()) as { data: unknown }; console.log(data); ``` - Each page that was fetched is read by a language model, and its answer is checked against your schema. Only an object that fits comes back, as `json` on that URL's result. Keys that are not in `properties` are dropped. Make a property nullable when a page may not have it. - When it does not work out, the result still carries the page, with `json: null` and `json_error` (`code` and `message`): | `json_error.code` | Meaning | |---|---| | `JSON_SCHEMA_MISMATCH` | What was found did not fit the schema, after one correction | | `JSON_UNAVAILABLE` | Not read in time, or not now. Try again later | | `JSON_LIMIT_REACHED` | A daily limit of pages as JSON is used up (a team may have 500 a day) | | `JSON_NO_CONTENT` | The page had no text to read | - On Starter and up. On Free, `json` is refused with `400 UNSUPPORTED_OPTION`. - At most 3 `urls` in a call with `json` (`400 INVALID_PARAM` otherwise). A [batch](https://millionshort.com/docs/extract/batch) does not take it, and neither does the `extract` tool over MCP. A [crawl](https://millionshort.com/docs/crawl/parameters#request) takes the same `json`. - 3 credits on top of the mode's price for each page that came back as JSON (`extract_json` in `usage.breakdown`). A page whose JSON failed costs only its fetch. - All the pages of one call share 20 seconds for the reading. A page that does not get its turn answers `JSON_UNAVAILABLE`. The daily limit counts attempts, whether or not they work out. - The page's main text (its first 24 KB), your schema and your prompt are sent to a model provider to be read. We use only providers that do not keep or train on what they are sent. Nothing else about you is sent. ## Example ```bash curl https://api.millionshort.com/v1/extract \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "urls": ["https://example.org/guides/tide-tables"], "mode": "live", "formats": ["markdown", "metadata", "links"] }' ``` ```python import os import httpx response = httpx.post( "https://api.millionshort.com/v1/extract", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, json={"urls": ["https://example.org/guides/tide-tables"], "mode": "live"}, timeout=60, ) response.raise_for_status() body = response.json() for page in body["data"]["results"]: if page["status"] == "ok": print(page["title"], page["mode_used"], len(page["markdown"] or page["text"] or "")) else: print(page["url"], "failed:", page["error"]["code"]) print(body["usage"]["credits"], "credits") ``` ```ts const response = await fetch('https://api.millionshort.com/v1/extract', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ urls: ['https://example.org/guides/tide-tables'], mode: 'live' }), }); if (!response.ok) throw new Error(`extract failed: ${response.status}`); const body = await response.json(); for (const page of body.data.results) { if (page.status === 'ok') { console.log(page.title, page.mode_used, (page.markdown ?? page.text ?? '').length); } else { console.log(page.url, 'failed:', page.error.code); } } console.log(body.usage.credits, 'credits'); ``` The SDKs do not cover this endpoint yet. Their `extract` method belongs to an older draft and sends a different request: do not use it. Call the endpoint over HTTP as above. ## Response ```json { "data": { "results": [ { "url": "https://example.org/guides/tide-tables", "final_url": "https://example.org/guides/tide-tables", "status": "ok", "mode_used": "live", "fetched_at": "2026-11-18T10:00:00Z", "age_seconds": 0, "format": "markdown", "title": "How to read a tide table", "markdown": "# How to read a tide table\n\nA tide table lists the times of high and low water for one place...", "truncated": false, "metadata": { "description": "Times, heights and what the columns mean.", "author": null, "published_date": null, "language": "en", "canonical_url": null, "content_type": "text/html", "status_code": 200 }, "links": [{ "url": "https://example.org/guides/tidal-range", "text": "Tidal range" }], "topic": "science", "page_type": "tutorials", "source_hint": "web", "label_confidence": { "topic": 0.84, "page_type": 0.77, "source_hint": 0.77 }, "site": "example.org", "popularity": { "rank": null, "bucket": "long-tail" }, "risk": null }, { "url": "https://example.org/private", "status": "error", "error": { "code": "ROBOTS_DISALLOWED", "message": "This site's robots.txt does not allow our bot to fetch this page." } } ], "summary": { "requested": 2, "succeeded": 1, "failed": 1, "by_mode": { "live": 1 } } }, "usage": { "credits": 0.5, "cost_usd": 0.0005, "breakdown": { "extract_live": 0.5 } }, "warnings": [], "request_id": "req_..." } ``` The values are an illustration, for a request with two URLs. One entry per URL, in the order sent. The HTTP status is `200` whenever the request itself was valid, even when every URL failed: look at each entry's `status`. ### A result | Field | Type | Notes | |---|---|---| | `url` | string | The URL you sent | | `status` | `ok` or `error` | | | `final_url` | string | Where the page was after redirects | | `mode_used` | `cached`, `live`, `rendered`, `unblock`, `stealth` | The mode that produced this result. Also on a failed URL that was charged | | `fetched_at` | date and time | When the copy was taken | | `age_seconds` | integer | How old the copy is now. A live page fetched for any caller in the last five minutes is reused, and says so here | | `format` | `markdown` or `text` | Which of the two content fields is filled in | | `title` | string or null | | | `markdown` | string or null | The main content as Markdown | | `text` | string or null | The main content as plain paragraphs. Present when `text` is in `formats` | | `truncated` | boolean | `true` when the content was cut at `max_chars` | | `metadata` | object | Only when asked for: `description`, `author`, `published_date`, `language`, `canonical_url`, `content_type`, `status_code` | | `links` | array | Only when asked for: up to 2,000 `{url, text}` pairs | | `topic` | string or null | What the page is about: one of the 24 [topic slugs](https://millionshort.com/docs/search/topics-and-page-types) | | `page_type` | string or null | What kind of page it is: one of the 23 [page-type slugs](https://millionshort.com/docs/search/topics-and-page-types) | | `source_hint` | string or null | The [source](https://millionshort.com/docs/search/sources) that holds pages like this one | | `label_confidence` | object | `topic`, `page_type` and `source_hint`: how sure each label is, each 0 to 1 or `null` | | `filtered` | boolean | Present, and `true`, on a page left out by `topics`, `page_types` or `source_hints`. See [Labels](https://millionshort.com/docs/extract/parameters#labels) | | `site` | string | The host name | | `popularity`, `risk` | objects | The same [signals](https://millionshort.com/docs/search/popularity-and-risk) a search result carries, at no charge | | `error` | object | On a failed URL: `code`, `message`, `retry_after_seconds` when waiting helps, and `target_status` when the site said the page does not exist in a browser mode | | `charged` | boolean | Present, and `true`, on a failed URL that was charged: a browser mode reached the site and the page does not exist (`404`, `410`) | `data.summary` counts what was `requested`, `succeeded` and `failed`, and how many pages each mode served in `by_mode`. When a label list was sent it also has `filtered`: how many pages were left out. ### Per-URL errors | Code | Meaning | Try next | |---|---|---| | `URL_NOT_ALLOWED` | Not a public web page we will fetch: a private address, an unusual port, credentials in the URL, or a page flagged as malicious | | | `ROBOTS_DISALLOWED` | The site's robots.txt does not allow our bot | | | `ROBOTS_UNAVAILABLE` | robots.txt could not be read, so we did not fetch | Later | | `SITE_OPTED_OUT` | The site asked us not to fetch or serve it | | | `NOT_IN_CACHE` | `cached` mode: we hold no copy | `live` | | `FETCH_FAILED` | The site did not answer usefully, or answered with an error status. In a browser mode, with `charged: true`: the page does not exist | Later | | `TIMEOUT` | The site was too slow | Later | | `TOO_LARGE` | The page is over 10 MiB | | | `UNSUPPORTED_CONTENT_TYPE` | Not HTML, text, PDF, a word-processing, spreadsheet or slide document, XML or JSON | | | `BLOCKED_BY_SITE` | The site refused our bot | `unblock` | | `RENDER_FAILED` | `rendered` or `unblock` could not load the page | Later | | `HOST_BUSY` | We are already fetching from this site as fast as we allow | After `retry_after_seconds` | | `HOST_DAILY_LIMIT` | This team reached its [daily limit for this site](#the-daily-limit-per-site) | Tomorrow (UTC) | | `CAPACITY` | `rendered` and `unblock` are at capacity, for today or for the moment; or, in `cached` mode, the stored copy could not be looked up yet | After `retry_after_seconds` when it is given, else later | Every redirect is checked again against the same rules as the first URL. ## Labels Every page that comes back says what it is, in every mode, at no charge: ```text "topic": "health", "page_type": "articles", "source_hint": "medical", "label_confidence": { "topic": 0.93, "page_type": 0.71, "source_hint": 0.71 } ``` - **`topic`** and **`page_type`** are the same [24 topics and 23 page types](https://millionshort.com/docs/search/topics-and-page-types) a search result carries, made the same way. A program can treat a page it fetched and a page it found with one rule. The two can differ for one URL: the page may have changed since it was indexed, and Extract reads its main content. They are read from the page's title and the start of its text. - **`source_hint`** names the [source](https://millionshort.com/docs/search/sources) that holds pages like this one: a paper is `academic`, or `medical` when it is about health; a news article is `news`; a forum thread is `discussions`; a personal blog is `smallweb`; a page of no special kind is `web`. It tells an agent where to search for more of the same. It does not say that we hold the page. - **`label_confidence`** is between 0 and 1 for each label. A label is `null`, with a `null` confidence, when the page has too little text to tell, or when labels could not be made at that moment. Labels never fail a call and never change its price. ### Keep only some pages `topics`, `page_types` and `source_hints` take lists of those slugs. Within a list, a page needs to match any one entry; it has to pass every list that was sent. ```bash curl https://api.millionshort.com/v1/extract \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "urls": ["https://example.org/a", "https://example.org/b"], "mode": "live", "topics": ["health"], "page_types": ["articles", "research"] }' ``` ```python import os import requests r = requests.post( "https://api.millionshort.com/v1/extract", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, json={ "urls": [ "https://example.org/a", "https://example.org/b" ], "mode": "live", "topics": [ "health" ], "page_types": [ "articles", "research" ] }, timeout=30, ) r.raise_for_status() print(r.json()["data"]) ``` ```ts const res = await fetch('https://api.millionshort.com/v1/extract', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ "urls": [ "https://example.org/a", "https://example.org/b" ], "mode": "live", "topics": [ "health" ], "page_types": [ "articles", "research" ] }), }); if (!res.ok) throw new Error(`POST /v1/extract failed: ${res.status}`); const { data } = (await res.json()) as { data: unknown }; console.log(data); ``` A page that does not pass stays in `results`, in its place, so the answer still has one entry per URL: ```json { "url": "https://example.org/b", "final_url": "https://example.org/b", "status": "ok", "filtered": true, "mode_used": "live", "fetched_at": "2026-11-18T10:00:00Z", "age_seconds": 0, "topic": "food", "page_type": "products", "source_hint": "web", "label_confidence": { "topic": 0.88, "page_type": 0.91, "source_hint": 0.88 }, "site": "example.org", "popularity": { "rank": null, "bucket": "long-tail" }, "risk": null } ``` - The entry says what the page is and carries none of its content: no `title`, `format`, `markdown`, `text`, `truncated`, `metadata` or `links`. - **A page left out is still charged for its fetch.** The page had to be fetched to be labelled. The lists save your program the reading, not the fetch. - A page is never left out for a label it does not have: a `null` label passes. A page whose labels could not be made is kept, and the response carries a `labels_unavailable` warning. - An empty list, or a slug that is not on the lists of [`GET /v1/sources`](https://millionshort.com/docs/api-reference/sources) is a `400 INVALID_PARAM`. ## Request-level errors `400 INVALID_PARAM`; `400 UNSUPPORTED_OPTION` for a mode the plan does not include or one that is switched off; `429 INSUFFICIENT_CREDITS`; `429 RATE_LIMITED` when the team has no fetch slot free. See [Errors](https://millionshort.com/docs/errors). ## Limits | | Free | Starter | Growth | Scale | Business | |---|---|---|---|---|---| | Fetches at once, per team | 2 | 4 | 8 | 16 | 32 | | `rendered` | No | Yes | Yes | Yes | Yes | | `unblock` | No | No | Yes | Yes | Yes | | `stealth` (not switched on yet) | No | No | Yes | Yes | Yes | - **We are polite to sites.** For all customers together, one site gets at most 2 fetches at once and 1 a second. - Per team, per site, per day: 2,000 fetches in any mode other than `cached`. [What counts as a fetch](#the-daily-limit-per-site) is below. - 10 MiB per page; 20 seconds for a `live` page, 60 for `rendered`, 130 for `unblock` and `stealth`; up to 5 redirects. - A call with more URLs than the plan's fetches-at-once runs them in turn. It is refused with `429 RATE_LIMITED` only when no slot is free at all. - A site that gave no answer at all to your last two fetches of it (no connection, or nothing within the time limit) is not asked again for you for five minutes. Its URLs answer `TIMEOUT` or `FETCH_FAILED` at once in that time. What another team's fetches found never changes what you get. - When `rendered` or `unblock` are at capacity for the moment, the URL answers `CAPACITY` with `retry_after_seconds`. It is free, and it does not count as one of the day's attempts. ### The daily limit per site A team may fetch 2,000 pages of one site in a day (UTC), in every mode other than `cached`, [monitor](https://millionshort.com/docs/monitor/parameters) checks included. The limit is there so that nobody copies a site through us. It counts what you take from a site, so looking at a page again and finding it as it was does not count again: | Fetch | Counts towards the 2,000? | |---|---| | The first fetch of an address in a day | Yes | | The same address again, and the page is as it was at your last fetch | No | | The same address again, and the page has changed | Yes | | A fetch that got no page (an error status, a timeout) | Yes, every time | - **What decides is the page that came back, not how the address is written.** "Changed" means that the page's title, description or cleaned text differs from your last fetch of it, or that the address now redirects somewhere else. An address that redirects and the address it leads to are two addresses. A page that is different on every fetch (a search page, a feed, a page with a clock in its text) counts on every fetch. - **The same address** is compared without its fragment and with its query parameters in order: `https://example.org/a?x=1&y=2#top` and `https://example.org/a?y=2&x=1` are one address. Adding a parameter makes a new address, which counts. - A monitor that checks an unchanged page 96 times a day uses one fetch of the day, plus one for each change it finds. - **At the limit**, an address you already fetched that day can still be fetched, and is returned while the page is unchanged. A page that has changed, and any address not yet fetched that day, answers `HOST_DAILY_LIMIT` until the next day. Nothing is charged for it. - A fetch that is not counted again is still a request to the site (the politeness limits above hold), and a page that is returned is still charged its credits. ## Credits The call holds `urls × the price of the mode asked for` before any work (`auto` holds the `live` price), charges each page that succeeded at the price of the mode actually used, and hands the rest back in the same request. `usage.breakdown` has one line per mode used: `extract_cached`, `extract_live`, `extract_rendered`, `extract_unblock`, `extract_stealth`. A failed URL is free, with one exception: in `rendered`, `unblock` and `stealth`, a page the site says does not exist (`404` or `410`) is charged at the mode's price, because a browser reached the site for you. It is marked `charged: true`. Our own refusals (robots.txt, the URL rules, a site that opted out, our caps, capacity) are never charged. | Call | Credits | |---|---| | 1 URL, `live`, succeeds | 0.5 | | 10 URLs, `live`, 8 succeed | 4 | | 1 URL, `rendered`, succeeds | 2 | | 1 URL, `unblock`, succeeds | 10 | | 1 URL, `rendered`, the site answers `404` | 2 | | 5 URLs, all fail | 0 | | 10 URLs, `live`, all succeed, 6 left out by `page_types` | 5 | Labels are free in every mode. ## With search Extract is the second half of a common pair: search for pages, then read the ones worth reading. 1. [Search](https://millionshort.com/docs/search/parameters), and choose results by title, snippet, `popularity` and `risk`. 2. Send the chosen URLs to Extract. When a snippet is enough, skip the fetch: a search result carries up to 2,000 characters with `max_chars_per_result`. ## Over MCP The [MCP server](https://millionshort.com/docs/mcp) has an `extract` tool: up to 5 URLs, `mode`, `max_chars` and the three label lists (`topics`, `page_types`, `source_hints`), read-only, for callers with a key. Each page it returns says its topic, page type and source hint. --- Source: https://millionshort.com/docs/extract/batch Section: Endpoints / Extract # Extract batch Up to 1,000 URLs as one job, with results you poll for or a webhook when it ends. ```text POST https://api.millionshort.com/v1/extract/batch GET https://api.millionshort.com/v1/extract/batch/{id} DELETE https://api.millionshort.com/v1/extract/batch/{id} ``` The same extraction as [`POST /v1/extract`](https://millionshort.com/docs/extract/parameters), for up to 1,000 URLs, run as a job. ## Submit The body is the Extract request, with two differences: `urls` takes 1 to 1,000 entries, and there is one more field. | Field | Type | Default | Notes | |---|---|---|---| | `urls` | array of strings, 1 to 1,000, distinct | | Required | | `mode` | `auto`, `cached`, `live`, `rendered`, `unblock`, `stealth` | `"auto"` | As for Extract | | `max_age_hours` | integer, 0 to 8,760 | `168` | As for Extract | | `formats` | array of `markdown`, `text`, `links`, `metadata` | `["markdown","metadata"]` | As for Extract | | `max_chars` | integer, 1 to 500,000 | `50000` | As for Extract | | `webhook_id` | string | | An active [webhook endpoint](https://millionshort.com/docs/webhooks) of your team. Optional | | `topics`, `page_types`, `source_hints` | arrays of slugs | | Keep only the pages with these [labels](https://millionshort.com/docs/extract/parameters#labels). Optional | ```bash curl https://api.millionshort.com/v1/extract/batch \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: nightly-2026-11-18" \ -d '{ "urls": ["https://example.com/a", "https://example.com/b"], "mode": "live" }' ``` ```python import os import requests r = requests.post( "https://api.millionshort.com/v1/extract/batch", headers={ "Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"], "Idempotency-Key": "nightly-2026-11-18", }, json={ "urls": [ "https://example.com/a", "https://example.com/b" ], "mode": "live" }, timeout=30, ) r.raise_for_status() print(r.json()["data"]) ``` ```ts const res = await fetch('https://api.millionshort.com/v1/extract/batch', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json', 'Idempotency-Key': 'nightly-2026-11-18', }, body: JSON.stringify({ "urls": [ "https://example.com/a", "https://example.com/b" ], "mode": "live" }), }); if (!res.ok) throw new Error(`POST /v1/extract/batch failed: ${res.status}`); const { data } = (await res.json()) as { data: unknown }; console.log(data); ``` - An `Idempotency-Key` header is honoured for 24 hours: sending the same submit twice starts one batch. - Submit holds the price of the whole batch at the mode asked for. A team that cannot cover it gets `429 INSUFFICIENT_CREDITS` and nothing starts. - A team may have 5 batches open at once. The answer is the job, with `status: "queued"`. ## Poll ```bash curl https://api.millionshort.com/v1/extract/batch/$BATCH_ID \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" ``` ```python import os import requests r = requests.get( f"https://api.millionshort.com/v1/extract/batch/{os.environ['BATCH_ID']}", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, timeout=30, ) r.raise_for_status() print(r.json()["data"]) ``` ```ts const res = await fetch(`https://api.millionshort.com/v1/extract/batch/${process.env.BATCH_ID}`, { headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}` }, }); if (!res.ok) throw new Error(`GET /v1/extract/batch/… failed: ${res.status}`); const { data } = (await res.json()) as { data: unknown }; console.log(data); ``` | Field | Type | Notes | |---|---|---| | `id` | string | | | `status` | `queued`, `running`, `completed`, `cancelled`, `failed` | | | `total` | integer | URLs in the batch | | `completed` | integer | URLs done so far, succeeded or failed | | `failed` | integer | URLs that failed | | `results` | array | Extract results, up to 50 at a time | | `next` | string or null | Pass as `?cursor=` to get the next page of results; `null` at the end | Polling is free and does not count against the plan's requests a minute. It has its own limit of 120 a minute per team. Results are kept for 7 days. ## Cancel ```bash curl -X DELETE https://api.millionshort.com/v1/extract/batch/$BATCH_ID \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" ``` ```python import os import requests r = requests.delete( f"https://api.millionshort.com/v1/extract/batch/{os.environ['BATCH_ID']}", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, timeout=30, ) r.raise_for_status() print(r.json()["data"]) ``` ```ts const res = await fetch(`https://api.millionshort.com/v1/extract/batch/${process.env.BATCH_ID}`, { method: 'DELETE', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}` }, }); if (!res.ok) throw new Error(`DELETE /v1/extract/batch/… failed: ${res.status}`); const { data } = (await res.json()) as { data: unknown }; console.log(data); ``` Work that has finished is charged; what is left of the hold is handed back. ## How a batch runs - Every result carries its `topic`, `page_type`, `source_hint` and `label_confidence`, as for [Extract](https://millionshort.com/docs/extract/parameters#labels). With `topics`, `page_types` or `source_hints`, a page that does not pass counts as `completed`, has `filtered: true` and no content, and is charged for its fetch. A batch has no `summary` and no warnings: count the entries with `filtered: true`. A page whose labels could not be made is kept, with `null` labels. For a large crawl list this is how to keep, say, only the articles about health and skip reading the rest. - Finished pages are charged as they finish, at the price of the mode actually used. The rest of the hold is handed back when the batch ends. - Batch work waits for a busy site; it does not fail with `HOST_BUSY` at once. A page whose site is busy for us waits its turn, at no cost to it, for as long as the batch has been running for less than 60 minutes. After that, a page that meets the busy site five more times fails as `HOST_BUSY`, free. A batch on one site is slow on purpose: one page a second for all customers together, and at most half of that for one team, so 1,000 pages of one site take about 35 minutes. Several batches of the same site share that pace, so run them one after the other. Batch work also gives way to synchronous Extract calls. - A `cached` batch never fails a page because of the pace of our own lookups: stored copies are looked up at about 60 a minute per team, and the batch waits for them. A batch of 500 takes about eight minutes. - A page that cannot be fetched yet for another reason (a `robots.txt` that could not be read, for example) is tried again later in the batch, five times in all. - The [daily limit per site](https://millionshort.com/docs/extract/parameters#the-daily-limit-per-site) holds for batches as for single calls. - A batch that has not ended 24 hours after submit becomes `failed`, and what is left of its hold is handed back. - With `webhook_id`, an `extract_batch.completed` event is delivered when the batch ends, carrying `id`, `status`, `total`, `completed` and `failed`. ## Errors `400 INVALID_PARAM` (also for a `webhook_id` that is not an active endpoint of the team), `400 UNSUPPORTED_OPTION`, `401` for a missing or refused key, `404 JOB_NOT_FOUND` for a batch that does not exist or is not yours, `429 INSUFFICIENT_CREDITS` and `429 RATE_LIMITED`. Per-URL errors are the ones on the [Extract](https://millionshort.com/docs/extract/parameters#per-url-errors) page. --- Source: https://millionshort.com/docs/extract/labels Section: Endpoints / Extract # Labels on extracted pages Every page Extract returns says what it is about, what kind of page it is, and which source holds pages like it. A page that comes back from Extract carries three labels, in every mode, at no charge: ```text "topic": "health", "page_type": "articles", "source_hint": "medical", "label_confidence": { "topic": 0.93, "page_type": 0.71, "source_hint": 0.71 } ``` | Label | What it says | Values | |---|---|---| | `topic` | What the page is about | One of the 24 [topic slugs](https://millionshort.com/docs/search/topics-and-page-types) | | `page_type` | What kind of page it is | One of the 23 [page-type slugs](https://millionshort.com/docs/search/topics-and-page-types) | | `source_hint` | The [source](https://millionshort.com/docs/search/sources) that holds pages like this one | A source slug | | `label_confidence` | How sure each label is | 0 to 1 each, or `null` | ## One vocabulary across the endpoints The labels are the same ones everywhere, so a program can treat a page it found, a page it fetched and a page it was told about with one rule: - **Search** results carry `topic` and `page_type`, and a search can filter by them. See [Topics and page types](https://millionshort.com/docs/search/topics-and-page-types). - **Extract** labels every page it returns, described here. - **Monitor** events carry the same labels for each new result or changed page. See [Labels on monitor events](https://millionshort.com/docs/monitor/labels). `source_hint` tells an agent where to search for more of the same: a paper is `academic`, or `medical` when it is about health; a news article is `news`; a forum thread is `discussions`; a personal blog is `smallweb`. It does not say that we hold the page. ## Keep only some pages `topics`, `page_types` and `source_hints` on the request take lists of slugs. A page left out stays in `results`, in its place, with `filtered: true` and none of its content. ```bash curl https://api.millionshort.com/v1/extract \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "urls": ["https://example.org/a", "https://example.org/b"], "mode": "live", "topics": ["health"], "page_types": ["articles", "research"] }' ``` ```python import os import requests r = requests.post( "https://api.millionshort.com/v1/extract", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, json={ "urls": [ "https://example.org/a", "https://example.org/b" ], "mode": "live", "topics": [ "health" ], "page_types": [ "articles", "research" ] }, timeout=30, ) r.raise_for_status() print(r.json()["data"]) ``` ```ts const res = await fetch('https://api.millionshort.com/v1/extract', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ "urls": [ "https://example.org/a", "https://example.org/b" ], "mode": "live", "topics": [ "health" ], "page_types": [ "articles", "research" ] }), }); if (!res.ok) throw new Error(`POST /v1/extract failed: ${res.status}`); const { data } = (await res.json()) as { data: unknown }; console.log(data); ``` - **A page left out is still charged for its fetch.** It had to be fetched to be labelled. The lists save your program the reading, not the fetch. - A page is never left out for a label it does not have: a `null` label passes. - Labels never fail a call and never change its price. The full rules, with the entry a filtered page leaves behind, are under [Parameters](https://millionshort.com/docs/extract/parameters#labels). --- Source: https://millionshort.com/docs/extract/guides Section: Endpoints / Extract # Extract guides The jobs Extract is built for, each as the requests that do it. ## Search, then read The common pair: search for pages, then read the ones worth reading. 1. Search, and choose results by title, snippet, `popularity` and `risk`: ```bash curl https://api.millionshort.com/v1/search \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "query": "reading a tide table", "num_results": 10, "remove_top_sites": 1000, "max_highlights": 2 }' ``` ```python import os import requests r = requests.post( "https://api.millionshort.com/v1/search", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, json={ "query": "reading a tide table", "num_results": 10, "remove_top_sites": 1000, "max_highlights": 2 }, timeout=30, ) r.raise_for_status() for hit in r.json()["data"]["results"]: print(hit["position"], hit["title"], hit["url"]) ``` ```ts const res = await fetch('https://api.millionshort.com/v1/search', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ "query": "reading a tide table", "num_results": 10, "remove_top_sites": 1000, "max_highlights": 2 }), }); if (!res.ok) throw new Error(`POST /v1/search failed: ${res.status}`); const { data } = (await res.json()) as { data: { results: { position: number; title: string; url: string }[] }; }; for (const hit of data.results) console.log(hit.position, hit.title, hit.url); ``` The same call as a tool of the MCP server: ```json { "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "search", "arguments": { "query": "reading a tide table", "num_results": 10, "remove_top_sites": 1000, "max_highlights": 2 } } } ``` 2. Send the chosen URLs, up to 20, to Extract: ```bash curl https://api.millionshort.com/v1/extract \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "urls": ["https://example.org/guides/tide-tables", "https://example.org/guides/tidal-range"], "mode": "live" }' ``` ```python import os import requests r = requests.post( "https://api.millionshort.com/v1/extract", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, json={ "urls": [ "https://example.org/guides/tide-tables", "https://example.org/guides/tidal-range" ], "mode": "live" }, timeout=30, ) r.raise_for_status() print(r.json()["data"]) ``` ```ts const res = await fetch('https://api.millionshort.com/v1/extract', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ "urls": [ "https://example.org/guides/tide-tables", "https://example.org/guides/tidal-range" ], "mode": "live" }), }); if (!res.ok) throw new Error(`POST /v1/extract failed: ${res.status}`); const { data } = (await res.json()) as { data: unknown }; console.log(data); ``` When the text we hold is enough, skip the second call: [`include_content`](https://millionshort.com/docs/search/highlights) on the search returns it for web and news results. ## Keep only the pages worth reading Hand Extract a mixed list and let the [labels](https://millionshort.com/docs/extract/labels) sort it. With `page_types` or `topics` on the request, a page that does not match comes back as an entry with `filtered: true` and no content, so nothing unwanted reaches the model. The fetch of a filtered page is still charged. ## Many pages More than 20 URLs is a [batch](https://millionshort.com/docs/extract/batch): up to 1,000 as one job. Poll it, or name a [webhook](https://millionshort.com/docs/webhooks) and be told when it ends. A page of a batch that is waiting for a busy site waits, at no cost, until the batch has run for 60 minutes; only after that can it fail as `HOST_BUSY`. ## A page that scripts build When a `live` page looks like an empty shell that scripts fill in, the response carries a `looks_script_built` warning. Send that URL again with `mode: "rendered"`. No mode is ever upgraded for you, because `rendered` costs more. ## Staying within the limits One site gets at most 2 fetches at once and 1 a second from all our customers together, and a team may fetch 2,000 pages of one site a day. Spread a large job over sites, not over one. [Pricing and limits](https://millionshort.com/docs/extract/pricing) has the numbers. --- Source: https://millionshort.com/docs/extract/pricing Section: Endpoints / Extract # Extract pricing and limits A price for each mode, charged for pages that succeed. A live page is half a credit. ## What a page costs **1 credit is $0.001, and a live page is half a credit:** $0.50 per 1,000 pages at the list price. A page is charged at the price of the mode that produced it, and only when it succeeded, with one exception below. | Mode | Credits per page | Per 1,000 pages | |---|---|---| | `cached` | 0.25 | $0.25 | | `live` | 0.5 | $0.50 | | `rendered` | 2 | $2.00 | | `unblock` | 10 | $10.00 | | `stealth` | 25, not switched on yet | $25.00 | | `auto` | By the mode used | | | A page as JSON of your shape, on top of the mode | 3 | $3.00 | `stealth` is not switched on yet. When it is, it will work on the plans that include it (below). A page as JSON of your shape is asked for with [`json`](https://millionshort.com/docs/extract/parameters#json-of-your-shape): an object with a `schema` and an optional `prompt`. A call with `json` takes up to three URLs, and a page whose JSON failed costs only its fetch. JSON is on Starter and up; on Free it is refused with `400 UNSUPPORTED_OPTION`. | Call | Credits | |---|---| | 1 URL, `live`, succeeds | 0.5 | | 10 URLs, `live`, 8 succeed | 4 | | 1 URL, `rendered`, succeeds | 2 | | 1 URL, `rendered`, the site says the page does not exist (404) | 2 | | 5 URLs, all fail | 0 | | 10 URLs, `live`, all succeed, 6 left out by `page_types` | 5 | | 1 URL, `live`, returned as JSON of your shape | 0.5 + 3 = 3.5 | - The call holds `urls × the price of the mode asked for` before any work (`auto` holds the `live` price), charges each page that succeeded at the price of the mode actually used, and hands the rest back in the same request. - A URL that fails is free. A page left out by a label list is charged for its fetch. - **The one exception:** in `rendered`, `unblock` and `stealth`, a browser reaches the site for you. When the site answers that the page does not exist (`404` or `410`), the page is charged at the mode's price: the browser did the work. It comes back with `status: "error"`, `error.code: "FETCH_FAILED"`, `error.target_status` and `charged: true`. - Our own refusals are never charged: robots.txt, the URL rules, a site that opted out, our caps and our capacity. - [Labels](https://millionshort.com/docs/extract/labels) are free in every mode. - `usage.breakdown` has one line per mode used. ## Limits of a request | Limit | Value | |---|---| | `urls` | 1 to 20, distinct; 1 to 1,000 in a [batch](https://millionshort.com/docs/extract/batch) | | A URL | up to 2,048 characters | | `max_chars` | 1 to 500,000 | | A page | 10 MiB; up to 5 redirects | | Time for one page | 20 seconds for `live`, 60 for `rendered`, 130 for `unblock` and `stealth` | ## Limits of a plan | | Free | Starter | Growth | Scale | Business | |---|---|---|---|---|---| | Fetches at once, per team | 2 | 4 | 8 | 16 | 32 | | `rendered` | No | Yes | Yes | Yes | Yes | | `unblock` | No | No | Yes | Yes | Yes | | `stealth` (not switched on yet) | No | No | Yes | Yes | Yes | ## Limits that protect sites - For all customers together, one site gets at most 2 fetches at once and 1 a second. - Per team, per site, per day: 2,000 fetches in any mode other than `cached`. A page fetched again and found unchanged does not count again. [The daily limit per site](https://millionshort.com/docs/extract/parameters#the-daily-limit-per-site) says exactly what counts. The numbers on this page are those of [Parameters](https://millionshort.com/docs/extract/parameters#limits); when the two differ, that page is right. --- Source: https://millionshort.com/docs/extract/errors Section: Endpoints / Extract # Extract errors A request can fail as a whole, and each URL can fail on its own. Only the first changes the HTTP status. ## Two levels - **The request.** A request that is not valid, cannot be paid for, or has no room to run answers with an HTTP error and the one [error shape](https://millionshort.com/docs/errors#the-error-shape) every endpoint uses. - **Each URL.** A valid request answers `200` even when every URL failed. Each entry of `data.results` has `status: "ok"` or `status: "error"` with an `error` of its own. A URL that fails costs nothing, except in `rendered`, `unblock` and `stealth` when the site says the page does not exist (`404`, `410`): that page is charged at the mode's price and marked `charged: true`. ## Request errors | Status and code | When | |---|---| | `400 INVALID_PARAM` | A field the API does not take, a URL that is not `http` or `https`, an empty label list, an unknown slug. On a [batch](https://millionshort.com/docs/extract/batch), also a `webhook_id` that is not an `active` [endpoint](https://millionshort.com/docs/webhooks) of your team: one that does not exist, is still `pending` verification, or was `disabled` | | `400 UNSUPPORTED_OPTION` | A mode the plan does not include, or one that is switched off | | `401 AUTH_MISSING_KEY`, `401 AUTH_INVALID_KEY` | No `Authorization` header, or a key that is malformed, revoked or expired | | `404 JOB_NOT_FOUND` | `GET` or `DELETE` of a batch that does not exist or belongs to another team. The two are not told apart | | `429 INSUFFICIENT_CREDITS` | The balance does not cover the URLs at the price of the mode asked for | | `429 RATE_LIMITED` | The team has no fetch slot free at all | ## Per-URL errors | Code | Meaning | Try next | |---|---|---| | `URL_NOT_ALLOWED` | Not a public web page we will fetch | | | `ROBOTS_DISALLOWED` | The site's robots.txt does not allow our bot | | | `ROBOTS_UNAVAILABLE` | robots.txt could not be read, so we did not fetch | Later | | `SITE_OPTED_OUT` | The site asked us not to fetch or serve it | | | `NOT_IN_CACHE` | `cached` mode: we hold no copy | `live` | | `FETCH_FAILED` | The site did not answer usefully | Later | | `TIMEOUT` | The site was too slow | Later | | `TOO_LARGE` | The page is over 10 MiB | | | `UNSUPPORTED_CONTENT_TYPE` | Not a kind of document we read | | | `BLOCKED_BY_SITE` | The site refused our bot | `unblock` | | `RENDER_FAILED` | `rendered` or `unblock` could not load the page | Later | | `HOST_BUSY` | We are already fetching from this site as fast as we allow | After `retry_after_seconds` | | `HOST_DAILY_LIMIT` | This team reached its daily limit for this site | Tomorrow (UTC) | | `CAPACITY` | `rendered` and `unblock` are at capacity | After `retry_after_seconds` when it is given, else later | [Parameters](https://millionshort.com/docs/extract/parameters#per-url-errors) has the same table with every condition spelled out. ## What not to work around `ROBOTS_DISALLOWED` and `SITE_OPTED_OUT` are final: there is no option to ignore robots.txt, and no mode gets past a site's own choice. `BLOCKED_BY_SITE` is different. The site refused an automated request, and `unblock` is the mode for that, on the plans that include it. ## Warnings A `200` can carry `warnings`: `looks_script_built` when a `live` page looks like an empty shell (try `rendered`), and `labels_unavailable` when labels could not be made, in which case no page is left out by a label list. --- Source: https://millionshort.com/docs/monitor Section: Endpoints / Monitor # Monitor Save a search or a page, choose an interval, and be told only when something changed. ```text POST https://api.millionshort.com/v1/monitors ``` A monitor is a saved target, an interval and a place to deliver events. We run the check on schedule, remember what was there last time, and tell you only about the difference. ## Two kinds | Kind | Watches | A change is | |---|---|---| | `query` | A search: a query, one source, and the search filters | A result this monitor has not seen before, among the first `top_n` results | | `url` | One page | The page's main text differs from the last check by more than `min_change_chars` | A query monitor watches the sources that are kept current: `social`, `hn`, `news`, `law`, `contracts`, `podcasts`, `academic`, `medical` and `finance`. The `web` source is left out on purpose: it is [refreshed periodically](https://millionshort.com/docs/search/freshness), so a monitor on it would report the index changing, not the world. To watch something on the web, watch its page. ## How you hear about it - **A webhook.** Register an endpoint once, verify it, and events arrive signed. See [Webhooks](https://millionshort.com/docs/webhooks). - **Pulling.** Every monitor's events can be read with `GET /v1/monitors/{id}/events`, with or without a webhook. Events are kept 30 days. Every event says what its pages are, with the same [labels](https://millionshort.com/docs/monitor/labels) as Search and Extract, so the program that receives it can route it without fetching anything. ## In this section | Part | Page | |---|---| | Quickstart | [Create a monitor, then read its events](https://millionshort.com/docs/monitor/quickstart) | | Parameters | [The endpoints, every field, intervals and events](https://millionshort.com/docs/monitor/parameters) | | Guides | [News monitoring, and the other jobs](https://millionshort.com/docs/monitor/guides) | | Pricing and limits | [What a check costs, and how many monitors a plan has](https://millionshort.com/docs/monitor/pricing) | | Errors | [Request errors, failed checks and paused monitors](https://millionshort.com/docs/monitor/errors) | ## Without a monitor A scheduled search that remembers what it has seen does the job of a query monitor in your own code. The [news monitoring guide](https://millionshort.com/docs/monitor/guides/news-monitoring) has both ways. ## With the other endpoints A query monitor is a saved [search](https://millionshort.com/docs/search); a page monitor fetches the way [Extract](https://millionshort.com/docs/extract) does, under the same robots.txt rules and the same per-site limits. --- Source: https://millionshort.com/docs/monitor/quickstart Section: Endpoints / Monitor # Monitor quickstart Create a monitor, let it run, and read what changed. ## 1. Watch a search ```bash curl https://api.millionshort.com/v1/monitors \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "kind": "query", "name": "bridge tenders", "query": "bridge inspection", "source": "contracts", "top_n": 10, "interval_minutes": 1440 }' ``` ```python import os import requests r = requests.post( "https://api.millionshort.com/v1/monitors", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, json={ "kind": "query", "name": "bridge tenders", "query": "bridge inspection", "source": "contracts", "top_n": 10, "interval_minutes": 1440 }, timeout=30, ) r.raise_for_status() print(r.json()["data"]) ``` ```ts const res = await fetch('https://api.millionshort.com/v1/monitors', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ "kind": "query", "name": "bridge tenders", "query": "bridge inspection", "source": "contracts", "top_n": 10, "interval_minutes": 1440 }), }); if (!res.ok) throw new Error(`POST /v1/monitors failed: ${res.status}`); const { data } = (await res.json()) as { data: unknown }; console.log(data); ``` The answer is the monitor, with its `id`. The first check records a baseline and sends nothing, unless `notify_on_create` is `true`. After that, an event is made whenever a result appears among the first `top_n` that this monitor has not seen. ## 2. Or watch a page ```bash curl https://api.millionshort.com/v1/monitors \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "kind": "url", "url": "https://example.org/pricing", "mode": "live", "ignore": ["numbers", "dates"], "min_change_chars": 40, "interval_minutes": 60 }' ``` ```python import os import requests r = requests.post( "https://api.millionshort.com/v1/monitors", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, json={ "kind": "url", "url": "https://example.org/pricing", "mode": "live", "ignore": [ "numbers", "dates" ], "min_change_chars": 40, "interval_minutes": 60 }, timeout=30, ) r.raise_for_status() print(r.json()["data"]) ``` ```ts const res = await fetch('https://api.millionshort.com/v1/monitors', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ "kind": "url", "url": "https://example.org/pricing", "mode": "live", "ignore": [ "numbers", "dates" ], "min_change_chars": 40, "interval_minutes": 60 }), }); if (!res.ok) throw new Error(`POST /v1/monitors failed: ${res.status}`); const { data } = (await res.json()) as { data: unknown }; console.log(data); ``` `ignore` and `min_change_chars` keep a counter or a date in the page from making an event every hour. ## 3. Read the events ```bash curl "https://api.millionshort.com/v1/monitors/$MONITOR_ID/events?limit=50" \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" ``` ```python import os import requests r = requests.get( f"https://api.millionshort.com/v1/monitors/{os.environ['MONITOR_ID']}/events?limit=50", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, timeout=30, ) r.raise_for_status() print(r.json()["data"]) ``` ```ts const res = await fetch(`https://api.millionshort.com/v1/monitors/${process.env.MONITOR_ID}/events?limit=50`, { headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}` }, }); if (!res.ok) throw new Error(`GET /v1/monitors/…/events failed: ${res.status}`); const { data } = (await res.json()) as { data: unknown }; console.log(data); ``` Pass the id of the last event you handled as `after` to get only newer ones. Pulling is free. ## 4. Or have them delivered Register a [webhook](https://millionshort.com/docs/webhooks), verify it, and pass its id as `webhook_id` when you create the monitor. Events then arrive signed, and can still be pulled. ## Next - [Parameters](https://millionshort.com/docs/monitor/parameters): every field, the shortest interval each plan and source allows, and the events. - [Pricing and limits](https://millionshort.com/docs/monitor/pricing): what a check costs. - [News monitoring](https://millionshort.com/docs/monitor/guides/news-monitoring): the same job with a monitor or with a scheduled search. --- Source: https://millionshort.com/docs/monitor/parameters Section: Endpoints / Monitor # Monitor parameters The endpoints, every field of a monitor, the intervals each plan and source allows, and the events. A monitor is a saved target, an interval and a place to deliver events. | Kind | Target | A change is | Credits per check | |---|---|---|---| | `query` | A search: a query, one source, and the search filters | A result URL this monitor has not seen before, among the first `top_n` results | 1 | | `url` | One page | The page's main text differs from the last check by more than `min_change_chars` | The price of the mode: 0.5 for `live`, 2 for `rendered` | A check that fails, is put off, or cannot be paid for is free, except a `rendered` check whose page the site says does not exist (`404`, `410`), which is charged like a check that ran. ## Endpoints | Endpoint | What it does | |---|---| | `POST /v1/monitors` | Create a monitor | | `GET /v1/monitors` | List your monitors. Free | | `GET /v1/monitors/{id}` | One monitor. Free | | `PATCH /v1/monitors/{id}` | Change `status` (`active` or `paused`), `interval_minutes`, `webhook_id` or `name` | | `DELETE /v1/monitors/{id}` | Delete it | | `POST /v1/monitors/{id}/run` | Check now. Charged like a scheduled check. Four an hour per monitor | | `GET /v1/monitors/{id}/events` | Pull its events. Free. Events are kept 30 days | ## Create a query monitor ```bash curl https://api.millionshort.com/v1/monitors \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "kind": "query", "name": "bridge tenders", "query": "bridge inspection", "source": "contracts", "top_n": 10, "interval_minutes": 1440 }' ``` ```python import os import requests r = requests.post( "https://api.millionshort.com/v1/monitors", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, json={ "kind": "query", "name": "bridge tenders", "query": "bridge inspection", "source": "contracts", "top_n": 10, "interval_minutes": 1440 }, timeout=30, ) r.raise_for_status() print(r.json()["data"]) ``` ```ts const res = await fetch('https://api.millionshort.com/v1/monitors', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ "kind": "query", "name": "bridge tenders", "query": "bridge inspection", "source": "contracts", "top_n": 10, "interval_minutes": 1440 }), }); if (!res.ok) throw new Error(`POST /v1/monitors failed: ${res.status}`); const { data } = (await res.json()) as { data: unknown }; console.log(data); ``` ## Create a URL monitor ```bash curl https://api.millionshort.com/v1/monitors \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "kind": "url", "url": "https://example.org/pricing", "mode": "live", "ignore": ["numbers", "dates"], "min_change_chars": 40, "interval_minutes": 60 }' ``` ```python import os import requests r = requests.post( "https://api.millionshort.com/v1/monitors", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, json={ "kind": "url", "url": "https://example.org/pricing", "mode": "live", "ignore": [ "numbers", "dates" ], "min_change_chars": 40, "interval_minutes": 60 }, timeout=30, ) r.raise_for_status() print(r.json()["data"]) ``` ```ts const res = await fetch('https://api.millionshort.com/v1/monitors', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ "kind": "url", "url": "https://example.org/pricing", "mode": "live", "ignore": [ "numbers", "dates" ], "min_change_chars": 40, "interval_minutes": 60 }), }); if (!res.ok) throw new Error(`POST /v1/monitors failed: ${res.status}`); const { data } = (await res.json()) as { data: unknown }; console.log(data); ``` ## Fields | Field | Type | Default | Notes | |---|---|---|---| | `kind` | `query` or `url` | | Required | | `interval_minutes` | integer, 1 to 43,200 | | Required. How often to check. The longest is 30 days. The shortest your monitor may use depends on the plan and the source ([below](#sources-and-intervals)): no plan or source today allows less than 5 minutes, and a shorter value is refused with the shortest allowed | | `name` | string, up to 120 characters | | A label for you | | `webhook_id` | string | | An active [webhook endpoint](https://millionshort.com/docs/webhooks). Without it, you pull events | | `notify_on_create` | boolean | `false` | The first check records a baseline and sends nothing, unless this is `true` | | `confirm_after` | integer, 0 to 5 | `0` | A change must still be there on the next n checks before the event is sent | | `query` | string | | `query` monitors: what to search for | | `source` | one source | | `query` monitors: `social`, `hn`, `news`, `law`, `contracts`, `podcasts`, `academic`, `medical` or `finance` | | `filters` | object | | `query` monitors: the search request's domain lists, page types, topics and `safe_search` | | `top_n` | integer, 1 to 25 | `10` | `query` monitors: how far down the list to look for new results | | `url` | string | | `url` monitors: the page to watch | | `mode` | `live` or `rendered` | `"live"` | `url` monitors: how the page is fetched | | `ignore` | array of `numbers`, `dates` | | `url` monitors: kinds of change to disregard | | `min_change_chars` | integer, 0 to 10,000 | `40` | `url` monitors: the smallest change worth an event | ## Sources and intervals A query monitor watches one source, and only sources that are kept current: | Source | Shortest interval | |---|---| | `social`, `hn` | 15 minutes (5 minutes on the Scale plan and above) | | `news` | 1 hour | | `law`, `contracts`, `podcasts`, `academic`, `medical`, `finance` | 24 hours | | `web`, `smallweb`, `discussions`, `communities` | Not offered. The call answers `400 UNSUPPORTED_OPTION`. Watch a page with a `url` monitor instead | `web` is left out on purpose: it is [refreshed periodically](https://millionshort.com/docs/search/freshness), so a monitor on it would report the index changing, not the world. | Plan | Active monitors | Shortest interval | |---|---|---| | Free | 3 | 24 hours | | Starter | 25 | 1 hour | | Growth | 100 | 15 minutes | | Scale | 500 | 5 minutes (`social`, `hn`) | | Business | 2,000 | 5 minutes | A monitor's shortest interval is the longer of its plan's and its source's. A `url` monitor follows the plan column, and is never shorter than 15 minutes. ## A monitor | Field | Type | Notes | |---|---|---| | `id` | string | | | `kind` | `query` or `url` | | | `name` | string or null | | | `status` | `active` or `paused` | | | `paused_reason` | string or null | `user`, `insufficient_credits`, `webhook_disabled`, `failing`, `unavailable` or `plan`. [Monitor errors](https://millionshort.com/docs/monitor/errors#a-check-that-fails) says what each means | | `target` | object | What it watches | | `interval_minutes` | integer | | | `webhook_id` | string or null | | | `last_checked_at`, `last_changed_at`, `next_check_at` | date and time, or null | | | `consecutive_failures` | integer | | | `created_at` | date and time | | ## Events Events are delivered to the monitor's webhook when it has one, and can always be pulled: ```bash curl "https://api.millionshort.com/v1/monitors/$MONITOR_ID/events?limit=50" \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" ``` ```python import os import requests r = requests.get( f"https://api.millionshort.com/v1/monitors/{os.environ['MONITOR_ID']}/events?limit=50", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, timeout=30, ) r.raise_for_status() print(r.json()["data"]) ``` ```ts const res = await fetch(`https://api.millionshort.com/v1/monitors/${process.env.MONITOR_ID}/events?limit=50`, { headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}` }, }); if (!res.ok) throw new Error(`GET /v1/monitors/…/events failed: ${res.status}`); const { data } = (await res.json()) as { data: unknown }; console.log(data); ``` Pass the id of the last event you handled as `after` to get only newer ones. Every event has `id` (`evt_` and an identifier), `type`, `monitor_id`, `created_at` and `data`. | Type | When | `data` | |---|---|---| | `monitor.changed`, query | New result URLs appeared | `kind`, `new_results` (each with `title`, `url`, `site`, `source`, `snippet`, `published_date`, `position`, `topic`, `page_type`, `source_hint`, `label_confidence`), `checked_at` | | `monitor.changed`, URL | The page changed | `kind`, `url`, `topic`, `page_type`, `source_hint`, `label_confidence`, `added`, `removed`, `truncated`, `previous_hash`, `current_hash`, `checked_at` | | `monitor.failed` | 3 checks in a row failed | `code`, `message`, `consecutive_failures` | | `monitor.paused` | Out of credits 3 checks in a row, or its webhook endpoint was disabled | `reason` | Every `monitor.changed` event says what its pages are, with the same [labels](https://millionshort.com/docs/extract/parameters#labels) an extracted page carries, so the program that receives an event can route it without fetching anything. A page event carries the labels of the page as it is now. A new search result carries the `topic` and `page_type` the search gave it where it gave them, and otherwise ones read from its title and snippet; its `source_hint` is the source it came from. A label that is a known fact rather than a reading has a `null` confidence. Any label can be `null`, as on Extract. Labels are free. `added` and `removed` are the changed blocks of text, capped at 20 KB together. We keep the last two snapshots of a watched page, not its history. ## Behaviour to know - The first check records a baseline and sends nothing, unless `notify_on_create` is `true`. - Scheduled checks are spread by up to 10% of the interval, so a 60-minute monitor runs roughly hourly, not on the hour. - After 10 failed checks in a row a monitor is paused, with `paused_reason: "failing"`. A check we could not make because search was busy, or because a page's site was busy for us, is put off: it is free, and it is not a failed check. - A scheduled check that was put off is tried again about two minutes later, up to three times, before the monitor goes back to its interval. This holds for `query` and `url` monitors alike. - A query check costs 1 credit whatever `top_n` is. - A `url` monitor passes the same URL rules and robots.txt check as [Extract](https://millionshort.com/docs/extract/parameters) on every check, not only when it is created. - Checks count towards the [per-site daily fetch limit](https://millionshort.com/docs/extract/parameters#the-daily-limit-per-site) of Extract (2,000 fetches of one site a day), in the way that limit counts: **a check that finds the page unchanged is not another fetch of the day.** The first check of a page in a day counts once, and after that only a check that finds the page changed counts. A hundred monitored pages of one site, checked every 15 minutes, use about a hundred fetches a day plus one for each change. A page that is different on every check (a search page, a feed with a clock in it) counts on every check; `ignore: ["numbers", "dates"]` applies here as it does to what the monitor reports. When the day's fetches of a site are used up, a check that finds a changed page fails, free, until the next day (UTC). ## Errors `400 INVALID_PARAM`, which includes an interval shorter than the plan and the source allow (`error.details.min_interval_minutes` says the shortest); `400 UNSUPPORTED_OPTION` for a source a query monitor cannot watch; `401` for a missing or refused key; `404 JOB_NOT_FOUND` for a monitor that does not exist or is not yours; `429`. See [Errors](https://millionshort.com/docs/errors). ## Over MCP The MCP server has a read-only `list_monitor_events` tool. No MCP tool creates or deletes a monitor. ## Without a monitor A search run on a schedule that remembers the URLs it has seen does the same job in your own code. The [news monitoring guide](https://millionshort.com/docs/monitor/guides/news-monitoring) has both ways. --- Source: https://millionshort.com/docs/monitor/labels Section: Endpoints / Monitor # Labels on monitor events Every change a monitor reports says what its pages are, so a program can route an event without fetching anything. Every `monitor.changed` event carries labels for what changed: | Event | Where the labels are | |---|---| | A query monitor found new results | On each entry of `data.new_results`: `topic`, `page_type`, `source_hint`, `label_confidence` | | A page monitor found the page changed | On `data`: `topic`, `page_type`, `source_hint`, `label_confidence` | They are the labels an [extracted page](https://millionshort.com/docs/extract/labels) carries, with the same slugs: 24 topics, 23 page types, and the [sources](https://millionshort.com/docs/search/sources). ## Where each label comes from - **A page event** carries the labels of the page as it is now. - **A new search result** carries the `topic` and `page_type` the search gave it where it gave them, and otherwise ones read from its title and snippet. Its `source_hint` is the source it came from. - A label that is a known fact rather than a reading has a `null` confidence. Any label can be `null`, as on Extract. Labels are free and never fail a check. ## Using them - Send health pages to one queue and everything else to another, by `topic`. - Tell a news article from a forum thread about the same subject, by `page_type`. - Decide where to search for more of the same, by `source_hint`. To narrow what a query monitor watches in the first place, put page types and topics in its `filters`, as on a [search](https://millionshort.com/docs/search/topics-and-page-types). The fields of an event are listed under [Parameters](https://millionshort.com/docs/monitor/parameters#events). --- Source: https://millionshort.com/docs/monitor/guides Section: Endpoints / Monitor # Monitor guides The jobs Monitor is built for, each as the fields that do it. - [News monitoring](https://millionshort.com/docs/monitor/guides/news-monitoring): Watch a subject in the news and be told only about what is new. With a scheduled search, or more simply with Monitor. ## Recipes Each is a choice of fields on a monitor; [Parameters](https://millionshort.com/docs/monitor/parameters#fields) lists them all. - **A page that changes all the time.** Set `ignore` to `["numbers", "dates"]` and raise `min_change_chars`, so a counter or a timestamp is not a change. - **A change that must last.** Set `confirm_after`: the change must still be there on the next checks before the event is sent. Useful for pages that flicker. - **Only the top of the list.** Lower `top_n` on a query monitor to hear about a new result only when it ranks near the top. - **Tell me what is there now.** Set `notify_on_create` to get the first check as an event; otherwise it is a silent baseline. - **Check now.** `POST /v1/monitors/{id}/run` runs a check out of schedule, four an hour per monitor, charged like a scheduled one. - **Route by kind of page.** Read the [labels](https://millionshort.com/docs/monitor/labels) on each event. ## Receiving events well Answer a webhook quickly and do the work afterwards, check the signature on every delivery, and treat an event id you have seen before as already handled. [Webhooks](https://millionshort.com/docs/webhooks) has the signature check and the delivery rules. --- Source: https://millionshort.com/docs/monitor/guides/news-monitoring Section: Endpoints / Monitor # News monitoring Watch a subject in the news and be told only about what is new. With a scheduled search, or more simply with Monitor. The job: for a subject you care about, learn about new articles soon after they appear, and never be told about the same one twice. The first half of this guide does it with the Search API and your own scheduler; the second half lets a [Monitor](https://millionshort.com/docs/monitor) do the remembering. ## With a scheduled search Run a `news` search on a schedule and remember the URLs you have already seen. Every `news` result carries a `published_date`, so `start_date` leaves out anything old, and `exclude_risky` leaves out sites that carry a risk label. ```python import json import os import pathlib from datetime import date, timedelta from millionshort import MillionShort client = MillionShort(api_key=os.environ["MILLIONSHORT_API_KEY"]) QUERY = "central bank interest rate decision" STATE = pathlib.Path("seen-urls.json") def check(): seen = set(json.loads(STATE.read_text())) if STATE.exists() else set() since = (date.today() - timedelta(days=3)).isoformat() r = client.search(QUERY, sources=["news"], num_results=20, start_date=since, exclude_risky=True) fresh = [hit for hit in r.results if hit["url"] not in seen] STATE.write_text(json.dumps(sorted(seen | {hit["url"] for hit in r.results}))) return fresh, r.usage.credits fresh, credits = check() for hit in fresh: print(hit["published_date"], hit["extra"].get("publisher"), hit["title"], hit["url"]) print(len(fresh), "new;", credits, "credits") ``` ```ts import { existsSync, readFileSync, writeFileSync } from 'node:fs'; import { MillionShort } from 'millionshort'; const client = new MillionShort({ apiKey: process.env.MILLIONSHORT_API_KEY }); const QUERY = 'central bank interest rate decision'; const STATE = 'seen-urls.json'; async function check() { const seen = new Set(existsSync(STATE) ? JSON.parse(readFileSync(STATE, 'utf8')) : []); const since = new Date(Date.now() - 3 * 24 * 3600 * 1000).toISOString().slice(0, 10); const r = await client.search(QUERY, { sources: ['news'], numResults: 20, startDate: since, excludeRisky: true, }); const fresh = r.results.filter((hit) => !seen.has(hit.url)); for (const hit of r.results) seen.add(hit.url); writeFileSync(STATE, JSON.stringify([...seen].sort())); return { fresh, credits: r.usage?.credits }; } const { fresh, credits } = await check(); for (const hit of fresh) { console.log(hit.published_date, hit.extra.publisher, hit.title, hit.url); } console.log(fresh.length, 'new;', credits, 'credits'); ``` Run it from a scheduler of your choice, once an hour. The first run reports everything recent; later runs report only what is new. Make it better: - **Past the usual outlets.** `remove_top_sites: 1000` leaves out the largest news sites, which is where local and trade coverage shows up. - **Reactions too.** Add `social` to `sources` for first-hand posts, and read `source` on each result to tell them apart. Each source is one more credit. - **A beat, not a query.** Run several queries and share one `seen` set. - **Only certain outlets.** `include_domains` limits the search to the sites you name. What it costs: one search of `news` with 20 results is 1.5 credits. Hourly, that is 36 credits a day, about $0.04. ## With Monitor A [query monitor](https://millionshort.com/docs/monitor/parameters) does the remembering for you. It runs the search on an interval and produces an event only when a result URL appears that it has not seen before. On `news` the shortest interval is one hour; on `social` and `hn` it is 15 minutes. Create it once: ```bash curl https://api.millionshort.com/v1/monitors \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "kind": "query", "name": "rate decisions", "query": "central bank interest rate decision", "source": "news", "top_n": 20, "interval_minutes": 60 }' ``` ```python import os import requests r = requests.post( "https://api.millionshort.com/v1/monitors", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, json={ "kind": "query", "name": "rate decisions", "query": "central bank interest rate decision", "source": "news", "top_n": 20, "interval_minutes": 60 }, timeout=30, ) r.raise_for_status() print(r.json()["data"]) ``` ```ts const res = await fetch('https://api.millionshort.com/v1/monitors', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ "kind": "query", "name": "rate decisions", "query": "central bank interest rate decision", "source": "news", "top_n": 20, "interval_minutes": 60 }), }); if (!res.ok) throw new Error(`POST /v1/monitors failed: ${res.status}`); const { data } = (await res.json()) as { data: unknown }; console.log(data); ``` Then either pull its events when it suits you: ```bash curl "https://api.millionshort.com/v1/monitors/$MONITOR_ID/events?limit=50" \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" ``` ```python import os import requests r = requests.get( f"https://api.millionshort.com/v1/monitors/{os.environ['MONITOR_ID']}/events?limit=50", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, timeout=30, ) r.raise_for_status() print(r.json()["data"]) ``` ```ts const res = await fetch(`https://api.millionshort.com/v1/monitors/${process.env.MONITOR_ID}/events?limit=50`, { headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}` }, }); if (!res.ok) throw new Error(`GET /v1/monitors/…/events failed: ${res.status}`); const { data } = (await res.json()) as { data: unknown }; console.log(data); ``` or register a [webhook](https://millionshort.com/docs/webhooks) and have each `monitor.changed` event delivered, signed, to your own endpoint. The event's `data.new_results` holds the new articles, with `title`, `url`, `site`, `snippet` and `published_date`. Each check costs 1 credit, and a check that fails is free. An hourly monitor is 24 credits a day. ## Watching a page News does not always arrive as an article. To watch one page, a press room or a regulator's notices, a `url` monitor reports when the page's text changes and shows what was added and removed. See [Monitor parameters](https://millionshort.com/docs/monitor/parameters). ## Related - [Freshness and dates](https://millionshort.com/docs/search/freshness): which sources are current. - The [News](https://millionshort.com/docs/search/sources/news) and [Social](https://millionshort.com/docs/search/sources/social) source pages. --- Source: https://millionshort.com/docs/monitor/pricing Section: Endpoints / Monitor # Monitor pricing and limits You pay for checks that ran. Keeping a monitor, and reading its events, is free. ## What a check costs **1 credit is $0.001.** | Check | Credits | |---|---| | A `query` monitor, whatever `top_n` is | 1 | | A `url` monitor, `live` | 0.5 | | A `url` monitor, `rendered` | 2 | | A `url` monitor, `rendered`, and the site says the page does not exist (`404`, `410`) | 2: the browser reached the site | | Any other check that fails, is put off, or cannot be paid for | Free | | Listing monitors, reading one, pulling events | Free | A check you start yourself with `POST /v1/monitors/{id}/run` is charged like a scheduled one. What a monitor costs in a month is its checks: a query monitor on a 24-hour interval makes about 30 checks, so about 30 credits; a `live` page monitor every hour makes about 720 checks, so about 360 credits. A monitor that cannot pay for three checks in a row is paused, with `paused_reason: "insufficient_credits"`, and says so in a `monitor.paused` event. ## Limits of a plan | Plan | Active monitors | Shortest interval | |---|---|---| | Free | 3 | 24 hours | | Starter | 25 | 1 hour | | Growth | 100 | 15 minutes | | Scale | 500 | 5 minutes (`social`, `hn`) | | Business | 2,000 | 5 minutes | ## Limits of a source | Source | Shortest interval | |---|---| | `social`, `hn` | 15 minutes (5 minutes on the Scale plan and above) | | `news` | 1 hour | | `law`, `contracts`, `podcasts`, `academic`, `medical`, `finance` | 24 hours | | `web`, `smallweb`, `discussions`, `communities` | Not offered for a query monitor | A monitor's shortest interval is the longer of its plan's and its source's. A `url` monitor follows the plan, and is never shorter than 15 minutes. The longest interval is 30 days. ## Other limits - `top_n`: 1 to 25. - A check on demand: four an hour per monitor. - Events are kept 30 days. - A page monitor's checks count towards [Extract's daily limit per site](https://millionshort.com/docs/extract/parameters#the-daily-limit-per-site), in the way that limit counts: a check that finds the page unchanged is not another fetch of the day. The numbers on this page are those of [Parameters](https://millionshort.com/docs/monitor/parameters#sources-and-intervals); when the two differ, that page is right. --- Source: https://millionshort.com/docs/monitor/errors Section: Endpoints / Monitor # Monitor errors A request can be refused, a check can fail, and a monitor can be paused. Each tells you in its own way. ## Request errors A call to a Monitor endpoint that fails answers with the one [error shape](https://millionshort.com/docs/errors#the-error-shape) every endpoint uses. | Status and code | When | |---|---| | `400 INVALID_PARAM` | A field the API does not take, or a value out of range. An interval shorter than the plan and the source allow is one of these, and `error.details.min_interval_minutes` says the shortest that is allowed. So is a `webhook_id`, on create or `PATCH`, that is not an `active` [endpoint](https://millionshort.com/docs/webhooks) of your team: one that does not exist, is still `pending` verification, or was `disabled` | | `400 UNSUPPORTED_OPTION` | A source a query monitor cannot watch | | `401 AUTH_MISSING_KEY`, `401 AUTH_INVALID_KEY` | No `Authorization` header, or a key that is malformed, revoked or expired | | `404 JOB_NOT_FOUND` | No such monitor for this team. A monitor of another team is answered the same way | | `429 RATE_LIMITED` | Over the plan's requests a minute, or more than four checks on demand in an hour | ## A check that fails A check runs when nobody is waiting for an answer, so its failure reaches you as an event and on the monitor itself. | What happened | What you see | |---|---| | A check failed | `consecutive_failures` goes up on the monitor. Nothing is charged | | 3 checks in a row failed | A `monitor.failed` event, with `code`, `message` and `consecutive_failures` | | 10 checks in a row failed | The monitor is paused, with `paused_reason: "failing"`, and a `monitor.paused` event | | A check could not be paid for, 3 times in a row | The monitor is paused, with `paused_reason: "insufficient_credits"`, and a `monitor.paused` event | | Its webhook endpoint was disabled | The monitor is paused, with `paused_reason: "webhook_disabled"`, and a `monitor.paused` event | | Every check was put off for three days, at least three of them | A `monitor.failed` event that says the monitor could not be checked, and the monitor is paused, with `paused_reason: "unavailable"`, and a `monitor.paused` event. Nothing was charged | | Its plan no longer includes the mode of a page monitor, such as `rendered` | The monitor is paused, with `paused_reason: "plan"`, and a `monitor.paused` event. Nothing is charged for that check | A check we could not make because search was busy, or because a page's site was busy for us, is **put off**, not failed: it is free, it is tried again about two minutes later, up to three times, and it does not count towards the failures above. A monitor you paused yourself, with `status: "paused"` on `PATCH /v1/monitors/{id}`, has `paused_reason: "user"`. That is the one reason you set yourself. ## A page monitor's own failures A page monitor passes the same URL rules and robots.txt check as Extract on every check, not only when it is created. A site that starts to disallow our bot makes the checks fail with Extract's per-URL codes, such as `ROBOTS_DISALLOWED`. See [Extract errors](https://millionshort.com/docs/extract/errors). ## Starting again Set `status` to `active` with `PATCH /v1/monitors/{id}` once the cause is fixed: credits added, the webhook verified again, the page reachable, or a plan that includes the monitor's mode. A monitor that was `unavailable` can be resumed as it is, to try again. --- Source: https://millionshort.com/docs/map Section: Endpoints / Map # Map Give it a site and get the addresses of its pages, in one answer. ```text POST https://api.millionshort.com/v1/map ``` Map answers one question about a site: which pages does it have? Give it the address of a page of the site and it returns the URLs it found, without fetching their content. The call is synchronous: one request, one answer. [Crawl](https://millionshort.com/docs/crawl) goes one step further. It returns the pages themselves as clean text, as a job that runs in the background. ## What it is for - **Finding the right page before reading it.** The pricing page, the changelog, the docs for one function. `search` puts the URLs that match your words first. - **Handing an agent the outline of a site.** A list of URLs with titles is small enough to read whole. - **Choosing what to read.** Send the URLs you want to [Extract](https://millionshort.com/docs/extract), or let a [crawl](https://millionshort.com/docs/crawl) fetch a section. ## Where the URLs come from Map looks in three places and merges what it finds. Each URL says which one named it first, in `from`. | Source | What it is | What reaches the site | |---|---|---| | `sitemap` | The site's own sitemaps: the ones its robots.txt names, and `/sitemap.xml` | robots.txt and a few sitemap files | | `links` | The page you named, and the links on it | One fetch of that page | | `index` | The pages of the site that our own index holds, each with its title and labels | No page. Asked alone, its robots.txt | The `index` source is what a list of links cannot give you: URLs come back with a `title`, a `topic` and a `page_type`, and no page of the site is requested for them. ## How we treat the site Map fetches the way [Extract](https://millionshort.com/docs/extract) does. Requests carry our declared identity, `MillionShortBot`. robots.txt is honoured, and there is no option to ignore it. A sitemap file that robots.txt closes to our bot is not read, and a site whose robots.txt closes it to us is not mapped at all, not even from our index: when you ask for the index alone, we still read the site's robots.txt first. A caller cannot send cookies or headers to a site. ## In this section | Part | Page | |---|---| | Quickstart | [List a site, search inside it, keep one section](https://millionshort.com/docs/map/quickstart) | | Parameters | [Every request field, the sources, and the response](https://millionshort.com/docs/map/parameters) | | Guides | [Map then read, search inside a site, what the sources give](https://millionshort.com/docs/map/guides) | | Pricing and limits | [What a call costs, and the limits](https://millionshort.com/docs/map/pricing) | | Errors | [What can fail, and what a failed source looks like](https://millionshort.com/docs/map/errors) | ## Map or a search inside a site A search with `include_domains` finds the pages of a site that our index holds and that match a query: ```bash curl https://api.millionshort.com/v1/search \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "query": "pricing", "include_domains": ["example.org"], "num_results": 20 }' ``` ```python import os import requests r = requests.post( "https://api.millionshort.com/v1/search", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, json={ "query": "pricing", "include_domains": [ "example.org" ], "num_results": 20 }, timeout=30, ) r.raise_for_status() for hit in r.json()["data"]["results"]: print(hit["position"], hit["title"], hit["url"]) ``` ```ts const res = await fetch('https://api.millionshort.com/v1/search', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ "query": "pricing", "include_domains": [ "example.org" ], "num_results": 20 }), }); if (!res.ok) throw new Error(`POST /v1/search failed: ${res.status}`); const { data } = (await res.json()) as { data: { results: { position: number; title: string; url: string }[] }; }; for (const hit of data.results) console.log(hit.position, hit.title, hit.url); ``` The same call as a tool of the MCP server: ```json { "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "search", "arguments": { "query": "pricing", "include_domains": [ "example.org" ], "num_results": 20 } } } ``` It is not a list of every page the site has, which is what Map is for. ## With the other endpoints [Crawl](https://millionshort.com/docs/crawl) uses the same sources to find pages and returns their text. [Extract](https://millionshort.com/docs/extract) reads URLs you already have. [Search](https://millionshort.com/docs/search) finds pages across every site. --- Source: https://millionshort.com/docs/map/quickstart Section: Endpoints / Map # Map quickstart List a site's URLs, then search inside it, then keep one section. ## 1. List a site ```bash curl https://api.millionshort.com/v1/map \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "url": "https://example.org/", "limit": 100 }' ``` The same call with the Python SDK: ```python import os from millionshort import MillionShort client = MillionShort(api_key=os.environ["MILLIONSHORT_API_KEY"]) r = client.map(url="https://example.org/", limit=100) for u in r.urls: print(u["url"], u.get("title"), u["from"]) ``` The same call with the TypeScript SDK: ```ts import { MillionShort } from 'millionshort'; const client = new MillionShort({ apiKey: process.env.MILLIONSHORT_API_KEY }); const r = await client.map('https://example.org/', { limit: 100 }); for (const u of r.urls) console.log(u.url, u.title, u.from); ``` The answer lists the URLs in `data.urls`. Each one says where it was found, and carries what that source knew about it: ```json { "data": { "url": "https://example.org/", "urls": [ { "url": "https://example.org/", "title": "Example", "from": "links" }, { "url": "https://example.org/docs/start", "title": "Getting started", "last_modified": "2026-11-01", "from": "links" }, { "url": "https://example.org/pricing", "last_modified": "2026-10-14", "from": "sitemap" }, { "url": "https://example.org/guides/tide-tables", "title": "Reading a tide table", "from": "index", "topic": "science", "page_type": "tutorials" } ], "summary": { "found": 4, "returned": 4, "truncated": false, "by_source": { "links": 2, "sitemap": 1, "index": 1 } } }, "usage": { "credits": 1, "cost_usd": 0.001, "breakdown": { "map": 1 } }, "warnings": [], "request_id": "req_..." } ``` `limit` is the most URLs you get back, and the credits for that many are held while the call runs. Ask for what you need: the default is 500. ## 2. Search inside the site ```bash curl https://api.millionshort.com/v1/map \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "url": "https://example.org/", "search": "pricing", "limit": 20 }' ``` ```python import os import requests r = requests.post( "https://api.millionshort.com/v1/map", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, json={ "url": "https://example.org/", "search": "pricing", "limit": 20 }, timeout=30, ) r.raise_for_status() print(r.json()["data"]) ``` ```ts const res = await fetch('https://api.millionshort.com/v1/map', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ "url": "https://example.org/", "search": "pricing", "limit": 20 }), }); if (!res.ok) throw new Error(`POST /v1/map failed: ${res.status}`); const { data } = (await res.json()) as { data: unknown }; console.log(data); ``` With `search`, only matching URLs come back. The pages our index finds for the words in the page text come first. Then come the URLs whose address or title has every word. ## 3. Keep one section ```bash curl https://api.millionshort.com/v1/map \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "url": "https://example.org/docs", "include": ["^/docs/"], "exclude": ["^/docs/archive/"] }' ``` ```python import os import requests r = requests.post( "https://api.millionshort.com/v1/map", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, json={ "url": "https://example.org/docs", "include": [ "^/docs/" ], "exclude": [ "^/docs/archive/" ] }, timeout=30, ) r.raise_for_status() print(r.json()["data"]) ``` ```ts const res = await fetch('https://api.millionshort.com/v1/map', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ "url": "https://example.org/docs", "include": [ "^/docs/" ], "exclude": [ "^/docs/archive/" ] }), }); if (!res.ok) throw new Error(`POST /v1/map failed: ${res.status}`); const { data } = (await res.json()) as { data: unknown }; console.log(data); ``` `include` and `exclude` are regular expressions on the path of a URL. `^/docs/` keeps the paths that start with `/docs/`. `exclude` wins over `include`. ## 4. Check `truncated` and the warnings `summary.truncated` is `true` when the site has more than you were given: `limit` cut the list, or the sitemaps were too large to read to the end. When one source could not be read, the answer still comes, with a `source_unavailable` warning that names the source. ## Next - [Parameters](https://millionshort.com/docs/map/parameters): every field and the response. - [Guides](https://millionshort.com/docs/map/guides): map a site, then read the pages you chose. - [Crawl](https://millionshort.com/docs/crawl): the pages themselves, as a job. --- Source: https://millionshort.com/docs/map/parameters Section: Endpoints / Map # Map parameters Every field of a Map request, the three sources, and everything that comes back. ```text POST https://api.millionshort.com/v1/map ``` Lists the URLs of a site in one answer. The call is synchronous. ## Request | Field | Type | Default | Notes | |---|---|---|---| | `url` | string | | Required. A page of the site: `http` or `https`, default ports, a host name (not an address), no credentials in the URL. Up to 2,048 characters. It is in scope whatever the patterns say: it is listed when the `links` source read it (as the address it ended on, when it redirects) or another source names it | | `search` | string, up to 200 characters | | Keep only the URLs that match these words. See [Search inside the site](#search-inside-the-site) | | `limit` | integer, 1 to 5,000 | `500` | The most URLs returned. Credits are held for this many | | `include_subdomains` | boolean | `false` | Also list URLs on other hosts of the same site. By default only the host you named, with or without `www.` | | `include` | array of up to 20 patterns | | Keep only URLs whose path matches one of these. See [Patterns](#patterns) | | `exclude` | array of up to 20 patterns | | Leave out URLs whose path matches one of these. Wins over `include` | | `sources` | array of `sitemap`, `index`, `links` | all three | Where to look. See [Sources](#sources) | Any other field is a `400 INVALID_PARAM`. A caller cannot send cookies or headers to the site, and there is no option to ignore robots.txt. ## Example ```bash curl https://api.millionshort.com/v1/map \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "url": "https://example.org/docs", "search": "webhooks", "limit": 50, "include": ["^/docs/"], "sources": ["sitemap", "index", "links"] }' ``` ```python import os import requests r = requests.post( "https://api.millionshort.com/v1/map", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, json={ "url": "https://example.org/docs", "search": "webhooks", "limit": 50, "include": [ "^/docs/" ], "sources": [ "sitemap", "index", "links" ] }, timeout=30, ) r.raise_for_status() print(r.json()["data"]) ``` ```ts const res = await fetch('https://api.millionshort.com/v1/map', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ "url": "https://example.org/docs", "search": "webhooks", "limit": 50, "include": [ "^/docs/" ], "sources": [ "sitemap", "index", "links" ] }), }); if (!res.ok) throw new Error(`POST /v1/map failed: ${res.status}`); const { data } = (await res.json()) as { data: unknown }; console.log(data); ``` ## Sources | Source | Where the URLs come from | What it adds to a URL | Requests to the site | |---|---|---|---| | `links` | The page at `url`, and every link on it | `title`: the page's own title, or the text of the link | One fetch of the page, as [Extract](https://millionshort.com/docs/extract) `live` makes it | | `sitemap` | The `Sitemap:` lines of the site's robots.txt, and `/sitemap.xml`. Index files are followed and gzipped files are read | `last_modified`, when the sitemap gives one | robots.txt and up to 12 sitemap files | | `index` | The pages of the site that our own index holds: up to 50, the ones that match `search` when you send it | `title`, `topic` and `page_type` | No page. When `index` is the only source, the site's robots.txt is read, and nothing else | - A URL found by more than one source is listed once. `from` is the first source that named it, in the order `links`, `sitemap`, `index`, and what the later sources know is added to it. - Only sitemap files on the site you asked about are read, whatever its robots.txt points at. - A sitemap file that robots.txt closes to our bot is not read. - With `index` alone, a site whose robots.txt closes `url` to our bot is refused (`403 ROBOTS_DISALLOWED`). With other sources too, a site that robots.txt closes to us entirely is refused, and its index rows are not listed. - Sitemap reading stops at 12 files, 50,000 URLs or 15 seconds. When it stops early, `summary.truncated` is `true`. - A URL is listed because the site or our index names it. Map does not fetch the URLs it lists, so a listed URL can still be one that robots.txt does not let us read. ## Patterns `include` and `exclude` are regular expressions matched against the path of a URL, and only the path: not the host and not the query string. They are not anchored. | Pattern | Matches | |---|---| | `/docs/` | Any path that contains `/docs/` | | `^/docs/` | Paths that start with `/docs/` | | `\.pdf$` | Paths that end in `.pdf` | | `^/blog/2026/` | The 2026 posts of a blog | Each pattern is up to 200 characters. One that is not a valid regular expression is a `400 INVALID_PARAM` that names it. The page at `url` is in scope whatever the patterns say. ## Search inside the site With `search`, the answer keeps only matching URLs, best first: 1. The pages our index finds for your words in the text of the page, in the order our index ranks them. This is a real search of the page text, restricted to the site. 2. Then the URLs from the sitemap and the links whose address or title contains every word. A word in the path counts for more than one in the title. Everything else is left out. `summary.found` counts what matched. ## Response ```json { "data": { "url": "https://example.org/docs", "urls": [ { "url": "https://example.org/docs/webhooks/signing", "title": "Signing webhooks", "from": "index", "topic": "programming", "page_type": "documentation" }, { "url": "https://example.org/docs/webhooks", "title": "Webhooks", "last_modified": "2026-11-02", "from": "links" }, { "url": "https://example.org/docs/webhooks/retries", "last_modified": "2026-09-30", "from": "sitemap" } ], "summary": { "found": 3, "returned": 3, "truncated": false, "by_source": { "links": 1, "sitemap": 1, "index": 1 } } }, "usage": { "credits": 1, "cost_usd": 0.001, "breakdown": { "map": 1 } }, "warnings": [], "request_id": "req_..." } ``` | Field | Type | Notes | |---|---|---| | `data.url` | string | The page you named, as we read it | | `data.urls[].url` | string | Without its fragment. `http` and `https`, and a path with and without its last slash, are one URL | | `data.urls[].from` | `sitemap`, `index` or `links` | The first source that named the URL | | `data.urls[].title` | string | When known: the page's title or the text of a link | | `data.urls[].last_modified` | string | When the sitemap gives a date, as the site wrote it | | `data.urls[].topic`, `page_type` | string | For URLs our index holds: the same [labels](https://millionshort.com/docs/extract/labels) Extract returns | | `data.summary.found` | integer | URLs in scope, after `search` and before `limit` | | `data.summary.returned` | integer | URLs in this answer | | `data.summary.truncated` | boolean | `true` when the site has more than was returned | | `data.summary.by_source` | object | How many URLs each source named first | A field that is not known is left out of the entry. ## Warnings A source that could not be read does not fail the call. The answer carries a `source_unavailable` warning with the `source` and a `reason`, and the URLs of that source are missing. The whole call answers within about 25 seconds: when a slow site uses that time up, the sources left are skipped with `reason: TIMEOUT`. The call fails only when no source answered. See [Errors](https://millionshort.com/docs/map/errors). ## Credits 1 credit for every 10 URLs returned, or part of 10, and never less than 1. A call that fails, or that finds no URL, costs nothing. [Pricing and limits](https://millionshort.com/docs/map/pricing) has examples. --- Source: https://millionshort.com/docs/map/guides Section: Endpoints / Map # Map guides The jobs Map is built for, each as the requests that do it. ## Find the docs of a site, then read them Map chooses the pages. [Extract](https://millionshort.com/docs/extract) reads them. 1. List the documentation section: ```bash curl https://api.millionshort.com/v1/map \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "url": "https://example.org/docs", "include": ["^/docs/"], "limit": 200 }' ``` ```python import os import requests r = requests.post( "https://api.millionshort.com/v1/map", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, json={ "url": "https://example.org/docs", "include": [ "^/docs/" ], "limit": 200 }, timeout=30, ) r.raise_for_status() print(r.json()["data"]) ``` ```ts const res = await fetch('https://api.millionshort.com/v1/map', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ "url": "https://example.org/docs", "include": [ "^/docs/" ], "limit": 200 }), }); if (!res.ok) throw new Error(`POST /v1/map failed: ${res.status}`); const { data } = (await res.json()) as { data: unknown }; console.log(data); ``` 2. Choose the URLs worth reading, by address and by `title`, and by `page_type` where our index knows the page. Send up to 20 of them to Extract, or more as a [batch](https://millionshort.com/docs/extract/batch): ```bash curl https://api.millionshort.com/v1/extract \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "urls": ["https://example.org/docs/start", "https://example.org/docs/webhooks"], "mode": "live" }' ``` ```python import os import requests r = requests.post( "https://api.millionshort.com/v1/extract", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, json={ "urls": [ "https://example.org/docs/start", "https://example.org/docs/webhooks" ], "mode": "live" }, timeout=30, ) r.raise_for_status() print(r.json()["data"]) ``` ```ts const res = await fetch('https://api.millionshort.com/v1/extract', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ "urls": [ "https://example.org/docs/start", "https://example.org/docs/webhooks" ], "mode": "live" }), }); if (!res.ok) throw new Error(`POST /v1/extract failed: ${res.status}`); const { data } = (await res.json()) as { data: unknown }; console.log(data); ``` When you want every page of the section and do not need to choose, a [crawl](https://millionshort.com/docs/crawl) with the same `include` does both steps as one job. ## Search inside a site An agent that needs one page of a site, such as the pricing page or the changelog, should not read the whole list. Send the words: ```bash curl https://api.millionshort.com/v1/map \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "url": "https://example.org/", "search": "refund policy", "limit": 10 }' ``` ```python import os import requests r = requests.post( "https://api.millionshort.com/v1/map", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, json={ "url": "https://example.org/", "search": "refund policy", "limit": 10 }, timeout=30, ) r.raise_for_status() print(r.json()["data"]) ``` ```ts const res = await fetch('https://api.millionshort.com/v1/map', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ "url": "https://example.org/", "search": "refund policy", "limit": 10 }), }); if (!res.ok) throw new Error(`POST /v1/map failed: ${res.status}`); const { data } = (await res.json()) as { data: unknown }; console.log(data); ``` The first URLs are the pages our index finds for those words in the text of the page. A page can match without the words in its address. After them come the URLs whose address or title has every word. A small `limit` keeps the call at 1 credit. A line for your agent's instructions: "To find one page of a known site, call `map` with the site's address as `url`, what you are looking for as `search`, and a `limit` of 10." ## Which sources to ask for All three are asked by default, and that is right for most calls. Choose when you know more: | You want | Ask for | Why | |---|---|---| | The fullest list | all three | Each source knows pages the others do not | | No page of the site requested | `["index"]` | Our index answers. The site is asked for its robots.txt only, so that a site closed to our bot stays closed. You get up to 50 URLs, with titles and labels | | Only what the site itself publishes | `["sitemap"]` | The site's own list, with its dates | | What a visitor of one page can reach | `["links"]` | The page and its links, nothing else | - A sitemap can be out of date or incomplete. A page that nothing links to and no sitemap names is found only when our index holds it. - The `index` source is not a full list of the site. It is the pages we hold, at most 50 a call, and with `search` the ones that match. - `last_modified` comes from the sitemap and is the site's own claim. ## What `truncated` means `summary.truncated` is `true` in two cases: - **`limit` cut the list.** `summary.found` is larger than `summary.returned`. Raise `limit`, up to 5,000. - **The sitemaps were not read to the end.** One call reads at most 12 sitemap files and 50,000 URLs, in 15 seconds. A very large site has more than that. For a very large site, map one section at a time: give the section's address as `url` and its path as `include`. When `limit` cut the list, `search` and `include` do more for you than a larger `limit`. When the sitemaps were not read to the end, they do not help: patterns are applied to what was read, and the files are read from the start each time. The `links` and `index` sources still answer for the section you named. ## Subdomains By default Map lists the host you named, with or without `www.`. With `include_subdomains: true` it also lists other hosts of the same site, such as `docs.example.org` when you asked about `example.org`. It never lists another site. ## Staying polite Map makes few requests to a site, and they follow the rules every fetch of ours follows: our declared identity, robots.txt, and the pace a site should be asked at. A site whose robots.txt closes it to our bot answers `403 ROBOTS_DISALLOWED`. There is nothing to work around, and no option to try. [Errors](https://millionshort.com/docs/map/errors) has the rest. --- Source: https://millionshort.com/docs/map/pricing Section: Endpoints / Map # Map pricing and limits One credit for every 10 URLs returned. A map that fails or finds nothing is free. ## What a call costs **1 credit is $0.001.** Map costs 1 credit for every 10 URLs returned, or part of 10, and never less than 1 credit for a call that returns something. | Action | Credits | Per 1,000 URLs | |---|---|---| | A map, per 10 URLs returned (or part of 10; at least 1 a call) | 1 | $0.10 | | A map that fails | 0 | | | A map that finds no URL | 0 | | | `search`, `include`, `exclude`, `include_subdomains`, any choice of `sources` | 0 | | | Titles, dates and labels on the URLs | 0 | | | Call | URLs returned | Credits | Dollars | |---|---|---|---| | A small site | 7 | 1 | $0.001 | | `limit: 100`, the site has more | 100 | 10 | $0.01 | | The default `limit` of 500, all of them returned | 500 | 50 | $0.05 | | `search: "pricing"` on a large site | 12 | 2 | $0.002 | | `limit: 5000`, all of them returned | 5,000 | 500 | $0.50 | | robots.txt closes the site to our bot | 0 | 0 | $0 | - The call holds the price of `limit` URLs before any work, charges the URLs that came back, and hands the rest back in the same request. With the default `limit` that is a hold of 50 credits. - A team that cannot cover the hold gets `429 INSUFFICIENT_CREDITS`, and nothing is fetched. Send a smaller `limit`. - A source that fails costs nothing and takes nothing off the price: you pay for the URLs you were given. - `usage.breakdown` has one line, `map`. ## Limits of a request | Limit | Value | |---|---| | `limit` | 1 to 5,000 URLs | | `search` | up to 200 characters | | `include`, `exclude` | up to 20 patterns each, 200 characters a pattern | | Sitemap files read in one call | 12 | | URLs read from sitemaps in one call | 50,000 | | URLs from our index in one call | 50 | Map calls count against your plan's requests a minute, like any call. ## Limits that protect sites Map makes few requests to a site: its robots.txt, a few sitemap files, and the one page you named. They are made under the same rules as [Extract](https://millionshort.com/docs/extract/pricing#limits-that-protect-sites): - For all customers together, one site gets at most 2 fetches at once and 1 a second. - Per team, per site, per day: 2,000 fetches. A sitemap or a page fetched again and found unchanged does not count again. When a site is busy for us, the `links` or `sitemap` source may come back as a `source_unavailable` warning. The call still answers from the others. --- Source: https://millionshort.com/docs/map/errors Section: Endpoints / Map # Map errors A map fails only when no source answered. One source failing is a warning. ## Two levels - **The request.** A request that is not valid, cannot be paid for, or that no source could answer fails with an HTTP error and the one [error shape](https://millionshort.com/docs/errors#the-error-shape) every endpoint uses. It costs nothing. - **Each source.** When at least one source answered, the call is a `200`. A source that could not be read is a warning, and its URLs are missing. ## Request errors | Status and code | When | Try next | |---|---|---| | `400 INVALID_PARAM` | A field the API does not take, a `limit` over 5,000, an unknown source, a pattern that is not a valid regular expression | Fix the request | | `400 INVALID_PARAM`, with `details.reason` `URL_NOT_ALLOWED` | The URL is not a public web page we will fetch: an address, another port, credentials in the URL | | | `401 AUTH_MISSING_KEY`, `401 AUTH_INVALID_KEY` | No `Authorization` header, or a key that is malformed, revoked or expired | | | `403 ROBOTS_DISALLOWED` | The site's robots.txt closes it to our bot, or the site asked us not to fetch or serve it (`details.reason` is then `SITE_OPTED_OUT`). Our index is not used either | Nothing: this is final | | `429 INSUFFICIENT_CREDITS` | The balance does not cover `limit` URLs | A smaller `limit` | | `429 RATE_LIMITED` | Your plan's requests a minute; or, with `details.reason`, the site is busy for us (`HOST_BUSY`) or your team reached its daily limit for the site (`HOST_DAILY_LIMIT`) | After `retry_after_seconds` | | `502 FETCH_FAILED` | No source answered: the site did not answer usefully, or its robots.txt could not be read, so nothing was fetched | Later | | `502 FETCH_BLOCKED_BOT` | No source answered, and the site refused our bot | | | `504 FETCH_TIMEOUT` | The site was too slow | Later | The `429` with a `details.reason`, the two `502`s and the `504` happen only when every source you asked for failed. Keep `index` among the sources, beside `sitemap` or `links`, and a slow site still gets an answer from what we hold. A site whose robots.txt closes it to us is refused whatever the sources: asked for the index alone, we read the site's robots.txt first, and nothing else. When that robots.txt cannot be read, an index-only call is a `502 FETCH_FAILED`. ## A source that failed ```text "warnings": [ { "code": "source_unavailable", "source": "sitemap", "reason": "ROBOTS_UNAVAILABLE", "message": "The \"sitemap\" source could not be read for this call, so its URLs are missing." } ] ``` `reason` is one of the [per-URL codes of Extract](https://millionshort.com/docs/extract/errors#per-url-errors): | Reason | Meaning | Try next | |---|---|---| | `ROBOTS_UNAVAILABLE` | robots.txt could not be read, so we did not fetch | Later | | `HOST_BUSY` | We are already fetching from this site as fast as we allow | In a few seconds | | `HOST_DAILY_LIMIT` | Your team reached its daily limit for this site | Tomorrow (UTC) | | `BLOCKED_BY_SITE` | The site refused our bot | | | `TIMEOUT` | The site was too slow, or the call had no time left for this source (a map answers within about 25 seconds) | Later, or ask for that source alone with `sources` | | `FETCH_FAILED` | The source did not answer usefully. For `index`: our index could not be asked | Later | A site with no sitemap is not a failure. The `sitemap` source answers with no URLs and there is no warning. ## What not to work around `403 ROBOTS_DISALLOWED` is final. There is no option to ignore robots.txt, and no source gets past a site's own choice. ## `truncated` is not an error `summary.truncated: true` says the site has more URLs than you were given. Raise `limit`, or narrow the list with `include` or `search`. --- Source: https://millionshort.com/docs/crawl Section: Endpoints / Crawl # Crawl Give it a starting page and get the site's pages back as clean text, as a job. ```text POST https://api.millionshort.com/v1/crawl GET https://api.millionshort.com/v1/crawl GET https://api.millionshort.com/v1/crawl/{id} DELETE https://api.millionshort.com/v1/crawl/{id} ``` A crawl starts at one page, finds the pages of the site from its sitemap and its links, and returns each one as clean text. It runs in the background: you get a job at once, poll it for pages as they finish, and can be told by [webhook](https://millionshort.com/docs/webhooks) when it ends. A crawl is an [Extract batch](https://millionshort.com/docs/extract/batch) that finds its own URLs. Every page comes back in the shape of an Extract result, with one more field, `depth`. ## What it is for - **Bringing a section of a site into a knowledge base.** The docs, the help centre, a blog. - **Giving an agent a whole small site to read.** - **Keeping only some kinds of page.** Every page carries [labels](https://millionshort.com/docs/extract/labels): its topic, its kind, and the source that holds pages like it. They are free, and a crawl can keep only the pages with the labels you name. ## How pages are found - The page you name is always crawled. It is depth 0. - The site's sitemaps are read when the crawl starts. Their URLs are depth 1. - Every page that comes back gives its links. A link is one deeper than the page it was on. - `max_depth` says how far to go, `max_pages` how many pages you pay for at most, and `include` and `exclude` which paths. - By default a crawl stays on the host you named. It can widen to the site's other hosts, or follow links off the site, only when you ask. Pages nearest the start come first. ## How pages are obtained One field, `mode`, decides, as it does for [Extract](https://millionshort.com/docs/extract): | Mode | What it does | |---|---| | `live` | Fetches each page now, as our declared bot. The default | | `rendered` | Loads each page in a browser, so content built by scripts appears. Paid plans | | `unblock` | A rendered fetch for sites that refuse automated requests. Growth plan and above | | `cached` | Returns the copies we already hold. No page is requested from the site | A `cached` crawl is the one that asks least of a site: the site is asked for its robots.txt and its sitemaps, and for no page at all. When that robots.txt closes the start page to our bot, the crawl ends and nothing is served. ## How we treat the site We identify ourselves to sites as `MillionShortBot`. robots.txt is honoured for every page we fetch, and there is no option to ignore it. A site gets at most one page a second from all our customers together, and one account at most 30 pages of one site a minute and 2,000 a day. A crawl of one site is slow on purpose: a large one takes hours. A caller cannot send cookies, headers or a delay to a site. ## What it costs A crawled page costs 1 credit in `cached` and `live`, 2 in `rendered` and 26 in `unblock`. A page that fails is free, except a page a browser mode found missing. The crawl holds the price of `max_pages` when you start it, never costs more than that, and hands back what it did not use. [Pricing and limits](https://millionshort.com/docs/crawl/pricing) has the table. ## In this section | Part | Page | |---|---| | Quickstart | [Start a crawl, poll it, read the pages](https://millionshort.com/docs/crawl/quickstart) | | Parameters | [Every request field, the job, and the results](https://millionshort.com/docs/crawl/parameters) | | Guides | [One section of a site, paging, webhooks, stored copies, labels](https://millionshort.com/docs/crawl/guides) | | Pricing and limits | [What a page costs in each mode, and the limits](https://millionshort.com/docs/crawl/pricing) | | Errors | [Request errors, why a crawl stopped, per-page errors](https://millionshort.com/docs/crawl/errors) | ## With the other endpoints [Map](https://millionshort.com/docs/map) lists a site's URLs without reading them, in one call. [Extract](https://millionshort.com/docs/extract) reads URLs you already have. [Monitor](https://millionshort.com/docs/monitor) watches one page for changes. --- Source: https://millionshort.com/docs/crawl/quickstart Section: Endpoints / Crawl # Crawl quickstart Start a crawl, poll it, read the pages, and cancel one you no longer need. ## 1. Start a crawl ```bash curl https://api.millionshort.com/v1/crawl \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "url": "https://example.org/docs", "max_pages": 50, "include": ["^/docs/"] }' ``` The same call with the Python SDK: ```python import os from millionshort import MillionShort client = MillionShort(api_key=os.environ["MILLIONSHORT_API_KEY"]) job = client.crawl(url="https://example.org/docs", max_pages=50, include=["^/docs/"]) print(job.id, job.status) ``` The same call with the TypeScript SDK: ```ts import { MillionShort } from 'millionshort'; const client = new MillionShort({ apiKey: process.env.MILLIONSHORT_API_KEY }); const job = await client.crawl('https://example.org/docs', { maxPages: 50, include: ['^/docs/'] }); console.log(job.id, job.status); ``` The answer is `202` with the job. Nothing has been fetched yet: ```json { "data": { "id": "crawl_01jd3v9x7k2m4n6p8q0r2s4t6v", "status": "queued", "url": "https://example.org/docs", "mode": "live", "max_pages": 50, "max_depth": 3, "total": 1, "completed": 0, "failed": 0, "skipped": 0, "credits_held": 50, "credits_used": 0, "stop_reason": null, "webhook_id": null, "created_at": "2026-11-20T10:00:00Z", "finished_at": null, "expires_at": null }, "usage": null, "warnings": [], "request_id": "req_..." } ``` `credits_held` is the price of `max_pages` pages in the mode you chose. A team that cannot cover it gets `429 INSUFFICIENT_CREDITS` and nothing starts. What the crawl does not use is handed back when it ends. ## 2. Poll it ```bash curl https://api.millionshort.com/v1/crawl/$CRAWL_ID \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" ``` With the SDKs: ```python import os import time from millionshort import MillionShort client = MillionShort(api_key=os.environ["MILLIONSHORT_API_KEY"]) job = client.crawl(url="https://example.org/docs", max_pages=50) while job.status in ("queued", "running"): time.sleep(5) job = client.get_crawl(job.id) print(job.status, job.completed, "pages,", job.credits_used, "credits") ``` ```ts import { MillionShort } from 'millionshort'; const client = new MillionShort({ apiKey: process.env.MILLIONSHORT_API_KEY }); let job = await client.crawl('https://example.org/docs', { maxPages: 50 }); while (job.status === 'queued' || job.status === 'running') { await new Promise((resolve) => setTimeout(resolve, 5000)); job = await client.getCrawl(job.id); } console.log(job.status, job.completed, 'pages,', job.credits_used, 'credits'); ``` Polling is free and does not count against your plan's requests a minute. `status` goes from `queued` to `running` to `completed`, `cancelled` or `failed`. `completed` counts the pages that came back, `failed` the URLs that were tried and gave no page, and `total` the URLs found so far. A crawl of one site takes its time on purpose: about one page every two seconds for one account. Fifty pages take about two minutes, and a large crawl takes hours. The SDKs have a waiter that polls for you, every 5 seconds: `wait_crawl` in Python and `waitCrawl` in TypeScript. ## 3. Read the pages The poll carries the pages finished so far in `results`, up to 50 at a time, nearest the start first. Each one is an [Extract result](https://millionshort.com/docs/extract/parameters#response) with a `depth`. Two of this crawl's 14 results are shown here: ```json { "data": { "id": "crawl_01jd3v9x7k2m4n6p8q0r2s4t6v", "status": "completed", "url": "https://example.org/docs", "mode": "live", "max_pages": 50, "max_depth": 3, "total": 14, "completed": 12, "failed": 2, "skipped": 0, "credits_held": 50, "credits_used": 12, "stop_reason": "no_more_pages", "webhook_id": null, "created_at": "2026-11-20T10:00:00Z", "finished_at": "2026-11-20T10:00:41Z", "expires_at": "2026-11-27T10:00:41Z", "results": [ { "depth": 0, "url": "https://example.org/docs", "final_url": "https://example.org/docs", "status": "ok", "mode_used": "live", "fetched_at": "2026-11-20T10:00:03Z", "age_seconds": 0, "format": "markdown", "title": "Documentation", "markdown": "# Documentation\n\nStart here...", "truncated": false, "topic": "software", "page_type": "documentation", "source_hint": "web", "label_confidence": { "topic": 0.81, "page_type": 0.9, "source_hint": 0.9 }, "site": "example.org", "popularity": { "rank": null, "bucket": "long-tail" }, "risk": null }, { "depth": 1, "url": "https://example.org/docs/internal", "status": "error", "error": { "code": "ROBOTS_DISALLOWED", "message": "This site's robots.txt does not allow our bot to fetch this page." } } ], "next": null }, "usage": { "credits": 12, "cost_usd": 0.012, "breakdown": {} }, "request_id": "req_..." } ``` - A page that worked has `status: "ok"`, its `title`, its content in `markdown`, and its labels. - A URL that failed has `status: "error"` and an `error` of its own. It costs nothing, with one exception: in `rendered` and `unblock`, a page the browser found missing is charged and says `charged: true`. - When `next` is not `null`, pass it as `?cursor=` to get the next page. While the crawl runs, it is where to carry on from once any page has been read, even when no more pages are there yet. It is `null` before the first page has finished, and once the crawl has ended and you have read every page. - `stop_reason` says why the crawl ended. [Errors](https://millionshort.com/docs/crawl/errors#why-a-crawl-stopped) lists the reasons. Results are kept for 7 days after the crawl ended. `expires_at` says until when. ## 4. Cancel ```bash curl -X DELETE https://api.millionshort.com/v1/crawl/$CRAWL_ID \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" ``` ```python import os import requests r = requests.delete( f"https://api.millionshort.com/v1/crawl/{os.environ['CRAWL_ID']}", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, timeout=30, ) r.raise_for_status() print(r.json()["data"]) ``` ```ts const res = await fetch(`https://api.millionshort.com/v1/crawl/${process.env.CRAWL_ID}`, { method: 'DELETE', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}` }, }); if (!res.ok) throw new Error(`DELETE /v1/crawl/… failed: ${res.status}`); const { data } = (await res.json()) as { data: unknown }; console.log(data); ``` The pages that came back are kept and stay charged. The rest of the hold is handed back. The SDK methods are `cancel_crawl` in Python and `cancelCrawl` in TypeScript. ## Next - [Parameters](https://millionshort.com/docs/crawl/parameters): every field, the job and the results. - [Guides](https://millionshort.com/docs/crawl/guides): one section of a site, paging, the completion webhook, stored copies. - [Pricing and limits](https://millionshort.com/docs/crawl/pricing): what a page costs in each mode. --- Source: https://millionshort.com/docs/crawl/parameters Section: Endpoints / Crawl # Crawl parameters Every field of a crawl request, the job it returns, and the results you poll for. ```text POST https://api.millionshort.com/v1/crawl start a crawl GET https://api.millionshort.com/v1/crawl your team's crawls, newest first GET https://api.millionshort.com/v1/crawl/{id} one crawl, with a page of its results DELETE https://api.millionshort.com/v1/crawl/{id} cancel ``` ## Request | Field | Type | Default | Notes | |---|---|---|---| | `url` | string | | Required. Where the crawl starts: `http` or `https`, default ports, a host name (not an address), no credentials in the URL. Always crawled | | `max_pages` | integer, 1 to your plan's ceiling | `100`, or the ceiling if it is lower | The most pages charged: the pages that came back, plus any failed page that is charged (a page a browser mode found missing). Credits are held for this many, and a crawl never costs more than was held. See [Limits of a plan](#limits-of-a-plan) | | `max_depth` | integer, 0 to 10 | `3` | How many links away from the start page to go. `0` is that page alone. Sitemap URLs are depth 1 | | `include` | array of up to 20 patterns | | Crawl only URLs whose path matches one of these. The start page is crawled whatever they say | | `exclude` | array of up to 20 patterns | | Never crawl URLs whose path matches one of these. Wins over `include` | | `same_domain` | boolean | `true` | Stay on the host you named. `false` also follows links to other sites | | `include_subdomains` | boolean | `false` | Also crawl other hosts of the same site | | `sitemap` | `include`, `skip`, `only` | `"include"` | `include`: sitemap URLs and links. `skip`: links only. `only`: the start page and the sitemap's URLs, and links are not followed | | `mode` | `cached`, `live`, `rendered`, `unblock` | `"live"` | How each page is obtained. See [Modes](#modes) | | `formats` | array of `markdown`, `text`, `links`, `metadata` | `["markdown","metadata"]` | What to return for each page, as for [Extract](https://millionshort.com/docs/extract/parameters) | | `max_chars` | integer, 1 to 100,000 | `50000` | The longest content per page. Longer content is cut and `truncated` is `true`. Lower than Extract's 500,000, because a crawl keeps every page for a week | | `topics`, `page_types`, `source_hints` | arrays of slugs | | Keep only the pages with these [labels](https://millionshort.com/docs/extract/labels) | | `json` | object with `schema` and an optional `prompt` | | Each page as JSON of your shape, on the plans that include it. Extract's limit of three URLs a call does not apply to a crawl; the daily limits on pages read as JSON do | | `remove_top_sites` | integer, 0 to 1,000,000 | `0` | Only with `same_domain: false`: links to the N most popular sites are not followed | | `webhook_id` | string | | An active [webhook endpoint](https://millionshort.com/docs/webhooks) of your team. It is told when the crawl ends | Any other field is a `400 INVALID_PARAM`. A caller cannot send cookies, headers or a delay to a site, and there is no option to ignore robots.txt. `include` and `exclude` are regular expressions on the path of a URL, not anchored, as for [Map](https://millionshort.com/docs/map/parameters#patterns): `/docs/` matches any path that contains it, `^/docs/` only paths that start with it. An `Idempotency-Key` header is honoured for 24 hours: the same key with the same body returns the crawl it started, and the same key with another body is a `409 IDEMPOTENCY_CONFLICT`. ### Modes | Page | How it is obtained | Credits per page | |---|---|---| | A crawled page, `live` | Fetched now, as our declared bot | 1 | | A crawled page, `rendered` | Loaded in a browser, so content built by scripts appears. Paid plans | 2 | | A crawled page, `unblock` | A rendered fetch for sites that refuse automated requests. Growth plan and above | 26 | | A crawled page, `cached` | The copy we already hold. No page is requested from the site | 1 | - robots.txt is checked for every page we fetch, in `live`, `rendered` and `unblock`. A page it closes to our bot is not fetched, and costs nothing. - A crawl has no `auto` and no `stealth` mode, and no mode is ever chosen for you. - A `cached` crawl asks the site for its robots.txt and its sitemaps and for no page. Its URLs are the sitemap's and the ones our index holds for the site. Links are not followed, because a stored copy carries none. A page we do not hold comes back as `NOT_IN_CACHE`, free. `cached` cannot be combined with `same_domain: false`, and it is switched off for now, as it is for Extract. - A `cached` crawl reads the site's robots.txt first, with `sitemap: "skip"` too. When it closes the start URL to our bot, the crawl ends `failed` with `ROBOTS_DISALLOWED`; when it cannot be read, with `ROBOTS_UNAVAILABLE`. Nothing is served or charged. The stored copies themselves are served as Extract's `cached` serves them: robots.txt is not asked about each page. ### Scope | You send | Hosts crawled | |---|---| | nothing | The host of `url`, with or without `www.` | | `include_subdomains: true` | Every host of the same site, such as `docs.example.org` and `example.org` | | `same_domain: false` | Any host a crawled page links to | With `same_domain: false`, every other site is fetched under its own robots.txt and its own limits. `remove_top_sites: 1000` then leaves out links to the 1,000 most popular sites, so a crawl does not wander off to the large platforms every page links to. When popularity cannot be looked up for a part of the crawl, no off-site link of that part is followed. ## The crawl `POST` answers `202` with the crawl. `GET /v1/crawl/{id}` and `DELETE` answer with the same object. | Field | Type | Notes | |---|---|---| | `id` | string | Starts with `crawl_` | | `status` | `queued`, `running`, `completed`, `cancelled`, `failed` | | | `url`, `mode`, `max_pages`, `max_depth` | | As the crawl runs them. `max_pages` is your plan's ceiling when the default was above it | | `total` | integer | URLs found so far | | `completed` | integer | Pages that came back | | `failed` | integer | URLs that were tried and gave no page. Free, except a page a browser mode found missing (see [Pricing](https://millionshort.com/docs/crawl/pricing)) | | `skipped` | integer | URLs found and never tried, once the crawl has ended | | `credits_held` | number | What was held when the crawl started | | `credits_used` | number | What the crawl has been charged so far | | `stop_reason` | string or null | Why the crawl ended. See [Errors](https://millionshort.com/docs/crawl/errors#why-a-crawl-stopped) | | `unread_sources` | array of `sitemap`, `index` | Present when a list of URLs could not be read at the start. The crawl goes on with the links | | `webhook_id` | string or null | | | `created_at`, `finished_at` | date-times | | | `expires_at` | date-time or null | When the results are deleted: 7 days after the crawl ended | | `error` | object | `code` and `message`, on a crawl that failed | ## Poll ```bash curl https://api.millionshort.com/v1/crawl/$CRAWL_ID \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" ``` ```python import os import requests r = requests.get( f"https://api.millionshort.com/v1/crawl/{os.environ['CRAWL_ID']}", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, timeout=30, ) r.raise_for_status() print(r.json()["data"]) ``` ```ts const res = await fetch(`https://api.millionshort.com/v1/crawl/${process.env.CRAWL_ID}`, { headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}` }, }); if (!res.ok) throw new Error(`GET /v1/crawl/… failed: ${res.status}`); const { data } = (await res.json()) as { data: unknown }; console.log(data); ``` `GET /v1/crawl/{id}` adds two fields to the crawl: | Field | Type | Notes | |---|---|---| | `results` | array | The pages finished so far, in the order they finished, nearest the start first. Up to 50 at a time, and at most 4 MiB | | `next` | string or null | Pass as `?cursor=` to carry on from here. While the crawl runs it is set once any page has been read, even when no more pages are there yet; `null` before the first page has finished, and once the crawl has ended and its last page was read | Each result is an [Extract result](https://millionshort.com/docs/extract/parameters#response) plus `depth`: its content in the formats you asked for, `mode_used`, the [labels](https://millionshort.com/docs/extract/labels), and the `site`, `popularity` and `risk` of the page's site. A URL that failed has `status: "error"` and one of the [per-URL codes](https://millionshort.com/docs/crawl/errors#per-page-errors). Polling is free and does not count against the plan's requests a minute. It has its own limit of 120 a minute per team. `usage.credits` on a poll is what the crawl has been charged so far. ```bash curl "https://api.millionshort.com/v1/crawl?limit=20" \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" ``` ```python import os import requests r = requests.get( "https://api.millionshort.com/v1/crawl?limit=20", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, timeout=30, ) r.raise_for_status() print(r.json()["data"]) ``` ```ts const res = await fetch('https://api.millionshort.com/v1/crawl?limit=20', { headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}` }, }); if (!res.ok) throw new Error(`GET /v1/crawl failed: ${res.status}`); const { data } = (await res.json()) as { data: unknown }; console.log(data); ``` `GET /v1/crawl` lists your team's crawls, newest first, without results, in `data.crawls`. `limit` is 1 to 100 and defaults to 20. Free. ## Cancel ```bash curl -X DELETE https://api.millionshort.com/v1/crawl/$CRAWL_ID \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" ``` ```python import os import requests r = requests.delete( f"https://api.millionshort.com/v1/crawl/{os.environ['CRAWL_ID']}", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, timeout=30, ) r.raise_for_status() print(r.json()["data"]) ``` ```ts const res = await fetch(`https://api.millionshort.com/v1/crawl/${process.env.CRAWL_ID}`, { method: 'DELETE', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}` }, }); if (!res.ok) throw new Error(`DELETE /v1/crawl/… failed: ${res.status}`); const { data } = (await res.json()) as { data: unknown }; console.log(data); ``` The crawl becomes `cancelled`. The pages that came back are kept and stay charged, and the rest of the hold is handed back. Cancelling a crawl that has ended changes nothing. ## Events With `webhook_id`, one event is delivered when the crawl ends: `crawl.completed` for a crawl that is `completed` or `cancelled`, `crawl.failed` for one that failed. It carries `id`, `status`, `stop_reason`, `url`, `total`, `completed`, `failed` and `credits_used`. It does not carry the pages: fetch them with `GET /v1/crawl/{id}`. Events are signed and retried as described on [Webhooks](https://millionshort.com/docs/webhooks). ## How a crawl runs - Pages are fetched nearest the start first, and each URL once: a fragment is dropped, and `http` and `https`, and a path with and without its last slash, are one page. The query string is kept, because it can name another page. - Links that are not pages by their name, such as images, style sheets, archives and media files, are not followed. - A page waiting for a busy site waits its turn, at no cost, as a page of an [Extract batch](https://millionshort.com/docs/extract/batch#how-a-batch-runs) does. - A crawl tries at most 3 URLs for each page it may return, plus 20. Failures are free, and they are not endless. - A crawl stops with `max_pages` once it has been charged for `max_pages` pages. In `rendered` and `unblock` a page the browser found missing is charged and counts towards that, so the hold is never passed. - At about 30 pages of one site a minute, a large crawl takes hours. - With `topics`, `page_types` or `source_hints`, a page that does not pass has `filtered: true` and no content. It was fetched, so it is charged, and it counts as `completed`. - A crawl that ends with no page at all is `failed`, and its `error` is that of its first URL. - A crawl that has not ended 24 hours after it was started becomes `failed`. The pages that finished are kept, and what is left of the hold is handed back. ## Limits of a plan | | Free | Starter | Growth | Scale | Business | |---|---|---|---|---|---| | `max_pages`, at most | 50 | 500 | 2,000 | 10,000 | 25,000 | | Crawls open at once | 1 | 2 | 3 | 5 | 10 | | `rendered` | No | Yes | Yes | Yes | Yes | | `unblock` | No | No | Yes | Yes | Yes | A `max_pages` over the ceiling is a `400 INVALID_PARAM` whose `details.max` is the ceiling (over 25,000, the highest ceiling, it is a plain `400 INVALID_PARAM`). One crawl more than the plan may have open is a `429 RATE_LIMITED`. On one site the daily limit ends a crawl before a large ceiling does: a team gets 2,000 fetches of a site a day, sitemap files included, so a crawl of one site stops with `stop_reason: "site_daily_limit"` at about 2,000 pages, whatever the plan. ## Credits A crawled page costs 1 credit in `cached` and `live`, 2 in `rendered` and 26 in `unblock`, charged for the pages that came back. A URL that fails is free, with one exception in the browser modes. [Pricing and limits](https://millionshort.com/docs/crawl/pricing) has the table and examples. --- Source: https://millionshort.com/docs/crawl/guides Section: Endpoints / Crawl # Crawl guides The jobs Crawl is built for, each as the requests that do it. ## One section of a site Start at the section's first page and keep the crawl inside it with `include`: ```bash curl https://api.millionshort.com/v1/crawl \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "url": "https://example.org/docs", "max_pages": 200, "max_depth": 4, "include": ["^/docs/"], "exclude": ["^/docs/archive/", "\\.pdf$"] }' ``` ```python import os import requests r = requests.post( "https://api.millionshort.com/v1/crawl", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, json={ "url": "https://example.org/docs", "max_pages": 200, "max_depth": 4, "include": [ "^/docs/" ], "exclude": [ "^/docs/archive/", "\\.pdf$" ] }, timeout=30, ) r.raise_for_status() print(r.json()["data"]) ``` ```ts const res = await fetch('https://api.millionshort.com/v1/crawl', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ "url": "https://example.org/docs", "max_pages": 200, "max_depth": 4, "include": [ "^/docs/" ], "exclude": [ "^/docs/archive/", "\\.pdf$" ] }), }); if (!res.ok) throw new Error(`POST /v1/crawl failed: ${res.status}`); const { data } = (await res.json()) as { data: unknown }; console.log(data); ``` - `include` and `exclude` are regular expressions on the path. `^/docs/` keeps the paths that start with `/docs/`. - The start page is crawled even when it does not match `include`. - The sitemap is read at the start, so pages of the section that nothing links to are found too. `"sitemap": "skip"` follows links only. - Not sure what the section holds? [Map](https://millionshort.com/docs/map) it first with the same `include`. A map of 200 URLs costs 20 credits and shows what a crawl would fetch. ## Poll, and page through the results A poll returns up to 50 results and a `next` cursor. Wait for the crawl to end, then follow `next` until it is `null`: ```python import os import time from millionshort import MillionShort client = MillionShort(api_key=os.environ["MILLIONSHORT_API_KEY"]) job = client.crawl(url="https://example.org/docs", max_pages=200, include=["^/docs/"]) while job.status in ("queued", "running"): time.sleep(5) job = client.get_crawl(job.id) pages = [] while True: for page in job.results: if page["status"] == "ok": pages.append(page) if not job.next: break job = client.get_crawl(job.id, cursor=job.next) print(len(pages), "pages,", job.credits_used, "credits,", job.stop_reason) ``` ```ts import { MillionShort } from 'millionshort'; const client = new MillionShort({ apiKey: process.env.MILLIONSHORT_API_KEY }); let job = await client.crawl('https://example.org/docs', { maxPages: 200, include: ['^/docs/'] }); while (job.status === 'queued' || job.status === 'running') { await new Promise((resolve) => setTimeout(resolve, 5000)); job = await client.getCrawl(job.id); } const pages = []; for (;;) { for (const page of job.results ?? []) { if (page.status === 'ok') pages.push(page); } if (!job.next) break; job = await client.getCrawl(job.id, { cursor: job.next }); } console.log(pages.length, 'pages,', job.credits_used, 'credits,', job.stop_reason); ``` You can read results while the crawl runs too: a poll returns up to 50 of the pages finished so far, and while the crawl is running, `next` is where to carry on from once any page has been read, even when no more pages are there yet (before the first page finishes it is `null`: poll again without a cursor). Poll again with it and you get only the pages that finished since, or none yet; you never read a page twice. Pages come in the order they finished, so a cursor stays good. `next` is `null` once the crawl has ended and you have read its last page. Polling is free. Keep it to one poll every few seconds: the limit is 120 a minute for your team. ## Be told when it ends Register a [webhook endpoint](https://millionshort.com/docs/webhooks) once, verify it, and name it on the crawl: ```bash curl https://api.millionshort.com/v1/crawl \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: docs-2026-11-20" \ -d '{ "url": "https://example.org/docs", "max_pages": 200, "webhook_id": "wh_01jd3v9x7k2m4n6p8q0r2s4t6v" }' ``` ```python import os import requests r = requests.post( "https://api.millionshort.com/v1/crawl", headers={ "Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"], "Idempotency-Key": "docs-2026-11-20", }, json={ "url": "https://example.org/docs", "max_pages": 200, "webhook_id": "wh_01jd3v9x7k2m4n6p8q0r2s4t6v" }, timeout=30, ) r.raise_for_status() print(r.json()["data"]) ``` ```ts const res = await fetch('https://api.millionshort.com/v1/crawl', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json', 'Idempotency-Key': 'docs-2026-11-20', }, body: JSON.stringify({ "url": "https://example.org/docs", "max_pages": 200, "webhook_id": "wh_01jd3v9x7k2m4n6p8q0r2s4t6v" }), }); if (!res.ok) throw new Error(`POST /v1/crawl failed: ${res.status}`); const { data } = (await res.json()) as { data: unknown }; console.log(data); ``` When the crawl ends, the endpoint receives `crawl.completed`, or `crawl.failed` for a crawl that failed, with the crawl's `id`, `status`, `stop_reason` and counts. The event does not carry the pages. Fetch them with `GET /v1/crawl/{id}` and page through them as above. The `Idempotency-Key` makes a retry safe: sending the same request again within 24 hours returns the crawl that was started, and starts no second one. ## A crawl of stored copies With `mode: "cached"`, the pages come from the copies we already hold. The site is asked for its robots.txt and its sitemaps (with `sitemap: "skip"`, its robots.txt alone), and for no page at all: ```bash curl https://api.millionshort.com/v1/crawl \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "url": "https://example.org/", "mode": "cached", "max_pages": 100 }' ``` ```python import os import requests r = requests.post( "https://api.millionshort.com/v1/crawl", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, json={ "url": "https://example.org/", "mode": "cached", "max_pages": 100 }, timeout=30, ) r.raise_for_status() print(r.json()["data"]) ``` ```ts const res = await fetch('https://api.millionshort.com/v1/crawl', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ "url": "https://example.org/", "mode": "cached", "max_pages": 100 }), }); if (!res.ok) throw new Error(`POST /v1/crawl failed: ${res.status}`); const { data } = (await res.json()) as { data: unknown }; console.log(data); ``` - The URLs are the sitemap's and the ones our index holds for the site. Links are not followed, because a stored copy carries none. - A page we hold comes back with `mode_used: "cached"`. Its `fetched_at` is the earliest day the copy can have been captured, and `captured_before` the latest. - A page we do not hold comes back as `NOT_IN_CACHE`, free. Read those with [Extract](https://millionshort.com/docs/extract) `live`, or run a `live` crawl. - A site whose robots.txt closes the start page to our bot is not served from stored copies either: the crawl ends `failed` with `ROBOTS_DISALLOWED`, and costs nothing. When the robots.txt cannot be read, it ends with `ROBOTS_UNAVAILABLE`. The copies themselves are served as Extract's `cached` serves them: robots.txt is not asked about each page. - Its pages do not count towards your daily limit for the site, because none is fetched. Stored copies are looked up at about 60 a minute per team. `cached` is switched off for now, as it is for Extract, and may not ship. ## Use the labels Every page that comes back says what it is, at no charge: `topic`, `page_type` and `source_hint`, each with a confidence. Two ways to use them: - **Sort after the crawl.** Route pages by `page_type` in your own code: documentation to one index, blog posts to another. - **Keep only some pages.** With `page_types`, `topics` or `source_hints` on the request, a page that does not match comes back with `filtered: true` and no content, so nothing unwanted reaches your model: ```bash curl https://api.millionshort.com/v1/crawl \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "url": "https://example.org/", "max_pages": 300, "page_types": ["documentation", "tutorials", "faqs"] }' ``` ```python import os import requests r = requests.post( "https://api.millionshort.com/v1/crawl", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, json={ "url": "https://example.org/", "max_pages": 300, "page_types": [ "documentation", "tutorials", "faqs" ] }, timeout=30, ) r.raise_for_status() print(r.json()["data"]) ``` ```ts const res = await fetch('https://api.millionshort.com/v1/crawl', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ "url": "https://example.org/", "max_pages": 300, "page_types": [ "documentation", "tutorials", "faqs" ] }), }); if (!res.ok) throw new Error(`POST /v1/crawl failed: ${res.status}`); const { data } = (await res.json()) as { data: unknown }; console.log(data); ``` A filtered page was fetched to be labelled, so it is charged. When the unwanted pages live under their own paths, `exclude` is cheaper: a path that is excluded is never fetched. ## Staying polite A crawl follows the rules every fetch of ours follows, and you cannot switch them off: - **robots.txt.** Every page we fetch is checked. A page it closes to our bot comes back as `ROBOTS_DISALLOWED`, free. A site that closes everything gives a crawl that fails with that code and costs nothing, in `cached` as well. - **Pace.** A site gets at most one page a second from all our customers together, and one account at most 30 pages of one site a minute. Plan for about two seconds a page: 100 pages in three to four minutes, 1,000 in about 35. A large crawl takes hours. - **The daily limit.** A team may fetch 2,000 pages of one site a day, the sitemap files a crawl reads included. A page fetched again and found unchanged counts once, so crawling the same section again the same day uses the limit only for what changed. At the limit a crawl ends with `stop_reason: "site_daily_limit"` and keeps its pages, whatever your plan's `max_pages` ceiling. - Two crawls of the same site share that pace. Run them one after the other. ## Follow links off the site By default a crawl stays on the host you named. `"include_subdomains": true` widens it to the site's other hosts. `"same_domain": false` lets it follow links to other sites: ```bash curl https://api.millionshort.com/v1/crawl \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "url": "https://example.org/links", "max_pages": 100, "max_depth": 1, "same_domain": false, "remove_top_sites": 10000 }' ``` ```python import os import requests r = requests.post( "https://api.millionshort.com/v1/crawl", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, json={ "url": "https://example.org/links", "max_pages": 100, "max_depth": 1, "same_domain": False, "remove_top_sites": 10000 }, timeout=30, ) r.raise_for_status() print(r.json()["data"]) ``` ```ts const res = await fetch('https://api.millionshort.com/v1/crawl', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ "url": "https://example.org/links", "max_pages": 100, "max_depth": 1, "same_domain": false, "remove_top_sites": 10000 }), }); if (!res.ok) throw new Error(`POST /v1/crawl failed: ${res.status}`); const { data } = (await res.json()) as { data: unknown }; console.log(data); ``` This reads a page of links and the pages it points at. `remove_top_sites` leaves out links to the 10,000 most popular sites, the same cut [Search](https://millionshort.com/docs/search/remove-top-sites) has, so the crawl spends its pages on the primary sources and not on the large platforms every page links to. Keep `max_depth` small: off the site, the number of links grows fast, and `max_pages` is what stops it. ## Cancel, and what is charged ```bash curl -X DELETE https://api.millionshort.com/v1/crawl/$CRAWL_ID \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" ``` ```python import os import requests r = requests.delete( f"https://api.millionshort.com/v1/crawl/{os.environ['CRAWL_ID']}", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, timeout=30, ) r.raise_for_status() print(r.json()["data"]) ``` ```ts const res = await fetch(`https://api.millionshort.com/v1/crawl/${process.env.CRAWL_ID}`, { method: 'DELETE', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}` }, }); if (!res.ok) throw new Error(`DELETE /v1/crawl/… failed: ${res.status}`); const { data } = (await res.json()) as { data: unknown }; console.log(data); ``` - The pages that came back before the cancel are kept, can still be read for 7 days, and stay charged. - The rest of the hold is handed back at once. - Pages that were being fetched at that moment are dropped, and are not charged. ## From an agent, over MCP The [MCP server](https://millionshort.com/docs/mcp#map-and-crawl) has four tools for this: `map`, `crawl`, `crawl_status` and `crawl_cancel`. `crawl` takes the scope and mode fields of a crawl request (not `formats`, `max_chars`, `json` or `webhook_id`: pages come back as Markdown) and returns the job: ```json { "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "crawl", "arguments": { "url": "https://example.org/docs", "max_pages": 30, "include": ["^/docs/"] } } } ``` A line for your agent's instructions: "To read a section of a site, call `crawl` with a small `max_pages`, then call `crawl_status` with the crawl's id as `crawl_id` every few seconds until its status is no longer `queued` or `running`. Each page costs a credit, so ask for no more pages than you will read." --- Source: https://millionshort.com/docs/crawl/pricing Section: Endpoints / Crawl # Crawl pricing and limits One credit a page, charged for the pages that came back. The price of the whole crawl is held at the start and the rest handed back. ## What a page costs **1 credit is $0.001, and a crawled page is 1 credit:** $1.00 per 1,000 pages at the list price. A page is charged when it came back, at the price of the mode that produced it. | Action | Credits | Per 1,000 pages | |---|---|---| | A crawled page, `live` | 1 | $1.00 | | A crawled page, `cached` | 1 | $1.00 | | A crawled page, `rendered` | 2 | $2.00 | | A crawled page, `unblock` | 26 | $26.00 | | A crawled page as JSON of your shape, on top of the mode | 3 | $3.00 | | A URL that fails: robots.txt, the URL rules, a cap, a page we do not hold | 0 | | | Labels on every page, and the label filters | 0 | | | Polling, listing your crawls, cancelling | 0 | | | The sitemap read at the start, and following links | 0 | | | Crawl | Held at the start | Charged | Dollars | |---|---|---|---| | `max_pages: 50`, `live`, 12 pages came back and 2 failed | 50 | 12 | $0.012 | | `max_pages: 100`, `live`, all 100 came back | 100 | 100 | $0.10 | | `max_pages: 100`, `rendered`, 80 came back | 200 | 160 | $0.16 | | `max_pages: 500`, `live`, cancelled after 120 pages | 500 | 120 | $0.12 | | `max_pages: 100`, `live`, 100 came back, 40 left out by `page_types` | 100 | 100 | $0.10 | | `max_pages: 20`, `unblock`, 20 came back | 520 | 520 | $0.52 | | The site's robots.txt closes it to our bot | 100 | 0 | $0 | - Starting a crawl holds `max_pages × the price of the mode`, and 3 more a page when you ask for JSON. A team that cannot cover the hold gets `429 INSUFFICIENT_CREDITS` and nothing starts. Send a smaller `max_pages`. - Pages are charged as they finish. What is left of the hold is handed back when the crawl ends, is cancelled or fails. - A URL that fails is free. Our own refusals are never charged: robots.txt, the URL rules, a site that opted out, our caps and our capacity. - A page left out by a label list was fetched, so it is charged. - **The one exception**, as for [Extract](https://millionshort.com/docs/extract/pricing): in `rendered` and `unblock` a browser reaches the site for you. When the site answers that the page does not exist (`404` or `410`), the page is charged at the mode's price and marked `charged: true`. Such a page counts towards `max_pages`, so a crawl never costs more than it held. - JSON is charged only for a page that came back as JSON of your shape. - In your usage, a crawl's charges are broken down into the lines `crawl`, `crawl_rendered`, `crawl_unblock` and `crawl_json`. When you already have the URLs, [Extract](https://millionshort.com/docs/extract/pricing) reads a live page for half a credit. A crawl is priced for finding the pages as well. ## Limits of a request | Limit | Value | |---|---| | `max_depth` | 0 to 10 | | `include`, `exclude` | up to 20 patterns each, 200 characters a pattern | | `max_chars` | 1 to 100,000 | | A page | 10 MiB; up to 5 redirects | | URLs tried | 3 for each page the crawl may return, plus 20 | | How long a crawl may run | 24 hours | | How long results are kept | 7 days after the crawl ended | | Polls | 120 a minute per team | ## Limits of a plan | | Free | Starter | Growth | Scale | Business | |---|---|---|---|---|---| | `max_pages`, at most | 50 | 500 | 2,000 | 10,000 | 25,000 | | Crawls open at once | 1 | 2 | 3 | 5 | 10 | | `rendered` | No | Yes | Yes | Yes | Yes | | `unblock` | No | No | Yes | Yes | Yes | ## Limits that protect sites A crawl is for reading a site, not for copying it. - For all customers together, one site gets at most 2 fetches at once and 1 a second. - One account gets at most half of that: 30 pages of one site a minute. A crawl of 1,000 pages of one site takes about 35 minutes. - Per team, per site, per day: 2,000 pages, in any mode other than `cached`. A page fetched again and found unchanged does not count again. A crawl that reaches the limit ends with `stop_reason: "site_daily_limit"` and keeps its pages. Because of the daily limit, a crawl of more than 2,000 new pages of one site takes more than one day, whatever the plan's `max_pages` ceiling: one crawl of one site ends at about 2,000 pages (the sitemap files it read count too), and you start another the next day. [The daily limit per site](https://millionshort.com/docs/extract/parameters#the-daily-limit-per-site) says exactly what counts. --- Source: https://millionshort.com/docs/crawl/errors Section: Endpoints / Crawl # Crawl errors Starting a crawl can fail, a crawl can stop early, and each page can fail on its own. ## Three levels - **The request.** A request that is not valid or cannot be paid for answers with an HTTP error and the one [error shape](https://millionshort.com/docs/errors#the-error-shape) every endpoint uses. No crawl is started. - **The crawl.** A crawl that was started answers `200` when you poll it, for as long as its results are kept (7 days after it ended; then `404`). Its `status` and `stop_reason` say how it went, and a crawl that failed has an `error`. - **Each page.** Every entry of `results` has `status: "ok"` or `status: "error"` with an `error` of its own. A URL that fails costs nothing, except a page a browser mode (`rendered`, `unblock`) found missing: it is charged and says `charged: true`. ## Request errors | Status and code | When | Try next | |---|---|---| | `400 INVALID_PARAM` | A field the API does not take, a pattern that is not a valid regular expression, an unknown slug in a label list, `remove_top_sites` without `same_domain: false`, `mode: "cached"` with `same_domain: false` | Fix the request | | `400 INVALID_PARAM`, with `details.max` | `max_pages` is over your plan's ceiling. `details.max` is the ceiling. (Over 25,000, the highest ceiling, the `400` has no `details.max`) | A smaller `max_pages` | | `400 INVALID_PARAM` | A `cursor` on `GET /v1/crawl/{id}` that is not one we gave you | Use `next` as it came | | `400 INVALID_PARAM`, with `details.reason` `URL_NOT_ALLOWED` | The start URL is not a public web page we will fetch | | | `400 INVALID_PARAM` | A `webhook_id` that is not an `active` [endpoint](https://millionshort.com/docs/webhooks) of your team | Verify the endpoint first | | `400 UNSUPPORTED_OPTION` | A mode the plan does not include, or one that is switched off; `json` on a plan without it | | | `401 AUTH_MISSING_KEY`, `401 AUTH_INVALID_KEY` | No `Authorization` header, or a key that is malformed, revoked or expired | | | `403 ROBOTS_DISALLOWED` | The site asked us not to fetch or serve it | Nothing: this is final | | `404 JOB_NOT_FOUND` | `GET` or `DELETE` of a crawl that does not exist or belongs to another team. The two are not told apart | | | `409 IDEMPOTENCY_CONFLICT` | The `Idempotency-Key` was used with a different request | A new key | | `429 INSUFFICIENT_CREDITS` | The balance does not cover `max_pages` pages at the price of the mode | A smaller `max_pages` | | `429 RATE_LIMITED` | The plan's number of open crawls is reached; or more than 120 polls in a minute; or, on `POST` and `DELETE`, your plan's requests a minute | When a crawl ends, or cancel one; after `retry_after_seconds` | ## Why a crawl stopped `stop_reason` is `null` while the crawl runs. When it has ended: | `stop_reason` | `status` | Meaning | |---|---|---| | `max_pages` | `completed` | The crawl was charged for as many pages as you asked for: the pages that came back and, in the browser modes, any page charged because the browser found it missing. `skipped` counts the URLs it found and did not try | | `no_more_pages` | `completed` | Nothing was left to try within `max_depth` and the patterns | | `site_daily_limit` | `completed` | Your team reached its daily limit for the site (2,000 fetches, sitemap files included). The pages that came back are kept | | `too_many_failures` | `completed` | Too many URLs failed: a crawl tries at most 3 URLs for each page it may return, plus 20 | | `cancelled` | `cancelled` | You cancelled it | | `insufficient_credits` | `failed` | A part of the crawl could not be charged. The hold normally covers every page, so this is rare | | `time_limit` | `failed` | The crawl did not end within 24 hours | | `failed` | `failed` | Something went wrong on our side; or a `cached` crawl of a site whose robots.txt closes the start URL to our bot (`error.code` `ROBOTS_DISALLOWED`) or could not be read (`ROBOTS_UNAVAILABLE`, or another per-URL code when the check itself could not be made) | In every case the pages that finished are kept and stay charged, and what is left of the hold is handed back. ## A crawl with no page at all A crawl that ends without a single page that came back is `failed`, whatever its `stop_reason`, and its `error` carries the code of its first URL. The usual one: ```text "status": "failed", "completed": 0, "credits_used": 0, "error": { "code": "ROBOTS_DISALLOWED", "message": "No page came back. This site's robots.txt does not allow our bot to fetch this page." } ``` It costs nothing. (The exception is a browser-mode crawl whose pages the browser found missing: those pages are charged, as [Pricing](https://millionshort.com/docs/crawl/pricing) says, and `credits_used` shows it.) ## Per-page errors The codes are [Extract's](https://millionshort.com/docs/extract/errors#per-url-errors): | Code | Meaning | Try next | |---|---|---| | `URL_NOT_ALLOWED` | Not a public web page we will fetch | | | `ROBOTS_DISALLOWED` | The site's robots.txt does not allow our bot to fetch this page | | | `ROBOTS_UNAVAILABLE` | robots.txt could not be read, so we did not fetch. The crawl tried five times | Later | | `SITE_OPTED_OUT` | The site asked us not to fetch or serve it | | | `NOT_IN_CACHE` | `cached` mode: we hold no copy of this page | `live` | | `FETCH_FAILED` | The site did not answer usefully. A link to a page that does not exist ends here | | | `TIMEOUT` | The site was too slow | Later | | `TOO_LARGE` | The page is over 10 MiB | | | `UNSUPPORTED_CONTENT_TYPE` | Not a kind of document we read | | | `BLOCKED_BY_SITE` | The site refused our bot | `unblock` | | `RENDER_FAILED` | `rendered` or `unblock` could not load the page | Later | | `HOST_BUSY` | The site stayed busy for us for more than an hour | Later | | `HOST_DAILY_LIMIT` | Your team reached its daily limit for this site | Tomorrow (UTC) | | `CAPACITY` | `rendered` and `unblock` are at capacity | Later | A crawl waits for a busy site and does not fail a page with `HOST_BUSY` at once: see [how a batch runs](https://millionshort.com/docs/extract/batch#how-a-batch-runs), which is how a crawl runs too. ## What not to work around `ROBOTS_DISALLOWED` and `SITE_OPTED_OUT` are final: there is no option to ignore robots.txt, and no mode gets past a site's own choice. `BLOCKED_BY_SITE` is different. The site refused an automated request, and `unblock` is the mode for that, on the plans that include it. ## Notes on the crawl - `unread_sources` on a crawl names a list of URLs that could not be read when it started: `sitemap` or `index`. The crawl went on with the links it found. - A page with `filtered: true` is not an error. It was fetched, its labels did not match the lists you sent, and it comes back without content. --- Source: https://millionshort.com/docs/places Section: Endpoints / Places # Places Businesses and points of interest, by what they are and where they are, as data an agent can use. ```text POST https://api.millionshort.com/v1/places ``` Places finds businesses and points of interest by what they are and where they are: "coffee near Leslieville, Toronto", "pharmacy within a kilometre of this point", "museums inside this box", "branches of this chain near this IP address's city". Each place comes back as data: its name, category, address, coordinates, distance, phone number and website. The call is synchronous, and nothing is fetched from any site to answer it. It is the places search behind the Maps tab of the MillionShort [search site](https://millionshort.com/), as an endpoint. There is no map and there are no tiles: only the data. ## What it is for - **"Find somewhere nearby."** An agent that has to find, compare or recommend somewhere to go. - **Looking a business up.** A name or a brand, with or without a location, to get its address, phone number and website. - **Places as a starting point.** Take a place's `website` to [Search](https://millionshort.com/docs/search) with `include_domains`, or to [Extract](https://millionshort.com/docs/extract), to read what the business says about itself. ## What a place carries | Field | Notes | |---|---| | `name` | | | `category`, `categories` | From one tree of categories, so `dental_clinic` means the same everywhere | | `address` | In parts: street, unit, city, region, postcode, country, and one formatted line | | `lat`, `lng`, `distance_m` | The distance is from the point searched around | | `phone`, `website` | Where known | | `brand` | For branches of a chain | | `hours`, `open_now` | Where known, which is a small share of places | | `last_seen` | The day the place was last confirmed | What is not known is `null`. It is never left out and never made up. ## Coverage Read this before you build on it. - **Worldwide, and uneven.** Coverage is worldwide, more thorough in some countries than in others. - **Place names are read best in Canada and the United States.** Neighbourhood names and everyday trade words ("plumber", "dentist") work best there. Those two countries are also the only area the Local directory on the search site is curated for. Elsewhere, send `lat` and `lng`, or a plain city name. - **Opening hours are known for few places.** `open_now` leaves out every place whose hours we do not know, which is most of them. - **Listings can be stale.** A business that has closed may still be listed. `last_seen` says when a place was last confirmed. - **No ratings, reviews, photos or price levels.** We do not hold them. - **No map and no tiles.** [Which filters work where](https://millionshort.com/docs/places/parameters#which-filters-work-where) sets this out filter by filter. The curated Local directory of the search site is not part of this endpoint. ## Attribution The places come from open data, and some of its licences ask for a credit. Every answer carries `data.attribution`: one line of text, and the address of the page that lists each source and its licence. If you show these places to people, show that line, or a link to the page it names, with them. [Parameters](https://millionshort.com/docs/places/parameters#attribution) has the field. ## In this section | Part | Page | |---|---| | Quickstart | [Places near a name, then near a point, then reading the answer](https://millionshort.com/docs/places/quickstart) | | Parameters | [Every request field with an example, which filters work where, the category list, and everything that comes back](https://millionshort.com/docs/places/parameters) | | Guides | [Near a point, near an IP address, how `near` is read, finding a category, and opening hours](https://millionshort.com/docs/places/guides) | | Pricing and limits | [What a call costs, and the limits](https://millionshort.com/docs/places/pricing) | | Errors | [A location that is missing or not found, and the rest](https://millionshort.com/docs/places/errors) | ## On the search site A person can search the same places on the Maps tab of the [search site](https://millionshort.com/), and browse its Local tab, a curated directory of local businesses in cities of Canada and the United States. ## With the other endpoints [Search](https://millionshort.com/docs/search) finds pages; Places finds the businesses themselves. A place's `website` is a site you can search inside, and [Extract](https://millionshort.com/docs/extract) can read its pages. [The endpoints](https://millionshort.com/docs/endpoints) says where each one stands. --- Source: https://millionshort.com/docs/places/quickstart Section: Endpoints / Places # Places quickstart Places near a name, then near a point, then what comes back. ## 1. Find places near a name ```bash curl https://api.millionshort.com/v1/places \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "query": "coffee", "near": "Leslieville, Toronto", "limit": 5 }' ``` ```python from millionshort import MillionShort client = MillionShort(api_key=os.environ["MILLIONSHORT_API_KEY"]) r = client.places("coffee", near="Leslieville, Toronto", limit=5) for place in r.results: print(place["name"], place["address"]["formatted"], place["phone"]) print(r.usage.credits, r.request_id) ``` ```ts import { MillionShort } from 'millionshort'; const client = new MillionShort({ apiKey: process.env.MILLIONSHORT_API_KEY }); const r = await client.places({ query: 'coffee', near: 'Leslieville, Toronto', limit: 5 }); for (const place of r.results) { console.log(place.name, place.address.formatted, place.phone); } console.log(r.usage?.credits, r.requestId); ``` `query` says what you are looking for: a kind of place, a name or a brand. `near` says where, as a name. The two are separate on purpose: nothing in `query` is read as a location. ## 2. Or around a point When you already have coordinates, send them. This is the most reliable way to say where, in any country. ```bash curl https://api.millionshort.com/v1/places \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "query": "pharmacy", "lat": 43.6532, "lng": -79.3832, "radius_m": 1000 }' ``` ```python import os import requests r = requests.post( "https://api.millionshort.com/v1/places", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, json={ "query": "pharmacy", "lat": 43.6532, "lng": -79.3832, "radius_m": 1000 }, timeout=30, ) r.raise_for_status() print(r.json()["data"]) ``` ```ts const res = await fetch('https://api.millionshort.com/v1/places', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ "query": "pharmacy", "lat": 43.6532, "lng": -79.3832, "radius_m": 1000 }), }); if (!res.ok) throw new Error(`POST /v1/places failed: ${res.status}`); const { data } = (await res.json()) as { data: unknown }; console.log(data); ``` Where to look is one of `near`, `lat` with `lng`, `bbox`, `ip`, `near_me` or `neighbourhood`. Send one. The address your request comes from is used only when you send `"near_me": true`. [Parameters](https://millionshort.com/docs/places/parameters#request) has every field with an example, including the filters (`category`, `brand`, `has_phone`, `open_now` and the rest), `sort` and `fields`. ## 3. Read the answer ```json { "data": { "resolved": { "name": "Leslieville", "region": "ON", "country": "CA", "lat": 43.66883, "lng": -79.3267, "kind": "point", "accuracy": null, "alternatives": [] }, "results": [ { "id": "pawx2ncgk7b6wsi3t", "name": "Harbour Lane Coffee", "category": { "id": "cafe", "label": "Cafe" }, "categories": ["food_and_drink", "casual_eatery", "cafe"], "address": { "street": "1180 Queen St E", "unit": null, "city": "Toronto", "region": "ON", "postcode": "M4M 1L4", "country": "CA", "formatted": "1180 Queen St E, Toronto, ON M4M 1L4, CA" }, "lat": 43.662514, "lng": -79.333905, "distance_m": 912, "phone": "+14165550142", "website": "https://harbourlanecoffee.example/", "brand": null, "hours": null, "open_now": null, "last_seen": "2026-11-02", "popularity": 46 } ], "attribution": { "text": "Place data from open data sources. Credits and licences: https://millionshort.com/credits#places", "url": "https://millionshort.com/credits#places" } }, "request_id": "req_01JD0PLACES7Q2M4T8V", "usage": { "credits": 1, "cost_usd": 0.001, "breakdown": { "places": 1 } }, "warnings": [] } ``` - `resolved` says what `near` was taken to mean. Check it: "Springfield" is many places. `alternatives` lists other places of that name. - A field we do not know is `null`. Here the opening hours are not known, so `hours` and `open_now` are both `null`. That is the usual case. - `last_seen` is the day the place was last confirmed, not an edit by its owner. - `popularity` (0 to 100) says how well known and well attested the place is. See [How popularity is scored](https://millionshort.com/docs/places/guides#how-popularity-is-scored). ## 4. Show the credit line If you show these places to people, you must show `data.attribution.text`, or a link to `data.attribution.url`, with them. Every answer carries it, and no parameter removes it. See [Attribution](https://millionshort.com/docs/places/parameters#attribution), and the [data notices](https://millionshort.com/docs/places/parameters#data-notices) that go with the data. Places asked for with `"layer": "osm"` or `"layer": "both"` are a separate list under their own licence, and each carries its own credit: see [Data sources and licences](https://millionshort.com/docs/places/parameters#data-sources-and-licences). ## Next - [Parameters](https://millionshort.com/docs/places/parameters): every field of the request and the answer. - [Guides](https://millionshort.com/docs/places/guides): searching around a point, near an IP address, how `near` is read, finding the right category, and opening hours. - [Pricing and limits](https://millionshort.com/docs/places/pricing): 1 credit for up to 10 places. --- Source: https://millionshort.com/docs/places/parameters Section: Endpoints / Places # Places parameters Every field of a Places request, and everything that comes back for each place. ```text POST https://api.millionshort.com/v1/places ``` Finds businesses and points of interest by what they are and where they are, and returns them as data. The call is synchronous. Nothing is fetched from any site to answer it. There is no map and there are no tiles. ## Request A request says **what** is sought, **where** to look, how to **narrow** the places, and how to **shape** the answer. Any field not listed here is a `400 INVALID_PARAM`. ### What Send at least one of `query`, `category` and `brand`. | Field | Type | Example | Notes | |---|---|---|---| | `query` | string, 1 to 200 characters | `"query": "bike repair"` | A kind of place, a name or a brand. Never read as a location | | `category` | a category id or its name, or a list of up to 10 | `"category": "coffee_shop"`, `"category": ["Coffee shop", "cafe"]` | Keeps only places filed under one of them, or below it. See [Categories](#categories) | | `brand` | string, up to 120 characters | `"brand": "Tim Hortons"` | A chain or brand by name. Sent alone, it is searched by that name | With both `query` and `category`, `category` decides which places are kept: `"query": "coffee", "category": "bakery"` returns bakeries. ### Where Send at most **one** of these six. Two of them in one request is a `400`. | Field | Type | Example | Notes | |---|---|---|---| | `near` | string, up to 200 characters | `"near": "Leslieville, Toronto"` | A place by name. See [How `near` is read](https://millionshort.com/docs/places/guides#how-near-is-read) | | `lat`, `lng` | numbers, -90 to 90 and -180 to 180 | `"lat": 43.6532, "lng": -79.3832` | A point. They go together | | `bbox` | `[south, west, north, east]`, in degrees | `"bbox": [48.85, 2.29, 48.87, 2.35]` | A box | | `ip` | one public IPv4 or IPv6 address | `"ip": "203.0.113.24"` | The approximate location of that address: the nearest city we can place it in. See [IP addresses](#ip-addresses) | | `near_me` | boolean | `"near_me": true` | As `ip`, with the address this call came from | | `neighbourhood` | string, up to 120 characters | `"neighbourhood": "Leslieville", "city": "Toronto"` | A neighbourhood by name. Send `city` with it when the name is common | A name or a brand can be searched with no location at all. A kind of place cannot: "coffee" with nowhere to look is a [`400`](https://millionshort.com/docs/places/errors#location-errors). The address a request comes from is used only when `near_me` says so. ### Narrowing | Field | Type | Example | Notes | |---|---|---|---| | `city` | string, up to 120 characters | `"city": "Austin"` | With none of the six fields above, `city` is where to look. Beside `neighbourhood` it says which city's. Otherwise it keeps only places whose address has that city. Compared without case | | `region` | string, up to 120 characters | `"city": "Austin", "region": "TX"` | Goes with `city` as a location, and is then not checked on the places. Otherwise it keeps only places whose address has that region code. Compared without case | | `country` | two-letter country code | `"country": "CA"` | Keeps only places whose address is in that country | | `radius_m` | integer, 10 to 50,000 | `"radius_m": 1500` | A fixed radius in metres around the location. Not with `bbox`. Without it the radius fits the place | | `exclude_category` | as `category` | `"exclude_category": ["fast_food_restaurant"]` | Leaves out places filed under any of these | | `has_phone` | boolean | `"has_phone": true` | `true` keeps only places with a phone number | | `has_website` | boolean | `"has_website": true` | `true` keeps only places with a website | | `has_hours` | boolean | `"has_hours": true` | `true` keeps only places whose opening hours we know | | `open_now` | boolean | `"open_now": true` | `true` keeps only places whose hours we know and that are open now | | `min_popularity` | integer, 0 to 100 | `"min_popularity": 50` | Keeps only places whose [`popularity`](https://millionshort.com/docs/places/guides#how-popularity-is-scored) is at least this, among the best matches (up to 100 of them) | ### Shaping | Field | Type | Default | Example | Notes | |---|---|---|---|---| | `sort` | `relevance`, `distance` or `popularity` | `relevance` | `"sort": "distance"` | `distance` needs a point to measure from. With an area, or with no location, it is not applied, and the answer carries a `sort_not_applied` warning. `popularity` takes the best matches (up to 100 of them) and returns the most popular first | | `fields` | a list of [place fields](#a-place) | all | `"fields": ["name", "address", "phone"]` | Only these fields come back on each place. It changes no price | | `limit` | integer, 1 to 50 | `10` | `"limit": 20` | How many places to return. With `"layer": "both"`, how many in each list | | `layer` | `merged`, `osm` or `both` | `merged` | `"layer": "both"` | Which list of places to search. `merged` is our combined list. `osm` is the OpenStreetMap layer, a separate list under its own licence. `both` returns the two lists side by side, `results` and `osm_results`, never mixed. The OpenStreetMap layer is being switched on: until it is, `layer` is refused as an unknown parameter (400 INVALID_PARAM, free). See [Data sources and licences](#data-sources-and-licences) | ### Which filters work where Every field works worldwide, on the same places. What varies from one part of the world to another is how well a place *name* is read, and how much of the data a filter has to work with. | | Canada and the United States | Elsewhere | |---|---|---| | `lat` with `lng`, `bbox`, `radius_m` | Works | Works the same | | `near` with a city name | Read well, with or without the state or province ("Denver, CO") | A plain city name, or a city with its country ("Paris, France"), usually works | | `near` with a neighbourhood, a postcode, an intersection; `neighbourhood` | Read best here | Uneven. Prefer `lat` with `lng` | | Everyday trade words in `query` ("plumber", "dentist") | Read best here | Category ids are the safer choice | | `city`, `country` as a check on the address | Works | Works | | `region` as a check on the address | A state or province code (`ON`, `TX`) | An address may carry its region in words, or none. Prefer `country` and `city` | | `ip`, `near_me` | Placed in a city, more reliably here | Placed in a city, or the nearest town we know | | `category`, `exclude_category`, `brand` | Works | Works | | `has_phone`, `has_website` | Works | Works | | `has_hours`, `open_now` | Only where hours exist: few places | The same, and fewer still | | `sort`, `min_popularity`, `fields`, `limit` | Works | Works | Three more things to know: - **The Local directory is not part of this endpoint.** The search site's Local tab is a curated directory for cities of Canada and the United States, with its own categories. Places returns the worldwide places behind the Maps tab. - **Cuisines are categories.** There is no separate cuisine field: use `sushi_restaurant`, `italian_restaurant` and the like. - **What we do not hold has no filter.** No amenity tags (wifi, parking, wheelchair access), no ratings, reviews, photos or price levels. ### Categories A category has an id, such as `coffee_shop`, `pharmacy` or `museum`, and a name, such as "Coffee shop". `category` and `exclude_category` take either: a name is read as its id. Categories form a tree, and a category matches the places filed under it or under anything below it, so `restaurant` covers `sushi_restaurant`. Every place in an answer lists the ids it is filed under in `categories`, the broader ones first, and any of them can be sent as `category`. A category we do not have is a `400 INVALID_PARAM`. The list below has every one. #### The category list ```text GET https://api.millionshort.com/v1/places/categories ``` Free. Returns the categories a place can be filed under. | Query parameter | Example | Notes | |---|---|---| | `q` | `?q=sushi`, `?q=coffee%20shop` | Keeps the categories whose id holds every word. Up to 80 characters | | `parent` | `?parent=italian_restaurant` | Keeps the categories directly under this one | ```bash curl "https://api.millionshort.com/v1/places/categories?q=sushi" \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" ``` ```python import os import requests r = requests.get( "https://api.millionshort.com/v1/places/categories?q=sushi", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, timeout=30, ) r.raise_for_status() print(r.json()["data"]) ``` ```ts const res = await fetch('https://api.millionshort.com/v1/places/categories?q=sushi', { headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}` }, }); if (!res.ok) throw new Error(`GET /v1/places/categories failed: ${res.status}`); const { data } = (await res.json()) as { data: unknown }; console.log(data); ``` ```text { "data": { "categories": [ { "id": "sushi_restaurant", "label": "Sushi restaurant", "parent": "japanese_restaurant" } ] }, "request_id": "req_01JD0PLACESCAT4H8W2", "usage": { "credits": 0, "cost_usd": 0, "breakdown": { "place_categories": 0 } }, "warnings": [] } ``` Each entry has `id`, `label` and `parent`; `parent` is `null` at the top of the tree. With no parameter the whole tree comes back, about two thousand categories. The list does not say how many places a category holds. ### IP addresses `ip` and `near_me` search around the approximate location of an IP address. - **City level only.** The address is placed in the nearest city we know for its network, and the search runs around that city's point, rounded to two decimals. `resolved` says which city was used, with `"kind": "ip"` and `"accuracy": "city"`. It can be the wrong city: a mobile network or a VPN is often placed far from the person. - **The address is used to look up a city and then dropped.** It is not written to the request log, not kept, and not returned. It goes no further than our own search service, which does the lookup and keeps nothing of it. - **`near_me` means the machine that makes the call.** With cURL or an SDK on a server, that is the server, not the person your agent is working for. To search near a person, send that person's address as `ip` or, better, a position they shared as `lat` with `lng`. - An address we cannot place, and a call from a private network with `near_me`, is a [`location_not_found`](https://millionshort.com/docs/places/errors#location-errors). ## Examples A category inside a box: ```bash curl https://api.millionshort.com/v1/places \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "category": "museum", "bbox": [48.85, 2.29, 48.87, 2.35], "limit": 20 }' ``` ```python import os import requests r = requests.post( "https://api.millionshort.com/v1/places", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, json={ "category": "museum", "bbox": [ 48.85, 2.29, 48.87, 2.35 ], "limit": 20 }, timeout=30, ) r.raise_for_status() print(r.json()["data"]) ``` ```ts const res = await fetch('https://api.millionshort.com/v1/places', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ "category": "museum", "bbox": [ 48.85, 2.29, 48.87, 2.35 ], "limit": 20 }), }); if (!res.ok) throw new Error(`POST /v1/places failed: ${res.status}`); const { data } = (await res.json()) as { data: unknown }; console.log(data); ``` Restaurants in a neighbourhood, nearest first, leaving two categories out, with only four fields back: ```bash curl https://api.millionshort.com/v1/places \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "query": "restaurant", "neighbourhood": "Leslieville", "city": "Toronto", "exclude_category": ["pizza_restaurant", "Fast food restaurant"], "has_website": true, "sort": "distance", "fields": ["name", "category", "distance_m", "website"] }' ``` ```python import os import requests r = requests.post( "https://api.millionshort.com/v1/places", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, json={ "query": "restaurant", "neighbourhood": "Leslieville", "city": "Toronto", "exclude_category": [ "pizza_restaurant", "Fast food restaurant" ], "has_website": True, "sort": "distance", "fields": [ "name", "category", "distance_m", "website" ] }, timeout=30, ) r.raise_for_status() print(r.json()["data"]) ``` ```ts const res = await fetch('https://api.millionshort.com/v1/places', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ "query": "restaurant", "neighbourhood": "Leslieville", "city": "Toronto", "exclude_category": [ "pizza_restaurant", "Fast food restaurant" ], "has_website": true, "sort": "distance", "fields": [ "name", "category", "distance_m", "website" ] }), }); if (!res.ok) throw new Error(`POST /v1/places failed: ${res.status}`); const { data } = (await res.json()) as { data: unknown }; console.log(data); ``` Branches of a chain around an IP address's city that have opening hours on record: ```bash curl https://api.millionshort.com/v1/places \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "brand": "Tim Hortons", "ip": "203.0.113.24", "radius_m": 3000, "has_hours": true }' ``` ```python import os import requests r = requests.post( "https://api.millionshort.com/v1/places", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, json={ "brand": "Tim Hortons", "ip": "203.0.113.24", "radius_m": 3000, "has_hours": True }, timeout=30, ) r.raise_for_status() print(r.json()["data"]) ``` ```ts const res = await fetch('https://api.millionshort.com/v1/places', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ "brand": "Tim Hortons", "ip": "203.0.113.24", "radius_m": 3000, "has_hours": true }), }); if (!res.ok) throw new Error(`POST /v1/places failed: ${res.status}`); const { data } = (await res.json()) as { data: unknown }; console.log(data); ``` Dentists in a city, by city and state: ```bash curl https://api.millionshort.com/v1/places \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "category": "dental_clinic", "city": "Austin", "region": "TX", "has_phone": true }' ``` ```python import os import requests r = requests.post( "https://api.millionshort.com/v1/places", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, json={ "category": "dental_clinic", "city": "Austin", "region": "TX", "has_phone": True }, timeout=30, ) r.raise_for_status() print(r.json()["data"]) ``` ```ts const res = await fetch('https://api.millionshort.com/v1/places', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ "category": "dental_clinic", "city": "Austin", "region": "TX", "has_phone": true }), }); if (!res.ok) throw new Error(`POST /v1/places failed: ${res.status}`); const { data } = (await res.json()) as { data: unknown }; console.log(data); ``` ## Response `data` has three parts: `resolved`, `results` and `attribution`. The envelope around it (`request_id`, `usage`, `warnings`) is the one every endpoint uses. With `"layer": "osm"`, `data` also has `"layer": "osm"`, and `results` are places of the OpenStreetMap layer. With `"layer": "both"`, `data` has `"layer": "both"`, then `results` and `attribution` as for `merged`, and `osm_results` and `osm_attribution` for the OpenStreetMap layer. See [Data sources and licences](#data-sources-and-licences). ### resolved What the location was taken to mean. For a name (`near`, `neighbourhood`, or a `city` used as the location) it is the place found. For `ip` and `near_me` it is the city the address was placed in. It is `null` for `lat` with `lng`, for `bbox`, and for a search with no location. | Field | Type | Notes | |---|---|---| | `name` | string | The place found | | `region` | string or null | For a named place, a state, province or region code such as `ON`, when it has one. For an IP address, the region as we have it, which can be in words | | `country` | string or null | Two-letter country code | | `lat`, `lng` | numbers | Its position | | `kind` | `area`, `point` or `ip` | A city or a region is an `area`. A neighbourhood, a postcode, an address or a landmark is a `point`. `ip` is the city an address was placed in | | `accuracy` | `"city"` or null | `"city"` for `ip` and `near_me`; `null` otherwise | | `alternatives` | list, up to 5 | Other places of that name, each with `name`, `region` and `country`. Empty for `ip` | ```text "resolved": { "name": "Toronto", "region": "ON", "country": "CA", "lat": 43.71, "lng": -79.4, "kind": "ip", "accuracy": "city", "alternatives": [] } ``` The IP address itself is never in an answer. ### A place Each entry of `results`. Every field is present unless the request's `fields` picked some; what is not known is `null`. | Field | Type | Notes | |---|---|---| | `id` | string | Our id for the place | | `name` | string | | | `category` | object or null | The place's own category: `id` and `label` | | `categories` | list of strings | Every category id the place is filed under, the broader ones first | | `address` | object | `street`, `unit`, `city`, `region`, `postcode`, `country` (two letters) and `formatted`, each a string or null | | `lat`, `lng` | numbers | | | `distance_m` | integer or null | Metres from the point searched around: a named place when it is a `point`, the city an `ip` was placed in, `lat` and `lng`, or the middle of `bbox`. `null` when the location is an `area`, which has no one point, and when no location was sent | | `phone` | string or null | In international form, such as `+14165550142` | | `website` | string or null | | | `brand` | string or null | For a branch of a chain | | `hours` | object or null | `timezone`, `weekly` and `partial`. See below. `null` for most places | | `open_now` | boolean or null | `null` when the hours are not known | | `last_seen` | date or null | The day the place was last confirmed by one of the data's sources. Not an edit by its owner | | `popularity` | integer 0 to 100, or null | How well known the place is. See [How popularity is scored](https://millionshort.com/docs/places/guides#how-popularity-is-scored) | `hours.weekly` has one list per day, `monday` to `sunday`, of opening spans in the place's local time, written `"07:00-17:00"`. A day with none listed is an empty list. `hours.timezone` is the place's time zone, and `hours.partial` is `true` when some of the hours on record could not be read. ```text "hours": { "timezone": "America/Toronto", "weekly": { "monday": ["07:00-17:00"], "tuesday": ["07:00-17:00"], "wednesday": ["07:00-17:00"], "thursday": ["07:00-17:00"], "friday": ["07:00-19:00"], "saturday": ["08:00-19:00"], "sunday": [] }, "partial": false }, "open_now": true ``` Results come most relevant first, nearest first with `"sort": "distance"`, or most popular first with `"sort": "popularity"`. A place carries no rating, review, photo or price level, and no answer says which source a field came from. ### Attribution ```text "attribution": { "text": "Place data from open data sources. Credits and licences: https://millionshort.com/credits#places", "url": "https://millionshort.com/credits#places" } ``` The places come from open data, and some of its licences ask for a credit. Every answer carries this object: one line of text, and the address of the page that lists each source and its licence. No parameter removes it: `fields` shapes the places, not the credit. **If you show these places to people, you must show that line, or a link to that page, with them.** Our terms of service require it, and following it is up to you. Take the text from the answer; do not copy it from this page, because it can change. ### Data sources and licences The OpenStreetMap layer is being switched on. Until it is, the API refuses `layer` as an unknown parameter (400 INVALID_PARAM, free), and every answer is our combined list. What follows applies from the day it is on. Places of the OpenStreetMap layer (`"layer": "osm"`, and `osm_results` with `"layer": "both"`) are © OpenStreetMap contributors. The data is available under the [Open Database License (ODbL) 1.0](https://opendatacommons.org/licenses/odbl/1-0/). See [openstreetmap.org/copyright](https://www.openstreetmap.org/copyright). This layer is a separate list. Its places are never merged, de-duplicated or ranked with the other places. With `"layer": "both"` the two lists come back side by side: each is the answer its layer gives alone, and a place can be in both. `limit`, `sort`, `min_popularity`, `fields` and every filter apply to each list on its own. Every place of the OpenStreetMap layer carries its credit, and `fields` cannot remove it: ```text { "name": "…", "layer": "osm", "licence": "ODbL-1.0", "attribution": { "text": "© OpenStreetMap contributors", "url": "https://www.openstreetmap.org/copyright" } } ``` The answer carries the layer's credit too: `attribution` with `"layer": "osm"`, or `osm_attribution` with `"layer": "both"`. Each has `text`, `url` and `licence` (`"ODbL-1.0"`). **Terms for the OpenStreetMap layer.** Our terms of service say two things about these places: - If you show places of the OpenStreetMap layer to people, show "© OpenStreetMap contributors", linked to [https://www.openstreetmap.org/copyright](https://www.openstreetmap.org/copyright), next to them. - Nothing in our terms restricts the rights the ODbL gives you over places of the OpenStreetMap layer. Paying for the API and its rate limits apply to calls, not to what you do with those places once you have them. #### How to obtain the OpenStreetMap layer The OpenStreetMap layer is a database derived from OpenStreetMap alone. We offer it under the Open Database License (ODbL) 1.0. It is refreshed every week from the public OpenStreetMap data. Write to support@millionshort.com for a copy of the layer as we serve it (a data file, under the ODbL), or for a description of how it is made from the public data. The same offer is on the [Credits page](https://millionshort.com/credits#osm). ### Data notices Some of the place data comes from Foursquare Open Source Places, which Foursquare Labs, Inc. publishes under the Apache License, Version 2.0 (apache.org/licenses/LICENSE-2.0). Its notice asks that its content go in the developer documentation of an API that serves the data. Here it is, as Foursquare publishes it: ```text © 2026 Foursquare Labs, Inc. All rights reserved. The Foursquare OS Places dataset (the “Data”) is licensed under the Apache License, Version 2.0 (the “License”). You may not use, modify, or distribute the Data except in compliance with the License. As set forth more fully in the License, if you use, modify, or distribute the Data, you must: – provide recipients with a copy of the License. – if applicable, include prominent notices to the extent you’ve changed the Data. – preserve attribution to Foursquare, including preserving the full content of this NOTICE.txt file. To ensure appropriate attribution to Foursquare, we recommend the following: – if using/distributing the Data in flat file form as-is or after making changes/modifications: include this NOTICE.txt file, which may be modified to include an additional notice of your changes/modifications, if any. – if using/distributing the Data in API form as-is or after making changes/modifications: include a copy of the content from this NOTICE.txt file prominently in your developer documentation for such API, which may be modified to include an additional notice of your changes/modifications, if any. You may obtain a copy of the License at: http://www.apache.org/licenses/LICENSE-2.0. Unless required by applicable law or agreed to in writing, the Data distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. We also encourage you to join our Placemaker community where you can contribute and provide suggestions to improve the accuracy of the Data for future releases for yourself and others. ``` **Our changes:** we transformed the Data to our own format, normalised it, and combined it with other sources, keeping one listing per place. The same notice is on the [Credits page](https://millionshort.com/credits#places). Naming the source here is only to give the credit its licence asks for; it implies no endorsement. ### Warnings | Code | When | |---|---| | `hours_coverage` | Whenever `open_now` is sent: most places have no hours on record, so open places can be missing | | `sort_not_applied` | `"sort": "distance"` was sent and there is no point to measure from (the location is an `area`, or there is none). The places are in order of relevance | ## Limits | Limit | Value | |---|---| | `limit` | 1 to 50 | | `radius_m` | 10 to 50,000 metres | | `category`, `exclude_category` | up to 10 each | | `query`, `near` | up to 200 characters each | | `brand`, `neighbourhood`, `city`, `region` | up to 120 characters each | A plan's requests a minute and searches in flight apply as they do to a search; Places is not one of the heavy sources. [Pricing and limits](https://millionshort.com/docs/places/pricing) has the numbers. ## Credits 1 credit per list covers up to 10 places. Each further 10 places returned in that list, or part of 10, is 0.5. A call returns one list, or two with `"layer": "both"`, and each list is priced on its own. Every filter, `sort` and `fields` are free, the category list is free, and a call that fails costs nothing. [Pricing and limits](https://millionshort.com/docs/places/pricing) has worked examples. --- Source: https://millionshort.com/docs/places/guides Section: Endpoints / Places # Places guides The jobs Places is built for, each as the requests that do it. ## Find places near a point When you have coordinates (a device's position that the user shared, a place from an earlier answer, a geocoder of your own), send them. A point works the same in every country, and nothing has to be read from a name. ```bash curl https://api.millionshort.com/v1/places \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "query": "bike repair", "lat": 45.5231, "lng": -73.5817, "radius_m": 2000, "limit": 10 }' ``` ```python import os import requests r = requests.post( "https://api.millionshort.com/v1/places", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, json={ "query": "bike repair", "lat": 45.5231, "lng": -73.5817, "radius_m": 2000, "limit": 10 }, timeout=30, ) r.raise_for_status() print(r.json()["data"]) ``` ```ts const res = await fetch('https://api.millionshort.com/v1/places', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ "query": "bike repair", "lat": 45.5231, "lng": -73.5817, "radius_m": 2000, "limit": 10 }), }); if (!res.ok) throw new Error(`POST /v1/places failed: ${res.status}`); const { data } = (await res.json()) as { data: unknown }; console.log(data); ``` - Without `radius_m` the radius fits the search: it starts small and widens until there is enough to return. With `radius_m` it is fixed, and a quiet area can return fewer places than `limit`, or none. - Every result carries `distance_m` from the point. - To cover what a map shows, send its corners as `bbox`, `[south, west, north, east]`. `distance_m` is then measured from the middle of the box. - `"sort": "distance"` puts the nearest first. The default order is relevance. Unless you ask with `near_me`, we never work out where a caller is. A position the user shared is always better than a guess from an address. ## Search near an IP address or near the caller When there are no coordinates, an IP address gives a rough answer: the city its network is in. ```bash curl https://api.millionshort.com/v1/places -H "Authorization: Bearer $MILLIONSHORT_API_KEY" -H "Content-Type: application/json" -d '{ "query": "coffee", "ip": "203.0.113.24", "radius_m": 2000 }' ``` ```python import os import requests r = requests.post( "https://api.millionshort.com/v1/places", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, json={ "query": "coffee", "ip": "203.0.113.24", "radius_m": 2000 }, timeout=30, ) r.raise_for_status() print(r.json()["data"]) ``` ```ts const res = await fetch('https://api.millionshort.com/v1/places', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ "query": "coffee", "ip": "203.0.113.24", "radius_m": 2000 }), }); if (!res.ok) throw new Error(`POST /v1/places failed: ${res.status}`); const { data } = (await res.json()) as { data: unknown }; console.log(data); ``` ```text "resolved": { "name": "Toronto", "region": "ON", "country": "CA", "lat": 43.71, "lng": -79.4, "kind": "ip", "accuracy": "city", "alternatives": [] } ``` - **Read `resolved` and say what was used.** The answer names the city the address was placed in. Tell the user ("showing coffee near Toronto"), so a wrong guess is easy to correct. - **It is a city, not a street.** The search runs around the city's point. A mobile network or a VPN can be placed in another city altogether. - **`"near_me": true` uses the address the call itself comes from.** From a browser extension or a desktop agent that is the user. From a server it is the server: there, send the user's own address as `ip`, or their shared position as `lat` with `lng`. - **The address is not kept.** It is used to look up a city and then dropped: not written to the request log, not kept, not returned. It goes no further than our own search service, which does the lookup and keeps nothing of it. - An address we cannot place is a [`location_not_found`](https://millionshort.com/docs/places/errors#location-errors) with `details.param` of `ip` or `near_me`. Fall back to asking the user where they are. - Placing an address works worldwide, more reliably in Canada and the United States. ## How near is read `near` takes a place by name. These are read: | Kind | Examples | |---|---| | A city or town | `Toronto`, `Denver, CO`, `Paris, France` | | A neighbourhood, with its city when the name is common | `Leslieville, Toronto`, `Capitol Hill, Seattle` | | A postcode | `M4M 1L4`, `10001`, `SW1A 1AA` | | A street address | `100 Queen St W, Toronto` | | An intersection | `Yonge and Eglinton` | | An airport code | `YYZ` | What to know: - **Check `resolved`.** The answer says which place `near` was taken to mean, and lists others of that name in `alternatives`. "Cambridge" alone is a guess between several; "Cambridge, MA" and "Cambridge, UK" are not. - **Add the state, province or country** when a name is common. A name qualified that way is taken only when the place found is really there. Otherwise the answer is [`location_not_found`](https://millionshort.com/docs/places/errors#location-errors), never a different place. - **A city is an area; a neighbourhood or a postcode is a point.** Around a point, results carry `distance_m` and can take `radius_m`. Inside an area they carry no distance, because a city has no one point to measure from. - **Names are read best in Canada and the United States.** Neighbourhoods, postcodes, intersections and everyday trade words ("plumber", "dentist") are strongest there. Elsewhere, a plain city name usually works, and `lat` with `lng` always does. - **`query` is never read as a location.** `"query": "sushi leslieville"` is a search for that name. Send `"query": "sushi", "near": "Leslieville, Toronto"`. When a name is not found, fall back in this order: add or correct the qualifier, try the city alone, then send coordinates. ## Finding the right category A `query` word is matched as well as we can read it; a category is exact. When the kind of place matters, look the category up once and send its id. ```bash curl "https://api.millionshort.com/v1/places/categories?q=dental" -H "Authorization: Bearer $MILLIONSHORT_API_KEY" ``` ```python import os import requests r = requests.get( "https://api.millionshort.com/v1/places/categories?q=dental", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, timeout=30, ) r.raise_for_status() print(r.json()["data"]) ``` ```ts const res = await fetch('https://api.millionshort.com/v1/places/categories?q=dental', { headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}` }, }); if (!res.ok) throw new Error(`GET /v1/places/categories failed: ${res.status}`); const { data } = (await res.json()) as { data: unknown }; console.log(data); ``` The list is free. `?q=` keeps the categories whose id holds every word, and `?parent=italian_restaurant` lists what is directly under a category. Then: ```bash curl https://api.millionshort.com/v1/places -H "Authorization: Bearer $MILLIONSHORT_API_KEY" -H "Content-Type: application/json" -d '{ "category": ["dental_clinic", "general_dentistry"], "exclude_category": ["b2b_dental_lab"], "near": "Austin, TX", "has_phone": true }' ``` ```python import os import requests r = requests.post( "https://api.millionshort.com/v1/places", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, json={ "category": [ "dental_clinic", "general_dentistry" ], "exclude_category": [ "b2b_dental_lab" ], "near": "Austin, TX", "has_phone": True }, timeout=30, ) r.raise_for_status() print(r.json()["data"]) ``` ```ts const res = await fetch('https://api.millionshort.com/v1/places', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ "category": [ "dental_clinic", "general_dentistry" ], "exclude_category": [ "b2b_dental_lab" ], "near": "Austin, TX", "has_phone": true }), }); if (!res.ok) throw new Error(`POST /v1/places failed: ${res.status}`); const { data } = (await res.json()) as { data: unknown }; console.log(data); ``` - A category covers everything below it: `restaurant` includes `sushi_restaurant`. Cuisines are categories, not a field of their own. - `category` takes the id or the name: `"Coffee shop"` is read as `coffee_shop`. One we do not have is a `400`, so a typo is not a silent empty list. - Every place lists its own ids in `categories`. A result that is nearly right shows you which id to ask for next. - For a chain, `brand` is more exact than a name in `query`: `"brand": "Tim Hortons"`. - Outside Canada and the United States, a category id is a safer way to say what you want than an everyday trade word in `query`. ## Opening hours and open_now Opening hours are known for a small share of places. Plan for that. - A place with no hours on record has `"hours": null` and `"open_now": null`. `null` means "not known". It does not mean closed. - `"open_now": true` on the request keeps only places whose hours we know and that are open at this moment. Every place with unknown hours is left out, so the list is short and is mostly chains. The answer carries an `hours_coverage` warning to say so. - `"has_hours": true` keeps the places whose hours we know, open or not. It is the way to get a list you can reason about hours on. - For "what is open near here", it is often better to search without `open_now`, read `open_now` on each result, and tell the user which places are known to be open and which are not known. ```bash curl https://api.millionshort.com/v1/places \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "query": "pharmacy", "near": "M5B 2H1", "open_now": true }' ``` ```python import os import requests r = requests.post( "https://api.millionshort.com/v1/places", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, json={ "query": "pharmacy", "near": "M5B 2H1", "open_now": True }, timeout=30, ) r.raise_for_status() print(r.json()["data"]) ``` ```ts const res = await fetch('https://api.millionshort.com/v1/places', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ "query": "pharmacy", "near": "M5B 2H1", "open_now": true }), }); if (!res.ok) throw new Error(`POST /v1/places failed: ${res.status}`); const { data } = (await res.json()) as { data: unknown }; console.log(data); ``` `hours.weekly` is in the place's local time, and `hours.timezone` names its time zone, so you can work out later openings yourself. ## Read what a place says about itself A place carries no reviews or descriptions. Its `website` is the way to more: search inside it with [`include_domains`](https://millionshort.com/docs/search/filters), or read its pages with [Extract](https://millionshort.com/docs/extract). ```bash curl https://api.millionshort.com/v1/search \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "query": "opening hours menu", "include_domains": ["harbourlanecoffee.example"], "num_results": 5 }' ``` ```python import os import requests r = requests.post( "https://api.millionshort.com/v1/search", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, json={ "query": "opening hours menu", "include_domains": [ "harbourlanecoffee.example" ], "num_results": 5 }, timeout=30, ) r.raise_for_status() for hit in r.json()["data"]["results"]: print(hit["position"], hit["title"], hit["url"]) ``` ```ts const res = await fetch('https://api.millionshort.com/v1/search', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ "query": "opening hours menu", "include_domains": [ "harbourlanecoffee.example" ], "num_results": 5 }), }); if (!res.ok) throw new Error(`POST /v1/search failed: ${res.status}`); const { data } = (await res.json()) as { data: { results: { position: number; title: string; url: string }[] }; }; for (const hit of data.results) console.log(hit.position, hit.title, hit.url); ``` The same call as a tool of the MCP server: ```json { "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "search", "arguments": { "query": "opening hours menu", "include_domains": [ "harbourlanecoffee.example" ], "num_results": 5 } } } ``` ## A stale listing A business that has closed may still be listed. `last_seen` is the day a place was last confirmed. For a recommendation that matters, prefer places seen recently, and say when a listing is old. ## How popularity is scored Every place has a `popularity`, a whole number from 0 to 100. It is worked out from what we already hold about the place, not from visits or reviews, and it says how well known and well attested a place is. Two kinds of evidence go into it: - **Reach.** How popular the place's own website is, and how many places carry the same brand. A website on a platform that many unrelated places share (a social network, a site builder, a listings or ordering site) counts as no website of the place's own. - **The place's own evidence.** How many independent sources list it, how complete its listing is (a phone number, a website, opening hours, a street address), and how recently it was seen. Reach is worth at most 45 points, and it is scaled by the place's own evidence: a branch of a famous chain with little evidence of its own gets at most 18 of them. So a chain's shared website never makes every one of its branches 100. The place's own evidence is worth up to 55 points, so a well-attested independent place scores well without any reach at all. More of any kind of evidence never lowers the score. What the numbers look like in practice: a well-attested branch of a large chain is usually in the 80s or 90s, a well-attested independent place in the 30s to 60s, and a sparse or old listing below 20. A score is a guide for ordering and filtering, not a rating of quality. Most popular coffee places around a point, leaving out sparse listings: ```bash curl https://api.millionshort.com/v1/places \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "query": "coffee", "lat": 39.7392, "lng": -104.9903, "radius_m": 3000, "sort": "popularity", "min_popularity": 30, "fields": ["name", "address", "popularity"] }' ``` ```python import os import requests r = requests.post( "https://api.millionshort.com/v1/places", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, json={ "query": "coffee", "lat": 39.7392, "lng": -104.9903, "radius_m": 3000, "sort": "popularity", "min_popularity": 30, "fields": [ "name", "address", "popularity" ] }, timeout=30, ) r.raise_for_status() print(r.json()["data"]) ``` ```ts const res = await fetch('https://api.millionshort.com/v1/places', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ "query": "coffee", "lat": 39.7392, "lng": -104.9903, "radius_m": 3000, "sort": "popularity", "min_popularity": 30, "fields": [ "name", "address", "popularity" ] }), }); if (!res.ok) throw new Error(`POST /v1/places failed: ${res.status}`); const { data } = (await res.json()) as { data: unknown }; console.log(data); ``` `sort: "popularity"` and `min_popularity` work on the best matches for the search (up to 100 of them), then order or filter those. To tell independent places from chains, look at `brand` (null for a place with no brand), not at a low score. ### Popularity on the OpenStreetMap layer A place of the OpenStreetMap layer has a `popularity` too, on the same 0 to 100 scale, but it is a different score. It is worked out from that OpenStreetMap listing alone, never from our other places or anything looked up about them. Four equal parts go into it: - how complete the listing is (a phone number, a website, opening hours, a street address); - how recently a mapper edited or checked it; - how many times mappers have edited it; - whether the listing names its brand's own reference entry. The two scores are never compared or ordered together. With `"layer": "both"`, `sort: "popularity"` and `min_popularity` apply to each list on its own score. ## Two lists: our places and the OpenStreetMap layer The OpenStreetMap layer is being switched on; until it is, `layer` is refused as an unknown parameter (400 INVALID_PARAM, free). From then on, `"layer": "both"` returns two lists side by side: `results`, our combined list, and `osm_results`, the OpenStreetMap layer. Each list is the answer its layer gives alone to the same request. The two are never merged, de-duplicated or ranked together, so the same place can be in both. If you show them, show them as two lists, and show "© OpenStreetMap contributors", linked to [https://www.openstreetmap.org/copyright](https://www.openstreetmap.org/copyright), next to the places of the OpenStreetMap layer. Each list is priced on its own. [Data sources and licences](https://millionshort.com/docs/places/parameters#data-sources-and-licences) has the licence and the terms. ```bash curl https://api.millionshort.com/v1/places \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "query": "bakery", "near": "Leslieville, Toronto", "layer": "both", "limit": 5, "fields": ["name", "address", "phone"] }' ``` ```python import os import requests r = requests.post( "https://api.millionshort.com/v1/places", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, json={ "query": "bakery", "near": "Leslieville, Toronto", "layer": "both", "limit": 5, "fields": [ "name", "address", "phone" ] }, timeout=30, ) r.raise_for_status() print(r.json()["data"]) ``` ```ts const res = await fetch('https://api.millionshort.com/v1/places', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ "query": "bakery", "near": "Leslieville, Toronto", "layer": "both", "limit": 5, "fields": [ "name", "address", "phone" ] }), }); if (!res.ok) throw new Error(`POST /v1/places failed: ${res.status}`); const { data } = (await res.json()) as { data: unknown }; console.log(data); ``` Every place in `osm_results` carries `layer`, `licence` and `attribution`, whatever `fields` asked for. --- Source: https://millionshort.com/docs/places/pricing Section: Endpoints / Places # Places pricing and limits One credit for up to ten places in each list, charged for what comes back. ## What a call costs **1 credit is $0.001.** A call costs 1 credit and covers up to 10 places. Each further 10 places returned, or part of 10, adds 0.5. It is the price of one source of a [search](https://millionshort.com/docs/search/pricing). The price is per list. A call returns one list, or two with `"layer": "both"`: our combined list and the [separately licensed layer](https://millionshort.com/docs/places/parameters#data-sources-and-licences), side by side. Each list is priced on its own, as if it were a call of its own. That layer is being switched on; until it is, every call returns one list and `layer` is refused (400 INVALID_PARAM, free). | Call | Credits | |---|---| | `limit` 10, 10 places come back | 1 | | `limit` 20, 20 places come back | 1.5 | | `limit` 50, 50 places come back | 3 | | `limit` 50, 11 places come back | 1.5 | | `limit` 50, 3 places come back | 1 | | A call that finds nothing | 1 | | `"layer": "both"`, `limit` 10, 10 places in each list | 2 | | `"layer": "both"`, `limit` 20, 20 places and 3 places | 2.5 | | A call that fails, or whose location is missing or not found | 0 | | The category list | 0 | - The call holds the price of the `limit` asked for (twice the `limit` with `"layer": "both"`) before any work, charges for the places returned, and hands the rest back in the same request. - Every filter is free: `category`, `exclude_category`, `brand`, `city`, `region`, `country`, `radius_m`, `has_phone`, `has_website`, `has_hours` and `open_now`. So are `sort`, `fields`, `ip` and `near_me`. `fields` returns less and costs the same. - [`GET /v1/places/categories`](https://millionshort.com/docs/places/parameters#the-category-list) is free. - A call that fails or is refused costs nothing. That covers every `400`, `429` and `502`, including a location that is missing or not found. - `usage.breakdown` has the lines `places` (the base of each list) and, past 10 places in a list, `additional_results`. - A list that comes back empty still costs its base, like any call that finds nothing. ## Limits of a request | Limit | Value | |---|---| | `limit` | 1 to 50 places | | `radius_m` | 10 to 50,000 metres | | `category`, `exclude_category` | up to 10 each | | `query`, `near` | up to 200 characters each | | `brand`, `neighbourhood`, `city`, `region` | up to 120 characters each | ## Limits of a plan Places counts against a plan's requests a minute and its searches in flight, like any search. It is not one of the heavy sources, so the heavy-source limit does not apply. Every plan can call it, the Free plan included. [Credits and limits](https://millionshort.com/docs/credits-and-limits#rate-limits) has each plan's numbers. ## Without a key Over the [MCP server](https://millionshort.com/docs/mcp#places), the `places` tool works with no key: up to 5 places a call, and each call is one of the visitor's 10 free searches of the day, at most 5 in a minute. A places search and a web search spend the same allowance. The `list_place_categories` tool also works with no key and does not spend that allowance. The API itself always needs a key. --- Source: https://millionshort.com/docs/places/errors Section: Endpoints / Places # Places errors A request either answers with places or fails as a whole. A location that cannot be read is an error, never a guess. Places uses the one [error shape](https://millionshort.com/docs/errors#the-error-shape) every endpoint uses. No error is charged. ## Location errors Both are `400 INVALID_PARAM`, told apart by `error.details.reason`. | `details.reason` | When | Try next | |---|---|---| | `location_required` | The request names a kind of place and says nowhere to look | Send `near`, `lat` with `lng`, `bbox`, or one of the other [ways to say where](https://millionshort.com/docs/places/parameters#where) | | `location_not_found` | The place named, or the IP address, is not one we can place. `details.param` says which field: see below | Depends on the field | | `details.param` | What was not found | Try next | |---|---|---| | `near` | The place named in `near` | Add the state, province or country; try the city alone; or send `lat` and `lng` | | `neighbourhood` | The neighbourhood, with its `city` if one was sent | Send `city` with it; try the city alone; or send `lat` and `lng` | | `city` | The `city` (with its `region`) used as the location | Check the spelling and the region code; or send `near` with the country | | `ip` | The IP address could not be placed in a city | Ask the user where they are; send `near`, or `lat` and `lng` | | `near_me` | The address the call came from could not be placed, or is on a private network | The same | ```json { "error": { "code": "INVALID_PARAM", "message": "We could not find the place named in near. Try a city, a neighbourhood with its city, a postcode or a street address, or send lat and lng.", "retry_after_seconds": null, "details": { "param": "near", "reason": "location_not_found" } }, "request_id": "req_01JD0PLACES9X3K5N7B" } ``` A place is never guessed. A name that is qualified ("Springfield, OR") and cannot be found there is `location_not_found`, not a Springfield somewhere else. The address a request comes from is used only when `near_me` says so, and an address that cannot be placed is an error, not a default city. A search that reads its location and finds no places is not an error: it answers `200` with an empty `results`. ## Request errors | Status and code | When | |---|---| | `400 INVALID_PARAM` | A field the API does not take; none of `query`, `category` and `brand`; more than one of `near`, `lat` with `lng`, `bbox`, `ip`, `near_me` and `neighbourhood`; `lat` without `lng`; `radius_m` with `bbox` or with no location; a category we do not have; an `ip` that is not one public address; a `fields` entry that is not a place field; a value out of range or of the wrong type; and the two location errors above | | `401 AUTH_MISSING_KEY`, `401 AUTH_INVALID_KEY` | No `Authorization` header, or a key that is malformed, revoked or expired | | `403 QUOTA_EXCEEDED` | The key's monthly cap does not cover the call | | `429 INSUFFICIENT_CREDITS` | The balance does not cover the `limit` asked for | | `429 RATE_LIMITED` | The plan's requests a minute, or its searches in flight | | `429 CAPACITY` | We have no room for this call right now. Retry after `retry_after_seconds` | | `502 SEARCH_UNAVAILABLE` | Places could not be served right now. Retry after `retry_after_seconds` | [Errors](https://millionshort.com/docs/errors) says which of these are worth retrying. ## Warnings A `200` can carry `warnings`: `hours_coverage` whenever `open_now` is sent, because most places have no hours on record and open places can be missing from the list. See [Opening hours and open_now](https://millionshort.com/docs/places/guides#opening-hours-and-open_now). `sort_not_applied` says `"sort": "distance"` had no point to measure from, because the location is an area such as a city. The places are in order of relevance. Send `lat` with `lng`, or name a neighbourhood or an address. --- Source: https://millionshort.com/docs/agent Section: Endpoints / Agent # Agent A question in, an answer out in which every statement carries a quote from a page the run read. ```text POST https://api.millionshort.com/v1/agent ``` Agent takes a question and does the research. It plans searches, runs them on our [sources](https://millionshort.com/docs/search/sources), reads the pages that matter, and writes an answer. Every statement of the answer ends with one or more `[n]` markers, and each marker names a page and the words of that page that support the statement. Send a `schema` and the answer comes back as JSON in that shape instead, with the citations of each field. Earlier pages of these docs called this Research. It is the same endpoint. ## What a run is - **A question in.** `prompt` is the question. You can add pages to read first, hold the run to some sources or sites, and say how much work it may do. - **A cited answer out.** `answer` is text with `[n]` markers. `citations` lists, for each marker, the page (`url`, `title`, `source`) and the `quote` from it. - **Or data.** With `schema`, `output` is an object in your shape, `field_citations` maps each cited field to its citations, and `uncited_fields` names the filled fields that no checked quote supports. - **A job, not a call.** `POST /v1/agent` answers at once with an id. You then poll, read the steps as an event stream, or name a webhook to be told when it ends. - **A cap you set.** `max_credits` is the most a run may cost. A run that reaches it stops and returns what it has. ## How long it takes A run usually takes from a few seconds to a few minutes. On our own evaluation set, measured on 2026-11-20, the median run took about 6 seconds on `lite`, 10 seconds on `standard` and 20 seconds on `pro`. That is a measurement, not a promise: a question that needs more searches, slower sites or a longer answer takes longer. No run goes past 10 minutes; one that would is ended as `incomplete`, with `stop_reason: "time"`. ## What a run does The steps are fixed, and the same on every run: 1. **Plan.** Decide which searches to make, and on which sources. 2. **Search.** Run them with our own [Search](https://millionshort.com/docs/search). 3. **Read.** Fetch the pages worth reading with our own [Extract](https://millionshort.com/docs/extract): a stored copy when we hold one, a live fetch when we do not. 4. **Check what is missing.** On `standard` and `pro`: ask what the question still needs, then search and read again. 5. **Write.** Write the answer, with a quote for each statement. 6. **Check.** Compare every quote with the page it claims to come from, and remove what does not hold. A question that names somewhere ("bakeries near the station in Leeds") can also use [Places](https://millionshort.com/docs/places). That is all a run does. Its only tools are our own Search, Extract and Places, and it is our code that calls them: it opens no browser, runs no code, fills in no forms and posts nothing to the sites it reads. The model proposes searches and writes text; our code decides what is fetched and what may be said. [What a page can and cannot do](#what-a-page-can-and-cannot-do) says what that holds against. How much work a run may do is its `processor`: `lite`, `standard` or `pro`. [Parameters](https://millionshort.com/docs/agent/parameters#processors) has the table. ### Privacy Agent runs send your question and the pages read to our AI model provider (a sub-processor); they are not used for training. The [privacy policy](https://millionshort.com/privacy) says how we handle data. ## How citations are enforced A citation here is not a link the model chose to add. It is checked. - **Every statement needs a quote.** The writer must give, for each statement, words from a page the run fetched. - **The quote must be in the page, whole.** A quote is kept when it is one unbroken run of the words of the page we fetched: the same words in the same order, with nothing left out, at least 3 words and 12 characters long. Case, spacing and punctuation may differ. A quote that skips words is not kept, however much of it is in the page. A quote that is not kept is dropped. - **A statement with no quote left is removed.** `uncited_removed` counts how many were. - **`standard` and `pro` add a second pass.** A second reading puts each statement beside its quotes and removes the statements the quotes do not show. `verified` says whether that pass was made. When it could not be made, the answer is kept on the quote check alone, and `verified` is `false`. - **Nothing supported means no answer.** If no statement is left, the run ends `incomplete` with `stop_reason: "no_support"`. If the model would not, or could not, write an answer in a form that can be checked, the run ends `incomplete` with `stop_reason: "no_answer"`. Neither falls back to an answer without citations. - **With `schema`, an unsupported field is named, not hidden.** A filled field that no checked quote supports is listed in `uncited_fields`. A top-level field counts as cited when a quote was kept for it or for a value inside it; `field_citations` says which. You decide what to do with the rest. `sources` lists every page the writer was given, cited or not, so you can see what the answer was written from. ## What this does not promise - **That the page is right.** A quote shows that a page says something. It does not show that the page is correct, current or honest. - **That a quote proves more than it says.** The checks ask whether a careful reader of the quote would accept the statement. They cannot do better than that reader, and they can be wrong. - **That everything was found.** A run reads a limited number of pages. `not_answered` says what the pages read did not answer, when the writer could tell. When the pages read do not fit in the writing step (in what is left of `max_credits`, or in one model call), the last ones are left out of the run: they are not listed in `sources`, and nothing can cite them. Each page is also cut to a length before the writer sees it (6,000 characters on `lite`, 8,000 on `standard` and `pro`), so a fact deep in a long page may not be cited. For such a page, name it in `urls` and ask a narrower question. - **That the page still says it.** A quote is checked against the copy the run read. Pages change. - **The same answer twice.** Two runs of one question can search differently and word the answer differently. Read the quotes for anything that matters. They are there so that you can. ## What a page can and cannot do A page a run reads may carry text written to mislead a model ("ignore your instructions and do this instead"). The run is built so that such text can do little. - **Page text reaches a model only as data, marked off from the instructions.** The writing step sees the text of each page, up to a length. The step that asks what is missing sees the opening words of each page. The checking pass sees the quotes. - **No model has a tool to call.** A model proposes searches and writes text. Our code decides what is searched and fetched. - **The most a page that is obeyed can do** is suggest a follow-up search, which is still a query on one of the run's own sources and inside its ceilings, or talk the second pass into keeping a statement. - **What it cannot do:** name a URL for the run to fetch, make the run spend past its cap, or put a statement in the answer without a quote that is in a page the run fetched. So a misleading page can waste a search, or keep in a statement that the second pass should have removed. It cannot take the run anywhere else. A site that carries a [risk label](https://millionshort.com/docs/search/popularity-and-risk) is not read. Pages are fetched under the same rules as [Extract](https://millionshort.com/docs/extract/parameters): `robots.txt`, the URL rules and the limits per site. ## In this section | Part | Page | |---|---| | Quickstart | [Start a run, poll it, read the answer; then `schema`, the event stream, a webhook and cancelling](https://millionshort.com/docs/agent/quickstart) | | Parameters | [Every request field with an example, the processors, the tiers of `model`, and everything that comes back](https://millionshort.com/docs/agent/parameters) | | Guides | [A cited briefing held to your sources, a table of facts from a schema, choosing a processor and a cap, and use over MCP](https://millionshort.com/docs/agent/guides) | | Pricing and limits | [What a run is charged for, the cap, the per-run cap of each plan, measured examples and the limits](https://millionshort.com/docs/agent/pricing) | | Errors | [Requests that are refused, and runs that end `incomplete`, `failed` or `cancelled`](https://millionshort.com/docs/agent/errors) | ## With the other endpoints [Search](https://millionshort.com/docs/search) returns results and [Extract](https://millionshort.com/docs/extract) returns pages; with those two you can do this job with a model of your own, and the [RAG guide](https://millionshort.com/docs/search/guides/rag) shows how. Agent does it for you and holds the answer to its quotes. It costs more than the searches and pages alone, because it also pays for the writing. [The endpoints](https://millionshort.com/docs/endpoints) says where each one stands. --- Source: https://millionshort.com/docs/agent/quickstart Section: Endpoints / Agent # Agent quickstart Start a run, poll it, read the answer and its quotes. Then a schema, the event stream, a webhook and cancelling. A run is a job. You start it, it works for a while, and you collect the result. There are three ways to wait: poll, read the event stream, or be told by webhook. ## 1. Start a run ```bash curl https://api.millionshort.com/v1/agent \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: fares-2026-11-20" \ -d '{ "prompt": "What does a monthly adult pass cost on Northbridge Transit in 2026, and when did the price last change?", "processor": "lite", "max_credits": 40 }' ``` ```python import os from millionshort import MillionShort client = MillionShort(api_key=os.environ["MILLIONSHORT_API_KEY"]) run = client.start_agent( "What does a monthly adult pass cost on Northbridge Transit in 2026, and when did the price last change?", processor="lite", max_credits=40, idempotency_key="fares-2026-11-20", ) print(run.id, run.status) ``` ```ts import { MillionShort } from 'millionshort'; const client = new MillionShort({ apiKey: process.env.MILLIONSHORT_API_KEY }); const run = await client.startAgent( 'What does a monthly adult pass cost on Northbridge Transit in 2026, and when did the price last change?', { processor: 'lite', maxCredits: 40, idempotencyKey: 'fares-2026-11-20' }, ); console.log(run.id, run.status); ``` The answer is `202` and comes back at once: ```json { "data": { "id": "agt_01jd4f8q2m6r9t3v5x7z0b1c2d", "status": "queued", "processor": "lite", "model": "fast", "max_credits": 40, "request": { "processor": "lite", "model": "fast", "max_credits": 40 }, "progress": { "step": "queued", "searches": 0, "pages_read": 0, "model_calls": 0, "credits": 0 }, "stop_reason": null, "webhook_id": null, "created_at": "2026-11-20T14:02:11Z", "started_at": null, "finished_at": null }, "request_id": "req_01JD4F8Q2M6R9T3V5X7Z", "usage": { "credits": 0, "cost_usd": 0, "breakdown": {}, "steps": {} }, "warnings": [] } ``` - Keep `data.id`. Every other call names it. - `max_credits` is held from your credits now. What the run does not use is handed back when it ends. [Pricing and limits](https://millionshort.com/docs/agent/pricing#the-cap-is-a-hold) says how. - `Idempotency-Key` is optional. The same key with the same body returns the run it already made, with `200` in place of `202`, so a retry after a timeout does not start a second one. - `processor` says how much work the run may do. `lite` is the smallest. Left out, it is `standard`. ## 2. Poll it ```bash curl https://api.millionshort.com/v1/agent/$AGENT_ID \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" ``` ```python import os import requests r = requests.get( f"https://api.millionshort.com/v1/agent/{os.environ['AGENT_ID']}", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, timeout=30, ) r.raise_for_status() print(r.json()["data"]) ``` ```ts const res = await fetch(`https://api.millionshort.com/v1/agent/${process.env.AGENT_ID}`, { headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}` }, }); if (!res.ok) throw new Error(`GET /v1/agent/… failed: ${res.status}`); const { data } = (await res.json()) as { data: unknown }; console.log(data); ``` `status` is `queued`, then `running`, then one of the four endings: `completed`, `incomplete`, `failed` or `cancelled`. While the run is going, `progress` says which step it is on and what it has spent so far. Polling is free. The SDKs have a waiter that polls for you and returns the run once it has ended: ```python import os from millionshort import MillionShort client = MillionShort(api_key=os.environ["MILLIONSHORT_API_KEY"]) run = client.start_agent( "What does a monthly adult pass cost on Northbridge Transit in 2026, and when did the price last change?", processor="lite", ) done = client.wait_agent(run.id, poll_interval=2.0, timeout=600.0) print(done.status, done.stop_reason) print(done.answer) for cite in done.citations: print(cite["n"], cite["url"], cite["quote"]) print(done.usage.credits) ``` ```ts import { MillionShort } from 'millionshort'; const client = new MillionShort({ apiKey: process.env.MILLIONSHORT_API_KEY }); const run = await client.startAgent( 'What does a monthly adult pass cost on Northbridge Transit in 2026, and when did the price last change?', { processor: 'lite' }, ); const done = await client.waitAgent(run.id, { pollIntervalMs: 2000, timeoutMs: 600_000 }); console.log(done.status, done.stop_reason); console.log(done.answer); for (const cite of done.citations ?? []) console.log(cite.n, cite.url, cite.quote); console.log(done.usage?.credits); ``` Past its timeout the waiter raises `PollTimeoutError`. The run goes on, and you can poll it again. ## 3. Read the result Once the run has ended, the same `GET` carries the result: ```json { "data": { "id": "agt_01jd4f8q2m6r9t3v5x7z0b1c2d", "status": "completed", "processor": "lite", "model": "fast", "max_credits": 40, "request": { "processor": "lite", "model": "fast", "max_credits": 40 }, "progress": { "step": "check", "searches": 2, "pages_read": 4, "model_calls": 2, "credits": 8.8 }, "stop_reason": "done", "webhook_id": null, "created_at": "2026-11-20T14:02:11Z", "started_at": "2026-11-20T14:02:11Z", "finished_at": "2026-11-20T14:02:18Z", "steps": [ { "seq": 1, "type": "started", "at": "2026-11-20T14:02:11Z", "processor": "lite", "model": "fast" }, { "seq": 2, "type": "plan", "at": "2026-11-20T14:02:12Z", "searches": [ { "query": "Northbridge Transit monthly adult pass price 2026", "source": "web" }, { "query": "Northbridge Transit fare change", "source": "news" } ] }, { "seq": 3, "type": "search", "at": "2026-11-20T14:02:13Z", "query": "Northbridge Transit monthly adult pass price 2026", "source": "web", "results": 8, "new": 8 }, { "seq": 4, "type": "search", "at": "2026-11-20T14:02:13Z", "query": "Northbridge Transit fare change", "source": "news", "results": 5, "new": 4 }, { "seq": 5, "type": "read", "at": "2026-11-20T14:02:15Z", "asked": 3, "read": 3 }, { "seq": 6, "type": "write", "at": "2026-11-20T14:02:17Z", "statements": 3, "quotes_checked": 4 }, { "seq": 7, "type": "check", "at": "2026-11-20T14:02:18Z", "statements_kept": 2, "statements_removed": 1 } ], "answer": "A monthly adult pass on Northbridge Transit costs $96 in 2026 [1]. The price last changed on 1 March 2026, when it rose from $92 [1][2].", "output": null, "citations": [ { "n": 1, "url": "https://transit.northbridge.example/fares", "title": "Fares and passes", "source": "web", "quote": "Monthly adult pass: $96, effective 1 March 2026." }, { "n": 2, "url": "https://news.northbridge.example/2026/02/fares-rise-in-march", "title": "Transit fares rise in March", "source": "news", "quote": "the monthly adult pass goes from $92 to $96 on March 1" } ], "sources": [ { "url": "https://transit.northbridge.example/fares", "title": "Fares and passes", "source": "web", "how": "live", "cited": true }, { "url": "https://news.northbridge.example/2026/02/fares-rise-in-march", "title": "Transit fares rise in March", "source": "news", "how": "cached", "cited": true }, { "url": "https://transit.northbridge.example/passes/students", "title": "Student passes", "source": "web", "how": "cached", "cited": false }, { "url": "https://forum.northbridge.example/t/fare-increase", "title": "Fare increase thread", "source": "web", "how": "search", "cited": false } ], "uncited_removed": 1 }, "request_id": "req_01JD4F9A3N7S0U4W6Y8A", "usage": { "credits": 8.8, "cost_usd": 0.0088, "breakdown": { "search": 2, "search_content": 2, "extract_cached": 0.5, "extract_live": 0.5, "model_input": 2.6, "model_output": 1.2 }, "steps": { "searches": 2, "pages_read": 4, "places_lookups": 0, "model_calls": 2, "input_tokens": 6500, "output_tokens": 600 } }, "warnings": [] } ``` The site and its numbers are made up for this example. - **`answer`** is the text. Every statement ends with one or more `[n]`. - **`citations[n-1]`** is the page behind `[n]`, and `quote` is the words of that page that support the statement. The quote was found, whole and unbroken, in the text we fetched. - **`sources`** is every page the writer was given. `how` says where its text came from: with the search result (`search`), a stored copy (`cached`), a live fetch (`live`) or a places lookup (`places`). `cited` says whether the answer uses it. Here three pages were fetched, two from stored copies and one live, and those are the `extract_cached` and `extract_live` lines of `usage`. The fourth came with its search result, so it was not fetched and has no line of its own. - **`uncited_removed`** is 1 here: the writer made three statements, and one had no quote that was in its page, so it was removed. - **`usage`** is 0 until the run ends. Then it is the one charge, line by line, with the counts behind it in `usage.steps`. - **`stop_reason`** says why the run stopped. `done` goes with `completed`. An `incomplete` run says `budget`, `time`, `no_sources`, `no_support` or `no_answer`: see [Errors](https://millionshort.com/docs/agent/errors#runs-that-end-incomplete). To fetch the result without the steps, ask for it alone. While the run is going this answers `202` with `"ready": false` and a `Retry-After` header; that is not an error. ```bash curl https://api.millionshort.com/v1/agent/$AGENT_ID/results \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" ``` ```python import os import requests r = requests.get( f"https://api.millionshort.com/v1/agent/{os.environ['AGENT_ID']}/results", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, timeout=30, ) r.raise_for_status() print(r.json()["data"]) ``` ```ts const res = await fetch(`https://api.millionshort.com/v1/agent/${process.env.AGENT_ID}/results`, { headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}` }, }); if (!res.ok) throw new Error(`GET /v1/agent/…/results failed: ${res.status}`); const { data } = (await res.json()) as { data: unknown }; console.log(data); ``` ## 4. Ask for data with a schema Send a JSON Schema as `schema`, and the answer comes back as `output` in that shape. ```bash curl https://api.millionshort.com/v1/agent \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "prompt": "Northbridge Transit fares in 2026: the monthly adult pass, the single fare, and when prices last changed.", "schema": { "type": "object", "properties": { "monthly_pass": { "type": "number" }, "single_fare": { "type": "number" }, "currency": { "type": "string" }, "last_changed": { "type": "string", "description": "YYYY-MM-DD" } } } }' ``` ```python import os from millionshort import MillionShort client = MillionShort(api_key=os.environ["MILLIONSHORT_API_KEY"]) run = client.start_agent( "Northbridge Transit fares in 2026: the monthly adult pass, the single fare, and when prices last changed.", schema={ "type": "object", "properties": { "monthly_pass": {"type": "number"}, "single_fare": {"type": "number"}, "currency": {"type": "string"}, "last_changed": {"type": "string", "description": "YYYY-MM-DD"}, }, }, ) done = client.wait_agent(run.id) print(done.output) print(done.field_citations, done.uncited_fields) ``` ```ts import { MillionShort } from 'millionshort'; const client = new MillionShort({ apiKey: process.env.MILLIONSHORT_API_KEY }); const run = await client.startAgent( 'Northbridge Transit fares in 2026: the monthly adult pass, the single fare, and when prices last changed.', { schema: { type: 'object', properties: { monthly_pass: { type: 'number' }, single_fare: { type: 'number' }, currency: { type: 'string' }, last_changed: { type: 'string', description: 'YYYY-MM-DD' }, }, }, }, ); const done = await client.waitAgent(run.id); console.log(done.output); console.log(done.field_citations, done.uncited_fields); ``` The parts of the result that differ: ```text "answer": null, "output": { "monthly_pass": 96, "single_fare": 3.25, "currency": "CAD", "last_changed": "2026-03-01" }, "field_citations": { "monthly_pass": [1], "last_changed": [1, 2], "currency": [1] }, "uncited_fields": ["single_fare"], ``` `field_citations` gives the citation numbers of each field. `uncited_fields` lists the fields that are filled and that no checked quote supports: here the run filled `single_fare`, and could not show a quote for it. The value is returned, and you are told. [Guides](https://millionshort.com/docs/agent/guides#fill-a-table-of-facts-from-a-schema) says what to do with such a field. ## 5. Follow the steps as they happen ```text GET https://api.millionshort.com/v1/agent/{id}/events ``` The steps of a run as server-sent events: `agent.step` for each step, then one `agent.done` when the run has ended. ```bash curl "https://api.millionshort.com/v1/agent/$AGENT_ID/events" -N \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" ``` ```python import os from millionshort import MillionShort client = MillionShort(api_key=os.environ["MILLIONSHORT_API_KEY"]) run = client.start_agent("What changed in Northbridge Transit fares in 2026?", processor="lite") for event in client.stream_agent_events(run.id): print(event["event"], event["data"]) ``` ```ts import { MillionShort } from 'millionshort'; const client = new MillionShort({ apiKey: process.env.MILLIONSHORT_API_KEY }); const run = await client.startAgent('What changed in Northbridge Transit fares in 2026?', { processor: 'lite' }); for await (const { event, data } of client.streamAgentEvents(run.id)) { console.log(event, data); } ``` ```text event: agent.step data: {"seq":1,"type":"started","at":"2026-11-20T14:02:11Z","processor":"lite","model":"fast"} event: agent.step data: {"seq":2,"type":"plan","at":"2026-11-20T14:02:12Z","searches":[{"query":"Northbridge Transit fare change 2026","source":"news"}]} event: agent.done data: {"id":"agt_01jd4f8q2m6r9t3v5x7z0b1c2d","status":"completed","stop_reason":"done","usage":{...}} ``` - A stream stays open for 5 minutes at most. The run goes on after it closes. If a stream ends with no `agent.done`, open it again with `?after=` and the last `seq` you saw. - `agent.done` carries `id`, `status`, `stop_reason` and `usage`. It does not carry the answer: fetch that with `GET /v1/agent/{id}` or `/results`. - A team may have 2 streams open at once. The stream of a run that has already ended answers at once and is not counted. - Streams also share a limit across all teams. When it is full, opening one answers `429 CAPACITY`: poll instead. - Closing a stream does not cancel the run. ## 6. Or be told by webhook Register an endpoint once ([Webhooks](https://millionshort.com/docs/webhooks)), then name it when you start a run: ```bash curl https://api.millionshort.com/v1/agent \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "prompt": "What changed in Northbridge Transit fares in 2026?", "webhook_id": "wh_01jd3v9k2m8q4r6s0t1u2v3w4x" }' ``` ```python import os import requests r = requests.post( "https://api.millionshort.com/v1/agent", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, json={ "prompt": "What changed in Northbridge Transit fares in 2026?", "webhook_id": "wh_01jd3v9k2m8q4r6s0t1u2v3w4x" }, timeout=30, ) r.raise_for_status() print(r.json()["data"]) ``` ```ts const res = await fetch('https://api.millionshort.com/v1/agent', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ "prompt": "What changed in Northbridge Transit fares in 2026?", "webhook_id": "wh_01jd3v9k2m8q4r6s0t1u2v3w4x" }), }); if (!res.ok) throw new Error(`POST /v1/agent failed: ${res.status}`); const { data } = (await res.json()) as { data: unknown }; console.log(data); ``` When the run ends, however it ends, an `agent.completed` event is delivered there. Its `data` has `id`, `status`, `stop_reason` and `credits_used`. It does not carry the answer: fetch the run by its `id`. The event is signed like every other delivery. ## 7. Cancel a run ```bash curl -X DELETE https://api.millionshort.com/v1/agent/$AGENT_ID \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" ``` ```python import os import requests r = requests.delete( f"https://api.millionshort.com/v1/agent/{os.environ['AGENT_ID']}", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, timeout=30, ) r.raise_for_status() print(r.json()["data"]) ``` ```ts const res = await fetch(`https://api.millionshort.com/v1/agent/${process.env.AGENT_ID}`, { method: 'DELETE', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}` }, }); if (!res.ok) throw new Error(`DELETE /v1/agent/… failed: ${res.status}`); const { data } = (await res.json()) as { data: unknown }; console.log(data); ``` A run that has not started ends at once and costs nothing. A run in progress shows `cancelling` until its current step stops, then `cancelled`; the work it did is charged, with no minimum, and the rest of the hold is handed back. Cancelling a run that has already ended changes nothing and returns it. In the SDKs this is `cancel_agent(id)` in Python and `cancelAgent(id)` in TypeScript. ## Next - [Parameters](https://millionshort.com/docs/agent/parameters): every field of the request and of the result, the processors and the tiers of `model`. - [Guides](https://millionshort.com/docs/agent/guides): a briefing held to your sources, a table of facts, choosing a processor and a cap, and use over MCP. - [Pricing and limits](https://millionshort.com/docs/agent/pricing): what a run is charged for. - [Errors](https://millionshort.com/docs/agent/errors): what is refused, and how a run can end. --- Source: https://millionshort.com/docs/agent/parameters Section: Endpoints / Agent # Agent parameters Every field of an Agent request, the processors and the model tiers, and everything a run returns. | Call | Does | Cost | |---|---|---| | `POST https://api.millionshort.com/v1/agent` | Starts a run. Answers `202` with the run | Metered: see [Pricing](https://millionshort.com/docs/agent/pricing) | | `GET https://api.millionshort.com/v1/agent/{id}` | Status, progress and steps; the result once the run has ended | Free | | `GET https://api.millionshort.com/v1/agent/{id}/results` | The result alone. `202` with `"ready": false` while the run is going | Free | | `GET https://api.millionshort.com/v1/agent/{id}/events` | The steps as server-sent events | Free | | `DELETE https://api.millionshort.com/v1/agent/{id}` | Cancels the run | Free; work already done is charged | ## Request Only `prompt` is required. Any field not listed here is a `400 INVALID_PARAM`. ### The question | Field | Type | Default | Example | Notes | |---|---|---|---|---| | `prompt` | string, 3 to 4,000 characters | required | `"prompt": "Which provinces changed their minimum wage in 2026, and to what?"` | The question, or the task. Say what you want to know, and for when | | `urls` | array of URLs, 1 to 10 | none | `"urls": ["https://example.org/report-2026"]` | Pages to read first, before any search. They pass the same URL rules, `robots.txt` and limits per site as [Extract](https://millionshort.com/docs/extract/parameters) | | `schema` | object: a JSON Schema | none | `"schema": { "type": "object", "properties": { "founded": { "type": "integer" } } }` | Must have `"type": "object"` and `properties`. The result then comes back as `output` in this shape, and `answer` is `null`. See [With a schema](#with-a-schema) | ### Where the run may look Each of these applies to every search the run makes. | Field | Type | Default | Example | Notes | |---|---|---|---|---| | `sources` | array of [source slugs](https://millionshort.com/docs/search/sources), 1 or more | the run chooses among all of them | `"sources": ["web", "news"]` | The sources the run may search | | `space` | string | none | `"space": "curated:home-cooking"` | A [Space](https://millionshort.com/docs/search/spaces): its sites and filters apply to every search. The request's own `include_domains` and `exclude_domains` win over the Space's | | `remove_top_sites` | integer, 0 to 1,000,000 | `0` | `"remove_top_sites": 1000` | [Removes the N most popular sites](https://millionshort.com/docs/search/remove-top-sites) from every search | | `include_domains` | array of strings, 1 to 20 | none | `"include_domains": ["canada.ca", "ontario.ca"]` | Search only these sites | | `exclude_domains` | array of strings, 1 to 50 | none | `"exclude_domains": ["pinterest.com"]` | Leave these sites out | | `start_date` | string, `YYYY-MM-DD` | none | `"start_date": "2026-01-01"` | Only results from this day on, on the sources that carry dates | ### How much work, and who writes | Field | Type | Default | Example | Notes | |---|---|---|---|---| | `processor` | `lite`, `standard` or `pro` | `standard` | `"processor": "lite"` | How much work the run may do. A ceiling on work, not a price. See [Processors](#processors) | | `model` | `auto` or one of the tiers in [Models](#models) | `auto` | `"model": "balanced"` | The model that writes the answer, by tier. Any other value is a `400` | | `max_credits` | integer, 10 up to your plan's per-run cap | The lesser of your plan's per-run cap and what the tier needs: 40, 120 and 1,500 for `lite`, `standard` and `pro`, raised to the least the chosen tier needs | `"max_credits": 60` | The most the run may cost. Held when the run starts. Above your plan's per-run cap, the request is refused with `400 INVALID_PARAM`. See [The per-run cap](#the-per-run-cap) and [The cap](https://millionshort.com/docs/agent/pricing#the-cap-is-a-hold) | ### The per-run cap `max_credits` may be at most your plan's per-run cap: Free 200, Starter 1,000, Growth 2,500, Scale 5,000, Business 10,000, Enterprise by agreement. - **Above the cap, nothing starts.** The request is refused with `400 INVALID_PARAM`. The message names the cap, `error.details.plan_max_credits` carries it, and nothing is held or charged. - **Left out,** `max_credits` is the lesser of your plan's cap and what the tier needs: the processor's own default, raised to the least the chosen tier needs. - **Every run is charged at least 5 credits** when it ends `completed` or `incomplete`. [Pricing and limits](https://millionshort.com/docs/agent/pricing) has the prices: searches and pages at their list prices, and model tokens per 1,000 by tier. ### Being told | Field | Type | Default | Example | Notes | |---|---|---|---|---| | `webhook_id` | string | none | `"webhook_id": "wh_01jd3v9k2m8q4r6s0t1u2v3w4x"` | An active [webhook](https://millionshort.com/docs/webhooks) endpoint of your team. An `agent.completed` event is delivered there when the run ends | ### The Idempotency-Key header | Header | Type | Example | Notes | |---|---|---|---| | `Idempotency-Key` | string, up to 255 characters | `Idempotency-Key: fares-2026-11-20` | Optional. Honoured for 24 hours | - The same key with the same body returns the run that key already made, as it stands now. Nothing new starts and nothing more is held. That answer is `200`, not `202`. - The same key with a different body is a `409 IDEMPOTENCY_CONFLICT`. - "The same body" means the same bytes. Send the JSON the same way when you retry. ## Processors `processor` sets the most a run may do. A run often does less: it stops searching when it has what the question needs. | Processor | Searches | Pages read | Follow-up searches | Second pass over citations | Writes on | Default `max_credits` | |---|---|---|---|---|---|---| | `lite` | up to 3 | up to 6 | none | no | `fast` | 40 | | `standard` | up to 6 | up to 12 | up to 2 | yes | `fast` | 120 | | `pro` | up to 12 | up to 24 | up to 4 | yes | `balanced` | 1,500 | - **Follow-up searches** come after the first round of reading. The run asks what the question still needs and searches for that. - **The second pass** reads each statement beside its quotes once more, and removes the statements the quotes do not show. See [How citations are enforced](https://millionshort.com/docs/agent#how-citations-are-enforced). - **The default `max_credits`** is raised to the least the chosen tier needs when that is higher (`lite` with `balanced` and no `max_credits` holds 125), and cut to your plan's per-run cap when the cap is lower. [Choosing a processor](https://millionshort.com/docs/agent/guides#choose-a-processor-a-model-and-a-cap) has advice. ## Models `model` chooses which model writes the answer. You choose a tier, not a model by name: which model runs a tier is ours to choose, and it can change. | `model` | What it is | Price of its tokens | Input, per 1,000 tokens | Output, per 1,000 tokens | Least `max_credits` | |---|---|---|---|---|---| | `auto` | The processor's own: `fast` on `lite` and `standard`, `balanced` on `pro` | as that tier | | | | | `fast` | The quickest and the cheapest (the default on `lite` and `standard`) | 1× | 0.4 | 2 | 10 | | `balanced` | A larger model, at a higher price (the default on `pro`) | 20× | 8 | 40 | 125 | | `best` | Our top-tier model, at the highest price | 40× | 16 | 80 | 245 | - **`auto` is the default,** and it is right for most runs. - **The multiplier** is the price of a tier's tokens against those of `fast`. A run that writes on a dearer tier pays that price for the writing step only. - **Planning and checking always run on `fast`,** whatever `model` says. Only the writing step changes. - **A dearer tier needs a higher cap.** `max_credits` under the tier's least value is a `400`, because less could not pay for an answer. On a plan whose per-run cap is under that value, the tier cannot be used at all: see [Errors](https://millionshort.com/docs/agent/errors#requests-that-are-refused). - Output tokens include the model's thinking. ## The run Every call returns the run in `data`, in the usual envelope with `request_id`, `usage` and `warnings`. | Field | Type | Notes | |---|---|---| | `id` | string | `agt_` and 26 characters. Names the run in every other call | | `status` | string | See [Status](#status) | | `processor` | string | As asked for, or `standard` | | `model` | string | The model that writes. `auto` is shown as the model it became | | `max_credits` | number | The cap of this run, after any rise to what the tier needs or cut to the plan's per-run cap | | `request` | object | The request as it was understood: the processor, the model, the cap and the fields you sent. `schema` is shown as `true` | | `progress` | object | Where the run is: `step`, `searches`, `pages_read`, `model_calls`, and `credits` spent so far | | `stop_reason` | string or null | Why the run ended. `null` until it has, and it stays `null` on a `failed` run: `error` says why. See [Stop reasons](#stop-reasons) | | `webhook_id` | string or null | The endpoint named at the start | | `created_at`, `started_at`, `finished_at` | timestamps | `started_at` and `finished_at` are `null` until they happen | | `error` | object | On a `failed` run only: `code` and `message` | | `steps` | array | What the run has done so far. On `GET /v1/agent/{id}`. See [Steps](#steps) | Once the run has ended, `GET /v1/agent/{id}` also carries the result: | Field | Type | Notes | |---|---|---| | `answer` | string or null | The answer, with `[n]` markers. Every statement has at least one. `null` with `schema`, and when nothing could be supported | | `output` | object or null | With `schema`: the answer as data, in your shape | | `citations` | array | One entry for each `[n]`. See [Citations](#citations) | | `sources` | array | Every page the writer was given. See [Sources](#sources) | | `uncited_removed` | integer | Statements removed because no quote of theirs was kept | | `verified` | boolean | On `standard` and `pro` only: `true` when the second pass over the citations was made. `false` when it could not be afforded, reached or read; the quote check alone then stands, and the answer is kept. Absent on `lite`, and on a `standard` or `pro` run that ended before it reached the second pass | | `field_citations` | object | With `schema`: each cited field of `output`, and its citation numbers | | `uncited_fields` | array of strings | With `schema`: the filled top-level fields that no checked quote supports | | `not_answered` | string | When the writer could tell: what the pages read did not answer | | `schema_error` | string | With `schema`: why no `output` could be given | | `attribution` | object | On a run that looked places up: the credit line (`text`, `url`) every [Places](https://millionshort.com/docs/places) answer carries. Show it, or a link to the page it names, wherever you show the answer. No parameter removes it | `sources` lists the pages the writer was given. When the pages read do not fit in the writing step (in what is left of `max_credits`, or in one model call), the last ones are left out of the run: they are not in `sources`, and nothing can cite them. The writer is given each page up to a length: 6,000 characters on `lite`, 8,000 on `standard` and `pro`. Runs are kept for 30 days after they end. ### Status | `status` | Meaning | |---|---| | `queued` | Accepted, not started yet | | `running` | Working. `progress` says where | | `cancelling` | A cancel was asked for and the current step is stopping | | `completed` | Ended with an answer. `stop_reason` is `done` | | `incomplete` | Ended early. It carries what it has, which may be an answer, a partial one or none. `stop_reason` says why | | `failed` | Ended without a result and without a charge: a fault on our side, which includes a run that was not started within 30 minutes, or a team that could not cover the run when it ended. `error` says which. `stop_reason` stays `null` | | `cancelled` | Ended because you cancelled it | The last four are endings: a run in one of them does not change again. ### Stop reasons | `stop_reason` | Goes with | Meaning | |---|---|---| | `done` | `completed` | The run finished | | `budget` | `incomplete` | The next step would have gone past `max_credits` | | `time` | `incomplete` | The run reached 10 minutes | | `no_sources` | `incomplete` | The searches found nothing the run could read | | `no_support` | `incomplete` | Pages were read, and no statement could be supported by a quote | | `no_answer` | `incomplete` | The model would not, or could not, write an answer in a form that can be checked | | `cancelled` | `cancelled` | You cancelled it | [Errors](https://millionshort.com/docs/agent/errors#runs-that-end-incomplete) says what to try for each. ### Steps Each entry of `steps` has `seq`, a number that only goes up, `type`, and `at`, when it happened. The rest depends on the type. | `type` | Also carries | |---|---| | `started` | `processor`, `model` | | `plan` | `searches`: the searches planned, each with `query` and `source`. `places`, when the question names somewhere | | `search` | `query`, `source`, `results`, and `new`: how many of them the run had not seen. A search that could not be served has `skipped` and is not charged | | `places` | The lookup, and `results` | | `read` | `asked` and `read`: pages asked for, and pages that came back | | `gap_check` | `searches`: the follow-up searches. On `standard` and `pro` | | `write` | `statements` and `quotes_checked`. With `schema`: `schema_valid` and `fields_with_quotes` | | `verify` | `checked` and `unsupported`: the second pass. On `standard` and `pro` | | `check` | `statements_kept` and `statements_removed`. With `schema`: `fields_cited` and `fields_uncited` | The steps say what the run did, not what it read: page text is never in a step. The list keeps the most recent steps of a long run. Treat the fields beyond `seq`, `type` and `at` as information for a person or a log; new ones can be added. ### Citations | Field | Type | Notes | |---|---|---| | `n` | integer | The number of the `[n]` marker. `citations[n-1]` is citation `n` | | `url` | string or null | The page. `null` for a citation of places | | `title` | string or null | | | `source` | string | The source the page came from | | `quote` | string | The words of the page that support the statement: one unbroken run of the text we fetched, at least 3 words and 12 characters | ### Sources | Field | Type | Notes | |---|---|---| | `url` | string or null | | | `title` | string or null | | | `source` | string | | | `how` | string | Where the text came from: `search` (it came with the search result), `cached` (a stored copy), `live` (fetched for this run) or `places` | | `cited` | boolean | Whether the answer cites it | ### With a schema - `schema` is a JSON Schema whose top level is `"type": "object"` with `properties`. Describe a field with `description` when its name does not say enough: the writer reads it. - `output` follows the schema. A field the pages did not answer can be left out or `null`, as your schema allows. - `field_citations` has an entry for each cited field, with its citation numbers: `"founded": [1, 3]`. - A top-level field counts as cited when a quote was kept for it or for a value inside it: a quote for `items[0].price` cites `items`. Read `field_citations` to see which values those were. - `uncited_fields` lists the top-level fields that are filled and have none. They are returned so that you can see them, and named so that you do not mistake them for checked ones. - `citations` and `sources` are as for a text answer. ### Usage `usage` is in the envelope, beside `data`. It is all zeros and empty objects until the run ends, because a run is charged once, at its end. `progress.credits` is the running figure before then. | Field | Notes | |---|---| | `credits` | What the run was charged | | `cost_usd` | The same amount in US dollars | | `breakdown` | The charge by line. See below | | `steps` | The counts behind it: `searches`, `pages_read`, `places_lookups`, `model_calls`, `input_tokens`, `output_tokens` | | Line of `breakdown` | What it is | |---|---| | `search` | The searches, per source searched | | `search_content` | The page text that came with search results | | `extract_cached` | Pages read from a stored copy | | `extract_live` | Pages fetched live | | `places` | Places lookups | | `model_input`, `model_output` | The model's tokens, in and out | | `minimum` | What was added to bring a small `completed` or `incomplete` run up to the least such a run is charged. Never on a cancelled run | | `over_cap_not_charged` | Negative. The part of a step that cost more than it was sized for. It is not charged, and the cap stands | A line that is zero is left out. [Pricing and limits](https://millionshort.com/docs/agent/pricing) has the price of each. ## The result alone ```text GET https://api.millionshort.com/v1/agent/{id}/results ``` | Field | Notes | |---|---| | `id`, `status` | As on the run | | `ready` | `false` while the run is going: the answer is `202`, with a `Retry-After` header. `true` once it has ended | | `stop_reason`, `answer`, `output`, `citations`, `sources`, `uncited_removed` | Once `ready` is `true`. As on the run, with `verified`, `field_citations`, `uncited_fields`, `not_answered`, `schema_error` and `attribution` where they apply | ## The event stream ```text GET https://api.millionshort.com/v1/agent/{id}/events ``` Server-sent events. `?after=` skips the steps up to that number. | Event | `data` | |---|---| | `agent.step` | One [step](#steps) | | `agent.done` | `id`, `status`, `stop_reason` and `usage`. Sent once, when the run has ended | A stream closes after `agent.done`, or after 5 minutes, whichever comes first. A team may have 2 open at once (`429 RATE_LIMITED` beyond). There is also a limit shared by all teams: when it is full the answer is `429 CAPACITY`, and you should poll instead. The [quickstart](https://millionshort.com/docs/agent/quickstart#5-follow-the-steps-as-they-happen) shows one being read. ## The webhook event `agent.completed` is delivered to `webhook_id` when the run ends, whatever its ending. Its `data` has `id`, `status`, `stop_reason` and `credits_used`. [Webhooks](https://millionshort.com/docs/webhooks) says how deliveries are signed and retried. ## Limits | Limit | Value | |---|---| | Runs going at once, per team | 3 | | Event streams open at once, per team | 2 | | The longest a run may take | 10 minutes | | The longest one event stream stays open | 5 minutes | | The longest a run waits to be started | 30 minutes; after that it ends `failed`, free | | How long a run is kept after it ends | 30 days | | `prompt` | 3 to 4,000 characters | | `urls` | up to 10 | | `include_domains`, `exclude_domains` | up to 20 and 50 | | `max_credits` | 10 or more, up to the plan's per-run cap; above it, `400 INVALID_PARAM` naming the cap | | `Idempotency-Key` | up to 255 characters, honoured for 24 hours | Polling is free and does not count against your plan's requests a minute. It has a limit of its own, high enough for a poll every second on each of your runs; past it a poll is `429 RATE_LIMITED` with `Retry-After`. --- Source: https://millionshort.com/docs/agent/guides Section: Endpoints / Agent # Agent guides The jobs Agent is built for, each as the requests that do it. ## Write a cited briefing held to your sources A briefing is only as good as what it was allowed to read. Three ways to say where a run may look. Each applies to every search the run makes. ### Named sites and sources For a question whose answer belongs to a few publishers, name them. ```bash curl https://api.millionshort.com/v1/agent \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "prompt": "What changed in federal rules on e-bike imports in 2026? Give the dates the changes took effect.", "sources": ["web", "news"], "include_domains": ["canada.ca", "gazette.gc.ca"], "start_date": "2026-01-01" }' ``` ```python import os from millionshort import MillionShort client = MillionShort(api_key=os.environ["MILLIONSHORT_API_KEY"]) run = client.start_agent( "What changed in federal rules on e-bike imports in 2026? Give the dates the changes took effect.", sources=["web", "news"], include_domains=["canada.ca", "gazette.gc.ca"], start_date="2026-01-01", ) done = client.wait_agent(run.id) print(done.answer) ``` ```ts import { MillionShort } from 'millionshort'; const client = new MillionShort({ apiKey: process.env.MILLIONSHORT_API_KEY }); const run = await client.startAgent( 'What changed in federal rules on e-bike imports in 2026? Give the dates the changes took effect.', { sources: ['web', 'news'], includeDomains: ['canada.ca', 'gazette.gc.ca'], startDate: '2026-01-01', }, ); const done = await client.waitAgent(run.id); console.log(done.answer); ``` - `sources` says which of our [sources](https://millionshort.com/docs/search/sources) the run may search. Left out, the run chooses. - `include_domains` holds every search to those sites. `exclude_domains` leaves sites out instead. - `start_date` keeps results from that day on, on the sources that carry dates. Web pages carry none, so say the period in the `prompt` as well. ### A Space A [Space](https://millionshort.com/docs/search/spaces) is a saved scope: sites, a popularity cut, page types and topics under one name. Name it, and every search of the run uses it. ```bash curl https://api.millionshort.com/v1/agent \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "prompt": "How do home bakers keep a sourdough starter alive through a two-week holiday?", "space": "curated:home-cooking" }' ``` ```python import os import requests r = requests.post( "https://api.millionshort.com/v1/agent", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, json={ "prompt": "How do home bakers keep a sourdough starter alive through a two-week holiday?", "space": "curated:home-cooking" }, timeout=30, ) r.raise_for_status() print(r.json()["data"]) ``` ```ts const res = await fetch('https://api.millionshort.com/v1/agent', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ "prompt": "How do home bakers keep a sourdough starter alive through a two-week holiday?", "space": "curated:home-cooking" }), }); if (!res.ok) throw new Error(`POST /v1/agent failed: ${res.status}`); const { data } = (await res.json()) as { data: unknown }; console.log(data); ``` `include_domains` and `exclude_domains` sent beside a `space` replace the Space's own lists. ### The web without its most popular sites `remove_top_sites` takes the N most popular sites out of every search, which leaves the specialist sites, the forums and the people who wrote from experience. It is the filter MillionShort is named for; [Remove the top sites](https://millionshort.com/docs/search/remove-top-sites) explains it. ```bash curl https://api.millionshort.com/v1/agent \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "prompt": "What do owners report about the long-term reliability of mid-drive motors on e-bikes?", "sources": ["web", "discussions"], "remove_top_sites": 10000 }' ``` ```python import os import requests r = requests.post( "https://api.millionshort.com/v1/agent", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, json={ "prompt": "What do owners report about the long-term reliability of mid-drive motors on e-bikes?", "sources": [ "web", "discussions" ], "remove_top_sites": 10000 }, timeout=30, ) r.raise_for_status() print(r.json()["data"]) ``` ```ts const res = await fetch('https://api.millionshort.com/v1/agent', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ "prompt": "What do owners report about the long-term reliability of mid-drive motors on e-bikes?", "sources": [ "web", "discussions" ], "remove_top_sites": 10000 }), }); if (!res.ok) throw new Error(`POST /v1/agent failed: ${res.status}`); const { data } = (await res.json()) as { data: unknown }; console.log(data); ``` A narrow scope has a cost: the run may find nothing, or nothing it can support. That is an `incomplete` run with `stop_reason` of `no_sources` or `no_support`, not a guess. Widen the scope and run it again. ### Reading the briefing - Show the citations with the text. `[n]` is `citations[n-1]`, and its `quote` is what a reader should be able to check. - Look at `uncited_removed`. A high number says the writer wanted to say more than the pages showed. - Look at `not_answered`. It says which part of the question the pages read did not answer. - On `standard` and `pro`, look at `verified`. `false` means the second pass over the citations was not made, and the answer rests on the quote check alone. - `sources` with `"cited": false` were read and not used. They are often worth a look. ## Fill a table of facts from a schema To fill a row of a table, send the row's shape as `schema`. To fill a table, start one run for each row. ```bash curl https://api.millionshort.com/v1/agent \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "prompt": "The public library system of Halifax, Nova Scotia: number of branches, annual operating budget, and the year of the figures.", "schema": { "type": "object", "properties": { "branches": { "type": "integer" }, "operating_budget": { "type": "number", "description": "Annual, in Canadian dollars" }, "figures_year": { "type": "integer" } } }, "processor": "standard" }' ``` ```python import os from millionshort import MillionShort client = MillionShort(api_key=os.environ["MILLIONSHORT_API_KEY"]) SHAPE = { "type": "object", "properties": { "branches": {"type": "integer"}, "operating_budget": {"type": "number", "description": "Annual, in Canadian dollars"}, "figures_year": {"type": "integer"}, }, } cities = ["Halifax, Nova Scotia", "Regina, Saskatchewan", "Victoria, British Columbia"] runs = [ client.start_agent( f"The public library system of {city}: number of branches, annual operating budget, and the year of the figures.", schema=SHAPE, idempotency_key=f"libraries-{city}", ) for city in cities ] for city, run in zip(cities, runs): done = client.wait_agent(run.id) row = done.output or {} unchecked = set(done.uncited_fields or []) for field, value in row.items(): print(city, field, value, "UNCHECKED" if field in unchecked else "cited") ``` ```ts const res = await fetch('https://api.millionshort.com/v1/agent', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ "prompt": "The public library system of Halifax, Nova Scotia: number of branches, annual operating budget, and the year of the figures.", "schema": { "type": "object", "properties": { "branches": { "type": "integer" }, "operating_budget": { "type": "number", "description": "Annual, in Canadian dollars" }, "figures_year": { "type": "integer" } } }, "processor": "standard" }), }); if (!res.ok) throw new Error(`POST /v1/agent failed: ${res.status}`); const { data } = (await res.json()) as { data: unknown }; console.log(data); ``` - **Keep the schema flat and small.** Citations are kept per top-level field. A handful of well-named fields does better than one deep object. - **Describe what a name does not say:** the unit, the currency, the date format. The writer reads `description`. - **Start the rows together, within the limit.** A team may have 3 runs going at once; a further start is a `429 RATE_LIMITED`. The loop above starts three. - **Give each row its own `Idempotency-Key`,** so that a retry of the loop does not pay for a row twice. ### What to do with uncited_fields `uncited_fields` names the fields that are filled and that no checked quote supports. The value may still be right. It has not been shown to be. - **In a table people will rely on:** treat the field as empty, or mark it. Do not show it as if it were cited. - **To try again:** run the row again with a narrower `prompt` about that one field, or with `urls` naming the page you expect to hold it. - **When it matters:** read the cited fields' quotes too. `field_citations` gives the numbers, and `citations` the quotes. A field that is missing from both `field_citations` and `uncited_fields` was not filled. A top-level field counts as cited when a quote was kept for it or for a value inside it. For a field that holds a list or an object, read `field_citations` to see which of its values the quotes are for; the others stand unchecked. This is one more reason to keep the schema flat. ## Choose a processor, a model and a cap ### The processor `processor` is how much work a run may do. It is a ceiling on work, not a price: a run pays for what it did. | Processor | Searches | Pages read | Follow-up searches | Second pass over citations | Writes on | Default `max_credits` | |---|---|---|---|---|---|---| | `lite` | up to 3 | up to 6 | none | no | `fast` | 40 | | `standard` | up to 6 | up to 12 | up to 2 | yes | `fast` | 120 | | `pro` | up to 12 | up to 24 | up to 4 | yes | `balanced` | 1,500 | - **`lite`** for a question with one answer that a page or two will hold: a price, a date, who holds a post. It is the fastest and the cheapest, and it has no second pass. - **`standard`**, the default, for most questions. It looks again for what is missing, and it checks each statement against its quotes a second time. - **`pro`** for a question with several parts, or one where sources disagree. It reads the most, and it writes on `balanced`, which is where most of its cost comes from. Start with `standard`. Move down when the answers are good and you want them faster; move up when `not_answered` keeps naming the same gap. ### The model Leave `model` as `auto` unless you have a reason. `auto` is `fast` on `lite` and `standard`, `balanced` on `pro`. | `model` | What it is | Price of its tokens | Input, per 1,000 tokens | Output, per 1,000 tokens | Least `max_credits` | |---|---|---|---|---|---| | `auto` | The processor's own: `fast` on `lite` and `standard`, `balanced` on `pro` | as that tier | | | | | `fast` | The quickest and the cheapest (the default on `lite` and `standard`) | 1× | 0.4 | 2 | 10 | | `balanced` | A larger model, at a higher price (the default on `pro`) | 20× | 8 | 40 | 125 | | `best` | Our top-tier model, at the highest price | 40× | 16 | 80 | 245 | A dearer tier writes from the same pages. It does not search more or read more: that is the processor. On our own small evaluation set, a dearer tier did not answer better: start with `auto`. Planning and checking run on `fast` whichever tier writes. ### The cap `max_credits` is the most a run may cost. It is held from your credits when the run starts, and what the run does not use is handed back when it ends. ```bash curl https://api.millionshort.com/v1/agent \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "prompt": "Compare the 2026 curbside composting rules of Vancouver, Calgary and Toronto.", "processor": "pro", "model": "balanced", "max_credits": 600 }' ``` ```python import os import requests r = requests.post( "https://api.millionshort.com/v1/agent", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, json={ "prompt": "Compare the 2026 curbside composting rules of Vancouver, Calgary and Toronto.", "processor": "pro", "model": "balanced", "max_credits": 600 }, timeout=30, ) r.raise_for_status() print(r.json()["data"]) ``` ```ts const res = await fetch('https://api.millionshort.com/v1/agent', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ "prompt": "Compare the 2026 curbside composting rules of Vancouver, Calgary and Toronto.", "processor": "pro", "model": "balanced", "max_credits": 600 }), }); if (!res.ok) throw new Error(`POST /v1/agent failed: ${res.status}`); const { data } = (await res.json()) as { data: unknown }; console.log(data); ``` - **Left out,** the cap is the lesser of your plan's per-run cap and what the tier needs: 40, 120 and 1,500 for `lite`, `standard` and `pro`, raised to the least the chosen tier needs (`lite` with `balanced` and no `max_credits` holds 125). - **Never above your plan's per-run cap:** Free 200, Starter 1,000, Growth 2,500, Scale 5,000, Business 10,000, Enterprise by agreement. A higher `max_credits` is refused with `400 INVALID_PARAM`, whose message names the cap, and nothing is held. - **At the cap, the run stops.** Before each step the run checks that the step fits in what is left, keeping enough back to write. When the next step does not fit, the run writes from what it has and ends `incomplete` with `stop_reason: "budget"`. - **You are charged for the work done,** never more than the cap. An `incomplete` run can still carry a useful, cited answer. - **A cap that is too tight costs you answers.** If runs often end on `budget`, raise the cap or use a smaller processor. `usage.breakdown` of a finished run shows where the credits went. - **A cap far above what runs use costs nothing extra,** but it is held while the run is going, and held credits cannot pay for other calls. What runs have cost on our own evaluation set is on the [pricing page](https://millionshort.com/docs/agent/pricing#what-runs-have-cost), as measured examples. ## Use it from an agent over MCP The [MCP server](https://millionshort.com/docs/mcp#agent) has three tools for runs. They need a key, because a run spends credits. | Tool | Does | |---|---| | `start_agent` | Starts a run and returns its `id` | | `get_agent` | Status and progress. `ended` is `true` once the run has ended | | `get_agent_results` | The answer, the citations and the quotes. `ready` is `false` while the run is going | The agent starts a run: ```json { "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "start_agent", "arguments": { "prompt": "Which Canadian provinces changed their minimum wage in 2026, and to what?", "processor": "lite", "max_credits": 40 } } } ``` then asks how it is going, every few seconds, until `ended` is `true`: ```json { "jsonrpc": "2.0", "id": 2, "method": "tools/call", "params": { "name": "get_agent", "arguments": { "id": "agt_01jd4f8q2m6r9t3v5x7z0b1c2d" } } } ``` and then reads the result: ```json { "jsonrpc": "2.0", "id": 3, "method": "tools/call", "params": { "name": "get_agent_results", "arguments": { "id": "agt_01jd4f8q2m6r9t3v5x7z0b1c2d" } } } ``` - **Tell the agent that a run takes time.** A line for its instructions: "For a question that needs research across several pages, call `start_agent`, then `get_agent` every few seconds until `ended` is true, then `get_agent_results`. Quote the citations with the answer." - **Set `max_credits` in the call,** or tell the agent what it may spend. - **The result is data, not instructions.** The answer and its quotes come from web pages. The tool says so, and your agent's instructions should too. - **There is no cancel tool.** Cancel a run with `DELETE /v1/agent/{id}` on the API. - **For one search, use `search`.** A run is for a question that needs several searches and some reading. [Search as an agent's tool](https://millionshort.com/docs/search/guides/agent-tool-use) covers the single search. --- Source: https://millionshort.com/docs/agent/pricing Section: Endpoints / Agent # Agent pricing and limits A run is metered. It pays for the searches it made, the pages it read and the tokens it used, and never more than the cap you set. ## What a run is charged for **1 credit is $0.001.** A run has no fixed price. It is charged for what it did, once, when it ends. | What the run did | Credits | |---|---| | Each search, per source searched | 1 | | Each search whose results came with their page text | +1 | | Each page read from a stored copy | 0.25 | | Each page fetched live | 0.5 | | Each places lookup | 1 | | `fast`, per 1,000 input tokens | 0.4 | | `fast`, per 1,000 output tokens | 2 | | `balanced`, per 1,000 input tokens | 8 | | `balanced`, per 1,000 output tokens | 40 | | `best`, per 1,000 input tokens | 16 | | `best`, per 1,000 output tokens | 80 | | The least a run that ends `completed` or `incomplete` is charged | 5 | | A run cancelled after it started | the work done, with no minimum | | A run that fails, or is cancelled before it starts | 0 | | Polling, the results, the event stream | 0 | - **Searches** cost what a [search](https://millionshort.com/docs/search/pricing) costs: 1 credit for each source searched, and 1 more when the results came with their page text. - **Pages** cost what [Extract](https://millionshort.com/docs/extract/pricing) costs: 0.25 from a stored copy, 0.5 fetched live. The run uses a stored copy when we hold one. - **A places lookup** costs what a [Places](https://millionshort.com/docs/places/pricing) call costs. - **Model tokens** are charged per 1,000, by the model that used them. Planning and checking always use `fast`. The writing step uses the model in `model`. Output tokens include the model's thinking. - **A search that could not be served, and a page that could not be fetched, cost nothing.** - **The least a run that ends `completed` or `incomplete` is charged is 5 credits.** A small run is brought up to it, and `usage.breakdown` shows the difference as `minimum`. A cancelled run pays for the work done, with no minimum. - **A run is never charged more than `max_credits`.** `usage` on the finished run has the charge line by line, and the counts behind it. [Parameters](https://millionshort.com/docs/agent/parameters#usage) lists the lines. ### Worked examples | Run | What it did | Credits | |---|---|---| | A short question on `lite` | 2 searches (2), page text with 2 of them (2), 2 pages from stored copies (0.5), 1 fetched live (0.5), 6,500 input tokens (2.6) and 600 output tokens (1.2) on `fast` | 8.8 | | A table of facts on `standard` | 4 searches (4), page text with 4 of them (4), 6 pages from stored copies (1.5), 2 fetched live (1), 16,000 input tokens (6.4) and 1,400 output tokens (2.8) on `fast` | 19.7 | | A run that found nothing to read | One search, no page worth reading, no answer written | 5 (the minimum) | | A run that failed on our side | Anything | 0 | The counts in the first two rows are made up to be typical. The credits follow from the prices above. ## The cap is a hold `max_credits` is the most a run may cost. 1. **Held at the start.** When the run starts, the whole cap is taken out of your credits. A team that cannot cover it gets `429 INSUFFICIENT_CREDITS`, and nothing starts. 2. **Checked at every step.** Before a search, a page or a model call, the run checks that it fits in what is left of the cap. 3. **Charged once, at the end.** The run is charged out of the hold for what it did. 4. **The rest is handed back** as soon as the run ends. So a run with a cap of 120 that used 19.7 holds 120 while it is going and costs 19.7. When the next step does not fit in what is left, the run stops gathering, writes from what it has, and ends `incomplete` with `stop_reason: "budget"`. It is charged for the work done. If a step turns out to cost more than the run allowed for, the difference is ours: you are still charged no more than the cap. | `max_credits` | Value | |---|---| | Default on `lite` | 40 | | Default on `standard` | 120 | | Default on `pro` | 1,500 | | The least it may be | 10, or the least the tier needs (below) | | The most it may be | Your plan's per-run cap (below) | Left out, `max_credits` is the lesser of your plan's per-run cap and what the tier needs: the processor's own default, raised to the least the chosen tier needs when that is higher (`lite` with `balanced` and no `max_credits` holds 125). ## What each ending costs | The run ends | Charged | |---|---| | `completed` | The work done, at least 5 credits | | `incomplete`, whatever the `stop_reason`: `budget`, `time`, `no_sources`, `no_support` or `no_answer` | The work done, at least 5 credits | | `cancelled`, after it started | The work done up to the cancel, with no minimum | | `cancelled`, before it started | 0 | | `failed`: a fault on our side, which includes a run not started within 30 minutes, or a team that could not cover the run when it ended | 0 | Polling a run, reading its result and reading its event stream are free. A request that is refused (`400`, `404`, `409`, `429`) costs nothing and holds nothing. A run is the team's work, not one key's: a key's monthly cap does not count it. ## By plan The most `max_credits` may be is your plan's per-run cap. Every plan can start runs, the Free plan included. | Plan | The most `max_credits` may be, per run | |---|---| | Free | 200 | | Starter | 1,000 | | Growth | 2,500 | | Scale | 5,000 | | Business | 10,000 | | Enterprise | by agreement (10,000 until agreed) | On Enterprise the per-run cap is set by agreement, and the number in the table holds until it is. A request with `max_credits` above your plan's cap is refused with `400 INVALID_PARAM`: the message names the cap, `error.details.plan_max_credits` carries it, and nothing is held or charged. ## By tier | `model` | What it is | Price of its tokens | Input, per 1,000 tokens | Output, per 1,000 tokens | Least `max_credits` | |---|---|---|---|---|---| | `auto` | The processor's own: `fast` on `lite` and `standard`, `balanced` on `pro` | as that tier | | | | | `fast` | The quickest and the cheapest (the default on `lite` and `standard`) | 1× | 0.4 | 2 | 10 | | `balanced` | A larger model, at a higher price (the default on `pro`) | 20× | 8 | 40 | 125 | | `best` | Our top-tier model, at the highest price | 40× | 16 | 80 | 245 | - The multiplier is against `fast`, the cheapest tier. - **A tier has a least `max_credits`:** the smallest cap that could pay for it to write an answer at all. For `balanced` it is 125, for `best` 245. A lower cap is a `400 INVALID_PARAM`, and `error.details.min_max_credits` says the least. - **On a plan whose per-run cap is under that value, the tier cannot be used.** That is a `400 UNSUPPORTED_OPTION`. On the Free plan, with a per-run cap of 200, that rules out `best`. - A `pro` run writes on `balanced` unless you say otherwise, which is why its default cap is so much higher. ## What runs have cost > **Measured examples, not prices.** These come from runs of our own evaluation set of 16 prompts on 2026-11-20. Your questions are not ours. A run can cost several times these figures, or the minimum, and the numbers will move as the endpoint changes. Nothing here is a quote or a promise. What a run costs is what its `usage` says. | Processor | Prompts run | Time, at the median | Credits a run, on average | |---|---|---|---| | `lite` | 16 of 16 | about 6 seconds | about 10 | | `standard` | 16 of 16 | about 10 seconds | about 18 | | `pro` | 3 of 16 | about 20 seconds | about 370 | On that set, `lite` answered 13 of 16 correctly, `standard` answered 14 of 16 correctly, `pro` answered 2 of 3 (three prompts) correctly, and when we fetched the cited pages again about four in five quotes were still found in them (pages change; a run checks a quote against the copy it read). One thing to take from those runs: on `pro`, most of the cost was the `balanced` tier's tokens, not the searching or the reading. To find out what your own questions cost, run a few with a generous cap and read `usage.breakdown`. ## Limits | Limit | Value | |---|---| | Runs going at once, per team | 3 | | Event streams open at once, per team | 2 | | The longest a run may take | 10 minutes | | The longest one event stream stays open | 5 minutes | | The longest a run waits to be started | 30 minutes; after that it ends `failed`, free | | How long a run is kept after it ends | 30 days | | `prompt` | 3 to 4,000 characters | | `urls` | up to 10 | | `include_domains`, `exclude_domains` | up to 20 and 50 | | `max_credits` | 10 or more, up to the plan's per-run cap; above it, `400 INVALID_PARAM` naming the cap | | `Idempotency-Key` | up to 255 characters, honoured for 24 hours | - **Runs at once.** Starting another run while 3 are going is a `429 RATE_LIMITED` with `retry_after_seconds`. Wait for one to end. - **Event streams at once.** Opening another is a `429 RATE_LIMITED`. Close one, or poll. The stream of a run that has ended is not counted. There is also a limit shared by all teams: when it is full, opening a stream is a `429 CAPACITY`, and you should poll instead. - **Time.** A run that reaches 10 minutes ends `incomplete` with `stop_reason: "time"`. A run that is not started within 30 minutes is not run: it ends `failed`, free. - **Kept.** A run can be read for 30 days after it ends. - **Polling** is free and does not count against your plan's requests a minute. It has a limit of its own, high enough for a poll every second on each of your runs. - **The searches and pages of a run** are subject to the same rules as your own calls: `robots.txt`, the URL rules, and the [daily limit per site](https://millionshort.com/docs/extract/parameters#the-daily-limit-per-site). [Credits and limits](https://millionshort.com/docs/credits-and-limits) has each plan's credits and rate limits. ## Your data Agent runs send your question and the pages read to our AI model provider (a sub-processor); they are not used for training. The [privacy policy](https://millionshort.com/privacy) says how we handle data. --- Source: https://millionshort.com/docs/agent/errors Section: Endpoints / Agent # Agent errors A request that is refused is an HTTP error and costs nothing. A run that started and could not finish is not an error; its status says how it ended. There are two kinds of trouble, and they look different. - **The request is refused.** `POST /v1/agent` answers with an HTTP error in the one [error shape](https://millionshort.com/docs/errors#the-error-shape) every endpoint uses. No run exists, nothing is held and nothing is charged. - **The run ends early.** The start answered `202`, the run exists, and it ended `incomplete`, `failed` or `cancelled`. That is not an HTTP error: `GET /v1/agent/{id}` answers `200`, and `status` and `stop_reason` say what happened. ## Requests that are refused | Status and code | When | What to do | |---|---|---| | `400 INVALID_PARAM` | A field the API does not take; no `prompt`, or one outside 3 to 4,000 characters; a `schema` that is not an object schema with `properties`; a `model` or `processor` that is not on the list; a value of the wrong type or out of range | Fix the request. `message` names the field | | `400 INVALID_PARAM` with `details.plan_max_credits` | `max_credits` is above your plan's per-run cap (Free 200, Starter 1,000, Growth 2,500, Scale 5,000, Business 10,000, Enterprise by agreement). The message names the cap; `details` has `max_credits` as sent and `plan_max_credits`, the cap | Send a cap at or under `details.plan_max_credits`, or leave it out | | `400 INVALID_PARAM` with `details.min_max_credits` | `max_credits` is under what the chosen tier needs to write an answer at all | Send at least `details.min_max_credits`, or choose a cheaper tier | | `400 UNSUPPORTED_OPTION` | The tier needs a cap your plan's per-run cap cannot reach. `details` has `model`, `min_max_credits` and `plan_max_credits` | Choose another tier, or a plan with a higher per-run cap | | `401 AUTH_MISSING_KEY`, `401 AUTH_INVALID_KEY` | No `Authorization` header, or a key that is malformed, revoked or expired | Send a valid key | | `404 JOB_NOT_FOUND` | No run with that id for your team. Another team's run is answered the same way | Check the id | | `404 SPACE_NOT_FOUND` | The `space` named at the start is not a Space you can use | Check the slug, or leave `space` out | | `409 IDEMPOTENCY_CONFLICT` | The `Idempotency-Key` was already used, in the last 24 hours, with a different body | Use a new key for a new request. To retry, send the same bytes | | `429 INSUFFICIENT_CREDITS` | Your credits do not cover `max_credits`, which is held when a run starts | Lower `max_credits`, or add credits | | `429 RATE_LIMITED` | 3 runs are already going for your team; or 2 event streams are already open; or polls are coming too fast | Wait `retry_after_seconds`. For runs, wait for one to end. For streams, close one or poll | | `429 CAPACITY` | Opening an event stream when every stream we offer, across all teams, is in use | Poll `GET /v1/agent/{id}` instead. The run is not affected | ```json { "error": { "code": "INVALID_PARAM", "message": "max_credits must be at least 125 for model \"balanced\": less cannot pay for an answer.", "retry_after_seconds": null, "details": { "param": "max_credits", "model": "balanced", "min_max_credits": 125 } }, "request_id": "req_01JD4FAB5P9V2X6Z8B0C" } ``` A cap above the plan's, on the Free plan: ```json { "error": { "code": "INVALID_PARAM", "message": "max_credits of 300 is above this plan's per-run cap of 200. Send 200 or less, or leave max_credits out; a plan with a higher cap allows more.", "retry_after_seconds": null, "details": { "param": "max_credits", "max_credits": 300, "plan_max_credits": 200 } }, "request_id": "req_01JD4FAC7R2W4Y6A8C1D" } ``` Nothing is held for it, and nothing is charged. In the SDKs, `400 INVALID_PARAM` is a `ValidationError`, `400 UNSUPPORTED_OPTION` an `UnsupportedOptionError`, a `404` a `NotFoundError`, `429 INSUFFICIENT_CREDITS` an `InsufficientCreditsError`, `429 RATE_LIMITED` a `RateLimitError` and `429 CAPACITY` a `CapacityError`. Each carries `details` and `retry_after_seconds`. Notes: - **The limits on `max_credits` are checked before anything is held.** A refused start costs nothing. - **A `webhook_id` must be an active endpoint of your team.** One that is not, or is not verified yet, is a `400 INVALID_PARAM`. - **`GET /v1/agent/{id}/results` on a run that is still going is not an error.** It answers `202` with `"ready": false` and a `Retry-After` header. - **Runs are kept for 30 days after they end.** - **A stream that closes is not an error either.** A stream stays open 5 minutes at most. Open it again with `?after=` and the last `seq` you saw. [Errors](https://millionshort.com/docs/errors) says which errors are worth retrying, for every endpoint. ## Runs that end incomplete An `incomplete` run ended before it was done. `stop_reason` says why. It is charged for the work it did, at least 5 credits, and it is not an error: read what it carries. | `stop_reason` | What happened | What it carries | Try next | |---|---|---|---| | `budget` | The next step did not fit in what was left of `max_credits` | Usually an answer, written from what was read before the cap. It may cover less of the question | Raise `max_credits`, or use a smaller `processor` or a cheaper tier | | `time` | The run reached 10 minutes | No answer | Ask a narrower question, or use a smaller `processor` | | `no_sources` | The searches found nothing the run could read | No answer | Widen the scope: fewer `include_domains`, a smaller `remove_top_sites`, more `sources`, an earlier `start_date`. Or name pages in `urls` | | `no_support` | Pages were read, and no statement could be supported by a quote from them | No answer. `sources` lists what was read, and `not_answered` may say what was missing | Rephrase the question to what pages state outright, or widen the scope | | `no_answer` | The model would not, or could not, write an answer in a form that can be checked | No answer. `sources` lists what was read | Run it again. If it repeats, rephrase the question | A run that ended on `budget` with an answer is still held to the same checks: every statement in it has a quote. A run that ends `completed` can still say that one check was not made. On `standard` and `pro`, `verified: false` means the second pass over the citations could not be afforded, reached or read. The answer is kept, every quote in it was still found in its page, and only the second reading is missing. Run it again, or with a higher `max_credits`, if you need that pass. ## Runs that fail `failed` means the run ended with no result and no charge. Whatever was held is handed back. Nearly always the fault is ours: a worker stopped, the model or our own service could not be reached, or the run waited 30 minutes without being started. One case is not ours: a run whose `error.code` is `INSUFFICIENT_CREDITS` ended when the team could not cover it. Nothing was charged for that either. - `error` on the run has a `code` and a `message` that says what we know. `stop_reason` stays `null` on a failed run. - A failed run is not started again by us. Start a new one. With an `Idempotency-Key`, use a new key: the old key still returns the failed run. - If it keeps happening, send us the run's `id` and the `request_id` of the start. ## Runs that are cancelled `cancelled` means you sent `DELETE /v1/agent/{id}`. - A run that had not started ends at once and costs nothing. - A run in progress shows `cancelling` until its current step stops, and then `cancelled`. The work done is charged, with no minimum; the rest of the hold is handed back. It carries no answer. - Cancelling a run that has already ended changes nothing. The answer is `200` with the run as it is. ## Checking a run in code Treat the four endings differently, and read `stop_reason` on `incomplete`: ```python import os from millionshort import MillionShort, RateLimitError, ValidationError client = MillionShort(api_key=os.environ["MILLIONSHORT_API_KEY"]) try: run = client.start_agent("What changed in Northbridge Transit fares in 2026?", max_credits=60) except ValidationError as error: # details says what the limit is: plan_max_credits or min_max_credits raise SystemExit(f"{error.message} {error.details}") except RateLimitError as error: raise SystemExit(f"Too many runs at once. Try again in {error.retry_after_seconds} seconds.") done = client.wait_agent(run.id) if done.status == "completed": print(done.answer) elif done.status == "incomplete": print("Ended early:", done.stop_reason) if done.answer: print(done.answer) elif done.status == "failed": # nothing was charged; the run id and the start's request id are what to send us print("Failed:", done.error["message"], run.id, run.request_id) else: print("Cancelled.") print(done.usage.credits) ``` ```ts import { MillionShort, RateLimitError, ValidationError } from 'millionshort'; const client = new MillionShort({ apiKey: process.env.MILLIONSHORT_API_KEY }); try { const run = await client.startAgent('What changed in Northbridge Transit fares in 2026?', { maxCredits: 60 }); const done = await client.waitAgent(run.id); if (done.status === 'completed') { console.log(done.answer); } else if (done.status === 'incomplete') { console.log('Ended early:', done.stop_reason); if (done.answer) console.log(done.answer); } else if (done.status === 'failed') { // nothing was charged; the run id and the start's request id are what to send us console.log('Failed:', done.error?.message, run.id, run.requestId); } else { console.log('Cancelled.'); } console.log(done.usage?.credits); } catch (error) { if (error instanceof ValidationError) { // details says what the limit is: plan_max_credits or min_max_credits console.error(error.message, error.details); } else if (error instanceof RateLimitError) { console.error(`Too many runs at once. Try again in ${error.retryAfterSeconds} seconds.`); } else { throw error; } } ``` --- Source: https://millionshort.com/docs/mcp Section: Build with # MCP server One address, the tools of every endpoint, with or without a key. MillionShort runs a hosted [Model Context Protocol](https://modelcontextprotocol.io) server. Point an MCP client at one address and the agent can search our own independent index: the web, plus news, discussions, podcasts, academic and other specialist sources. There is nothing to install. ## The address ```text https://mcp.millionshort.com/mcp ``` The server speaks streamable HTTP. It keeps no session: every request is checked and answered on its own. ## With a key or without | Mode | How | What the agent gets | |---|---|---| | **API key** | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, with your plan's limits. Calls are charged to your credits at the same rate as the API. | | **No key** | Send no `Authorization` header | `search` and `list_sources` (source names only). One source and up to 5 results per search, no `explain`. 10 free searches a day per visitor, at most 5 in a minute. | The no-key mode is meant for trying the server and for chat assistants that have no way to send a key. It gives 10 searches a day; a free key gives more. A visitor is the address the connection comes from (for IPv6, its /64 network), and a day is a UTC day. Every answer to a no-key search says how many searches are left today: `allowance.searches_left_today` (and `allowance.searches_per_day`) in the structured answer, and a last line of the text. When the 10 are used up, `search` returns the error "10 free searches a day without a key; get a free key at" followed by the address of the [dashboard](https://millionshort.com/app/), where a key is free. Past 5 in a minute, it says how many seconds to wait. All callers without a key also share a daily total; when that is used up, `search` says so. Signing in through the client (OAuth) is not available yet. Get a key in the [dashboard](https://millionshort.com/app/). [Authentication](https://millionshort.com/docs/authentication) covers keys in full. ## Tools | Tool | What it does | Without a key | |---|---|---| | `search` | Searches MillionShort's own independent index: the web, plus news, discussions, podcasts, academic and other specialist sources. Returns ranked results with title, URL, site, date, snippet, a popularity band, how visits to the site are moving, where it is popular and what it is built with. What sets it apart is control over which sites and pages come back: - Popularity: remove the N most popular sites to reach lesser-known ones (remove_top_sites), keep only them (only_top_sites), or pick popularity bands (popularity_buckets). - Domains: only (include_domains), block (exclude_domains), boost or bury. - Page types (formats such as tutorials, documentation, forums, listicles) and topics: keep only, exclude, boost or bury. - Site signals: sites with rising or falling visits (traffic_trend), sites popular in a country (popular_in), sites built with a given technology (site_tech), no risky sites (exclude_risky). - Date (start_date, end_date, time_range), language and country. - More text per result: highlights, the passages that answer the query (max_highlights), and the text of the page itself (include_content). A filter that a source cannot apply is reported in a note, never dropped silently; list_sources says which filters each source applies. | Yes, with smaller limits | | `get_domain_info` | Returns the popularity rank and band, and the risk level and categories, for up to 25 domains. | No | | `list_sources` | Lists the sources the search tool accepts, with a one-line description of each, how often new material arrives in it and which search filters it applies. Also lists the page types, topics, traffic trends and popularity bands. | Yes, with smaller limits | These three tools only read. Each carries a `title` and the annotations `readOnlyHint: true`, `destructiveHint: false`, `idempotentHint: true`, `openWorldHint: true`, so a client can allow them without asking each time. The other endpoints have tools too, each described with its endpoint: [`extract`](https://millionshort.com/docs/extract/parameters#over-mcp), [`list_monitor_events`](https://millionshort.com/docs/monitor/parameters), and below, [Map and Crawl](#map-and-crawl), [Spaces](#spaces) and [Places](#places). ### search | Argument | Type | Default | Notes | |---|---|---|---| | `query` | string, 1 to 400 characters | | Required. What to search for. | | `sources` | array of `web`, `news`, `smallweb`, `discussions`, `hn`, `social`, `communities`, `podcasts`, `academic`, `medical`, `law`, `finance`, `contracts`, 1 to 5 items | `["web"]` | Sources to search, up to 5. list_sources describes each one. | | `num_results` | integer, 1 to 50 | `10` | How many results to return (1 to 50). | | `remove_top_sites` | integer, 0 to 1,000,000 | | Remove results from the N most popular sites, for example 1000 or 100000. Cannot be combined with only_top_sites. | | `only_top_sites` | integer, 0 to 1,000,000 | | Keep only results from the N most popular sites. Cannot be combined with remove_top_sites. | | `include_domains` | array of strings (each 1 to 253 characters), up to 25 | | Return results from these domains only. | | `exclude_domains` | array of strings (each 1 to 253 characters), up to 25 | | Never return results from these domains. | | `boost_domains` | array of strings (each 1 to 253 characters), up to 25 | | Rank results from these domains higher. | | `bury_domains` | array of strings (each 1 to 253 characters), up to 25 | | Rank results from these domains lower. | | `only_domains` | array of strings (each 1 to 253 characters), up to 25 | | Another name for include_domains, for example ["example.org"]. Both lists are merged. | | `block_domains` | array of strings (each 1 to 253 characters), up to 25 | | Another name for exclude_domains, for example ["example.com"]. Both lists are merged. | | `page_types` | array of `research`, `directories`, `creative-writing`, `support`, `comments`, `faqs`, `reference`, `legal`, `listicles`, `news`, `articles`, `companies`, `press-releases`, `profiles`, `blogs`, `products`, `forums`, `spam`, `data`, `documentation`, `transcripts`, `tutorials`, `reviews`, up to 23 | | Keep only these page types (formats), for example ["tutorials", "documentation"]. Applied by web and news. | | `exclude_page_types` | array of `research`, `directories`, `creative-writing`, `support`, `comments`, `faqs`, `reference`, `legal`, `listicles`, `news`, `articles`, `companies`, `press-releases`, `profiles`, `blogs`, `products`, `forums`, `spam`, `data`, `documentation`, `transcripts`, `tutorials`, `reviews`, up to 23 | | Never return these page types, for example ["listicles", "spam"]. | | `boost_page_types` | array of `research`, `directories`, `creative-writing`, `support`, `comments`, `faqs`, `reference`, `legal`, `listicles`, `news`, `articles`, `companies`, `press-releases`, `profiles`, `blogs`, `products`, `forums`, `spam`, `data`, `documentation`, `transcripts`, `tutorials`, `reviews`, up to 23 | | Rank these page types higher, for example ["documentation"]. | | `bury_page_types` | array of `research`, `directories`, `creative-writing`, `support`, `comments`, `faqs`, `reference`, `legal`, `listicles`, `news`, `articles`, `companies`, `press-releases`, `profiles`, `blogs`, `products`, `forums`, `spam`, `data`, `documentation`, `transcripts`, `tutorials`, `reviews`, up to 23 | | Rank these page types lower, for example ["forums"]. | | `topics` | array of `adult`, `art`, `programming`, `law`, `education`, `hardware`, `entertainment`, `social-life`, `fashion`, `business`, `food`, `games`, `health`, `history`, `home`, `industry`, `literature`, `politics`, `religion`, `science`, `software`, `sports`, `transport`, `travel`, up to 24 | | Keep only these topics, for example ["science", "health"]. Applied by web and news. | | `exclude_topics` | array of `adult`, `art`, `programming`, `law`, `education`, `hardware`, `entertainment`, `social-life`, `fashion`, `business`, `food`, `games`, `health`, `history`, `home`, `industry`, `literature`, `politics`, `religion`, `science`, `software`, `sports`, `transport`, `travel`, up to 24 | | Never return these topics, for example ["adult"]. | | `boost_topics` | array of `adult`, `art`, `programming`, `law`, `education`, `hardware`, `entertainment`, `social-life`, `fashion`, `business`, `food`, `games`, `health`, `history`, `home`, `industry`, `literature`, `politics`, `religion`, `science`, `software`, `sports`, `transport`, `travel`, up to 24 | | Rank these topics higher, for example ["programming"]. | | `bury_topics` | array of `adult`, `art`, `programming`, `law`, `education`, `hardware`, `entertainment`, `social-life`, `fashion`, `business`, `food`, `games`, `health`, `history`, `home`, `industry`, `literature`, `politics`, `religion`, `science`, `software`, `sports`, `transport`, `travel`, up to 24 | | Rank these topics lower, for example ["entertainment"]. | | `popularity_buckets` | array of `top-100`, `top-1k`, `top-10k`, `top-100k`, `top-1m`, `long-tail`, up to 6 | | Keep only results whose site is in one of these popularity bands, for example ["long-tail", "top-1m"]. long-tail is outside the 1,000,000 most popular sites. | | `traffic_trend` | array of `rising`, `spiking`, `steady`, `falling`, `dropped`, `new`, up to 6 | | Keep only results whose site has visits moving this way, for example ["rising", "spiking"]. rising: growing. spiking: jumped sharply in the last days. steady: no clear change. falling: shrinking. dropped: fell sharply in the last days. new: the site appeared recently. Few sites are moving at any one time, so expect fewer results. | | `popular_in` | array of strings (each 2 to 2 characters), up to 10 | | Keep only results whose site is popular in any of these countries (two-letter codes), for example ["DE", "AT"]. | | `site_tech` | array of strings (each 1 to 40 characters), up to 10 | | Keep only results whose site is built with any of these, for example ["wordpress", "woocommerce"]. Upper and lower case are the same. Each result lists what its site is built with. | | `exclude_risky` | boolean | `false` | Drop results whose site carries a risk label, for example true. | | `start_date` | string | | Results published on or after this day (YYYY-MM-DD), for example "2026-01-01". Applied by sources that carry dates; web pages carry none. | | `end_date` | string | | Results published on or before this day (YYYY-MM-DD), for example "2026-06-30". | | `time_range` | `day`, `week`, `month`, `year` | | The last 1, 7, 30 or 365 days, for example "week". Cannot be combined with start_date or end_date. | | `language` | string, 2 to 2 characters | | Results in this language (two-letter code), for example "de". Web results store no language: theirs is detected from the text. | | `country` | string, 2 to 2 characters | | Results from this country (two-letter code), for example "GB". For web and news: sites with the domain ending of that country. | | `max_highlights` | integer, 0 to 5 | `0` | Return up to this many passages per result that answer the query most directly, for example 3. | | `highlight_characters` | integer, 100 to 600 | `300` | Target length of one highlight, in characters, for example 200. Needs max_highlights. | | `safe_search` | `off`, `moderate`, `strict` | `"moderate"` | Adult-content filter. | | `max_chars_per_result` | integer, 0 to 2,000 | `800` | Longest snippet per result, in characters. | | `include_content` | boolean | `false` | Add the text of each page to its result, for example true. It is the copy already held, with the dates it was captured between; the site is not contacted. For web and news results. Each result that comes back with its text adds to the cost of the call. Needs a key. | | `max_characters` | integer, 500 to 50,000 | `10000` | Longest page text per result, in characters, for example 4000. Needs include_content. One answer holds at most 60,000 characters of page text, shared by its results, so this is lowered to fit when num_results is large. Needs a key. | | `explain` | boolean | `false` | Add a short list of reasons each result matched. Needs a key. | Without a key, `sources` takes one source, `num_results` goes up to 5 and `explain` is left out. The arguments mean what the same fields mean in the [Search reference](https://millionshort.com/docs/search/parameters). With [Spaces](#spaces), `search` also takes `space`: a saved scope, by name. ### get_domain_info | Argument | Type | Default | Notes | |---|---|---|---| | `domains` | array of strings (each 1 to 253 characters), 1 to 25 items | | Required. Domain names, for example ["example.com"]. | ### list_sources No arguments. With a key it returns the sources with a one-line description of each, and the page types and topics that `search` accepts. Without a key it returns the names of the sources only. ## Filters your agent can use The `search` tool is not only a query box. With a key, it takes the filters that set this search apart, under the same names as the API: | Argument | What the agent can ask for | |---|---| | `remove_top_sites` | The web without its N most popular sites, to reach specialist and first-hand pages | | `only_top_sites` | Only the N most popular sites: the mainstream view | | `boost_domains`, `bury_domains` | Named sites first, or last | | `exclude_domains`, `include_domains` | Named sites removed, or searched alone | | `page_types` | Kinds of page: forums, comments, tutorials, documentation, reviews, research and others, 23 in all. Acts on `web` and `news` results | | `topics` | Subjects: programming, health, business, food and others, 24 in all. Acts on `web` and `news` results | | `exclude_page_types`, `exclude_topics`, and the `boost_` and `bury_` forms | Kinds of page or subjects left out, moved ahead or moved to the end | | `start_date`, `end_date`, `time_range`, `language`, `country` | Dates, language and country, on the sources that carry them. Web pages have no date, so a date filter is not applied to `web`, and the answer says so | | `popularity_buckets`, `traffic_trend`, `popular_in`, `site_tech`, `exclude_risky` | Sites by popularity bucket, by how their visits are moving, by the countries they are popular in, by what they are built with, or without the ones that carry a risk label | | `max_highlights` | The passages of each result that best answer the query | | `include_content` | The text of the page as we hold it, on `web` and `news` results. It needs a key and adds 1 credit to the call for up to 10 results that come back with text | | `safe_search` | `off`, `moderate` or `strict` | Every result also says how popular its site is, and `get_domain_info` returns popularity and risk for any site. `list_sources` returns the page types and topics. Models do not reach for these unless told to. Add a few lines to your agent's instructions; [Filters for agents](https://millionshort.com/docs/search/filters#what-to-tell-your-agent) has a block to paste, and recipes such as long-tail forum discussions on a topic with no product pages. ## Map and Crawl Four tools let an agent find the pages of a site and read them. All four need a key: there is no no-key mode for them. A tool call costs what the API call behind it costs. | Tool | What the agent can do | Cost | |---|---|---| | `map` | List the URLs of a site, or find one page inside it | 1 credit per 10 URLs returned | | `crawl` | Start a crawl of a site and get a job back | 1 credit a page that comes back, in `live` | | `crawl_status` | Read a crawl's progress and a page of its results | Free | | `crawl_cancel` | Stop a crawl | Free | ### map Lists the URLs of a site from its sitemaps, the links of the page named and our own index. It only reads. The arguments are the fields of a [Map request](https://millionshort.com/docs/map/parameters#request): `url`, `search`, `limit`, `include_subdomains`, `include`, `exclude` and `sources`. Over MCP, `limit` is 100 when left out and at most 1,000 (the API's own default is 500 and its maximum 5,000), so that the list fits what a model can read. A map that fails or finds nothing is free. ### crawl Starts a crawl and returns the job at once, with its id. It takes these fields of a [crawl request](https://millionshort.com/docs/crawl/parameters#request) and no others: `url`, `max_pages`, `max_depth`, `include`, `exclude`, `same_domain`, `include_subdomains`, `sitemap`, `mode`, `topics`, `page_types`, `source_hints` and `remove_top_sites`. Pages always come back as Markdown. `formats`, `max_chars`, `json` and `webhook_id` are for the API and the SDKs. The price of `max_pages` pages is held when the crawl starts, and what it does not use is handed back. robots.txt is always honoured, and every page carries its [labels](https://millionshort.com/docs/extract/labels). ### crawl_status Takes `crawl_id` and returns the crawl's `status`, its counts, and the pages finished so far, each as text with its labels: up to 50 pages and 60,000 characters of text a call. `max_chars` sets the longest text per page (5,000 when left out, at most 50,000; 0 lists the pages without text). When there are more results, it returns `next` to pass as `cursor` on the next call. While the crawl runs, `next` is where to carry on from once any page has been read, even when nothing more is there yet, so pages already read are not sent again. Free. ### crawl_cancel Takes `crawl_id` and stops the crawl. It is marked as a destructive tool, so a client can ask before calling it: a cancelled crawl cannot be resumed. The pages that came back are kept and stay charged. The rest of the hold is handed back. A line for your agent's instructions: "To find one page of a known site, call `map` with `search`. To read a section of a site, call `crawl` with a small `max_pages`, then `crawl_status` every few seconds until the crawl has ended. Each page costs a credit." A crawl reads one site at about 30 pages a minute. A small crawl ends in minutes; a large one takes hours, so an agent should not wait on it in one turn. ## Spaces A [Space](https://millionshort.com/docs/search/spaces) is a saved scope for search: sites, a popularity cut, page types, topics, a lens and site filters under one name. Over MCP an agent can find one, make one, and search with one. Spaces are free; a search with a Space costs what the search costs. | Tool or argument | What the agent can do | Without a key | |---|---|---| | `list_spaces` | See the Spaces it can search with | Yes: the curated Spaces | | `create_space` | Save a scope under a name | No | | `space` on `search` | Search with a Space | Yes, with a curated Space | ### list_spaces Lists Spaces. It only reads. With a key it returns your team's Spaces and the curated ones, which are ours and the same ones the MillionShort search site offers. Without a key it returns the curated Spaces. ### create_space Saves a Space and returns it with its slug. It needs a key, and it is the one tool that writes: it stores a Space for your team and changes nothing else. It takes a name and the settings of a [Space](https://millionshort.com/docs/spaces#the-space-object): the sites and whether to search inside them or prefer them, the popularity cut, page types and topics to keep or leave out, a lens, site filters, default sources and safe search. The number of Spaces a team can keep depends on its plan. ### space on search Pass `space` to the `search` tool: an id, a slug of your team, or `curated:` and the slug of a curated Space. An argument the agent sends with the same call replaces the Space's value for that setting, and everything else comes from the Space. Without a key, `space` takes a curated Space, and the no-key limits stay: one source and up to 5 results, and the first 20 sites of a Space that searches inside a list. A line for your agent's instructions: "To search a subject area, call `list_spaces` and pass the slug of a fitting Space as `space`; send your own filters only to step outside it." ## Places Two tools find businesses and points of interest with [Places](https://millionshort.com/docs/places). ### places Finds businesses and points of interest by what they are and where they are, and returns them as data: name, category, address, coordinates, distance, phone number and website. It only reads. The arguments are the fields of a [Places request](https://millionshort.com/docs/places/parameters#request): | Arguments | Example | |---|---| | What: `query`, `category`, `brand` | `"query": "bike repair"`, `"category": "Coffee shop"`, `"brand": "Tim Hortons"` | | Where, one of: `near`, `lat` with `lng`, `bbox`, `ip`, `near_me`, `neighbourhood` | `"near": "Leslieville, Toronto"`, `"near_me": true` | | Narrowing: `city`, `region`, `country`, `radius_m`, `exclude_category`, `has_phone`, `has_website`, `has_hours`, `open_now` | `"city": "Austin", "region": "TX"`, `"has_phone": true` | | Shaping: `sort`, `fields`, `limit` | `"sort": "distance"`, `"fields": ["name", "address", "phone"]` | Over the hosted server, `near_me` means the machine the agent's MCP client runs on, placed in a city by its address. The address is used to look up that city and then dropped. Every filter works worldwide; place names, neighbourhoods and everyday trade words are read best in Canada and the United States, and opening hours are known for few places. [Which filters work where](https://millionshort.com/docs/places/parameters#which-filters-work-where) has the table. | | With a key | Without a key | |---|---|---| | Places per call | up to 50 | up to 5 | | Cost | what the API call costs: 1 credit for up to 10 places | free | | Allowance | your plan's limits | one of the visitor's 10 free searches of the day, at most 5 in a minute | Without a key, a places search and a web search spend the same daily allowance. The answer carries the credit line of the data, `attribution`; an agent that shows the places to a person should show it too. A line for your agent's instructions: "To find a business or somewhere nearby, call `places` with what you are looking for as `query` and the location as `near`, or as `lat` and `lng` when you have coordinates. Never put the location in `query`. When the kind of place matters, look its id up with `list_place_categories` and send it as `category`." ### list_place_categories Lists the categories a place can be filed under, so an agent can find the ids `category` and `exclude_category` take. It only reads. Arguments: `query`, words the category's id must hold (`"query": "sushi"`), and `parent`, a category id whose direct children to list (`"parent": "italian_restaurant"`). Each entry has `id`, `label` and `parent`. A long list is cut short in the text, and says how many more there are. It is free with a key. Without a key it also works, and it does not spend the 10 free searches of the day. ## Agent [Agent](https://millionshort.com/docs/agent) works over MCP as it does on the API, at the same prices and with the same per-run caps. An agent can hand a research question to a run and collect a cited answer. A run takes from a few seconds to a few minutes, so it is three tools, not one: start, ask how it is going, read the result. | Tool | What the agent can do | Without a key | |---|---|---| | `start_agent` | Start a run and get its `id` | No | | `get_agent` | See the run's status and progress | No | | `get_agent_results` | Read the answer, the citations and the quotes | No | All three need a key, because a run spends credits. ### start_agent Starts a run and returns its `id`, `status`, `processor`, `model` and the `max_credits` held for it. It is not a read-only tool: it starts work that is charged to your credits, so a client may ask before each call. It changes nothing else. | Argument | Type | Default | Notes | |---|---|---|---| | `prompt` | string, 3 to 4,000 characters | | Required. The question. Example: "Which Canadian provinces changed their minimum wage in 2026, and to what?". | | `urls` | array of strings (each 8 to 2,048 characters), 1 to 10 items | | Pages to read first: absolute http or https URLs. Example: ["https://example.org/report"]. | | `schema` | object | | A JSON Schema with "type": "object" and "properties". The answer then comes back as "output" in this shape, with the citations of each field. Example: {"type": "object", "properties": {"founded": {"type": "integer"} } }. | | `sources` | array of `web`, `news`, `smallweb`, `discussions`, `hn`, `social`, `communities`, `podcasts`, `academic`, `medical`, `law`, `finance`, `contracts`, 1 to 13 items | | The sources the run may search. Left out, the run picks among all of them. list_sources describes each one. Example: ["web", "news"]. | | `remove_top_sites` | integer, 0 to 1,000,000 | | Removes the N most popular sites from every search of the run. Example: 1000. | | `include_domains` | array of strings (each 1 to 253 characters), up to 20 | | Search only these sites. Example: ["canada.ca"]. | | `exclude_domains` | array of strings (each 1 to 253 characters), up to 50 | | Leave these sites out of every search. Example: ["pinterest.com"]. | | `start_date` | string | | Only results from this day on, as YYYY-MM-DD. Example: "2026-01-01". | | `processor` | `lite`, `standard`, `pro` | `"standard"` | How much work the run may do; a ceiling on work, not a price. lite: up to 3 searches and 6 pages. standard: up to 6 searches and 12 pages, a check for what is missing, and a second pass over every citation. pro: up to 12 searches and 24 pages, and the answer is written on the balanced tier. Example: "lite". | | `model` | `auto`, `fast`, `balanced`, `best` | `"auto"` | The model that writes the answer, by tier: fast (the quickest and the cheapest), balanced (a larger model, 20× the token price) or best (the largest, 40×). auto is the processor's own: fast on lite and standard, balanced on pro. Example: "auto". | | `max_credits` | integer, 10 to 100,000 | | The most the run may cost. Held when the run starts; what is not used is handed back. Left out: 40, 120 or 1500 by processor, cut to the plan's per-run cap. A cap above the plan's is refused (Free 200, Starter 1,000, Growth 2,500, Scale 5,000, Business 10,000). Example: 60. | The arguments mean what the same fields mean in an [Agent request](https://millionshort.com/docs/agent/parameters#request). `webhook_id` and the `Idempotency-Key` header are on the API only. With [Spaces](#spaces), the tool also takes `space`. A run is metered: 1 credit for each source of each search (and 1 more when results come with their page text), 0.25 or 0.5 for each page, and the model's tokens, with at least 5 credits a run and never more than `max_credits`, which is at most your plan's per-run cap (Free 200, Starter 1,000, Growth 2,500, Scale 5,000, Business 10,000, Enterprise by agreement). A failed run is free. [Agent pricing and limits](https://millionshort.com/docs/agent/pricing) has the table. ### get_agent Takes the `id` and returns the run's `status`, the step it is on, the searches made, the pages read and the credits so far. `ended` is `true` once the run has ended, and the answer then says why it stopped and what it was charged. It only reads, and it is free. ### get_agent_results Takes the `id` and returns the result: `answer` with its `[n]` markers, `citations` (each with the page and the quote that supports the statement), `sources`, `uncited_removed`, and what the run was charged, line by line. With a `schema` it returns `output`, `field_citations` and `uncited_fields`. While the run is going, `ready` is `false`: call again in a few seconds. It only reads, and it is free. The answer and the quotes come from web pages. They are data for your agent to weigh, not instructions for it to follow. A line for your agent's instructions: "For a question that needs research across several pages, call `start_agent` with a `max_credits`, then `get_agent` every few seconds until `ended` is true, then `get_agent_results`. Give the citations with the answer." [Agent guides](https://millionshort.com/docs/agent/guides#use-it-from-an-agent-over-mcp) has the calls. ## What a result looks like A result comes back twice: as short numbered text for the model to read, and as `structuredContent` that matches the tool's output schema. ```text 2 results for "tide tables": 1. Tide tables for the north coast https://example.org/tides example.org | 2026-03-04 | popularity: top-100k Daily high and low water times for every harbour on the north coast. 2. ... ``` ## Set up a client ### Claude Code With your key: ```bash claude mcp add --transport http millionshort https://mcp.millionshort.com/mcp \ --header "Authorization: Bearer ms-YOUR_API_KEY" ``` Without a key: ```bash claude mcp add --transport http millionshort https://mcp.millionshort.com/mcp ``` ### Claude (web and desktop apps) Add the server as a custom connector: open **Customize**, **Connectors**, **+ Add**, **Add custom connector**, and enter the name `MillionShort` and the address above. Under **Authentication** choose **No sign in**. Under **Request headers**, add `Authorization` with the value `Bearer ms-YOUR_API_KEY` for every tool; leave it empty for the no-key mode. The [Claude page](https://millionshort.com/docs/integrations/claude) has the details. ### Cursor Add the server to `.cursor/mcp.json` in your project, or to `~/.cursor/mcp.json` for every project: ```json { "mcpServers": { "millionshort": { "url": "https://mcp.millionshort.com/mcp", "headers": { "Authorization": "Bearer ms-YOUR_API_KEY" } } } } ``` ### ChatGPT On chatgpt.com, go to **chatgpt.com/plugins**, press **+**, **Add custom MCP server**, enter the address above, choose **No authentication**, and **Create as a plugin**. The [ChatGPT page](https://millionshort.com/docs/integrations/chatgpt) has the details. ChatGPT cannot send an API key, so it connects in the no-key mode, with `search` and `list_sources` at the no-key limits. The names of these menus change between releases of each app. If a step above does not match what you see, look for "connectors" or "MCP servers" in the app's settings; the address and the choice of no authentication stay the same. ### VS Code Add the server to `.mcp.json` at the workspace root. VS Code fills in `${MILLIONSHORT_API_KEY}` from the environment; the [VS Code page](https://millionshort.com/docs/integrations/vscode) has the rest. ```json { "mcpServers": { "millionshort": { "type": "http", "url": "https://mcp.millionshort.com/mcp", "headers": { "Authorization": "Bearer ${MILLIONSHORT_API_KEY}" }, "tools": ["*"] } } } ``` ### Any other client [Integrations](https://millionshort.com/docs/integrations) has a page for each of more than 40 clients, with its exact file or command. Most take a block like this one. Leave `headers` out to connect without a key. ```json { "mcpServers": { "millionshort": { "type": "http", "url": "https://mcp.millionshort.com/mcp", "headers": { "Authorization": "Bearer ms-YOUR_API_KEY" } } } } ``` ## Check the connection You can call the server by hand. This lists the tools a caller with no key gets: ```bash curl https://mcp.millionshort.com/mcp \ -H "Content-Type: application/json" \ -H "Accept: application/json, text/event-stream" \ -d '{ "jsonrpc": "2.0", "id": 1, "method": "tools/list" }' ``` Add `-H "Authorization: Bearer $MILLIONSHORT_API_KEY"` to see every tool. | Status | Meaning | |---|---| | `200` | A JSON-RPC answer in one JSON body | | `401` | A key that was refused, or no key on a server whose no-key mode is off | | `403` | The request came from a web page whose origin is not allowed | | `405` | `GET` or `DELETE`: the server answers `POST` only | | `413` | The request body is over 256 KB | | `429` | Too many requests from one address | ## Run it locally The same server runs on your own machine over standard input and output, for clients that start their tools as local processes. It is the `millionshort-mcp` command of the `@millionshort/mcp` package. The package is not on the public registry yet; this section applies once it is. ```json { "mcpServers": { "millionshort": { "command": "millionshort-mcp", "env": { "MILLIONSHORT_API_KEY": "ms-YOUR_API_KEY" } } } } ``` The local server always needs a key and offers `search`, `get_domain_info` and `list_sources`. ## Privacy A key is passed to the API for the one request that carries it and is never stored. Queries and caller addresses are not written to the server's log. See the [privacy policy](https://millionshort.com/privacy) and the [terms](https://millionshort.com/terms). --- Source: https://millionshort.com/docs/sdks/python Section: Build with # Python SDK A small client with synchronous and asynchronous forms. The Python SDK is a thin client for the [REST API](https://millionshort.com/docs/search/parameters). It needs Python 3.9 or later. ## Install ```bash pip install millionshort ``` **Not published yet.** The package is not on the public package index yet, so this command finds nothing today; it works once the package is published. Until then, call the REST API directly: every method below is one request, and the reference pages show each one with `curl`. ## Create a client ```python import os from millionshort import MillionShort client = MillionShort(api_key=os.environ["MILLIONSHORT_API_KEY"]) ``` | Argument | Default | Meaning | |---|---|---| | `api_key` | none | Your key. Read it from the environment yourself; the client does not. | | `base_url` | `https://api.millionshort.com` | The API address. | | `timeout` | `60.0` | Seconds to wait for one request. | | `max_retries` | `2` | How many times a request that is safe to repeat is retried. | The client holds a connection pool. Close it with `client.close()`, or use it in a `with` block. ## Search ```python import os from millionshort import MillionShort client = MillionShort(api_key=os.environ["MILLIONSHORT_API_KEY"]) r = client.search( "sourdough starter hydration", sources=["web", "smallweb"], remove_top_sites=10000, num_results=20, exclude_domains=["example.com"], explain=True, ) for hit in r.results: print(hit["position"], hit["site"], hit["popularity"]["bucket"]) print(" ", hit["title"]) print(" ", hit["url"]) for reason in hit.get("why", []): print(" why:", reason) print(r.summary["returned"], "returned;", r.summary["removed"]["popularity"], "removed by popularity") print(r.usage.credits, "credits; request", r.request_id) for warning in r.warnings: print("warning:", warning["code"], warning["message"]) ``` `search` takes the query and these keyword arguments, which are the fields of the [Search reference](https://millionshort.com/docs/search/parameters): `sources`, `num_results`, `remove_top_sites`, `only_top_sites`, `include_domains`, `exclude_domains`, `boost_domains`, `bury_domains`, `page_types`, `topics`, `safe_search`, `max_chars_per_result` and `explain`. The filters, highlights and page content are keyword arguments too, under the same names as in the reference: for example `start_date`, `language`, `country`, `exclude_page_types`, `boost_topics`, `traffic_trend`, `popular_in`, `site_tech`, `exclude_risky`, `max_highlights` and `include_content`. An argument you leave out uses the API's default. ## What comes back Every method returns a `Result`. The API wraps its answer as `data`, `usage`, `warnings` and `request_id`; the SDK unwraps it: - the fields of `data` are attributes of the result: `r.results`, `r.summary`; - `r.usage` has `credits`, `cost_usd` and `breakdown`; - `r.warnings` is a list; - `r.request_id` is a string; - `r.to_dict()` returns `data` as a plain dictionary. Each entry of `r.results` is a dictionary, so its fields are read with brackets: `hit["title"]`. ## Sources and domain info ```python import os from millionshort import MillionShort client = MillionShort(api_key=os.environ["MILLIONSHORT_API_KEY"]) catalog = client.list_sources() print([source["slug"] for source in catalog.sources]) print([page_type["slug"] for page_type in catalog.page_types]) info = client.get_domain_info(["example.com", "blog.example.org"]) for entry in info.domains: print(entry["domain"], entry["popularity"]["bucket"], entry["risk"]) ``` ## Map and Crawl `map` lists the URLs of a site. `crawl` starts a job that returns the site's pages as clean text: ```python import os import time from millionshort import MillionShort client = MillionShort(api_key=os.environ["MILLIONSHORT_API_KEY"]) found = client.map(url="https://example.org/", search="pricing", limit=20) for u in found.urls: print(u["url"], u.get("title")) job = client.crawl(url="https://example.org/docs", max_pages=50, include=["^/docs/"]) while job.status in ("queued", "running"): time.sleep(5) job = client.get_crawl(job.id) for page in job.results: if page["status"] == "ok": print(page["depth"], page["url"], page["page_type"]) else: print(page["url"], "failed:", page["error"]["code"]) print(job.completed, "pages,", job.credits_used, "credits") ``` | Method | Does | |---|---| | `map(url, ...)` | Lists a site's URLs. `url` comes first; the keyword arguments are the other fields of a [Map request](https://millionshort.com/docs/map/parameters#request): `search`, `limit`, `include_subdomains`, `include`, `exclude`, `sources` | | `crawl(url, ...)` | Starts a crawl and returns the job. `url` comes first; the keyword arguments are the other fields of a [crawl request](https://millionshort.com/docs/crawl/parameters#request): `max_pages`, `max_depth`, `include`, `exclude`, `mode` and the rest | | `get_crawl(id, cursor=None)` | The crawl, with a page of its results. Pass `next` as `cursor` for the following page. Free | | `list_crawls(limit=None)` | Your team's crawls, newest first, without results. Free | | `cancel_crawl(id)` | Stops a crawl. The pages that came back are kept and stay charged | | `wait_crawl(id, poll_interval=5.0, timeout=600.0)` | Polls until the crawl ends, then returns it with every page of results. It gives up after `timeout` seconds (the crawl keeps running). A large crawl takes hours: give it a timeout to match, or poll `get_crawl` yourself | A map costs 1 credit per 10 URLs returned, and a crawled page 1 credit in `live`: see [Map pricing](https://millionshort.com/docs/map/pricing) and [Crawl pricing](https://millionshort.com/docs/crawl/pricing). A page that fails is free. ## Spaces A [Space](https://millionshort.com/docs/search/spaces) is a saved scope for search. Create one, then pass its slug or id as `space` on `search`: ```python import os from millionshort import MillionShort client = MillionShort(api_key=os.environ["MILLIONSHORT_API_KEY"]) baking = client.create_space( "Baking", sites=["example.org", "example.com/blog"], remove_top_sites=1000, ) r = client.search("sourdough hydration", space=baking.slug) print(len(r.results), "results from", r.space["sites_applied"], "sites") listing = client.list_spaces(scope="all") for entry in listing.spaces: print(entry["slug"], "curated" if entry["curated"] else "ours") client.update_space(baking.id, remove_top_sites=10000) client.delete_space(baking.id) ``` | Method | Does | |---|---| | `create_space(name, ...)` | Creates a Space. The keyword arguments are the fields of the [Space object](https://millionshort.com/docs/spaces#the-space-object): `sites`, `mode`, `remove_top_sites`, `lens` and the rest | | `list_spaces(scope=...)` | Lists Spaces: `"own"` (the default), `"curated"` or `"all"` | | `get_space(id)` | Reads one, by id, by your slug, or as `"curated:"` | | `update_space(id, ...)` | Changes the fields given; the others stay. `lens` is one field: a `lens` given replaces all three of its lists | | `delete_space(id)` | Deletes it | | `import_spaces(spaces)` | Loads Spaces exported from the MillionShort search site: the export file as a dictionary, or a list of entries | | `search(query, space=...)` | Searches with a Space. An argument you pass beside it replaces the Space's value for that setting | All of them are free; a search with a Space costs what the search costs. A Space that does not exist raises `NotFoundError`, with the code `SPACE_NOT_FOUND`. A curated Space cannot be changed: `MillionShortError`, with the code `SPACE_READ_ONLY`. ## Places ```python from millionshort import MillionShort client = MillionShort(api_key=os.environ["MILLIONSHORT_API_KEY"]) r = client.places("coffee", near="Leslieville, Toronto", limit=5) for place in r.results: print(place["name"], place["address"]["formatted"], place["phone"]) print(r.attribution["text"]) ``` The keyword arguments are the fields of a [Places request](https://millionshort.com/docs/places/parameters#request), under the same names: `category`, `exclude_category`, `brand`, `near`, `lat`, `lng`, `bbox`, `ip`, `near_me`, `neighbourhood`, `city`, `region`, `country`, `radius_m`, `has_phone`, `has_website`, `has_hours`, `open_now`, `sort`, `fields` and `limit`. If you show the places to people, show `attribution` with them. ```python r = client.places( category="Coffee shop", neighbourhood="Leslieville", city="Toronto", has_website=True, sort="distance", fields=["name", "distance_m", "website"], ) ``` `near_me=True` searches around the city of the machine that runs this code. On a server, send the person's own address as `ip`, or a position they shared as `lat` and `lng`. `list_place_categories()` returns the categories `category` takes, free: `client.list_place_categories(q="sushi")`, or `parent="italian_restaurant"` for what is directly under a category. ## Agent The methods of [Agent](https://millionshort.com/docs/agent). A question in, an answer with a checked quote for every statement out. A run is a job: start it, then wait for it. ```python import os from millionshort import MillionShort client = MillionShort(api_key=os.environ["MILLIONSHORT_API_KEY"]) run = client.start_agent( "What does a monthly adult pass cost on Northbridge Transit in 2026, and when did the price last change?", processor="lite", max_credits=40, idempotency_key="fares-2026-11-20", ) done = client.wait_agent(run.id, poll_interval=2.0, timeout=600.0) print(done.status, done.stop_reason) print(done.answer) for cite in done.citations: print(cite["n"], cite["url"], cite["quote"]) print(done.usage.credits, done.usage.steps) ``` | Method | Does | |---|---| | `start_agent(prompt, ...)` | Starts a run and returns it, with its `id`. The keyword arguments are the fields of an [Agent request](https://millionshort.com/docs/agent/parameters#request), under the same names: `urls`, `schema`, `sources`, `space`, `remove_top_sites`, `include_domains`, `exclude_domains`, `start_date`, `processor`, `model`, `max_credits` and `webhook_id`. `idempotency_key` is sent as the `Idempotency-Key` header, and lets the client retry the call | | `get_agent(id)` | The run: status, progress and steps, and the result once it has ended. Free | | `get_agent_results(id)` | The result alone. `ready` is `False` while the run is going, which is not an error. Free | | `wait_agent(id, poll_interval=2.0, timeout=600.0)` | Polls until the run is `completed`, `incomplete`, `failed` or `cancelled`, and returns it. Past `timeout` it raises `PollTimeoutError`; the run goes on | | `stream_agent_events(id, after=None)` | Yields the steps as they happen, each a dictionary with `event` and `data`: `agent.step` for each step, then one `agent.done`. Free | | `cancel_agent(id)` | Cancels the run. The work already done is charged | `citations[n-1]` is the page behind the `[n]` marker of `answer`: `n`, `url`, `title`, `source` and `quote`. With `schema`, read `output`, `field_citations` and `uncited_fields` in place of `answer`. An `incomplete` run is not an exception: `stop_reason` says why it ended early. ```python import os from millionshort import MillionShort client = MillionShort(api_key=os.environ["MILLIONSHORT_API_KEY"]) run = client.start_agent("What changed in Northbridge Transit fares in 2026?", processor="lite") last = 0 for event in client.stream_agent_events(run.id): if event["event"] == "agent.step": last = event["data"]["seq"] print(last, event["data"]["type"]) else: print("ended:", event["data"]["status"], event["data"]["stop_reason"]) ``` A stream is closed after 5 minutes at most. If it ends with no `agent.done`, call again with `after=last`. A run is metered, and never costs more than `max_credits`. [Agent pricing and limits](https://millionshort.com/docs/agent/pricing) has the prices, and [Agent errors](https://millionshort.com/docs/agent/errors) what a start can be refused for. ## Async `AsyncMillionShort` has the same methods, awaited: ```python import asyncio import os from millionshort import AsyncMillionShort async def main(): async with AsyncMillionShort(api_key=os.environ["MILLIONSHORT_API_KEY"]) as client: r = await client.search("harbour pilot schedules", num_results=5) for hit in r.results: print(hit["title"], hit["url"]) asyncio.run(main()) ``` ## Errors Every failure raises a subclass of `MillionShortError`: | Class | Raised for | |---|---| | `ValidationError` | `INVALID_PARAM` | | `UnsupportedOptionError` | `UNSUPPORTED_OPTION` | | `AuthenticationError` | `AUTH_INVALID_KEY`, `AUTH_MISSING_KEY` | | `MillionShortError` | `QUOTA_EXCEEDED`, `ACCOUNT_NOT_ELIGIBLE`, `ACCOUNT_SUSPENDED` | | `NotFoundError` | `NOT_FOUND` | | `RateLimitError` | `RATE_LIMITED` | | `CapacityError` | `CAPACITY` | | `InsufficientCreditsError` | `INSUFFICIENT_CREDITS` | | `ServerError` | `INTERNAL` | | `SearchUnavailableError` | `SEARCH_UNAVAILABLE` | | `APIConnectionError` | The request never reached the API (network failure or timeout). | Each error has `code`, `message`, `request_id`, `details`, `retry_after_seconds` and `status_code`. ```python import os import time from millionshort import ( CapacityError, InsufficientCreditsError, MillionShort, MillionShortError, RateLimitError, SearchUnavailableError, ) client = MillionShort(api_key=os.environ["MILLIONSHORT_API_KEY"]) for attempt in range(4): try: r = client.search("tide tables", num_results=5) break except (RateLimitError, CapacityError, SearchUnavailableError) as error: time.sleep(error.retry_after_seconds or 2**attempt) except InsufficientCreditsError as no_credits: raise SystemExit("Out of credits.") from no_credits except MillionShortError as error: raise SystemExit(f"{error.code}: {error.message} (request {error.request_id})") else: raise SystemExit("Still failing after four attempts.") print(len(r.results), "results") ``` ## Retries The client retries a `GET`, such as `list_sources`, on `429` and on a server error, waiting as long as the API asks. It does not repeat a `POST` on its own, so a failed `search` raises at once: retry it yourself, as in the example above. The [Errors](https://millionshort.com/docs/errors) page says which codes are worth a retry. ## A trial key An agent with no key can get a short-lived one: ```python from millionshort import MillionShort key = MillionShort().create_agent_key("my-agent").api_key client = MillionShort(api_key=key) ``` See [Authentication](https://millionshort.com/docs/authentication#trial-key-for-agents). --- Source: https://millionshort.com/docs/sdks/typescript Section: Build with # TypeScript SDK A small client for TypeScript and JavaScript with no dependencies. The TypeScript SDK is a thin client for the [REST API](https://millionshort.com/docs/search/parameters), for TypeScript and JavaScript. It has no dependencies and uses the platform's own `fetch`, so it needs Node.js 18 or later. Call it from your server. Do not put your API key in code that runs in a browser. ## Install ```bash npm install millionshort ``` **Not published yet.** The package is not on the public registry yet, so this command finds nothing today; it works once the package is published. Until then, call the REST API directly: every method below is one request, and the reference pages show each one with `curl`. ## Create a client The package has a named export, `MillionShort`. There is no default export. ```ts import { MillionShort } from 'millionshort'; const client = new MillionShort({ apiKey: process.env.MILLIONSHORT_API_KEY }); ``` | Option | Default | Meaning | |---|---|---| | `apiKey` | none | Your key. Read it from the environment yourself; the client does not. | | `baseUrl` | `https://api.millionshort.com` | The API address. | | `timeoutMs` | `60000` | Milliseconds to wait for one request. | | `maxRetries` | `2` | How many times a request that is safe to repeat is retried. | ## Search Options are written in camelCase and sent as the snake_case fields of the [Search reference](https://millionshort.com/docs/search/parameters): `removeTopSites` is `remove_top_sites`. ```ts import { MillionShort } from 'millionshort'; const client = new MillionShort({ apiKey: process.env.MILLIONSHORT_API_KEY }); const r = await client.search('sourdough starter hydration', { sources: ['web', 'smallweb'], removeTopSites: 10000, numResults: 20, excludeDomains: ['example.com'], explain: true, }); for (const hit of r.results) { console.log(hit.position, hit.site, hit.popularity.bucket); console.log(' ', hit.title); console.log(' ', hit.url); for (const reason of hit.why ?? []) console.log(' why:', reason); } console.log(r.summary.returned, 'returned;', r.summary.removed.popularity, 'removed by popularity'); console.log(r.usage?.credits, 'credits; request', r.requestId); for (const warning of r.warnings) console.log('warning:', warning.code, warning.message); ``` The options are `sources`, `numResults`, `removeTopSites`, `onlyTopSites`, `includeDomains`, `excludeDomains`, `boostDomains`, `buryDomains`, `pageTypes`, `topics`, `safeSearch`, `maxCharsPerResult` and `explain`. The filters, highlights and page content are options too, under the names of the reference in camelCase: for example `startDate`, `language`, `country`, `excludePageTypes`, `boostTopics`, `trafficTrend`, `popularIn`, `siteTech`, `excludeRisky`, `maxHighlights` and `includeContent`. An option you leave out uses the API's default. ## What comes back The API wraps its answer as `data`, `usage`, `warnings` and `request_id`. The SDK unwraps it: - the fields of `data` sit directly on the result: `r.results`, `r.summary`; - `r.usage` has `credits`, `cost_usd` and `breakdown`; - `r.warnings` is an array; - `r.requestId` is a string. The fields inside a result keep the API's names, so a result has `published_date` and `page_type`. ## Sources and domain info ```ts import { MillionShort } from 'millionshort'; const client = new MillionShort({ apiKey: process.env.MILLIONSHORT_API_KEY }); const catalog = await client.listSources(); console.log(catalog.sources.map((source) => source.slug)); console.log(catalog.page_types.map((pageType) => pageType.slug)); const info = await client.getDomainInfo(['example.com', 'blog.example.org']); for (const entry of info.domains) { console.log(entry.domain, entry.popularity.bucket, entry.risk); } ``` ## Map and Crawl `map` lists the URLs of a site. `crawl` starts a job that returns the site's pages as clean text: ```ts import { MillionShort } from 'millionshort'; const client = new MillionShort({ apiKey: process.env.MILLIONSHORT_API_KEY }); const found = await client.map('https://example.org/', { search: 'pricing', limit: 20 }); for (const u of found.urls) console.log(u.url, u.title); let job = await client.crawl('https://example.org/docs', { maxPages: 50, include: ['^/docs/'] }); while (job.status === 'queued' || job.status === 'running') { await new Promise((resolve) => setTimeout(resolve, 5000)); job = await client.getCrawl(job.id); } for (const page of job.results ?? []) { if (page.status === 'ok') console.log(page.depth, page.url, page.page_type); else console.log(page.url, 'failed:', page.error?.code); } console.log(job.completed, 'pages,', job.credits_used, 'credits'); ``` | Method | Does | |---|---| | `map(url, options?)` | Lists a site's URLs. The options are the other fields of a [Map request](https://millionshort.com/docs/map/parameters#request) in camelCase: `search`, `limit`, `includeSubdomains`, `include`, `exclude`, `sources` | | `crawl(url, options?)` | Starts a crawl and returns the job. The options are the other fields of a [crawl request](https://millionshort.com/docs/crawl/parameters#request) in camelCase: `maxPages`, `maxDepth`, `include`, `exclude`, `mode` and the rest | | `getCrawl(id, { cursor })` | The crawl, with a page of its results. Pass `next` as `cursor` for the following page. Free | | `listCrawls({ limit })` | Your team's crawls, newest first, without results. Free | | `cancelCrawl(id)` | Stops a crawl. The pages that came back are kept and stay charged | | `waitCrawl(id, options?)` | Polls until the crawl ends, then returns it with every page of results. It polls every 5 seconds unless `pollIntervalMs` says otherwise, and gives up after `timeoutMs` (10 minutes by default; the crawl keeps running). A large crawl takes hours: give it a timeout to match, or poll `getCrawl` yourself | A map costs 1 credit per 10 URLs returned, and a crawled page 1 credit in `live`: see [Map pricing](https://millionshort.com/docs/map/pricing) and [Crawl pricing](https://millionshort.com/docs/crawl/pricing). A page that fails is free. ## Spaces A [Space](https://millionshort.com/docs/search/spaces) is a saved scope for search. Create one, then pass its slug or id as `space` on `search`: ```ts import { MillionShort } from 'millionshort'; const client = new MillionShort({ apiKey: process.env.MILLIONSHORT_API_KEY }); const baking = await client.createSpace('Baking', { sites: ['example.org', 'example.com/blog'], removeTopSites: 1000, }); const r = await client.search('sourdough hydration', { space: baking.slug }); console.log(r.results.length, 'results from', r.space?.sites_applied, 'sites'); const listing = await client.listSpaces({ scope: 'all' }); for (const entry of listing.spaces) console.log(entry.slug, entry.curated); await client.updateSpace(baking.id, { removeTopSites: 10000 }); await client.deleteSpace(baking.id); ``` | Method | Does | |---|---| | `createSpace(name, options)` | Creates a Space. The options are the fields of the [Space object](https://millionshort.com/docs/spaces#the-space-object) in camelCase: `sites`, `mode`, `removeTopSites`, `lens` and the rest | | `listSpaces(options)` | Lists Spaces: `scope` is `'own'` (the default), `'curated'` or `'all'` | | `getSpace(id)` | Reads one, by id, by your slug, or as `'curated:'` | | `updateSpace(id, patch)` | Changes the fields given; the others stay. `lens` is one field: a `lens` given replaces all three of its lists | | `deleteSpace(id)` | Deletes it | | `importSpaces(spaces)` | Loads Spaces exported from the MillionShort search site: the export file as an object, or an array of entries | | `search(query, { space })` | Searches with a Space. An option you pass beside it replaces the Space's value for that setting | All of them are free; a search with a Space costs what the search costs. A Space that does not exist rejects with `NotFoundError`, with the code `SPACE_NOT_FOUND`. A curated Space cannot be changed: `MillionShortError`, with the code `SPACE_READ_ONLY`. ## Places ```ts import { MillionShort } from 'millionshort'; const client = new MillionShort({ apiKey: process.env.MILLIONSHORT_API_KEY }); const r = await client.places({ query: 'coffee', near: 'Leslieville, Toronto', limit: 5 }); for (const place of r.results) { console.log(place.name, place.address.formatted, place.phone); } console.log(r.attribution.text); ``` The options are the fields of a [Places request](https://millionshort.com/docs/places/parameters#request), in camelCase: `query`, `category`, `excludeCategory`, `brand`, `near`, `lat`, `lng`, `bbox`, `ip`, `nearMe`, `neighbourhood`, `city`, `region`, `country`, `radiusM`, `hasPhone`, `hasWebsite`, `hasHours`, `openNow`, `sort`, `fields` and `limit`. If you show the places to people, show `attribution` with them. ```ts const nearby = await client.places({ category: 'Coffee shop', neighbourhood: 'Leslieville', city: 'Toronto', hasWebsite: true, sort: 'distance', fields: ['name', 'distance_m', 'website'], }); ``` `nearMe: true` searches around the city of the machine that runs this code. On a server, send the person's own address as `ip`, or a position they shared as `lat` and `lng`. `listPlaceCategories()` returns the categories `category` takes, free: `client.listPlaceCategories({ q: 'sushi' })`, or `{ parent: 'italian_restaurant' }` for what is directly under a category. ## Agent The methods of [Agent](https://millionshort.com/docs/agent). A question in, an answer with a checked quote for every statement out. A run is a job: start it, then wait for it. ```ts import { MillionShort } from 'millionshort'; const client = new MillionShort({ apiKey: process.env.MILLIONSHORT_API_KEY }); const run = await client.startAgent( 'What does a monthly adult pass cost on Northbridge Transit in 2026, and when did the price last change?', { processor: 'lite', maxCredits: 40, idempotencyKey: 'fares-2026-11-20' }, ); const done = await client.waitAgent(run.id, { pollIntervalMs: 2000, timeoutMs: 600_000 }); console.log(done.status, done.stop_reason); console.log(done.answer); for (const cite of done.citations ?? []) console.log(cite.n, cite.url, cite.quote); console.log(done.usage?.credits, done.usage?.steps); ``` | Method | Does | |---|---| | `startAgent(prompt, options)` | Starts a run and resolves to it, with its `id`. The options are the fields of an [Agent request](https://millionshort.com/docs/agent/parameters#request), in camelCase: `urls`, `schema`, `sources`, `space`, `removeTopSites`, `includeDomains`, `excludeDomains`, `startDate`, `processor`, `model`, `maxCredits` and `webhookId`. `idempotencyKey` is sent as the `Idempotency-Key` header, and lets the client retry the call | | `getAgent(id)` | The run: status, progress and steps, and the result once it has ended. Free | | `getAgentResults(id)` | The result alone. `ready` is `false` while the run is going, which is not an error. Free | | `waitAgent(id, { pollIntervalMs, timeoutMs })` | Polls until the run is `completed`, `incomplete`, `failed` or `cancelled`, and resolves to it. Past `timeoutMs` it rejects with `PollTimeoutError`; the run goes on | | `streamAgentEvents(id, { after })` | An async iterator of the steps as they happen: `agent.step` for each, then one `agent.done`. Free | | `cancelAgent(id)` | Cancels the run. The work already done is charged | `citations[n-1]` is the page behind the `[n]` marker of `answer`: `n`, `url`, `title`, `source` and `quote`. With `schema`, read `output`, `field_citations` and `uncited_fields` in place of `answer`. The fields of a run keep the API's names. An `incomplete` run does not reject: `stop_reason` says why it ended early. ```ts import { MillionShort } from 'millionshort'; const client = new MillionShort({ apiKey: process.env.MILLIONSHORT_API_KEY }); const run = await client.startAgent('What changed in Northbridge Transit fares in 2026?', { processor: 'lite' }); let last = 0; for await (const { event, data } of client.streamAgentEvents(run.id)) { if (event === 'agent.step') { last = data.seq; console.log(last, data.type); } else { console.log('ended:', data.status, data.stop_reason); } } ``` A stream is closed after 5 minutes at most. If it ends with no `agent.done`, call again with `{ after: last }`. A run is metered, and never costs more than `maxCredits`. [Agent pricing and limits](https://millionshort.com/docs/agent/pricing) has the prices, and [Agent errors](https://millionshort.com/docs/agent/errors) what a start can be refused for. ## Errors Every failure rejects with a subclass of `MillionShortError`: | Class | Raised for | |---|---| | `ValidationError` | `INVALID_PARAM` | | `UnsupportedOptionError` | `UNSUPPORTED_OPTION` | | `AuthenticationError` | `AUTH_INVALID_KEY`, `AUTH_MISSING_KEY` | | `MillionShortError` | `QUOTA_EXCEEDED`, `ACCOUNT_NOT_ELIGIBLE`, `ACCOUNT_SUSPENDED` | | `NotFoundError` | `NOT_FOUND` | | `RateLimitError` | `RATE_LIMITED` | | `CapacityError` | `CAPACITY` | | `InsufficientCreditsError` | `INSUFFICIENT_CREDITS` | | `ServerError` | `INTERNAL` | | `SearchUnavailableError` | `SEARCH_UNAVAILABLE` | | `APIConnectionError` | The request never reached the API (network failure or timeout). | Each error has `code`, `message`, `requestId`, `details`, `retryAfterSeconds` and `statusCode`. ```ts import { CapacityError, InsufficientCreditsError, MillionShort, MillionShortError, RateLimitError, SearchUnavailableError, } from 'millionshort'; const client = new MillionShort({ apiKey: process.env.MILLIONSHORT_API_KEY }); let r; for (let attempt = 0; attempt < 4 && !r; attempt += 1) { try { r = await client.search('tide tables', { numResults: 5 }); } catch (error) { if ( error instanceof RateLimitError || error instanceof CapacityError || error instanceof SearchUnavailableError ) { const seconds = error.retryAfterSeconds ?? 2 ** attempt; await new Promise((resolve) => setTimeout(resolve, seconds * 1000)); } else if (error instanceof InsufficientCreditsError) { throw new Error('Out of credits.'); } else if (error instanceof MillionShortError) { throw new Error(`${error.code}: ${error.message} (request ${error.requestId})`); } else { throw error; } } } if (!r) throw new Error('Still failing after four attempts.'); console.log(r.results.length, 'results'); ``` ## Retries The client retries a `GET`, such as `listSources`, on `429` and on a server error, waiting as long as the API asks. It does not repeat a `POST` on its own, so a failed `search` rejects at once: retry it yourself, as in the example above. The [Errors](https://millionshort.com/docs/errors) page says which codes are worth a retry. ## A trial key An agent with no key can get a short-lived one: ```ts import { MillionShort } from 'millionshort'; const { api_key } = await new MillionShort().createAgentKey('my-agent'); const client = new MillionShort({ apiKey: api_key }); ``` See [Authentication](https://millionshort.com/docs/authentication#trial-key-for-agents). --- Source: https://millionshort.com/docs/integrations Section: Build with # Integrations Add MillionShort to the agents and tools you already use. Every integration takes the same API key, and every MCP client the same address. > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. The MCP server: `https://mcp.millionshort.com/mcp` (streamable HTTP; a key in `Authorization: Bearer`, or none for the no-key mode). The API: `https://api.millionshort.com`. Each row says what works today: - **Available**: ours, ready today. - **MCP**: through the hosted MCP server, today. - **Recipe**: a few lines of code or one HTTP step, today. - **Coming soon**: not yet: the page says what to use meanwhile. ## Choose how to connect | If you are | Use | Start at | |---|---|---| | Using a coding agent | The MCP server, and a line in the agent's instructions that says when to search | [Coding agents](https://millionshort.com/docs/integrations#coding-agents) | | Using a chat assistant | The MCP server as a connector; with no key it gives 10 free searches a day | [Chat apps](https://millionshort.com/docs/integrations#chat-apps) | | Building an agent or an app | Your framework's MCP client, or a function tool that calls the API | [Frameworks & SDKs](https://millionshort.com/docs/integrations#frameworks) | | Calling a model's API yourself | A function tool in its tool-calling loop, or its remote MCP feature | [Model APIs](https://millionshort.com/docs/integrations#model-apis) | | Building without code | An MCP step or an HTTP step in your workflow tool | [Low-code builders](https://millionshort.com/docs/integrations#low-code) | | An agent with no key | The no-key MCP mode, or a trial key the agent asks for itself | [Have your agent do it](https://millionshort.com/docs/integrations#have-your-agent-do-it) | ## Coding agents One address, added once. Each page has the exact file or command for that agent, and how to turn its own search off. - [Claude Code](https://millionshort.com/docs/integrations/claude-code) (MCP): One `claude mcp add` command, or a `.mcp.json` the team shares. - [Cursor](https://millionshort.com/docs/integrations/cursor) (MCP): A `.cursor/mcp.json` entry that reads the key from the environment, plus a project rule. - [Codex](https://millionshort.com/docs/integrations/codex) (MCP): Three lines of `config.toml`, shared by the CLI, the IDE extension and the app. - [GitHub Copilot in VS Code](https://millionshort.com/docs/integrations/vscode) (MCP): A `.mcp.json` in the workspace, or one `code --add-mcp` command. - [Gemini CLI](https://millionshort.com/docs/integrations/gemini-cli) (MCP): One `gemini mcp add` command, or a `settings.json` entry. - [GitHub Copilot CLI](https://millionshort.com/docs/integrations/copilot-cli) (MCP): One `copilot mcp add` command, or `~/.copilot/mcp-config.json`. - [Windsurf (Devin Desktop)](https://millionshort.com/docs/integrations/windsurf) (MCP): An `mcp_config.json` entry, in the project or for every project. - [Devin](https://millionshort.com/docs/integrations/devin) (MCP): A custom MCP server with an auth header, in the web app or the Devin CLI. - [Cline](https://millionshort.com/docs/integrations/cline) (MCP): A remote server in the MCP settings, or one `cline mcp add` command. - [Kilo Code](https://millionshort.com/docs/integrations/kilo-code) (MCP): A remote server in `kilo.jsonc`, for the editor extensions and the CLI. - [Zed](https://millionshort.com/docs/integrations/zed) (MCP): A `context_servers` entry, and an agent profile without the built-in web tools. - [OpenCode](https://millionshort.com/docs/integrations/opencode) (MCP): A remote server in `opencode.jsonc`, with the key read from the environment. - [Continue](https://millionshort.com/docs/integrations/continue) (MCP): A block file in `.continue/mcpServers/`. - [Goose](https://millionshort.com/docs/integrations/goose) (MCP): A streamable HTTP extension in `config.yaml`, or through `goose configure`. - [JetBrains Junie and AI Assistant](https://millionshort.com/docs/integrations/jetbrains) (MCP): An `mcp.json` for Junie, or a server in the IDE's AI settings. - [Kiro](https://millionshort.com/docs/integrations/kiro) (MCP): An `mcp.json` in `.kiro/settings`, for the IDE and the Kiro CLI. - [Antigravity](https://millionshort.com/docs/integrations/antigravity) (MCP): A `serverUrl` entry in its MCP config, from the MCP store's raw view. - [Amp](https://millionshort.com/docs/integrations/amp) (MCP): An `amp.mcpServers` entry in its settings file. - [Warp](https://millionshort.com/docs/integrations/warp) (MCP): A server added in Warp's MCP settings, pasted as JSON. - [Factory Droid](https://millionshort.com/docs/integrations/factory-droid) (MCP): One `droid mcp add` command with the key as a header. - [Amazon Q Developer](https://millionshort.com/docs/integrations/amazon-q-developer) (MCP): A server with a header in the IDE plugin's MCP settings. - [Visual Studio](https://millionshort.com/docs/integrations/visual-studio) (MCP): A `.mcp.json` in the solution, for GitHub Copilot in Visual Studio. - [Augment Code](https://millionshort.com/docs/integrations/augment) (MCP): One `auggie mcp add` command, or the settings file. - [Qwen Code](https://millionshort.com/docs/integrations/qwen-code) (MCP): One `qwen mcp add` command, or a `settings.json` entry. - [Kimi Code](https://millionshort.com/docs/integrations/kimi-code) (MCP): One `kimi mcp add` command, or `~/.kimi/mcp.json`. - [Crush](https://millionshort.com/docs/integrations/crush) (MCP): An `mcp` entry with the key read from the environment. - [Rovo Dev](https://millionshort.com/docs/integrations/rovo-dev) (MCP): A server in `~/.rovodev/mcp.json`. - [Pi](https://millionshort.com/docs/integrations/pi) (MCP): One `pi mcp add` command that reads the key from the environment. - [Grok Build](https://millionshort.com/docs/integrations/grok-build) (MCP): One `grok mcp add` command, or `~/.grok/config.toml`. - [Replit Agent](https://millionshort.com/docs/integrations/replit-agent) (MCP): A personal MCP server with a custom header, in Integrations. - [Lovable](https://millionshort.com/docs/integrations/lovable) (MCP): A custom MCP connector for the chat that builds your app. - [v0](https://millionshort.com/docs/integrations/v0) (MCP): An MCP connection with a bearer token, from the prompt bar. ## Chat apps Search from a conversation. Most connect with a key in a header; every one works with no key at all. - [Claude](https://millionshort.com/docs/integrations/claude) (MCP): A custom connector for claude.ai, the desktop app and mobile, with the key as a request header. - [ChatGPT](https://millionshort.com/docs/integrations/chatgpt) (MCP): A custom MCP server with no sign-in: the no-key mode. - [Open WebUI](https://millionshort.com/docs/integrations/open-webui) (MCP): An external tool server of type MCP, with the key as a bearer token. - [LibreChat](https://millionshort.com/docs/integrations/librechat) (MCP): An `mcpServers` entry in `librechat.yaml`, a key per user if you like. - [AnythingLLM](https://millionshort.com/docs/integrations/anythingllm) (MCP): An entry in `anythingllm_mcp_servers.json` for its agent. - [LM Studio](https://millionshort.com/docs/integrations/lm-studio) (MCP): An `mcp.json` entry, for local models that take tools. - [Cherry Studio](https://millionshort.com/docs/integrations/cherry-studio) (MCP): A streamable HTTP server with a header, in its MCP settings. - [LobeChat](https://millionshort.com/docs/integrations/lobechat) (MCP): A custom MCP skill with the key as an HTTP header. - [Msty](https://millionshort.com/docs/integrations/msty) (MCP): An HTTP tool in the Toolbox, with a bearer token. - [Mistral Le Chat](https://millionshort.com/docs/integrations/le-chat) (MCP): A custom MCP connector with an HTTP bearer token. - Slack (Coming soon): Search from a channel, as an app. - Microsoft Teams (Coming soon): Search from a chat, as an app. ## Frameworks & SDKs Agent frameworks, with their own MCP client or a function tool that calls the API. The same key everywhere. - [LangChain](https://millionshort.com/docs/integrations/langchain) (MCP; package coming soon): LangChain's MCP adapters today; `langchain-millionshort` and `@millionshort/langchain` next. - [Vercel AI SDK](https://millionshort.com/docs/integrations/vercel-ai-sdk) (MCP; package coming soon): The AI SDK's MCP client today; `@millionshort/ai-sdk` next. - [OpenAI Agents SDK](https://millionshort.com/docs/integrations/openai-agents) (MCP): The hosted MCP server as a tool, or a function tool, in Python and TypeScript. - [Claude Agent SDK](https://millionshort.com/docs/integrations/claude-agent-sdk) (MCP): An HTTP MCP server in the agent's options, with its own web tools turned off. - [Pydantic AI](https://millionshort.com/docs/integrations/pydantic-ai) (MCP): The server as a toolset, or a typed function tool. - [Google ADK](https://millionshort.com/docs/integrations/google-adk) (MCP): An MCP toolset for the Agent Development Kit, in Python and TypeScript. - [LlamaIndex](https://millionshort.com/docs/integrations/llamaindex) (MCP): The server's tools through its MCP tool spec, for a function agent. - [CrewAI](https://millionshort.com/docs/integrations/crewai) (MCP): The server in an agent's `mcps`, or a search tool of your own. - [Agno](https://millionshort.com/docs/integrations/agno) (MCP): MCP tools over streamable HTTP, with the key as a header. - [Haystack](https://millionshort.com/docs/integrations/haystack) (MCP): An MCP toolset for its agents and pipelines, with the key as a token. - [smolagents](https://millionshort.com/docs/integrations/smolagents) (MCP): Tools loaded over MCP, or a search tool of your own. - [DSPy](https://millionshort.com/docs/integrations/dspy) (Recipe): A search function as a tool for `dspy.ReAct`. - [Strands Agents](https://millionshort.com/docs/integrations/strands) (MCP): An MCP client as a tool provider for the agent. - [Mastra](https://millionshort.com/docs/integrations/mastra) (MCP): An MCP client whose tools go straight to a Mastra agent. - [Semantic Kernel](https://millionshort.com/docs/integrations/semantic-kernel) (MCP): The server as a kernel plugin over streamable HTTP. - [Microsoft Agent Framework](https://millionshort.com/docs/integrations/microsoft-agent-framework) (MCP): An MCP tool over streamable HTTP for its agents. - [Genkit](https://millionshort.com/docs/integrations/genkit) (MCP): An MCP client whose tools a Genkit generate call can use. - [Spring AI](https://millionshort.com/docs/integrations/spring-ai) (MCP): A streamable HTTP connection in the MCP client starter. - [Letta](https://millionshort.com/docs/integrations/letta) (MCP): A streamable HTTP MCP server attached to Letta agents. - [LiteLLM](https://millionshort.com/docs/integrations/litellm) (MCP): An MCP server in the proxy's config, for every model behind it. - [Composio](https://millionshort.com/docs/integrations/composio) (MCP): A custom toolkit made from the server, beside an agent's other apps. - [CAMEL-AI](https://millionshort.com/docs/integrations/camel-ai) (MCP): An MCP toolkit for CAMEL agents. - [PraisonAI](https://millionshort.com/docs/integrations/praisonai) (MCP): MCP tools for PraisonAI agents, by URL. - [Langroid](https://millionshort.com/docs/integrations/langroid) (MCP): MCP tools for Langroid agents over streamable HTTP. - [NVIDIA NeMo Agent Toolkit](https://millionshort.com/docs/integrations/nemo-agent-toolkit) (MCP): An MCP client in the workflow's YAML. ## Model APIs No framework: MillionShort as a tool in a model's own tool-calling loop, or as a remote MCP server the API connects to for you. - [OpenAI](https://millionshort.com/docs/integrations/openai) (MCP): A remote MCP tool in the Responses API, or a function tool. - [Anthropic](https://millionshort.com/docs/integrations/anthropic) (MCP): The MCP connector in the Messages API, or a tool for Claude. - [Gemini](https://millionshort.com/docs/integrations/gemini) (Recipe): A search function as a tool, called for you by the SDK. - [OpenRouter](https://millionshort.com/docs/integrations/openrouter) (Recipe): One function tool for any model that takes tools. - [Ollama](https://millionshort.com/docs/integrations/ollama) (Recipe): Search for local models that take tools. - [Groq](https://millionshort.com/docs/integrations/groq) (MCP): A remote MCP tool in its Responses API. - [Mistral](https://millionshort.com/docs/integrations/mistral) (Recipe): A function tool with the Mistral SDKs. - [Cohere](https://millionshort.com/docs/integrations/cohere) (Recipe): A tool for Command models, results returned as documents. - [xAI](https://millionshort.com/docs/integrations/xai) (MCP): A remote MCP tool in the xAI Responses API. ## Low-code builders Search as a step in a workflow: an MCP client step where the tool has one, an HTTP step everywhere. - [n8n](https://millionshort.com/docs/integrations/n8n) (MCP; node coming soon): The MCP Client Tool for an AI Agent node, or an HTTP Request node; a community node next. - [Zapier](https://millionshort.com/docs/integrations/zapier) (Recipe; app coming soon): A Webhooks by Zapier POST step; a Zapier app next. - [Make](https://millionshort.com/docs/integrations/make) (MCP; app coming soon): The MCP Client app, or the HTTP module; a Make app next. - [Dify](https://millionshort.com/docs/integrations/dify) (MCP; plugin coming soon): An MCP server under Tools, or an HTTP Request node; a plugin next. - [Langflow](https://millionshort.com/docs/integrations/langflow) (MCP): The MCP Tools component in streamable HTTP mode. - [Activepieces](https://millionshort.com/docs/integrations/activepieces) (MCP): An MCP tool for its agents, or the HTTP piece. - [RAGFlow](https://millionshort.com/docs/integrations/ragflow) (MCP): An MCP server for its agent components. - [Tines](https://millionshort.com/docs/integrations/tines) (MCP): An MCP server for its AI agent action, or an HTTP Request action. - [Gumloop](https://millionshort.com/docs/integrations/gumloop) (MCP): A custom MCP server with a header. - [Lindy](https://millionshort.com/docs/integrations/lindy) (MCP): A custom MCP server for your agents. - [Relevance AI](https://millionshort.com/docs/integrations/relevance-ai) (MCP): A custom MCP server for its agents. - [Retool](https://millionshort.com/docs/integrations/retool) (MCP): An MCP resource for Retool Agents, or a REST API resource. - [Voiceflow](https://millionshort.com/docs/integrations/voiceflow) (MCP): An MCP tool for its agents, or an API step. - [StackAI](https://millionshort.com/docs/integrations/stackai) (MCP): An MCP node with the key as a header. - [Windmill](https://millionshort.com/docs/integrations/windmill) (Recipe): A script step in TypeScript or Python that calls the API. - [Workato](https://millionshort.com/docs/integrations/workato) (MCP): A remote MCP server with a token, for its genies. - [Bubble](https://millionshort.com/docs/integrations/bubble) (Recipe): A call in the API Connector, with the key as a private header. - [Clay](https://millionshort.com/docs/integrations/clay) (Recipe): An HTTP API column that searches for each row. - [Botpress](https://millionshort.com/docs/integrations/botpress) (Recipe): An Execute Code card that calls the API. ## Research & RAG Open-source research agents and assistants that take an MCP server as a source. - [GPT Researcher](https://millionshort.com/docs/integrations/gpt-researcher) (MCP): The MCP retriever, with the key as a connection header. - [Hermes Agent](https://millionshort.com/docs/integrations/hermes-agent) (MCP): An `mcp_servers` entry in its `config.yaml`. - [OpenClaw](https://millionshort.com/docs/integrations/openclaw) (MCP; skill coming soon): An MCP server in `openclaw.json`, with its own web search turned off; a skill next. - [Onyx](https://millionshort.com/docs/integrations/onyx) (MCP): A custom MCP server with a shared API key, for its assistants. - [nanobot](https://millionshort.com/docs/integrations/nanobot) (MCP): A `tools.mcpServers` entry in its `config.json`. - [DeerFlow](https://millionshort.com/docs/integrations/deer-flow) (MCP): An HTTP MCP server in `extensions_config.json`. - [SurfSense](https://millionshort.com/docs/integrations/surfsense) (MCP): A custom plugin with a server URL and a header. - [WeKnora](https://millionshort.com/docs/integrations/weknora) (MCP): An MCP service imported as JSON. - SearXNG (Coming soon): An engine of its own, which also reaches the projects that search through SearXNG. ## Voice agents Search inside a voice agent, with short answers made to be spoken. - [LiveKit Agents](https://millionshort.com/docs/integrations/livekit-agents) (MCP): The MCP server for a voice session, or a function tool. - [Pipecat](https://millionshort.com/docs/integrations/pipecat) (MCP): An MCP client that registers the tools with the model service. - [ElevenLabs Agents](https://millionshort.com/docs/integrations/elevenlabs) (MCP): A custom MCP server with a secret header, for a voice agent. - [Vapi](https://millionshort.com/docs/integrations/vapi) (MCP): An MCP tool with the key as a header. - [Tavus](https://millionshort.com/docs/integrations/tavus) (MCP): An MCP connector that a conversational video agent can call. - [Cartesia](https://millionshort.com/docs/integrations/cartesia) (Recipe): A webhook tool that calls the API for a voice agent. ## Cookbook and starters Small working projects, each one file or one folder, run with one key. Each was run against the API on the date on its page. - [Research agent](https://millionshort.com/docs/integrations/cookbook-research-agent) (Available): Search, read the highlights, answer with citations. Python, one file. - [Next.js search app](https://millionshort.com/docs/integrations/cookbook-nextjs-search) (Available): A search page with filters, the key kept on the server. - [Long-tail finder](https://millionshort.com/docs/integrations/cookbook-long-tail-finder) (Available): The same question with and without the most popular sites, side by side. - [RAG with fresh pages](https://millionshort.com/docs/integrations/cookbook-rag-fresh-pages) (Available): Search with page text, then answer only from it. - [News watch](https://millionshort.com/docs/integrations/cookbook-news-watch) (Available): A daily brief of new articles on your topics, from the news source. - [Domain check](https://millionshort.com/docs/integrations/cookbook-domain-check) (Available): Popularity and risk for a list of sites, as a table. ## Directories Catalogues that will list the server and the skill, for clients that install from one. None is live yet: use the address above meanwhile. - Official MCP Registry (Coming soon): The server as `com.millionshort/search`. - GitHub MCP Registry (Coming soon): One-click install in VS Code. - Docker MCP Catalog (Coming soon): The remote server, from Docker's MCP Toolkit. - skills.sh (Coming soon): The search skill, for any agent that reads skills. - Gemini CLI extensions (Coming soon): The server and the skill as one extension. - Claude directory (Coming soon): The connector and the plugin. - ChatGPT directory (Coming soon): An app listing. - Cursor Marketplace (Coming soon): A plugin with the rule and the server. ## Have your agent do it Paste this into the coding agent you use. It reads the set-up file written for agents, finds the page for itself, connects the server and runs one search. ```text Prompt Read https://millionshort.com/docs/auth.md, then find the page for this agent in https://millionshort.com/docs/integrations.md and follow it to connect the MillionShort MCP server (https://mcp.millionshort.com/mcp) to this workspace. Use the key in the MILLIONSHORT_API_KEY environment variable and never print it; if it is not set, use the no-key mode. Then run one search with remove_top_sites set to 1000 and show me what came back. ``` ## Ask for an integration Not listed? If it speaks MCP it already works: give it the address at the top of this page, over streamable HTTP, with the key as an `Authorization: Bearer` header. If it takes a function as a tool, the [agent tool use guide](https://millionshort.com/docs/search/guides/agent-tool-use) has one in Python and in TypeScript. For anything else, [tell us what you use](https://millionshort.com/contact). --- Source: https://millionshort.com/docs/integrations/langchain Section: Build with # LangChain MillionShort search for LangChain agents, through LangChain's own MCP adapter, in Python and TypeScript. MCP · Python and TypeScript · Nothing of ours to install · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. LangChain connects to the MillionShort MCP server with its own `MCPAdapter`: it opens the connection, finds the server's tools, `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them all), and turns them into LangChain tools you pass to `create_agent` (`createAgent` in TypeScript). With no MCP at all, a function tool that calls the API does the same job. MillionShort's own LangChain packages are [coming soon](#coming-soon-the-packages). ## 1. Install ```bash Python pip install "langchain[mcp]" langchain-anthropic export MILLIONSHORT_API_KEY=ms-YOUR_API_KEY ``` ```bash TypeScript npm install @langchain/mcp-adapters@^2.0.0 @langchain/core @langchain/langgraph langchain @langchain/anthropic zod export MILLIONSHORT_API_KEY=ms-YOUR_API_KEY ``` In Python, MCP ships inside LangChain from version 1.4 as `langchain.mcp`, through the `mcp` extra. It is in beta: importing it prints a beta warning once, and the API may change. Before 1.4 the same job was done by the standalone `langchain-mcp-adapters` package and its `MultiServerMCPClient`; that package still exists, but LangChain's docs now point to `langchain.mcp`. In TypeScript, the examples need `@langchain/mcp-adapters` 2.0 or later. The examples use an Anthropic model, as LangChain's MCP docs do, so they read ANTHROPIC_API_KEY; any chat model that supports tools works. Get a MillionShort key in the [dashboard](https://millionshort.com/app/); an agent can ask for a [trial key](https://millionshort.com/docs/api-reference/agent-key) by itself. ## 2. Connect the server In Python, the key goes on a FastMCP `Client` as `auth`, which sends it as a bearer token; in TypeScript, it goes in the server's `headers`. Without a key, leave `auth` or the headers out. ```python Python import asyncio import os from fastmcp.client import Client from langchain.mcp import MCPAdapter async def main(): client = Client("https://mcp.millionshort.com/mcp", auth=os.environ["MILLIONSHORT_API_KEY"]) async with MCPAdapter(client) as adapter: tools = await adapter.list_tools() print([tool.name for tool in tools]) # search, get_domain_info, list_sources, ... asyncio.run(main()) ``` ```ts TypeScript import { MCPAdapter } from '@langchain/mcp-adapters'; const adapter = new MCPAdapter({ servers: { millionshort: { url: 'https://mcp.millionshort.com/mcp', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}` }, }, }, }); try { const tools = await adapter.listTools(); console.log(tools.map((tool) => tool.name)); // millionshort_search, millionshort_get_domain_info, millionshort_list_sources, ... } finally { await adapter.close(); } ``` The TypeScript adapter puts the server's name in front of each tool's name. ## 3. Give the tools to an agent Pass the tools to `create_agent` with a system prompt that says when to search. LangChain agents have no web search of their own, so there is nothing to turn off. ```python Python import asyncio import os from fastmcp.client import Client from langchain.agents import create_agent from langchain.mcp import MCPAdapter async def main(): async with MCPAdapter(Client("https://mcp.millionshort.com/mcp", auth=os.environ["MILLIONSHORT_API_KEY"])) as adapter: tools = await adapter.list_tools() agent = create_agent( "claude-sonnet-5", tools, system_prompt="Use the MillionShort search tool for anything recent or niche, and cite the URLs.", ) question = "Find independent blogs about home espresso, without the 1,000 most popular sites." result = await agent.ainvoke({"messages": [{"role": "user", "content": question}]}, {"recursion_limit": 10}) print(result["messages"][-1].content) asyncio.run(main()) ``` ```ts TypeScript import { MCPAdapter } from '@langchain/mcp-adapters'; import { createAgent } from 'langchain'; const adapter = new MCPAdapter({ servers: { millionshort: { url: 'https://mcp.millionshort.com/mcp', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}` } }, }, }); try { const agent = createAgent({ model: 'claude-sonnet-5', tools: await adapter.listTools(), systemPrompt: 'Use the MillionShort search tool for anything recent or niche, and cite the URLs.', }); const result = await agent.invoke( { messages: [{ role: 'user', content: 'Find independent blogs about home espresso, without the 1,000 most popular sites.' }] }, { recursionLimit: 10 }, ); console.log(result.messages.at(-1)?.text); } finally { await adapter.close(); } ``` The recursion limit caps the agent's steps. A line that works well in the system prompt: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## 4. Check it works Step 2 lists the tools with no model involved: you should see every tool of the server (fewer without a key). After a run of step 3, `result["messages"]` (`result.messages`) holds the model's tool calls; one of them should be to `search`, and the answer should cite pages. ## Without MCP: a function tool A function with LangChain's `tool` decorator (or `tool()` in TypeScript) calls `POST /v1/search`. ```python Python import json import os import urllib.request from langchain.agents import create_agent from langchain.tools import tool @tool def millionshort_search(query: str, remove_top_sites: int = 1000, num_results: int = 5) -> str: """Search the web with MillionShort. remove_top_sites leaves out the N most popular sites.""" request = urllib.request.Request( "https://api.millionshort.com/v1/search", data=json.dumps({"query": query, "remove_top_sites": remove_top_sites, "num_results": num_results}).encode(), headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"], "Content-Type": "application/json"}, ) with urllib.request.urlopen(request, timeout=30) as response: results = json.load(response)["data"]["results"] return json.dumps([{"title": r["title"], "url": r["url"], "snippet": r.get("snippet")} for r in results]) agent = create_agent("claude-sonnet-5", [millionshort_search]) result = agent.invoke({"messages": [{"role": "user", "content": "Find independent blogs about home espresso."}]}) print(result["messages"][-1].content) ``` ```ts TypeScript import { createAgent, tool } from 'langchain'; import { z } from 'zod'; const millionshortSearch = tool( async ({ query, remove_top_sites }) => { const res = await fetch('https://api.millionshort.com/v1/search', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json' }, body: JSON.stringify({ query, remove_top_sites, num_results: 5 }), }); if (!res.ok) throw new Error(`search failed: ${res.status}`); const { data } = (await res.json()) as { data: { results: { title: string; url: string; snippet?: string }[] } }; return JSON.stringify(data.results.map(({ title, url, snippet }) => ({ title, url, snippet }))); }, { name: 'millionshort_search', description: 'Search the web with MillionShort. remove_top_sites leaves out the N most popular sites.', schema: z.object({ query: z.string(), remove_top_sites: z.number().int().default(1000) }), }, ); const agent = createAgent({ model: 'claude-sonnet-5', tools: [millionshortSearch] }); const result = await agent.invoke({ messages: [{ role: 'user', content: 'Find independent blogs about home espresso.' }] }); console.log(result.messages.at(-1)?.text); ``` ## MCP configuration The same address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. Both adapters pick streamable HTTP for an `https` address, so there is no transport to set. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Settings | Variable | Meaning | |---|---| | `MILLIONSHORT_API_KEY` | Your key, read by the examples above. Leave `auth` or the header out for the no-key mode | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. The recursion limit of a run (`recursion_limit`, `recursionLimit`) is the step limit. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | | Python cannot import `langchain.mcp` | LangChain is older than 1.4, or was installed without the `mcp` extra | `pip install -U "langchain[mcp]"` | | `MCPAdapter` is not exported in TypeScript | `@langchain/mcp-adapters` 1.x is installed | Install `@langchain/mcp-adapters@^2.0.0` | | The run stops with a recursion limit message | The agent reached its step limit | Raise the limit, or ask for fewer results per search | ## Coming soon: the packages > **Coming soon.** MillionShort's own LangChain packages are built and tested, and are not on a package registry yet. Their names are placeholders until they are published, and may change. Until then, use the MCP adapter in steps 1 to 4, or the function tool above. The packages are three LangChain tools that call the public API, with the same fields and limits as the API, returning a reduced result made for a model to read. | Tool name | What it does | Endpoint | |---|---|---| | `millionshort_search` | Search one or more sources | `POST /v1/search` | | `millionshort_get_domain_info` | Popularity and risk for up to 25 sites | `POST /v1/domain` | | `millionshort_list_sources` | The sources, page types and topics search accepts | `GET /v1/sources` | ### Python: `langchain-millionshort` Package (placeholder name): `langchain-millionshort`. Python 3.10 or later. Give all three tools to an agent: ```python from langgraph.prebuilt import create_react_agent from langchain_millionshort import millionshort_tools def build_agent(model): """`model` is any LangChain chat model that supports tools.""" return create_react_agent(model, millionshort_tools()) ``` Or call one tool directly, which is also the quickest way to see what a model will be given: ```python import json from langchain_millionshort import MillionShortSearch search = MillionShortSearch() # reads MILLIONSHORT_API_KEY answer = json.loads( search.invoke({"query": "restoring a cast iron skillet", "remove_top_sites": 1000, "num_results": 3}) ) for hit in answer["results"]: print(hit["position"], hit["title"], hit["url"]) ``` | Name | What it is | |---|---| | `millionshort_tools(client=None)` | All three tools, as a list | | `MillionShortSearch`, `MillionShortDomainInfo`, `MillionShortSources` | The tools, one class each | | `MillionShortClient(api_key=..., base_url=..., timeout=...)` | Sets the key, the address and the timeout. Pass it as `client` | | `MillionShortError` | Raised by a failed call, with `code`, `status`, `request_id` and `retry_after_seconds` | Each tool works with `invoke` and `ainvoke`, and returns JSON text. ### TypeScript: `@millionshort/langchain` Package (placeholder name): `@millionshort/langchain`. It needs `@langchain/core`. ```ts import type { BaseChatModel } from '@langchain/core/language_models/chat_models'; import { millionshortTools } from '@millionshort/langchain'; /** `llm` is any LangChain chat model that supports tools. */ export function withSearch(llm: BaseChatModel) { if (!llm.bindTools) throw new Error('this model does not take tools'); return llm.bindTools(millionshortTools()); } ``` The same array goes to an agent constructor as its `tools`. One tool, called directly: ```ts import { millionshortSearch } from '@millionshort/langchain'; const search = millionshortSearch(); // reads MILLIONSHORT_API_KEY const answer = JSON.parse( await search.invoke({ query: 'restoring a cast iron skillet', remove_top_sites: 1000, num_results: 3 }), ); for (const hit of answer.results) { console.log(hit.position, hit.title, hit.url); } ``` | Export | What it is | |---|---| | `millionshortTools(options?)` | All three tools, as an array | | `millionshortSearch(options?)`, `millionshortDomainInfo(options?)`, `millionshortSources(options?)` | One tool each | | `MillionShortError` | Thrown by a failed call, with `code`, `status`, `requestId` and `retryAfterSeconds` | Options: `apiKey`, `baseUrl`, `timeoutMs` and `fetch`. ### Settings and fields Both packages read `MILLIONSHORT_API_KEY` (the `api_key` argument or `apiKey` option overrides it) and `MILLIONSHORT_BASE_URL`, the API address, by default `https://api.millionshort.com`. The search tool takes the fields of [`POST /v1/search`](https://millionshort.com/docs/search/parameters) under the same names. A search answer is reduced to what a model needs: for each result its position, title, URL, site, source, date, snippet, popularity band and risk level, then the counts of removed results, any warnings, the credits charged and the request id. ## Related - [Agent tool use](https://millionshort.com/docs/search/guides/agent-tool-use): when to give a model tools, and what to tell it. - [Vercel AI SDK](https://millionshort.com/docs/integrations/vercel-ai-sdk), [LlamaIndex](https://millionshort.com/docs/integrations/llamaindex) and [CrewAI](https://millionshort.com/docs/integrations/crewai). - [MCP server](https://millionshort.com/docs/mcp) and [Filters for agents](https://millionshort.com/docs/search/filters). - LangChain's own documentation, read on 2026-11-19: [MCP (Python)](https://docs.langchain.com/oss/python/langchain/mcp), [MCP authentication (Python)](https://docs.langchain.com/oss/python/langchain/mcp/auth), [Migrate from langchain-mcp-adapters](https://docs.langchain.com/oss/python/migrate/langchain-mcp-adapters), [MCP (TypeScript)](https://docs.langchain.com/oss/javascript/langchain/mcp), [MCP authentication (TypeScript)](https://docs.langchain.com/oss/javascript/langchain/mcp/auth). --- Source: https://millionshort.com/docs/integrations/vercel-ai-sdk Section: Build with # Vercel AI SDK MillionShort search as tools for the AI SDK's generateText and streamText, through its MCP client. MCP · TypeScript · Nothing of ours to install · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. The AI SDK's MCP client connects to the MillionShort MCP server and turns its tools (`search`, `get_domain_info`, `list_sources` and the tools of the other endpoints; [the MCP page](https://millionshort.com/docs/mcp#tools) lists them all) into AI SDK tools for `generateText` and `streamText`. With no MCP at all, a `tool()` that calls the API does the same job. MillionShort's own AI SDK package is [coming soon](#coming-soon-the-package). ## 1. Install ```bash TypeScript npm install ai @ai-sdk/mcp zod export MILLIONSHORT_API_KEY=ms-YOUR_API_KEY ``` The MCP client lives in its own package, `@ai-sdk/mcp`. The examples use a model string, as the AI SDK's docs do; a string in the `creator/model-name` form goes through the AI Gateway, which reads its key from AI_GATEWAY_API_KEY. A provider package's model works the same way. Get a MillionShort key in the [dashboard](https://millionshort.com/app/); an agent can ask for a [trial key](https://millionshort.com/docs/api-reference/agent-key) by itself. Run this on a server. The key must not reach a browser. ## 2. Connect the server `createMCPClient` with an `http` transport speaks streamable HTTP, and sends `headers` with every request. Without a key, leave the headers out. ```ts TypeScript import { createMCPClient } from '@ai-sdk/mcp'; const mcpClient = await createMCPClient({ transport: { type: 'http', url: 'https://mcp.millionshort.com/mcp', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}` }, }, }); try { const tools = await mcpClient.tools(); console.log(Object.keys(tools)); // search, get_domain_info, list_sources, ... } finally { await mcpClient.close(); } ``` ## 3. Give the tools to a model Pass the tools to `generateText` or `streamText`. `stopWhen: isStepCount(5)` lets the model search, read the results and search again, and stops it after five steps. The AI SDK adds no web search of its own unless you pass a provider's search tool, so leave those out. ```ts TypeScript import { createMCPClient } from '@ai-sdk/mcp'; import { generateText, isStepCount } from 'ai'; const mcpClient = await createMCPClient({ transport: { type: 'http', url: 'https://mcp.millionshort.com/mcp', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}` }, }, }); try { const { text } = await generateText({ model: 'anthropic/claude-sonnet-5.5', system: 'Use the MillionShort search tool for anything recent or niche, and cite the URLs.', tools: await mcpClient.tools(), stopWhen: isStepCount(5), prompt: 'Find independent blogs about home espresso, without the 1,000 most popular sites.', }); console.log(text); } finally { await mcpClient.close(); } ``` With `streamText`, close the client in the `onEnd` callback instead, once the response has finished. A line that works well in `system`: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## 4. Check it works Step 2 lists the tools with no model involved: you should see every tool of the server (fewer without a key; [the MCP page](https://millionshort.com/docs/mcp#tools) lists them). After a `generateText` run, `steps` in its result holds each step's tool calls; one of them should be to `search`, and the answer should cite pages. ## Without MCP: a function tool A `tool()` with an `inputSchema` and an `execute` function calls `POST /v1/search`. ```ts TypeScript import { generateText, isStepCount, tool } from 'ai'; import { z } from 'zod'; const millionshortSearch = tool({ description: 'Search the web with MillionShort. remove_top_sites leaves out the N most popular sites.', inputSchema: z.object({ query: z.string(), remove_top_sites: z.number().int().default(1000) }), execute: async ({ query, remove_top_sites }) => { const res = await fetch('https://api.millionshort.com/v1/search', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json' }, body: JSON.stringify({ query, remove_top_sites, num_results: 5 }), }); if (!res.ok) throw new Error(`search failed: ${res.status}`); const { data } = (await res.json()) as { data: { results: { title: string; url: string; snippet?: string }[] } }; return data.results.map(({ title, url, snippet }) => ({ title, url, snippet })); }, }); const { text } = await generateText({ model: 'anthropic/claude-sonnet-5.5', tools: { millionshort_search: millionshortSearch }, stopWhen: isStepCount(5), prompt: 'Find independent blogs about home espresso.', }); console.log(text); ``` ## MCP configuration The same address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP (transport type `http` in the AI SDK). | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Settings | Variable | Meaning | |---|---| | `MILLIONSHORT_API_KEY` | Your key, read by the examples above. Leave the header out for the no-key mode | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. Each step of a multi-step generation can search again, so `stopWhen` is also your spending limit. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | | `createMCPClient` is not found in `ai` | The MCP client moved to its own package | Install `@ai-sdk/mcp` and import `createMCPClient` from it | | The model stops after one step, without an answer | `generateText` and `streamText` stop after one step by default | Set `stopWhen: isStepCount(5)` or similar | ## Coming soon: the package > **Coming soon.** MillionShort's own AI SDK package is built and tested, and is not on a package registry yet. Its name is a placeholder until it is published, and may change. Until then, use the MCP client in steps 1 to 4, or the function tool above. Package (placeholder name): `@millionshort/ai-sdk`. Three tools for the AI SDK, version 5 or later. They call the public API, have the same fields and limits as it, and return a reduced result made for a model to read. ```ts import { generateText, stepCountIs, type LanguageModel } from 'ai'; import { millionshortTools } from '@millionshort/ai-sdk'; /** `model` is any AI SDK language model that supports tools. */ export async function research(model: LanguageModel, question: string) { const { text } = await generateText({ model, prompt: question, tools: millionshortTools(), // reads MILLIONSHORT_API_KEY stopWhen: stepCountIs(5), }); return text; } ``` `millionshortTools()` returns an object with three tools, under the names the MCP server uses: | Tool | What it does | Endpoint | |---|---|---| | `search` | Search one or more sources | `POST /v1/search` | | `get_domain_info` | Popularity and risk for up to 25 sites | `POST /v1/domain` | | `list_sources` | The sources, page types and topics search accepts | `GET /v1/sources` | To give a model search and nothing else, or to name the tool yourself: ```ts import { generateText, stepCountIs, type LanguageModel } from 'ai'; import { millionshortSearch } from '@millionshort/ai-sdk'; export async function answer(model: LanguageModel, question: string) { const { text } = await generateText({ model, prompt: question, tools: { web_search: millionshortSearch({ timeoutMs: 20000 }) }, stopWhen: stepCountIs(3), }); return text; } ``` | Export | What it is | |---|---| | `millionshortTools(options?)` | All three tools | | `millionshortSearch(options?)` | Search | | `millionshortDomainInfo(options?)` | Domain info | | `millionshortSources(options?)` | The sources list | | `MillionShortClient` | The small HTTP client the tools use | | `MillionShortError` | Thrown by a failed call, with `code`, `status`, `requestId` and `retryAfterSeconds` | | Option | Environment variable | Meaning | |---|---|---| | `apiKey` | `MILLIONSHORT_API_KEY` | Your key | | `baseUrl` | `MILLIONSHORT_BASE_URL` | The API address. Default `https://api.millionshort.com` | | `timeoutMs` | | How long to wait for one call | | `fetch` | | Your own `fetch`, for a proxy or a test | The package's own client makes the same call the search tool makes, and returns the same reduced result, with no model involved: ```ts import { MillionShortClient } from '@millionshort/ai-sdk'; const client = new MillionShortClient(); // reads MILLIONSHORT_API_KEY const result = await client.search({ query: 'restoring a cast iron skillet', remove_top_sites: 1000, num_results: 3, }); console.log(JSON.stringify(result, null, 2).slice(0, 600)); ``` The search tool takes the fields of [`POST /v1/search`](https://millionshort.com/docs/search/parameters) under the same names. A search answer is reduced to what a model needs: for each result its position, title, URL, site, source, date, snippet, popularity band and risk level, then the counts of removed results, any warnings, the credits charged and the request id. ## Related - [Agent tool use](https://millionshort.com/docs/search/guides/agent-tool-use): when to use tools, and what to tell the model. - [LangChain](https://millionshort.com/docs/integrations/langchain), with the same server through LangChain's MCP adapter. - [OpenAI Agents SDK](https://millionshort.com/docs/integrations/openai-agents) and [Claude Agent SDK](https://millionshort.com/docs/integrations/claude-agent-sdk). - [MCP server](https://millionshort.com/docs/mcp) and [Filters for agents](https://millionshort.com/docs/search/filters). - The AI SDK's own documentation, read on 2026-11-19: [MCP tools](https://ai-sdk.dev/docs/ai-sdk-core/mcp-tools), [Tool calling](https://ai-sdk.dev/docs/ai-sdk-core/tools-and-tool-calling), [AI Gateway](https://ai-sdk.dev/providers/ai-sdk-providers/ai-gateway). --- Source: https://millionshort.com/docs/integrations/activepieces Section: Build with # Activepieces MillionShort search as a step in Activepieces, through the hosted MCP server or the API. MCP · Hosted MCP server, nothing to install · Key in a form field · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. ## 1. Add the MCP server Open an agent's **Tools**, add an **MCP server**, URL `https://mcp.millionshort.com/mcp`, authentication **Custom headers** with `Authorization: Bearer ms-YOUR_API_KEY`, or none for the no-key mode. Activepieces lists the tools as soon as it is added. ## 2. Or call the API in an HTTP step In a flow, the **HTTP** piece's **Send HTTP request**: ```text Send HTTP request Method: POST URL: https://api.millionshort.com/v1/search Authentication: Bearer Token, Token = ms-YOUR_API_KEY Body Type: JSON JSON Body: {"query": "...", "remove_top_sites": 1000, "num_results": 5} ``` A token typed into the step is stored in the flow and shows in exports. Later steps pick the results from this step's output in the data selector. ## 3. Try it Ask Activepieces's agent, or run the step with this as the query: > Search MillionShort for forum threads about restoring a cast iron skillet, with the 1,000 most popular sites removed. List the five most useful with their links. A good answer comes from a `search` call (the client shows the tool call) and links to pages you may not have seen before. ## 4. Tell it when to search Activepieces has no setting we could find that turns its own web search off, so say which search to use. Add this line to the agent's instructions: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## 5. Check it works The agent's tool list shows the server's tools. Test the HTTP step and look for `data.results` in its output. With a key you should see `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them); with no key, fewer, `search` and `list_sources` among them. ## The server One address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. A key is optional. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | ## Related - [MCP server](https://millionshort.com/docs/mcp): the address, every tool, and what the no-key mode allows. - [Filters for agents](https://millionshort.com/docs/search/filters): what to ask `search` for, with recipes. - More low-code builders: [n8n](https://millionshort.com/docs/integrations/n8n), [Zapier](https://millionshort.com/docs/integrations/zapier), [Make](https://millionshort.com/docs/integrations/make), [Dify](https://millionshort.com/docs/integrations/dify), and [every integration](https://millionshort.com/docs/integrations). - Activepieces's own documentation, read on 2026-11-19: [Agent tools](https://www.activepieces.com/docs/agents/tools), [HTTP piece](https://www.activepieces.com/pieces/http). --- Source: https://millionshort.com/docs/integrations/agno Section: Build with # Agno MillionShort search for Agno agents, through Agno's MCP tools or a plain Python function. MCP · Python · Nothing of ours to install · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. Agno's `MCPTools` connects to the MillionShort MCP server over streamable HTTP and hands its tools to an agent: `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints, such as `extract`, `places`, `map` and `crawl` ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them all). With no MCP at all, a Python function that calls the API does the same job. ## 1. Install ```bash Python pip install "agno[mcp]" openai export MILLIONSHORT_API_KEY=ms-YOUR_API_KEY ``` The examples use an OpenAI model, so Agno reads your OpenAI key from OPENAI_API_KEY too; any model Agno supports works the same way. Get a MillionShort key in the [dashboard](https://millionshort.com/app/); an agent can ask for a [trial key](https://millionshort.com/docs/api-reference/agent-key) by itself. ## 2. Connect the server `StreamableHTTPClientParams` carries the address and the header. `async with` opens the connection, loads the tools and closes it at the end. ```python Python import asyncio import os from agno.agent import Agent from agno.models.openai import OpenAIResponses from agno.tools.mcp import MCPTools, StreamableHTTPClientParams server_params = StreamableHTTPClientParams( url="https://mcp.millionshort.com/mcp", headers={"Authorization": f"Bearer {os.environ['MILLIONSHORT_API_KEY']}"}, ) async def main(): async with MCPTools(server_params=server_params, transport="streamable-http") as millionshort: agent = Agent( model=OpenAIResponses(id="gpt-5.2"), tools=[millionshort], instructions="Use the millionshort search tool for anything recent or niche, and cite the URLs.", ) await agent.aprint_response("Find independent blogs about home espresso, without the 1,000 most popular sites.", stream=True) asyncio.run(main()) ``` ## 3. Give the tools to an agent The `MCPTools` object goes into the agent's `tools` list like any other toolkit. Two arguments of `MCPTools` are worth knowing: - Without a key, pass the address alone: `MCPTools(url="https://mcp.millionshort.com/mcp", transport="streamable-http")`. The agent gets `search` and `list_sources`. - `include_tools=["search"]` loads only the tools you name, if you want the agent to see less. Agno agents have no web search of their own: the agent has only the tools you pass, so there is nothing to turn off. ## 4. Check it works Run the example: the answer should cite pages from the results. To see the tools without a model, list them from the connection: ```python Python import asyncio import os from agno.tools.mcp import MCPTools, StreamableHTTPClientParams async def main(): params = StreamableHTTPClientParams( url="https://mcp.millionshort.com/mcp", headers={"Authorization": f"Bearer {os.environ['MILLIONSHORT_API_KEY']}"}, ) async with MCPTools(server_params=params, transport="streamable-http") as millionshort: print([tool.name for tool in millionshort.functions.values()]) # search, get_domain_info, list_sources, ... asyncio.run(main()) ``` If the model answers from memory, say when to search in its instructions: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## Without MCP: a function tool Agno turns a plain Python function into a tool: its name, type hints and docstring tell the model how to call it. ```python Python import json import os import urllib.request from agno.agent import Agent from agno.models.openai import OpenAIResponses def millionshort_search(query: str, remove_top_sites: int = 1000, num_results: int = 5) -> str: """Search the web with MillionShort. remove_top_sites leaves out the N most popular sites.""" request = urllib.request.Request( "https://api.millionshort.com/v1/search", data=json.dumps({"query": query, "remove_top_sites": remove_top_sites, "num_results": num_results}).encode(), headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"], "Content-Type": "application/json"}, ) with urllib.request.urlopen(request, timeout=30) as response: results = json.load(response)["data"]["results"] return json.dumps([{"title": r["title"], "url": r["url"], "snippet": r.get("snippet")} for r in results]) agent = Agent(model=OpenAIResponses(id="gpt-5.2"), tools=[millionshort_search]) agent.print_response("Find independent blogs about home espresso.") ``` ## MCP configuration The same address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Settings | Variable | Meaning | |---|---| | `MILLIONSHORT_API_KEY` | Your key, read by the examples above. Leave the header out for the no-key mode | `StreamableHTTPClientParams` also takes `timeout` (seconds, 30 by default) and `sse_read_timeout` (300 by default). ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | | The agent has no MillionShort tools | The agent ran after the `async with` block ended, so the connection is closed | Create and run the agent inside the `async with MCPTools(...)` block | ## Related - [Agent tool use](https://millionshort.com/docs/search/guides/agent-tool-use): when to give a model tools, and what to tell it. - [OpenAI Agents SDK](https://millionshort.com/docs/integrations/openai-agents) and [Strands Agents](https://millionshort.com/docs/integrations/strands): the same server in other agent frameworks. - [MCP server](https://millionshort.com/docs/mcp) and [Filters for agents](https://millionshort.com/docs/search/filters). - Agno's own documentation, read on 2026-11-19: [Streamable HTTP transport](https://docs.agno.com/tools/mcp/transports/streamable_http), [Python functions as tools](https://docs.agno.com/tools/creating-tools/python-functions). --- Source: https://millionshort.com/docs/integrations/amazon-q-developer Section: Build with # Amazon Q Developer MillionShort search in Amazon Q Developer, through the hosted MCP server. MCP · Hosted MCP server, nothing to install · Key in a header · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. ## 1. Add the server In the Amazon Q Developer plugin (VS Code, JetBrains and others): 1. Open the Q Developer panel, **Chat**, the tools icon, then **+**. 2. Choose the scope (global or this workspace), name it `millionshort`, transport **http**, URL `https://mcp.millionshort.com/mcp`. 3. Under **Headers**, add `Authorization` with the value `Bearer ms-YOUR_API_KEY`. Leave it out for the no-key mode. 4. **Save**. ## 2. Try it Ask Amazon Q Developer: > Search MillionShort for forum threads about restoring a cast iron skillet, with the 1,000 most popular sites removed. List the five most useful with their links. A good answer comes from a `search` call (the client shows the tool call) and links to pages you may not have seen before. ## 3. Tell it when to search Amazon Q Developer has no setting we could find that turns its own web search off, so say which search to use. Add this line to the project's instructions for Amazon Q: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## 4. Check it works After saving, the MCP servers panel lists `millionshort` and its tools, each with its permission. With a key you should see `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them); with no key, fewer, `search` and `list_sources` among them. ## Good to know - The Amazon Q Developer CLI is now the Kiro CLI: its set-up is on the [Kiro page](https://millionshort.com/docs/integrations/kiro). ## The server One address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. A key is optional. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | ## Related - [MCP server](https://millionshort.com/docs/mcp): the address, every tool, and what the no-key mode allows. - [Filters for agents](https://millionshort.com/docs/search/filters): what to ask `search` for, with recipes. - More coding agents: [Claude Code](https://millionshort.com/docs/integrations/claude-code), [Cursor](https://millionshort.com/docs/integrations/cursor), [Codex](https://millionshort.com/docs/integrations/codex), [GitHub Copilot in VS Code](https://millionshort.com/docs/integrations/vscode), and [every integration](https://millionshort.com/docs/integrations). - Amazon Q Developer's own documentation, read on 2026-11-19: [MCP in the IDE](https://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/mcp-ide.html), [MCP](https://docs.aws.amazon.com/amazonq/latest/qdeveloper-ug/qdev-mcp.html). --- Source: https://millionshort.com/docs/integrations/amp Section: Build with # Amp MillionShort search in Amp, through the hosted MCP server. MCP · Hosted MCP server, nothing to install · Key read from the environment · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. ## 1. Add the server Add the server under `amp.mcpServers` in `~/.config/amp/settings.json`. Amp fills in `${MILLIONSHORT_API_KEY}` from the environment: ```json With a key { "amp.mcpServers": { "millionshort": { "url": "https://mcp.millionshort.com/mcp", "headers": { "Authorization": "Bearer ${MILLIONSHORT_API_KEY}" } } } } ``` ```json Without a key { "amp.mcpServers": { "millionshort": { "url": "https://mcp.millionshort.com/mcp" } } } ``` In a workspace's `.amp/settings.json` the server runs only after `amp mcp approve millionshort`. ## 2. Try it Ask Amp: > Search MillionShort for forum threads about restoring a cast iron skillet, with the 1,000 most popular sites removed. List the five most useful with their links. A good answer comes from a `search` call (the client shows the tool call) and links to pages you may not have seen before. ## 3. Turn off the built-in search Turn Amp's own web tools off with `amp.tools.disable` in the same file. Run `amp tools list` first to see their exact names: ```json settings.json { "amp.tools.disable": ["builtin:web_search", "builtin:read_web_page"] } ``` Add this line to `AGENTS.md`: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## 4. Check it works Run `amp mcp doctor`: it shows the connection. `amp tools list` lists the server's tools. With a key you should see `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them); with no key, fewer, `search` and `list_sources` among them. ## The server One address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. A key is optional. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | ## Related - [MCP server](https://millionshort.com/docs/mcp): the address, every tool, and what the no-key mode allows. - [Filters for agents](https://millionshort.com/docs/search/filters): what to ask `search` for, with recipes. - More coding agents: [Claude Code](https://millionshort.com/docs/integrations/claude-code), [Cursor](https://millionshort.com/docs/integrations/cursor), [Codex](https://millionshort.com/docs/integrations/codex), [GitHub Copilot in VS Code](https://millionshort.com/docs/integrations/vscode), and [every integration](https://millionshort.com/docs/integrations). - Amp's own documentation, read on 2026-11-19: [MCP](https://ampcode.com/docs/markdown/customize/mcp), [Settings](https://ampcode.com/docs/markdown/cli/settings), [AGENTS.md](https://ampcode.com/docs/markdown/customize/agents-md). --- Source: https://millionshort.com/docs/integrations/anthropic Section: Build with # Anthropic MillionShort search for Claude in the Messages API, through the MCP connector or a tool the SDK's tool runner calls, in Python and TypeScript. MCP · Python and TypeScript · Nothing of ours to install · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. The MCP connector lets the Messages API connect to the MillionShort MCP server for you: Anthropic's servers list the server's tools ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them) and call them while Claude works, in one request. If you would rather run the search in your own process, the SDK's tool runner calls a plain function for Claude and loops until it is done. ## 1. Install ```bash Python pip install anthropic requests export MILLIONSHORT_API_KEY=ms-YOUR_API_KEY ``` ```bash TypeScript npm install @anthropic-ai/sdk zod export MILLIONSHORT_API_KEY=ms-YOUR_API_KEY ``` The SDK reads your Anthropic key from ANTHROPIC_API_KEY. Get a MillionShort key in the [dashboard](https://millionshort.com/app/); an agent can ask for a [trial key](https://millionshort.com/docs/api-reference/agent-key) by itself. `requests` and `zod` are only for the tool runner further down. ## 2. Connect the server The connector is in beta: call `client.beta.messages.create` with the `mcp-client-2025-11-20` beta. It takes two halves, and both are required: the server in `mcp_servers`, and an `mcp_toolset` in `tools` that names it. The key goes in `authorization_token`, which the connector sends to our server as a bearer token. Without a key, leave `authorization_token` out. ```python Python import os import anthropic client = anthropic.Anthropic() response = client.beta.messages.create( model="claude-opus-5-5", max_tokens=16000, betas=["mcp-client-2025-11-20"], mcp_servers=[{ "type": "url", "url": "https://mcp.millionshort.com/mcp", "name": "millionshort", "authorization_token": os.environ["MILLIONSHORT_API_KEY"], }], tools=[{"type": "mcp_toolset", "mcp_server_name": "millionshort"}], messages=[{"role": "user", "content": "Find independent blogs about home espresso, without the 1,000 most popular sites."}], ) print("".join(block.text for block in response.content if block.type == "text")) ``` ```ts TypeScript import Anthropic from '@anthropic-ai/sdk'; const client = new Anthropic(); const response = await client.beta.messages.create({ model: 'claude-opus-5-5', max_tokens: 16000, betas: ['mcp-client-2025-11-20'], mcp_servers: [ { type: 'url', url: 'https://mcp.millionshort.com/mcp', name: 'millionshort', authorization_token: process.env.MILLIONSHORT_API_KEY }, ], tools: [{ type: 'mcp_toolset', mcp_server_name: 'millionshort' }], messages: [{ role: 'user', content: 'Find independent blogs about home espresso, without the 1,000 most popular sites.' }], }); for (const block of response.content) if (block.type === 'text') console.log(block.text); ``` Anthropic's servers make the calls, so our server must be reachable from the internet, which it is. The connector speaks streamable HTTP, which is what our server speaks. ## 3. Tell it when to search Claude's own web search is a server tool that runs only when you list it in `tools`, so leave it out. Claude calls a connected tool when the request maps to what the tool does; to make that reliable, put a line like this in `system`: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. To offer only some of the tools, turn them all off in the toolset's `default_config` and turn the ones you want back on in its `configs`, keyed by tool name (each with `"enabled": true`). ## 4. Check it works Each tool call shows up in the response's `content` as an `mcp_tool_use` block, followed by an `mcp_tool_result` block with what our server sent back: ```python Python import os import anthropic response = anthropic.Anthropic().beta.messages.create( model="claude-opus-5-5", max_tokens=16000, betas=["mcp-client-2025-11-20"], mcp_servers=[{"type": "url", "url": "https://mcp.millionshort.com/mcp", "name": "millionshort", "authorization_token": os.environ["MILLIONSHORT_API_KEY"]}], tools=[{"type": "mcp_toolset", "mcp_server_name": "millionshort"}], messages=[{"role": "user", "content": "Search MillionShort for home espresso blogs."}], ) for block in response.content: if block.type == "mcp_tool_use": print(block.server_name, block.name, block.input) # millionshort search {...} elif block.type == "mcp_tool_result": print("error" if block.is_error else "ok") ``` ```ts TypeScript import Anthropic from '@anthropic-ai/sdk'; const response = await new Anthropic().beta.messages.create({ model: 'claude-opus-5-5', max_tokens: 16000, betas: ['mcp-client-2025-11-20'], mcp_servers: [{ type: 'url', url: 'https://mcp.millionshort.com/mcp', name: 'millionshort', authorization_token: process.env.MILLIONSHORT_API_KEY }], tools: [{ type: 'mcp_toolset', mcp_server_name: 'millionshort' }], messages: [{ role: 'user', content: 'Search MillionShort for home espresso blogs.' }], }); for (const block of response.content) { if (block.type === 'mcp_tool_use') console.log(block.server_name, block.name, block.input); else if (block.type === 'mcp_tool_result') console.log(block.is_error ? 'error' : 'ok'); } ``` To try it, ask: > Search MillionShort for forum threads about restoring a cast iron skillet, with the 1,000 most popular sites removed. List the five most useful with their links. ## Without MCP: the tool runner The SDK's tool runner (also in beta) turns a function into a tool, runs it when Claude asks, and loops until Claude stops asking. Your process makes the search, so this works where the connector is not available. ```python Python import json import os import anthropic import requests from anthropic import beta_tool @beta_tool def millionshort_search(query: str) -> str: """Search the web with MillionShort, leaving out the 1,000 most popular sites. Args: query: What to search for. """ r = requests.post( "https://api.millionshort.com/v1/search", headers={"Authorization": f"Bearer {os.environ['MILLIONSHORT_API_KEY']}"}, json={"query": query, "remove_top_sites": 1000, "num_results": 5}, timeout=30, ) r.raise_for_status() return json.dumps([{"title": x["title"], "url": x["url"], "snippet": x.get("snippet")} for x in r.json()["data"]["results"]]) runner = anthropic.Anthropic().beta.messages.tool_runner( model="claude-opus-5-5", max_tokens=16000, tools=[millionshort_search], messages=[{"role": "user", "content": "Find independent blogs about home espresso."}], ) final = runner.until_done() print("".join(block.text for block in final.content if block.type == "text")) ``` ```ts TypeScript import Anthropic from '@anthropic-ai/sdk'; import { betaZodTool } from '@anthropic-ai/sdk/helpers/beta/zod'; import { z } from 'zod'; const millionshortSearch = betaZodTool({ name: 'millionshort_search', description: 'Search the web with MillionShort, leaving out the 1,000 most popular sites.', inputSchema: z.object({ query: z.string().describe('What to search for') }), run: async ({ query }) => { const res = await fetch('https://api.millionshort.com/v1/search', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json' }, body: JSON.stringify({ query, remove_top_sites: 1000, num_results: 5 }), }); if (!res.ok) throw new Error(`search failed: ${res.status}`); const { data } = (await res.json()) as { data: { results: { title: string; url: string; snippet?: string }[] } }; return JSON.stringify(data.results.map(({ title, url, snippet }) => ({ title, url, snippet }))); }, }); const final = await new Anthropic().beta.messages.toolRunner({ model: 'claude-opus-5-5', max_tokens: 16000, tools: [millionshortSearch], messages: [{ role: 'user', content: 'Find independent blogs about home espresso.' }], }); for (const block of final.content) if (block.type === 'text') console.log(block.text); ``` In Python you can also iterate the runner (`for message in runner:`) to see each turn as it happens. ## MCP configuration The same address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Settings | Variable | Meaning | |---|---| | `MILLIONSHORT_API_KEY` | Your key, read by the examples above. Leave `authorization_token` out for the no-key mode | | ANTHROPIC_API_KEY | Your Anthropic key, read by the SDK | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | | `400` naming `mcp_servers` or the toolset | One half is missing, or `mcp_server_name` does not match the server's `name` | Send both, with the same name, and the `mcp-client-2025-11-20` beta | | The connector fails, the tool runner works | Anthropic's servers could not reach ours, or the connector is not offered where you call Claude | Try again, or use the tool runner | ## Related - [Agent tool use](https://millionshort.com/docs/search/guides/agent-tool-use): when to give a model tools, and what to tell it. - [Claude](https://millionshort.com/docs/integrations/claude) and [Claude Code](https://millionshort.com/docs/integrations/claude-code): the same server in Anthropic's apps. - Other model APIs: [OpenAI](https://millionshort.com/docs/integrations/openai), [Gemini](https://millionshort.com/docs/integrations/gemini), [Groq](https://millionshort.com/docs/integrations/groq), [xAI](https://millionshort.com/docs/integrations/xai). - [MCP server](https://millionshort.com/docs/mcp) and [Filters for agents](https://millionshort.com/docs/search/filters). - Anthropic's own documentation, read on 2026-11-19: [MCP connector](https://platform.claude.com/docs/en/agents-and-tools/mcp-connector), [Tool use](https://platform.claude.com/docs/en/agents-and-tools/tool-use/overview). --- Source: https://millionshort.com/docs/integrations/antigravity Section: Build with # Antigravity MillionShort search in Antigravity, through the hosted MCP server. MCP · Hosted MCP server, nothing to install · Key in a header · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. ## 1. Add the server In the IDE, open the **...** menu of the agent panel, **MCP Servers**, **Manage MCP Servers**, **View raw config**, and add the server. The file is `~/.gemini/config/mcp_config.json` (every project) or `.agents/mcp_config.json` in a workspace. The key is `serverUrl`, and the server must speak streamable HTTP, which ours does. ```json With a key { "mcpServers": { "millionshort": { "serverUrl": "https://mcp.millionshort.com/mcp", "headers": { "Authorization": "Bearer ms-YOUR_API_KEY" } } } } ``` ```json Without a key { "mcpServers": { "millionshort": { "serverUrl": "https://mcp.millionshort.com/mcp" } } } ``` In the Antigravity CLI (`agy`), `/mcp` opens the same settings. ## 2. Try it Ask Antigravity: > Search MillionShort for forum threads about restoring a cast iron skillet, with the 1,000 most popular sites removed. List the five most useful with their links. A good answer comes from a `search` call (the client shows the tool call) and links to pages you may not have seen before. ## 3. Tell it when to search Antigravity has no setting we could find that turns its own web search off, so say which search to use. Add this line to `AGENTS.md` or `GEMINI.md`: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## 4. Check it works `/mcp` in the CLI, or the MCP Servers panel in the IDE, shows the server and its tools. MCP tools ask before they run; a permission rule `mcp(millionshort/*)` allows every tool of the server, `crawl` included, which spends credits. With a key you should see `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them); with no key, fewer, `search` and `list_sources` among them. ## The server One address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. A key is optional. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | ## Related - [MCP server](https://millionshort.com/docs/mcp): the address, every tool, and what the no-key mode allows. - [Filters for agents](https://millionshort.com/docs/search/filters): what to ask `search` for, with recipes. - More coding agents: [Claude Code](https://millionshort.com/docs/integrations/claude-code), [Cursor](https://millionshort.com/docs/integrations/cursor), [Codex](https://millionshort.com/docs/integrations/codex), [GitHub Copilot in VS Code](https://millionshort.com/docs/integrations/vscode), and [every integration](https://millionshort.com/docs/integrations). - Antigravity's own documentation, read on 2026-11-19: [MCP](https://antigravity.google/docs/mcp), [Rules](https://antigravity.google/docs/rules), [Permissions](https://antigravity.google/docs/permissions). --- Source: https://millionshort.com/docs/integrations/anythingllm Section: Build with # AnythingLLM MillionShort search in AnythingLLM, through the hosted MCP server. MCP · Hosted MCP server, nothing to install · Key in a header · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. ## 1. Add the server Add the server to `anythingllm_mcp_servers.json`, in the `plugins` folder of AnythingLLM's storage (the desktop app's is `~/Library/Application Support/anythingllm-desktop/storage/plugins` on macOS, `~/.config/anythingllm-desktop/storage/plugins` on Linux). Set `type` to `streamable`: without it AnythingLLM uses the older SSE transport. ```json With a key { "mcpServers": { "millionshort": { "type": "streamable", "url": "https://mcp.millionshort.com/mcp", "headers": { "Authorization": "Bearer ms-YOUR_API_KEY" } } } } ``` ```json Without a key { "mcpServers": { "millionshort": { "type": "streamable", "url": "https://mcp.millionshort.com/mcp" } } } ``` ## 2. Try it In a workspace, start an agent session with `@agent` and ask: > Search MillionShort for forum threads about restoring a cast iron skillet, with the 1,000 most popular sites removed. List the five most useful with their links. A good answer comes from a `search` call (the client shows the tool call) and links to pages you may not have seen before. ## 3. Tell it when to search AnythingLLM has no setting we could find that turns its own web search off, so say which search to use. Add this line to the workspace's system prompt: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## 4. Check it works The MCP section of the agent skills shows `millionshort` running, with its tools. Reload it there after editing the file. With a key you should see `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them); with no key, fewer, `search` and `list_sources` among them. ## The server One address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. A key is optional. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | ## Related - [MCP server](https://millionshort.com/docs/mcp): the address, every tool, and what the no-key mode allows. - [Filters for agents](https://millionshort.com/docs/search/filters): what to ask `search` for, with recipes. - More chat apps: [Claude](https://millionshort.com/docs/integrations/claude), [ChatGPT](https://millionshort.com/docs/integrations/chatgpt), [Open WebUI](https://millionshort.com/docs/integrations/open-webui), [LibreChat](https://millionshort.com/docs/integrations/librechat), and [every integration](https://millionshort.com/docs/integrations). - AnythingLLM's own documentation, read on 2026-11-19: [MCP compatibility](https://docs.anythingllm.com/mcp-compatibility/overview), [Desktop storage](https://docs.anythingllm.com/installation-desktop/storage). --- Source: https://millionshort.com/docs/integrations/augment Section: Build with # Augment Code MillionShort search in Augment Code, through the hosted MCP server. MCP · Hosted MCP server, nothing to install · Key read from the environment · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. ## 1. Add the server With the Auggie CLI, one command: ```bash With a key auggie mcp add millionshort --transport http \ --url https://mcp.millionshort.com/mcp \ --header "Authorization:Bearer ms-YOUR_API_KEY" ``` ```bash Without a key auggie mcp add millionshort --transport http --url https://mcp.millionshort.com/mcp ``` Or edit `~/.augment/settings.json`, where Auggie fills in `${MILLIONSHORT_API_KEY}` from the environment. In the IDE extensions, paste the same JSON with **Import from JSON** in the MCP section of the settings (the **Add remote MCP** form has no header field): ```json ~/.augment/settings.json { "mcpServers": { "millionshort": { "type": "http", "url": "https://mcp.millionshort.com/mcp", "headers": { "Authorization": "Bearer ${MILLIONSHORT_API_KEY}" } } } } ``` ## 2. Try it Ask Augment Code: > Search MillionShort for forum threads about restoring a cast iron skillet, with the 1,000 most popular sites removed. List the five most useful with their links. A good answer comes from a `search` call (the client shows the tool call) and links to pages you may not have seen before. ## 3. Turn off the built-in search Deny Auggie's own `web-search` and `web-fetch` tools in the same settings file: ```json ~/.augment/settings.json { "toolPermissions": [ { "toolName": "web-search", "permission": { "type": "deny" } }, { "toolName": "web-fetch", "permission": { "type": "deny" } } ] } ``` Add this line to `AGENTS.md`: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## 4. Check it works Run `auggie mcp list`, or `/mcp` in a session. In the IDE, the server is in the MCP section of the settings. With a key you should see `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them); with no key, fewer, `search` and `list_sources` among them. ## The server One address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. A key is optional. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | ## Related - [MCP server](https://millionshort.com/docs/mcp): the address, every tool, and what the no-key mode allows. - [Filters for agents](https://millionshort.com/docs/search/filters): what to ask `search` for, with recipes. - More coding agents: [Claude Code](https://millionshort.com/docs/integrations/claude-code), [Cursor](https://millionshort.com/docs/integrations/cursor), [Codex](https://millionshort.com/docs/integrations/codex), [GitHub Copilot in VS Code](https://millionshort.com/docs/integrations/vscode), and [every integration](https://millionshort.com/docs/integrations). - Augment Code's own documentation, read on 2026-11-19: [Auggie CLI integrations](https://docs.augmentcode.com/cli/integrations), [Permissions](https://docs.augmentcode.com/cli/permissions), [MCP in the IDE](https://docs.augmentcode.com/setup-augment/mcp). --- Source: https://millionshort.com/docs/integrations/botpress Section: Build with # Botpress MillionShort search as a step in Botpress, with one call to the API. Recipe · An HTTP step · Key in a form field · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. ## 1. Call the API in an HTTP step Save the key as a configuration variable: **Bot Settings**, **Configuration Variables**, **+**, name `MILLIONSHORT_API_KEY`. Then an **Execute Code** card (it has Axios; declare `results` as a workflow variable first): ```js Execute Code const res = await axios.post( 'https://api.millionshort.com/v1/search', { query: 'your query', remove_top_sites: 1000, num_results: 5 }, { headers: { Authorization: `Bearer ${env.MILLIONSHORT_API_KEY}` } }, ); workflow.results = res.data.data.results; ``` ## 2. Try it Ask Botpress's agent, or run the step with this as the query: > Search MillionShort for forum threads about restoring a cast iron skillet, with the 1,000 most popular sites removed. List the five most useful with their links. A good answer comes from a `search` call (the client shows the tool call) and links to pages you may not have seen before. ## 3. Tell it when to search Botpress has no search step of its own here, so say which search to use. If the bot's AI reads the results, tell it: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## 4. Check it works Run the flow in the Studio emulator and look at the `results` variable. A search that worked returns `data.results`, each with a `title`, a `url` and a `snippet`, and `usage.credits`: what it cost. ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | `401 AUTH_MISSING_KEY` or `AUTH_INVALID_KEY` | The key is missing or wrong | Set `MILLIONSHORT_API_KEY`; keys start with `ms-` | | `400 INVALID_PARAM` | A field name or value the API does not take | The `message` names the field; the [search reference](https://millionshort.com/docs/search/parameters) lists them all | | `429 RATE_LIMITED` or `CAPACITY` | Too many calls a minute, or no free capacity right now | Wait the `Retry-After` seconds, then retry | | `429 INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; do not retry | ## Related - [MCP server](https://millionshort.com/docs/mcp): the address, every tool, and what the no-key mode allows. - [Filters for agents](https://millionshort.com/docs/search/filters): what to ask `search` for, with recipes. - More low-code builders: [n8n](https://millionshort.com/docs/integrations/n8n), [Zapier](https://millionshort.com/docs/integrations/zapier), [Make](https://millionshort.com/docs/integrations/make), [Dify](https://millionshort.com/docs/integrations/dify), and [every integration](https://millionshort.com/docs/integrations). - Botpress's own documentation, read on 2026-11-19: [Execute Code card](https://botpress.com/docs/studio/concepts/cards/execute-code), [Configuration variables](https://botpress.com/docs/studio/concepts/variables/scopes/configuration). --- Source: https://millionshort.com/docs/integrations/bubble Section: Build with # Bubble MillionShort search as a step in Bubble, with one call to the API. Recipe · An HTTP step · Key in a form field · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. ## 1. Call the API in an HTTP step Install the **API Connector** plugin and add an API: ```text API Connector API Name: millionshort Authentication: Private key in header Key name: Authorization Private key: Bearer ms-YOUR_API_KEY Call: search, used as an Action (or as Data) Method: POST URL: https://api.millionshort.com/v1/search Body (JSON): {"query": "", "remove_top_sites": 1000, "num_results": 5} ``` Include `Bearer ` and a space in the private key. **Initialize call** runs it once so Bubble learns the shape of the answer; `` becomes a parameter of the call. ## 2. Try it Ask Bubble's agent, or run the step with this as the query: > Search MillionShort for forum threads about restoring a cast iron skillet, with the 1,000 most popular sites removed. List the five most useful with their links. A good answer comes from a `search` call (the client shows the tool call) and links to pages you may not have seen before. ## 3. Tell it when to search Bubble has no search of its own, so say which search to use. If an AI step reads the results, tell it: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## 4. Check it works **Initialize call** shows each field that came back. The call then appears under the API Connector in the workflow editor. A search that worked returns `data.results`, each with a `title`, a `url` and a `snippet`, and `usage.credits`: what it cost. ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | `401 AUTH_MISSING_KEY` or `AUTH_INVALID_KEY` | The key is missing or wrong | Set `MILLIONSHORT_API_KEY`; keys start with `ms-` | | `400 INVALID_PARAM` | A field name or value the API does not take | The `message` names the field; the [search reference](https://millionshort.com/docs/search/parameters) lists them all | | `429 RATE_LIMITED` or `CAPACITY` | Too many calls a minute, or no free capacity right now | Wait the `Retry-After` seconds, then retry | | `429 INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; do not retry | ## Related - [MCP server](https://millionshort.com/docs/mcp): the address, every tool, and what the no-key mode allows. - [Filters for agents](https://millionshort.com/docs/search/filters): what to ask `search` for, with recipes. - More low-code builders: [n8n](https://millionshort.com/docs/integrations/n8n), [Zapier](https://millionshort.com/docs/integrations/zapier), [Make](https://millionshort.com/docs/integrations/make), [Dify](https://millionshort.com/docs/integrations/dify), and [every integration](https://millionshort.com/docs/integrations). - Bubble's own documentation, read on 2026-11-19: [API Connector](https://manual.bubble.io/help-guides/integrations/api/the-api-connector), [Authentication](https://manual.bubble.io/help-guides/integrations/api/the-api-connector/authentication). --- Source: https://millionshort.com/docs/integrations/camel-ai Section: Build with # CAMEL-AI MillionShort search for CAMEL agents, through CAMEL's MCP toolkit. MCP · Python · Nothing of ours to install · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. CAMEL's `MCPToolkit` connects to the MillionShort MCP server by URL and turns its tools into CAMEL function tools, so a `ChatAgent` can call `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints, such as `extract`, `places`, `map` and `crawl` ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them all). Without MCP, a plain function tool that calls the API does the same job. ## 1. Install ```bash Python pip install camel-ai "mcp<2" export MILLIONSHORT_API_KEY=ms-YOUR_API_KEY ``` Pin the MCP Python SDK below 2. The current release of `camel-ai` (0.2.90) asks only for `mcp>=1.3.0`, so a fresh install gets MCP 2.x, and `camel.toolkits` then fails to import (it uses a name that MCP 2 removed). With `mcp<2` it installs and connects. The examples use an OpenAI model, which reads your key from OPENAI_API_KEY; any model CAMEL supports works. Get a MillionShort key in the [dashboard](https://millionshort.com/app/); an agent can ask for a [trial key](https://millionshort.com/docs/api-reference/agent-key) by itself. ## 2. Connect the server Describe the server in the same `mcpServers` shape CAMEL reads from a config file, as a dict, with `type` set to `streamable_http` and the key in `headers`. Without a key, leave `headers` out. ```python Python import os millionshort_config = { "mcpServers": { "millionshort": { "url": "https://mcp.millionshort.com/mcp", "type": "streamable_http", "headers": {"Authorization": f"Bearer {os.environ['MILLIONSHORT_API_KEY']}"}, } } } ``` A JSON file with the same content works too: `MCPToolkit(config_path="config/millionshort.json")`. ## 3. Give the tools to an agent `MCPToolkit` connects in `async with`; pass `toolkit.get_tools()` to the agent: ```python Python import asyncio import os from camel.agents import ChatAgent from camel.models import ModelFactory from camel.toolkits import MCPToolkit from camel.types import ModelPlatformType, ModelType config = { "mcpServers": { "millionshort": { "url": "https://mcp.millionshort.com/mcp", "type": "streamable_http", "headers": {"Authorization": f"Bearer {os.environ['MILLIONSHORT_API_KEY']}"}, } } } async def main(): model = ModelFactory.create(model_platform=ModelPlatformType.OPENAI, model_type=ModelType.GPT_4O) async with MCPToolkit(config_dict=config) as toolkit: agent = ChatAgent( system_message="Use the millionshort search tool for anything recent or niche, and cite the URLs.", model=model, tools=toolkit.get_tools(), ) response = await agent.astep("Find independent blogs about home espresso, without the 1,000 most popular sites.") print(response.msgs[0].content) asyncio.run(main()) ``` ## 4. Check it works List the tools without a model: ```python Python import asyncio import os from camel.toolkits import MCPToolkit config = {"mcpServers": {"millionshort": {"url": "https://mcp.millionshort.com/mcp", "type": "streamable_http", "headers": {"Authorization": f"Bearer {os.environ['MILLIONSHORT_API_KEY']}"}}}} async def main(): async with MCPToolkit(config_dict=config) as toolkit: print([tool.get_function_name() for tool in toolkit.get_tools()]) # search, get_domain_info, list_sources, ... asyncio.run(main()) ``` With no key you see `search` and `list_sources`. Then run step 3: the answer should cite pages. If the agent answers from memory, say when to search in its system message: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## Without MCP: a function tool A plain function, wrapped in a `FunctionTool`, that calls `POST /v1/search`. CAMEL builds the tool's schema from the signature and the docstring: ```python Python import json import os import urllib.request from camel.agents import ChatAgent from camel.toolkits import FunctionTool def millionshort_search(query: str, remove_top_sites: int = 1000) -> str: """Search the web with MillionShort. Args: query (str): What to search for. remove_top_sites (int): Leave out the N most popular sites. """ request = urllib.request.Request( "https://api.millionshort.com/v1/search", data=json.dumps({"query": query, "remove_top_sites": remove_top_sites, "num_results": 5}).encode(), headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"], "Content-Type": "application/json"}, ) with urllib.request.urlopen(request, timeout=30) as response: results = json.load(response)["data"]["results"] return json.dumps([{"title": r["title"], "url": r["url"], "snippet": r.get("snippet")} for r in results]) agent = ChatAgent(system_message="Search before you answer, and cite the URLs.", tools=[FunctionTool(millionshort_search)]) print(agent.step("Find independent blogs about home espresso.").msgs[0].content) ``` ## MCP configuration The same address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Settings | Variable | Meaning | |---|---| | `MILLIONSHORT_API_KEY` | Your key, read by the examples above. Leave `headers` out for the no-key mode | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | | `from camel.toolkits import ...` fails on `FastMCP` | MCP Python SDK 2.x is installed | `pip install "mcp<2"` | | `get_tools()` returns no MillionShort tools | The connection failed, and `skip_failed` (on by default) skipped the server | Check the URL and the header; pass `skip_failed=False` to `MCPToolkit` to see the failure | ## Related - [Agent tool use](https://millionshort.com/docs/search/guides/agent-tool-use): when to give a model tools, and what to tell it. - [Langroid](https://millionshort.com/docs/integrations/langroid) and [PraisonAI](https://millionshort.com/docs/integrations/praisonai): the same server in other Python agent frameworks. - [MCP server](https://millionshort.com/docs/mcp) and [Filters for agents](https://millionshort.com/docs/search/filters). - CAMEL-AI's own documentation, read on 2026-11-19: [CAMEL agents as MCP clients](https://docs.camel-ai.org/mcp/camel_agents_as_an_mcp_clients), [Models](https://docs.camel-ai.org/key_modules/models), and the `MCPToolkit` source in the [CAMEL repository](https://github.com/camel-ai/camel). --- Source: https://millionshort.com/docs/integrations/cartesia Section: Build with # Cartesia MillionShort search for a Cartesia voice agent, as a webhook tool that calls the API. Recipe · Playground and API · Nothing of ours to install · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. Cartesia's agents have three kinds of tools: system tools, webhook tools and client tools. We found no way in Cartesia's agent documentation to connect an agent to an outside MCP server, so this page uses a webhook tool: when the model calls it, Cartesia sends `POST /v1/search` to our API and gives the response body to the model. Spoken answers work best with few results: the tool below fixes `num_results` at 3 and `max_highlights` at 1, so the model reads short passages rather than long text. Each search also adds a little latency to the turn it runs in. ## 1. Install Nothing to install. You need a MillionShort key from the [dashboard](https://millionshort.com/app/) and a Cartesia API key. ## 2. Create the webhook tool Create the tool with Cartesia's API: send `POST https://api.cartesia.ai/v1/agents/tools` with your Cartesia API key as a bearer token in `Authorization`, the header `Cartesia-Version: 2026-08-14`, and this JSON body: ```json { "type": "webhook", "name": "millionshort_search", "description": "Searches the web for current or niche information. Use it when the caller asks about recent events or facts you do not know.", "pre_tool_speech": "auto", "execution_mode": "immediate", "response_timeout_secs": 20, "api_schema": { "url": "https://api.millionshort.com/v1/search", "method": "POST", "request_body_schema": { "type": "object", "properties": { "query": { "type": "string", "description": "What to search for." }, "num_results": { "type": "integer", "constant_value": 3 }, "max_highlights": { "type": "integer", "constant_value": 1 }, "remove_top_sites": { "type": "integer", "constant_value": 1000 } }, "required": ["query"] }, "authentication": { "mode": "bearer", "token": { "type": "secret", "secret_value": "ms-YOUR_API_KEY" } } } } ``` `authentication` with `mode` `bearer` sends `Authorization: Bearer ms-YOUR_API_KEY`; Cartesia stores the key as a secret and never returns it. Do not also set `Authorization` in `request_headers`. The model fills in `query` only: values set with `constant_value` are hidden from it. In the Playground, the same fields are on the **Tools** page: **Add tool**, then **Webhook**, gives the Create Webhook form with the tool name, description, method, URL, authentication and execution settings. ## 3. Give the tool to an agent Add the tool's ID to the agent's `config.tools` as `{ "id": "" }`. An update to `config.tools` replaces the whole list, so include the tools the agent already has. An agent can have up to 64 tools. Then say when to search in the agent's instructions, and how to answer: > Use the millionshort_search tool for anything recent, niche, or that needs a source. Answer in two or three short sentences and name the site you used. ## 4. Check it works Place a test call from the Playground and ask a question that needs the web. The answer should name pages it found. If the request fails, Cartesia gives the model an error result and the conversation goes on. A search that worked returns `data.results`, each with a `title`, a `url` and `highlights`, and `usage.credits`: what it cost. ## Settings | Field | Value | Meaning | |---|---|---| | `api_schema.url` | `https://api.millionshort.com/v1/search` | Our search endpoint. Cartesia does not follow redirects, so use this address as written | | `api_schema.authentication` | `bearer`, with the key as a secret | Sends `Authorization: Bearer ms-...` | | `num_results`, `max_highlights` | `constant_value` 3 and 1 | Few results with one short passage each, for a spoken answer | | `remove_top_sites` | `constant_value` 1000 | Leaves out the 1,000 most popular sites. Set it to 0 to keep them | | `pre_tool_speech` | `auto` | Lets the agent decide whether to say something before it searches. `force` always asks it to | | `execution_mode` | `immediate` | Runs in the current turn. `async` lets the turn finish while the search runs | | `response_timeout_secs` | 20 | How long Cartesia waits for our answer (1 to 120) | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. Cartesia passes at most 16 KiB of a response body to the model and cuts the rest. Three results with one highlight each stay small. ## When it fails | What you see | Why | Fix | |---|---|---| | `401 AUTH_MISSING_KEY` or `AUTH_INVALID_KEY` | The key is missing or wrong | Set `MILLIONSHORT_API_KEY`; keys start with `ms-` | | `400 INVALID_PARAM` | A field name or value the API does not take | The `message` names the field; the [search reference](https://millionshort.com/docs/search/parameters) lists them all | | `429 RATE_LIMITED` or `CAPACITY` | Too many calls a minute, or no free capacity right now | Wait the `Retry-After` seconds, then retry | | `429 INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; do not retry | | The model gets an error result and says it could not search | Our API returned an error, did not answer within `response_timeout_secs`, or could not be reached; Cartesia does not retry a `POST` | Check the key and the URL, and that the tool sends no `Authorization` in `request_headers` | | The result ends with "[cut off: the response was longer than this tool returns]" | The response was over 16 KiB | Keep `num_results` at 3 and `max_highlights` at 1 | | The agent never calls the tool | The description or the instructions do not say when to | Say in both when to search | ## Related - [ElevenLabs Agents](https://millionshort.com/docs/integrations/elevenlabs), [Vapi](https://millionshort.com/docs/integrations/vapi) and [Pipecat](https://millionshort.com/docs/integrations/pipecat): voice agents that connect to the MCP server. - [Search reference](https://millionshort.com/docs/search/parameters): every field of `POST /v1/search`. - [Filters for agents](https://millionshort.com/docs/search/filters) and [Agent tool use](https://millionshort.com/docs/search/guides/agent-tool-use). - Cartesia's own documentation, read on 2026-11-19: [Tools](https://docs.cartesia.ai/agents/tools), [Webhook tools](https://docs.cartesia.ai/agents/webhook-tools), [Create a tool](https://docs.cartesia.ai/api-reference/agents/tools/create). --- Source: https://millionshort.com/docs/integrations/chatgpt Section: Build with # ChatGPT MillionShort search in ChatGPT, through the hosted MCP server. MCP · Hosted MCP server, nothing to install · No key only · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. ## 1. Add the server ChatGPT on the web: 1. Go to **chatgpt.com/plugins**, press **+**, then **Add custom MCP server**. 2. Name `MillionShort`, server URL `https://mcp.millionshort.com/mcp`. 3. Authentication: **No authentication**. 4. Read the risk notice, choose **I understand and want to continue**, then **Create as a plugin**, and install it from your plugins. Your workspace's permissions decide whether you can add one. ChatGPT signs in to a custom server with OAuth or not at all, and cannot send a key, so it uses the no-key mode: `search` and `list_sources`, one source and up to 5 results a search, 10 free searches a day. ## 2. Try it In a conversation, type `@`, pick MillionShort, and ask: > Search MillionShort for forum threads about restoring a cast iron skillet, with the 1,000 most popular sites removed. List the five most useful with their links. A good answer comes from a `search` call (the client shows the tool call) and links to pages you may not have seen before. ## 3. Tell it when to search ChatGPT has no switch we could find for its own web search in a conversation, so say which search to use. Add this line to your custom instructions or the project's instructions: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## 4. Check it works The plugin's details page lists its tools (press refresh to load them). In a chat, expand the tool call to see what came back. With a key you should see `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them); with no key, fewer, `search` and `list_sources` among them. ## The server One address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. A key is optional. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | ## Related - [MCP server](https://millionshort.com/docs/mcp): the address, every tool, and what the no-key mode allows. - [Filters for agents](https://millionshort.com/docs/search/filters): what to ask `search` for, with recipes. - More chat apps: [Claude](https://millionshort.com/docs/integrations/claude), [Open WebUI](https://millionshort.com/docs/integrations/open-webui), [LibreChat](https://millionshort.com/docs/integrations/librechat), [AnythingLLM](https://millionshort.com/docs/integrations/anythingllm), and [every integration](https://millionshort.com/docs/integrations). - ChatGPT's own documentation, read on 2026-11-19: [Custom MCP server](https://developers.openai.com/api/docs/guides/custom-mcp-server), [Connect from ChatGPT](https://developers.openai.com/apps-sdk/deploy/connect-chatgpt). --- Source: https://millionshort.com/docs/integrations/cherry-studio Section: Build with # Cherry Studio MillionShort search in Cherry Studio, through the hosted MCP server. MCP · Hosted MCP server, nothing to install · Key in a header · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. ## 1. Add the server Open **Settings**, **MCP**, **Add**, and choose **Import from JSON**: ```json With a key { "mcpServers": { "millionshort": { "type": "streamableHttp", "url": "https://mcp.millionshort.com/mcp", "headers": { "Authorization": "Bearer ms-YOUR_API_KEY" } } } } ``` ```json Without a key { "mcpServers": { "millionshort": { "type": "streamableHttp", "url": "https://mcp.millionshort.com/mcp" } } } ``` Or fill the form by hand: type **Streamable HTTP**, the URL, and in **Headers** one line, `Authorization=Bearer ms-YOUR_API_KEY`. Save, switch the server on, and give it to your assistant (its **MCP** settings), or turn it on from the chat input's MCP button. ## 2. Try it Ask Cherry Studio: > Search MillionShort for forum threads about restoring a cast iron skillet, with the 1,000 most popular sites removed. List the five most useful with their links. A good answer comes from a `search` call (the client shows the tool call) and links to pages you may not have seen before. ## 3. Tell it when to search Cherry Studio has no setting we could find that turns its own web search off, so say which search to use. Add this line to the assistant's prompt: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## 4. Check it works The server's card shows it connected; its **Tools** tab lists the server's tools and **Logs** shows any error. With a key you should see `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them); with no key, fewer, `search` and `list_sources` among them. ## Good to know - Cherry Studio's hosted docs did not load for us, so these steps come from its own source code (linked below). ## The server One address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. A key is optional. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | ## Related - [MCP server](https://millionshort.com/docs/mcp): the address, every tool, and what the no-key mode allows. - [Filters for agents](https://millionshort.com/docs/search/filters): what to ask `search` for, with recipes. - More chat apps: [Claude](https://millionshort.com/docs/integrations/claude), [ChatGPT](https://millionshort.com/docs/integrations/chatgpt), [Open WebUI](https://millionshort.com/docs/integrations/open-webui), [LibreChat](https://millionshort.com/docs/integrations/librechat), and [every integration](https://millionshort.com/docs/integrations). - Cherry Studio's own documentation, read on 2026-11-19: [Add MCP server dialog (source)](https://github.com/CherryHQ/cherry-studio/blob/main/src/renderer/pages/settings/McpSettings/AddMcpServerModal.tsx), [Server fields (source)](https://github.com/CherryHQ/cherry-studio/blob/main/src/renderer/pages/settings/McpSettings/McpServerFields.tsx). --- Source: https://millionshort.com/docs/integrations/claude Section: Build with # Claude MillionShort search in Claude, through the hosted MCP server. MCP · Hosted MCP server, nothing to install · Key in a form field · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. ## 1. Add the server 1. Open **Customize**, **Connectors**, **+ Add**, **Add custom connector**. 2. Name `MillionShort`, remote MCP server URL `https://mcp.millionshort.com/mcp`. **Continue**. 3. Under **Authentication** choose **No sign in**. 4. Under **Request headers**, add `Authorization` with the value `Bearer ms-YOUR_API_KEY`. Leave it empty for the no-key mode. 5. **Add**. The connector is added to your account, so it works in claude.ai, Claude Desktop and the mobile apps alike. On Team and Enterprise plans an owner adds it for the organization (**Organization settings**, **Connectors**), and members then **Connect** it; a key added there is shared by everyone who uses the connector, so use one with limits you are happy with. The Free plan allows one custom connector. ## 2. Try it Ask Claude: > Search MillionShort for forum threads about restoring a cast iron skillet, with the 1,000 most popular sites removed. List the five most useful with their links. A good answer comes from a `search` call (the client shows the tool call) and links to pages you may not have seen before. ## 3. Turn off the built-in search In a chat, click **+** at the lower left of the chat box and untick **Web search**. Where your version has no such switch, ask for the connector by name. On Team and Enterprise, an owner can turn web search off for everyone under **Organization settings**, **Capabilities**. In a project, add this line to the project instructions: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## 4. Check it works Click **+** in the chat box, then **Connectors**: `MillionShort` is listed with a switch, and its details list the tools. Ask for a search and look for the tool-call card. With a key you should see `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them); with no key, fewer, `search` and `list_sources` among them. ## Good to know - To change the key, remove the connector and add it again. - Claude Desktop's own `claude_desktop_config.json` is for local servers. For this server use **Connectors** as above. ## The server One address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. A key is optional. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | ## Related - [MCP server](https://millionshort.com/docs/mcp): the address, every tool, and what the no-key mode allows. - [Filters for agents](https://millionshort.com/docs/search/filters): what to ask `search` for, with recipes. - More chat apps: [ChatGPT](https://millionshort.com/docs/integrations/chatgpt), [Open WebUI](https://millionshort.com/docs/integrations/open-webui), [LibreChat](https://millionshort.com/docs/integrations/librechat), [AnythingLLM](https://millionshort.com/docs/integrations/anythingllm), and [every integration](https://millionshort.com/docs/integrations). - Claude's own documentation, read on 2026-11-19: [Custom connectors using remote MCP](https://support.claude.com/en/articles/11175166-get-started-with-custom-connectors-using-remote-mcp), [Web search](https://support.claude.com/en/articles/10684626-enable-and-use-web-search). --- Source: https://millionshort.com/docs/integrations/claude-agent-sdk Section: Build with # Claude Agent SDK MillionShort search for agents built with the Claude Agent SDK, in Python and TypeScript. MCP · Python and TypeScript · Nothing of ours to install · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. The Agent SDK runs Claude Code's agent loop inside your application. You add the MillionShort MCP server to the options of `query()` as an HTTP server, allow its tools by name, and turn off the SDK's own web tools so the agent searches with MillionShort. The agent then has the tools you allow, named `mcp__millionshort__search` and so on: `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them all). ## 1. Install ```bash Python pip install claude-agent-sdk export MILLIONSHORT_API_KEY=ms-YOUR_API_KEY ``` ```bash TypeScript npm install @anthropic-ai/claude-agent-sdk zod export MILLIONSHORT_API_KEY=ms-YOUR_API_KEY ``` The SDK needs Python 3.10 or later, or Node.js 18.14 or later, and reads your Anthropic key from ANTHROPIC_API_KEY. Get a MillionShort key in the [dashboard](https://millionshort.com/app/); an agent can ask for a [trial key](https://millionshort.com/docs/api-reference/agent-key) by itself. The SDK runs Claude Code: each `query()` starts a Claude Code process and talks to it. Both packages bundle a native Claude Code binary, so most installs need nothing else. Two installs come without it, according to the SDK's docs: pip installing the source distribution instead of a platform wheel (on ARM64 Windows, for example), and npm skipping optional dependencies (`npm ci --omit=optional`). Then install Claude Code yourself: the Python SDK finds it on your PATH, and in TypeScript you set `pathToClaudeCodeExecutable` to it. ## 2. Connect the server Pass the server in `mcp_servers` (`mcpServers` in TypeScript) with type `http`. MCP tools need permission before Claude can call them, so list them in `allowed_tools`; `disallowed_tools` takes the built-in `WebSearch` and `WebFetch` tools out of the agent's context. Without a key, leave the headers out. ```python Python import asyncio import os from claude_agent_sdk import ClaudeAgentOptions, ResultMessage, query async def main(): options = ClaudeAgentOptions( mcp_servers={ "millionshort": { "type": "http", "url": "https://mcp.millionshort.com/mcp", "headers": {"Authorization": f"Bearer {os.environ['MILLIONSHORT_API_KEY']}"}, } }, allowed_tools=["mcp__millionshort__search", "mcp__millionshort__get_domain_info", "mcp__millionshort__list_sources"], disallowed_tools=["WebSearch", "WebFetch"], ) prompt = "Find independent blogs about home espresso, without the 1,000 most popular sites." async for message in query(prompt=prompt, options=options): if isinstance(message, ResultMessage) and message.subtype == "success": print(message.result) asyncio.run(main()) ``` ```ts TypeScript import { query } from '@anthropic-ai/claude-agent-sdk'; for await (const message of query({ prompt: 'Find independent blogs about home espresso, without the 1,000 most popular sites.', options: { mcpServers: { millionshort: { type: 'http', url: 'https://mcp.millionshort.com/mcp', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}` }, }, }, allowedTools: ['mcp__millionshort__search', 'mcp__millionshort__get_domain_info', 'mcp__millionshort__list_sources'], disallowedTools: ['WebSearch', 'WebFetch'], }, })) { if (message.type === 'result' && message.subtype === 'success') { console.log(message.result); } } ``` `mcp__millionshort__*` allows every tool of the server at once, `crawl` included, which spends credits. The middle part of each name is the key you give the server in `mcp_servers`. ## 3. Give the tools to an agent A research agent needs no files and no shell. `tools=[]` removes every built-in tool, web tools included, so the MillionShort tools are all the agent has; `system_prompt` says when to use them and `max_turns` caps the loop. ```python Python import asyncio import os from claude_agent_sdk import ClaudeAgentOptions, ResultMessage, query options = ClaudeAgentOptions( mcp_servers={ "millionshort": { "type": "http", "url": "https://mcp.millionshort.com/mcp", "headers": {"Authorization": f"Bearer {os.environ['MILLIONSHORT_API_KEY']}"}, } }, tools=[], allowed_tools=["mcp__millionshort__*"], system_prompt="Use the MillionShort search tool for anything recent or niche, and cite the URLs.", max_turns=8, ) async def main(): async for message in query(prompt="Find independent blogs about home espresso.", options=options): if isinstance(message, ResultMessage) and message.subtype == "success": print(message.result) asyncio.run(main()) ``` ```ts TypeScript import { query } from '@anthropic-ai/claude-agent-sdk'; for await (const message of query({ prompt: 'Find independent blogs about home espresso.', options: { mcpServers: { millionshort: { type: 'http', url: 'https://mcp.millionshort.com/mcp', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}` }, }, }, tools: [], allowedTools: ['mcp__millionshort__*'], systemPrompt: 'Use the MillionShort search tool for anything recent or niche, and cite the URLs.', maxTurns: 8, }, })) { if (message.type === 'result' && message.subtype === 'success') { console.log(message.result); } } ``` A line that works well in the system prompt: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## 4. Check it works The first message of every run is a `system` message with subtype `init`. It gives each MCP server's status and the tools the agent has; `millionshort` should be `connected`, with its `mcp__millionshort__` tools listed. ```python Python import asyncio import os from claude_agent_sdk import ClaudeAgentOptions, SystemMessage, query async def main(): server = {"type": "http", "url": "https://mcp.millionshort.com/mcp", "headers": {"Authorization": f"Bearer {os.environ['MILLIONSHORT_API_KEY']}"}} options = ClaudeAgentOptions(mcp_servers={"millionshort": server}, allowed_tools=["mcp__millionshort__*"]) async for message in query(prompt="List the sources MillionShort can search.", options=options): if isinstance(message, SystemMessage) and message.subtype == "init": print(message.data.get("mcp_servers")) print([name for name in message.data.get("tools", []) if name.startswith("mcp__")]) asyncio.run(main()) ``` ```ts TypeScript import { query } from '@anthropic-ai/claude-agent-sdk'; for await (const message of query({ prompt: 'List the sources MillionShort can search.', options: { mcpServers: { millionshort: { type: 'http', url: 'https://mcp.millionshort.com/mcp', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}` } }, }, allowedTools: ['mcp__millionshort__*'], }, })) { if (message.type === 'system' && message.subtype === 'init') { console.log(message.mcp_servers); console.log(message.tools.filter((name) => name.startsWith('mcp__'))); } } ``` A status of `pending` is not a failure on its own: the SDK may still be connecting, or may have the tool list cached from an earlier run and connect on the first call. `failed` or `needs-auth` means the agent runs without the tools. ## Without the remote server: a custom tool The SDK's own way to add a function is a custom tool, served from inside your process by an in-process MCP server. This one calls `POST /v1/search` directly. The Python version uses httpx, as the SDK's docs do: ```bash Python pip install claude-agent-sdk httpx ``` ```python Python import asyncio import json import os from typing import Any import httpx from claude_agent_sdk import ClaudeAgentOptions, ResultMessage, create_sdk_mcp_server, query, tool @tool("millionshort_search", "Search the web with MillionShort, without the 1,000 most popular sites.", {"query": str}) async def millionshort_search(args: dict[str, Any]) -> dict[str, Any]: async with httpx.AsyncClient(timeout=30) as client: response = await client.post( "https://api.millionshort.com/v1/search", json={"query": args["query"], "remove_top_sites": 1000, "num_results": 5}, headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, ) response.raise_for_status() results = [{"title": r["title"], "url": r["url"], "snippet": r.get("snippet")} for r in response.json()["data"]["results"]] return {"content": [{"type": "text", "text": json.dumps(results)}]} async def main(): server = create_sdk_mcp_server(name="web", version="1.0.0", tools=[millionshort_search]) options = ClaudeAgentOptions(mcp_servers={"web": server}, allowed_tools=["mcp__web__millionshort_search"], tools=[]) async for message in query(prompt="Find independent blogs about home espresso.", options=options): if isinstance(message, ResultMessage) and message.subtype == "success": print(message.result) asyncio.run(main()) ``` ```ts TypeScript import { createSdkMcpServer, query, tool } from '@anthropic-ai/claude-agent-sdk'; import { z } from 'zod'; const millionshortSearch = tool( 'millionshort_search', 'Search the web with MillionShort, without the 1,000 most popular sites.', { query: z.string() }, async ({ query }) => { const res = await fetch('https://api.millionshort.com/v1/search', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json' }, body: JSON.stringify({ query, remove_top_sites: 1000, num_results: 5 }), }); if (!res.ok) return { content: [{ type: 'text', text: `search failed: ${res.status}` }], isError: true }; const { data } = (await res.json()) as { data: { results: { title: string; url: string; snippet?: string }[] } }; const results = data.results.map(({ title, url, snippet }) => ({ title, url, snippet })); return { content: [{ type: 'text', text: JSON.stringify(results) }] }; }, ); const web = createSdkMcpServer({ name: 'web', version: '1.0.0', tools: [millionshortSearch] }); for await (const message of query({ prompt: 'Find independent blogs about home espresso.', options: { mcpServers: { web }, allowedTools: ['mcp__web__millionshort_search'], tools: [] }, })) { if (message.type === 'result' && message.subtype === 'success') console.log(message.result); } ``` ## MCP configuration The same address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. In the SDK that is type `http`; a `.mcp.json` file in your project takes the same fields. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Settings | Variable | Meaning | |---|---| | `MILLIONSHORT_API_KEY` | Your key, read by the examples above. Leave the header out for the no-key mode | The SDK's own options that matter here: `allowed_tools` (`allowedTools`) pre-approves the tools, `disallowed_tools` (`disallowedTools`) or `tools` removes the built-in ones, and `max_turns` (`maxTurns`) limits the loop. ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. Each turn the agent takes can call `search` again, so `max_turns` is also a spending limit. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | | Claude sees the tools but does not call them | MCP tools need permission, and they are not in `allowed_tools` | Add `mcp__millionshort__*` to `allowed_tools` (`allowedTools`) | | The server is `failed` or `needs-auth` in the init message, and the run goes on without it | The key is missing or wrong, or the address cannot be reached | Check the key and the address; the SDK does not stop the run for a server that fails to connect | | The agent searches with its own web tools | `WebSearch` and `WebFetch` are still in its context | Add them to `disallowed_tools`, or pass `tools=[]` | | "Claude Code not found" | The install has no bundled Claude Code binary | Install Claude Code, then set `cli_path` (Python) or `pathToClaudeCodeExecutable` (TypeScript) if it is not on your PATH | ## Related - [Agent tool use](https://millionshort.com/docs/search/guides/agent-tool-use): when to give a model tools, and what to tell it. - [Anthropic](https://millionshort.com/docs/integrations/anthropic): the same server in the Messages API, with no agent loop. - [Claude Code](https://millionshort.com/docs/integrations/claude-code): the same server in the terminal. - [OpenAI Agents SDK](https://millionshort.com/docs/integrations/openai-agents) and [Pydantic AI](https://millionshort.com/docs/integrations/pydantic-ai). - [MCP server](https://millionshort.com/docs/mcp) and [Filters for agents](https://millionshort.com/docs/search/filters). - The SDK's own documentation, read on 2026-11-19: [Connect to external tools with MCP](https://code.claude.com/docs/en/agent-sdk/mcp), [Give Claude custom tools](https://code.claude.com/docs/en/agent-sdk/custom-tools), [Quickstart](https://code.claude.com/docs/en/agent-sdk/quickstart), [Python reference](https://code.claude.com/docs/en/agent-sdk/python), [TypeScript reference](https://code.claude.com/docs/en/agent-sdk/typescript). --- Source: https://millionshort.com/docs/integrations/claude-code Section: Build with # Claude Code MillionShort search in Claude Code, through the hosted MCP server. MCP · Hosted MCP server, nothing to install · Key read from the environment · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. ## 1. Add the server One command. It saves the server for you in this project (add `--scope user` for every project): ```bash With a key claude mcp add --transport http millionshort https://mcp.millionshort.com/mcp \ --header "Authorization: Bearer $MILLIONSHORT_API_KEY" ``` ```bash Without a key claude mcp add --transport http millionshort https://mcp.millionshort.com/mcp ``` To share the server with your team, put a `.mcp.json` at the project root instead. Claude Code fills in `${MILLIONSHORT_API_KEY}` from each person's environment, so the key is never in the file, and asks once before it uses a project's servers: ```json .mcp.json { "mcpServers": { "millionshort": { "type": "http", "url": "https://mcp.millionshort.com/mcp", "headers": { "Authorization": "Bearer ${MILLIONSHORT_API_KEY}" } } } } ``` ## 2. Try it Ask Claude Code: > Search MillionShort for forum threads about restoring a cast iron skillet, with the 1,000 most popular sites removed. List the five most useful with their links. A good answer comes from a `search` call (the client shows the tool call) and links to pages you may not have seen before. ## 3. Turn off the built-in search Deny Claude Code's own web tools in `.claude/settings.json` (this project) or `~/.claude/settings.json` (everywhere): ```json .claude/settings.json { "permissions": { "deny": ["WebSearch", "WebFetch"] } } ``` Then add this line to `CLAUDE.md` at the project root: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## 4. Check it works Run `claude mcp list` in a shell (it says `Connected`), or type `/mcp` in a session to see the server and its tools. With a key you should see `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them); with no key, fewer, `search` and `list_sources` among them. ## Good to know - A plugin with the server and a search skill is coming; until it is published, the command above is the whole set-up. - If `MILLIONSHORT_API_KEY` is not set when Claude Code reads `.mcp.json`, it warns you and the server gets no key. ## The server One address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. A key is optional. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | ## Related - [MCP server](https://millionshort.com/docs/mcp): the address, every tool, and what the no-key mode allows. - [Filters for agents](https://millionshort.com/docs/search/filters): what to ask `search` for, with recipes. - More coding agents: [Cursor](https://millionshort.com/docs/integrations/cursor), [Codex](https://millionshort.com/docs/integrations/codex), [GitHub Copilot in VS Code](https://millionshort.com/docs/integrations/vscode), [Gemini CLI](https://millionshort.com/docs/integrations/gemini-cli), and [every integration](https://millionshort.com/docs/integrations). - Claude Code's own documentation, read on 2026-11-19: [MCP](https://code.claude.com/docs/en/mcp), [Permissions](https://code.claude.com/docs/en/permissions), [Memory](https://code.claude.com/docs/en/memory). --- Source: https://millionshort.com/docs/integrations/clay Section: Build with # Clay MillionShort search as a step in Clay, with one call to the API. Recipe · An HTTP step · Key in a form field · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. ## 1. Call the API in an HTTP step 1. In a table, **Add enrichment**, **HTTP API**. 2. Save the key once as a header account: **Select header account**, **+ Add account**, header `Authorization` with the value `Bearer ms-YOUR_API_KEY`. Clay keeps it encrypted for the workspace; a key typed into the column's headers is visible to anyone with the table. 3. On **Configure**: method **POST**, endpoint `https://api.millionshort.com/v1/search`, and a JSON body. Type `/` to insert a column, such as a company name, as the query: ```json JSON body {"query": "/Company Name reviews", "remove_top_sites": 1000, "num_results": 5} ``` ## 2. Try it Ask Clay's agent, or run the step with this as the query: > Search MillionShort for forum threads about restoring a cast iron skillet, with the 1,000 most popular sites removed. List the five most useful with their links. A good answer comes from a `search` call (the client shows the tool call) and links to pages you may not have seen before. ## 3. Tell it when to search Clay has no search of its own in this column, so say which search to use. If an AI column reads the results, tell it: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## 4. Check it works **Test** runs it on one row: the response has `data.results`. A search that worked returns `data.results`, each with a `title`, a `url` and a `snippet`, and `usage.credits`: what it cost. ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | `401 AUTH_MISSING_KEY` or `AUTH_INVALID_KEY` | The key is missing or wrong | Set `MILLIONSHORT_API_KEY`; keys start with `ms-` | | `400 INVALID_PARAM` | A field name or value the API does not take | The `message` names the field; the [search reference](https://millionshort.com/docs/search/parameters) lists them all | | `429 RATE_LIMITED` or `CAPACITY` | Too many calls a minute, or no free capacity right now | Wait the `Retry-After` seconds, then retry | | `429 INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; do not retry | ## Related - [MCP server](https://millionshort.com/docs/mcp): the address, every tool, and what the no-key mode allows. - [Filters for agents](https://millionshort.com/docs/search/filters): what to ask `search` for, with recipes. - More low-code builders: [n8n](https://millionshort.com/docs/integrations/n8n), [Zapier](https://millionshort.com/docs/integrations/zapier), [Make](https://millionshort.com/docs/integrations/make), [Dify](https://millionshort.com/docs/integrations/dify), and [every integration](https://millionshort.com/docs/integrations). - Clay's own documentation, read on 2026-11-19: [HTTP API integration](https://university.clay.com/docs/http-api-integration-overview). --- Source: https://millionshort.com/docs/integrations/cline Section: Build with # Cline MillionShort search in Cline, through the hosted MCP server. MCP · Hosted MCP server, nothing to install · Key in a header · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. ## 1. Add the server In the Cline panel, open **MCP Servers**, **Configure**, **Configure MCP Servers**, and add the server to `cline_mcp_settings.json`. Set `type` to `streamableHttp`: without it Cline uses the older SSE transport. ```json With a key { "mcpServers": { "millionshort": { "type": "streamableHttp", "url": "https://mcp.millionshort.com/mcp", "headers": { "Authorization": "Bearer ms-YOUR_API_KEY" }, "disabled": false, "autoApprove": ["search", "list_sources", "get_domain_info"] } } } ``` ```json Without a key { "mcpServers": { "millionshort": { "type": "streamableHttp", "url": "https://mcp.millionshort.com/mcp", "disabled": false, "autoApprove": ["search", "list_sources"] } } } ``` With the Cline CLI, one command: ```bash cline mcp add millionshort https://mcp.millionshort.com/mcp --transport http \ --header "Authorization: Bearer ms-YOUR_API_KEY" --yes ``` ## 2. Try it Ask Cline: > Search MillionShort for forum threads about restoring a cast iron skillet, with the 1,000 most popular sites removed. List the five most useful with their links. A good answer comes from a `search` call (the client shows the tool call) and links to pages you may not have seen before. ## 3. Tell it when to search Cline has no setting we could find that turns its own web search off, so say which search to use. Add this line to a rule file in `.clinerules/`: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## 4. Check it works The **MCP Servers** panel shows `millionshort` with its tools. From a shell, `cline config mcp`. With a key you should see `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them); with no key, fewer, `search` and `list_sources` among them. ## Good to know - `autoApprove` lets the tools it names run without asking; the three above only read. Leave `crawl`, `crawl_cancel` and `create_space` out of it: they spend credits, stop a crawl or save a Space. Leave it empty to be asked each time. ## The server One address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. A key is optional. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | ## Related - [MCP server](https://millionshort.com/docs/mcp): the address, every tool, and what the no-key mode allows. - [Filters for agents](https://millionshort.com/docs/search/filters): what to ask `search` for, with recipes. - More coding agents: [Claude Code](https://millionshort.com/docs/integrations/claude-code), [Cursor](https://millionshort.com/docs/integrations/cursor), [Codex](https://millionshort.com/docs/integrations/codex), [GitHub Copilot in VS Code](https://millionshort.com/docs/integrations/vscode), and [every integration](https://millionshort.com/docs/integrations). - Cline's own documentation, read on 2026-11-19: [MCP overview](https://docs.cline.bot/mcp/mcp-overview), [Cline rules](https://docs.cline.bot/customization/cline-rules). --- Source: https://millionshort.com/docs/integrations/codex Section: Build with # Codex MillionShort search in Codex, through the hosted MCP server. MCP · Hosted MCP server, nothing to install · Key read from the environment · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. ## 1. Add the server Add the server to `~/.codex/config.toml` (or `.codex/config.toml` in a trusted project). With `bearer_token_env_var`, Codex sends the key from the environment as `Authorization: Bearer`: ```toml With a key [mcp_servers.millionshort] url = "https://mcp.millionshort.com/mcp" bearer_token_env_var = "MILLIONSHORT_API_KEY" ``` ```toml Without a key [mcp_servers.millionshort] url = "https://mcp.millionshort.com/mcp" ``` Without a key, one command does the same: ```bash codex mcp add millionshort --url https://mcp.millionshort.com/mcp ``` The Codex CLI, the IDE extension and the app read the same `config.toml`: set it up once. ## 2. Try it Ask Codex: > Search MillionShort for forum threads about restoring a cast iron skillet, with the 1,000 most popular sites removed. List the five most useful with their links. A good answer comes from a `search` call (the client shows the tool call) and links to pages you may not have seen before. ## 3. Turn off the built-in search Codex's own web search is on by default. Turn it off at the top of `config.toml`, before any `[table]`: ```toml config.toml web_search = "disabled" ``` Add this line to `AGENTS.md`: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## 4. Check it works Run `codex mcp list` in a shell, or `/mcp` inside Codex. With a key you should see `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them); with no key, fewer, `search` and `list_sources` among them. ## The server One address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. A key is optional. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | ## Related - [MCP server](https://millionshort.com/docs/mcp): the address, every tool, and what the no-key mode allows. - [Filters for agents](https://millionshort.com/docs/search/filters): what to ask `search` for, with recipes. - More coding agents: [Claude Code](https://millionshort.com/docs/integrations/claude-code), [Cursor](https://millionshort.com/docs/integrations/cursor), [GitHub Copilot in VS Code](https://millionshort.com/docs/integrations/vscode), [Gemini CLI](https://millionshort.com/docs/integrations/gemini-cli), and [every integration](https://millionshort.com/docs/integrations). - Codex's own documentation, read on 2026-11-19: [MCP](https://learn.chatgpt.com/docs/extend/mcp), [Configuration reference](https://learn.chatgpt.com/docs/config-file/config-reference), [AGENTS.md](https://learn.chatgpt.com/docs/agent-configuration/agents-md). --- Source: https://millionshort.com/docs/integrations/cohere Section: Build with # Cohere MillionShort search for Cohere's Command models, as a tool whose results go back as documents the answer cites, in Python. Recipe · Python · Nothing of ours to install · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. Cohere's Chat endpoint takes function tools: the model asks for a call, your code runs the search, and you send the results back as `document` items. The model then answers from those documents and returns citations that point at them. Cohere's tool use documentation shows Python, so this page does too. ## 1. Install ```bash Python pip install cohere requests export MILLIONSHORT_API_KEY=ms-YOUR_API_KEY ``` The example reads your Cohere key from COHERE_API_KEY. Get a MillionShort key in the [dashboard](https://millionshort.com/app/); an agent can ask for a [trial key](https://millionshort.com/docs/api-reference/agent-key) by itself. ## 2. Minimal example ```python Python import json import os import cohere import requests def millionshort_search(query: str) -> list[dict]: r = requests.post( "https://api.millionshort.com/v1/search", headers={"Authorization": f"Bearer {os.environ['MILLIONSHORT_API_KEY']}"}, json={"query": query, "remove_top_sites": 1000, "num_results": 5}, timeout=30, ) r.raise_for_status() return [{"title": x["title"], "url": x["url"], "snippet": x.get("snippet")} for x in r.json()["data"]["results"]] tools = [{"type": "function", "function": { "name": "millionshort_search", "description": "Search the web with MillionShort, leaving out the 1,000 most popular sites.", "parameters": {"type": "object", "properties": {"query": {"type": "string"}}, "required": ["query"]}, }}] co = cohere.ClientV2(api_key=os.environ["COHERE_API_KEY"]) messages = [{"role": "user", "content": "Find independent blogs about home espresso."}] response = co.chat(model="command-a-plus-05-2026", messages=messages, tools=tools) while response.message.tool_calls: messages.append(response.message) for call in response.message.tool_calls: results = millionshort_search(**json.loads(call.function.arguments)) documents = [{"type": "document", "document": {"data": json.dumps(result)}} for result in results] messages.append({"role": "tool", "tool_call_id": call.id, "content": documents}) response = co.chat(model="command-a-plus-05-2026", messages=messages, tools=tools) print(response.message.content[0].text) print(response.message.citations) ``` Each search result becomes one document, so each citation points at one page. The model may call the tool again after seeing results; the loop runs until it answers. ## 3. Tell it when to search Cohere searches nothing unless your code does, so there is no built-in search to turn off. Put a line like this in a `system` message at the start of `messages`: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## 4. Check it works Run the example, then ask: > Search MillionShort for forum threads about restoring a cast iron skillet, with the 1,000 most popular sites removed. List the five most useful with their links. After the first `co.chat` call, `response.message.tool_calls` names `millionshort_search` with a `query`; the final answer's `citations` point at the documents you sent back. ## Tools The function tool above is `search` alone. For the server's other tools as well (`get_domain_info`, `list_sources` and the tools of the other endpoints), use an agent framework that speaks MCP with our [MCP server](https://millionshort.com/docs/mcp): | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Settings | Variable | Meaning | |---|---| | `MILLIONSHORT_API_KEY` | Your key, read by the example above | | COHERE_API_KEY | Your Cohere key, read by the example above | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | `401 AUTH_MISSING_KEY` or `AUTH_INVALID_KEY` | The key is missing or wrong | Set `MILLIONSHORT_API_KEY`; keys start with `ms-` | | `400 INVALID_PARAM` | A field name or value the API does not take | The `message` names the field; the [search reference](https://millionshort.com/docs/search/parameters) lists them all | | `429 RATE_LIMITED` or `CAPACITY` | Too many calls a minute, or no free capacity right now | Wait the `Retry-After` seconds, then retry | | `429 INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; do not retry | | The model answers without calling the tool | Nothing told it when to search | Add the line from step 3 | ## Related - [Agent tool use](https://millionshort.com/docs/search/guides/agent-tool-use): when to give a model tools, and what to tell it. - [RAG with MillionShort](https://millionshort.com/docs/search/guides/rag): retrieval with citations, step by step. - Other model APIs: [Mistral](https://millionshort.com/docs/integrations/mistral), [OpenAI](https://millionshort.com/docs/integrations/openai), [Anthropic](https://millionshort.com/docs/integrations/anthropic), [Ollama](https://millionshort.com/docs/integrations/ollama). - [Search API reference](https://millionshort.com/docs/search/parameters) and [MCP server](https://millionshort.com/docs/mcp). - Cohere's own documentation, read on 2026-11-19: [Tool use quickstart](https://docs.cohere.com/docs/tool-use-quickstart), [Tool use overview](https://docs.cohere.com/docs/tool-use-overview). --- Source: https://millionshort.com/docs/integrations/composio Section: Build with # Composio MillionShort search as a Composio custom MCP toolkit, next to an agent's other apps. MCP · Python and TypeScript · Nothing of ours to install · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. Composio's Custom MCP feature turns a remote MCP server into a toolkit with a CUSTOM_ slug. You create the MillionShort toolkit once; Composio syncs its tools (`search`, `get_domain_info`, `list_sources` and the tools of the other endpoints; [the MCP page](https://millionshort.com/docs/mcp#tools) lists them), and any session that names the toolkit can use them beside Composio's own toolkits. Composio calls our server; your app never holds your users' MillionShort keys. **Plans.** A toolkit shared with every user of your Composio project (`user_id="all"`) works on every Composio plan. A toolkit private to one user needs Composio's Pro plan; on the free plan, creating one returns 403. ## 1. Install ```bash Python pip install composio composio-openai-agents openai-agents export MILLIONSHORT_API_KEY=ms-YOUR_API_KEY ``` ```bash TypeScript npm install @composio/core @composio/openai-agents @openai/agents export MILLIONSHORT_API_KEY=ms-YOUR_API_KEY ``` The Composio SDKs read your Composio key from COMPOSIO_API_KEY. The Python SDK needs Python 3.11 or later; the TypeScript SDK is ESM only. The examples use the OpenAI Agents SDK, as Composio's quickstart does; Composio has providers for other frameworks. Get a MillionShort key in the [dashboard](https://millionshort.com/app/). ## 2. Create the toolkit Do this once per Composio project. With the API key mode, each user connects their own MillionShort key, and Composio puts it in the header where the code has `generic_api_key`: ```python Python from composio import Composio composio = Composio() # reads COMPOSIO_API_KEY toolkit = composio.custom_toolkits.create( name="MillionShort", mcp_url="https://mcp.millionshort.com/mcp", auth_schemes=[ { "mode": "API_KEY", "headers": {"Authorization": "Bearer {{generic_api_key}}"}, "api_key_field": {"display_name": "MillionShort API key"}, } ], user_id="all", # shared with every user of the project ) print(toolkit.slug) # CUSTOM_MILLIONSHORT ``` ```ts TypeScript import { Composio } from '@composio/core'; const composio = new Composio(); // reads COMPOSIO_API_KEY const toolkit = await composio.customToolkits.create({ name: 'MillionShort', mcpUrl: 'https://mcp.millionshort.com/mcp', authSchemes: [ { mode: 'API_KEY', headers: { Authorization: 'Bearer {{generic_api_key}}' }, apiKeyField: { displayName: 'MillionShort API key' }, }, ], userId: 'all', // shared with every user of the project }); console.log(toolkit.slug); // CUSTOM_MILLIONSHORT ``` For the no-key mode, use `auth_schemes=[{"mode": "NO_AUTH"}]` (`authSchemes: [{ mode: 'NO_AUTH' }]`): no one connects anything, and the tools sync at once. `mcp_url`, `auth_schemes` and `user_id` cannot be changed later; to change them, delete the toolkit and create it again. ## 3. Give the tools to an agent Name the toolkit in a session. With the API key mode, the user connects their key the first time (Composio's hosted page asks for it), and the tools sync when the first account connects. `session.authorize` gives you that link; the session's own connection tool can also offer it in the chat. ```python Python from agents import Agent, Runner from composio import Composio from composio_openai_agents import OpenAIAgentsProvider composio = Composio(provider=OpenAIAgentsProvider()) session = composio.sessions.create(user_id="user_123", toolkits=["CUSTOM_MILLIONSHORT"]) connection = session.authorize("CUSTOM_MILLIONSHORT") print("Connect your MillionShort key:", connection.redirect_url) connection.wait_for_connection() agent = Agent( name="Researcher", instructions="Use the MillionShort tools for anything recent or niche, and cite the URLs.", model="gpt-5.2", tools=session.tools(), ) print(Runner.run_sync(agent, "Find independent blogs about home espresso.").final_output) ``` ```ts TypeScript import { Composio } from '@composio/core'; import { OpenAIAgentsProvider } from '@composio/openai-agents'; import { Agent, run } from '@openai/agents'; const composio = new Composio({ provider: new OpenAIAgentsProvider() }); const session = await composio.sessions.create('user_123', { toolkits: ['CUSTOM_MILLIONSHORT'] }); const connection = await session.authorize('CUSTOM_MILLIONSHORT'); console.log('Connect your MillionShort key:', connection.redirectUrl); await connection.waitForConnection(); const agent = new Agent({ name: 'Researcher', instructions: 'Use the MillionShort tools for anything recent or niche, and cite the URLs.', model: 'gpt-5.2', tools: await session.tools(), }); console.log((await run(agent, 'Find independent blogs about home espresso.')).finalOutput); ``` A session does not hand the model every tool up front: the agent finds the MillionShort tools through Composio's tool search (COMPOSIO_SEARCH_TOOLS) and runs them through the session. With a no-auth toolkit, leave out the three connection lines. ## 4. Check it works `custom_toolkits.create` prints the slug. After the first connection, run the agent: its run should include a MillionShort `search` call and an answer that cites pages. If the tools never synced (for example, the first sync failed), sync again with `composio.custom_toolkits.sync("CUSTOM_MILLIONSHORT", connected_account_id=...)`. If the agent answers from memory, say when to search in its instructions: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## MCP configuration The same address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. Composio needs the final address, with no redirects and no key in the URL. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Settings | Variable | Meaning | |---|---| | `MILLIONSHORT_API_KEY` | Your own key, for trying the toolkit. In the API key mode, each user enters theirs on Composio's connection page; in the no-auth mode, no key is sent | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. In the API key mode, each user's searches count against their own key. A no-auth toolkit runs in the no-key mode, with its limits. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | | Creating the toolkit returns 403 | A private toolkit (`user_id` set to one user) on a plan below Pro | Use `user_id="all"`, or move to Composio's Pro plan | | Creating the toolkit returns 409 | A shared toolkit for the same URL exists already | Use its slug, or delete it and create it again | | The session has no MillionShort tools | No account has connected yet, so the tools have not synced | Connect a key with `session.authorize`, or sync the toolkit | | The agent's tool search misses the tools | Composio's search can miss custom tools that synced | Name the tool in the prompt, or check the toolkit's tool list in Composio | ## Related - [Agent tool use](https://millionshort.com/docs/search/guides/agent-tool-use): when to give a model tools, and what to tell it. - [OpenAI Agents SDK](https://millionshort.com/docs/integrations/openai-agents): the same server connected straight from the SDK, without Composio. - [MCP server](https://millionshort.com/docs/mcp) and [Filters for agents](https://millionshort.com/docs/search/filters). - Composio's own documentation, read on 2026-11-19: [Custom MCP](https://docs.composio.dev/docs/extending-sessions/custom-mcp), [Quickstart](https://docs.composio.dev/docs/quickstart), [Authentication](https://docs.composio.dev/docs/authentication). --- Source: https://millionshort.com/docs/integrations/continue Section: Build with # Continue MillionShort search in Continue, through the hosted MCP server. MCP · Hosted MCP server, nothing to install · Key in a header · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. ## 1. Add the server Create `.continue/mcpServers/millionshort.yaml`. A block file needs `name`, `version` and `schema`: ```yaml With a key name: MillionShort version: 0.0.1 schema: v1 mcpServers: - name: millionshort type: streamable-http url: https://mcp.millionshort.com/mcp requestOptions: headers: Authorization: Bearer ms-YOUR_API_KEY ``` ```yaml Without a key name: MillionShort version: 0.0.1 schema: v1 mcpServers: - name: millionshort type: streamable-http url: https://mcp.millionshort.com/mcp ``` ## 2. Try it Ask Continue: > Search MillionShort for forum threads about restoring a cast iron skillet, with the 1,000 most popular sites removed. List the five most useful with their links. A good answer comes from a `search` call (the client shows the tool call) and links to pages you may not have seen before. ## 3. Tell it when to search Continue has no setting we could find that turns its own web search off, so say which search to use. Add this line to a rule file in `.continue/rules/`: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## 4. Check it works MCP tools work in Agent mode only. Switch the chat to Agent mode: the `millionshort` tools are in its tools list. With a key you should see `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them); with no key, fewer, `search` and `list_sources` among them. ## Good to know - Keep a block file that holds a key out of version control. ## The server One address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. A key is optional. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | ## Related - [MCP server](https://millionshort.com/docs/mcp): the address, every tool, and what the no-key mode allows. - [Filters for agents](https://millionshort.com/docs/search/filters): what to ask `search` for, with recipes. - More coding agents: [Claude Code](https://millionshort.com/docs/integrations/claude-code), [Cursor](https://millionshort.com/docs/integrations/cursor), [Codex](https://millionshort.com/docs/integrations/codex), [GitHub Copilot in VS Code](https://millionshort.com/docs/integrations/vscode), and [every integration](https://millionshort.com/docs/integrations). - Continue's own documentation, read on 2026-11-19: [MCP](https://docs.continue.dev/customize/deep-dives/mcp), [config.yaml reference](https://docs.continue.dev/reference), [Rules](https://docs.continue.dev/customize/deep-dives/rules). --- Source: https://millionshort.com/docs/integrations/cookbook-domain-check Section: Build with # Domain check How popular each site of a list is, and whether it carries a risk label, as a table or as CSV. Available · TypeScript, Node 22.18+ · One file, nothing to install · Tested 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. `POST /v1/domain` takes up to 25 sites and returns, for each, its popularity rank and band and, when it has one, its risk level and categories. The script sends your list in batches of 25 and prints the answers. Useful before you add a site to `include_domains`, or to vet a list of links. ## 1. Get the code ```ts check.ts // Domain check: popularity and risk for a list of sites, as a table (or CSV with --csv). // // export MILLIONSHORT_API_KEY=ms-YOUR_API_KEY // node check.ts example.com example.org # or: node check.ts --file sites.txt [--csv] // // Node 22.18 or later runs TypeScript as it is; nothing to install. One call per 25 sites, 1 credit each. import { readFileSync } from 'node:fs'; const API = (process.env.MILLIONSHORT_BASE_URL ?? 'https://api.millionshort.com').replace(/\/$/, ''); type DomainInfo = { domain: string; popularity: { rank: number | null; bucket: string }; risk: { level: string; categories: string[] } | null; }; async function lookUp(domains: string[]): Promise { const res = await fetch(`${API}/v1/domain`, { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json' }, body: JSON.stringify({ domains }), }); const body = (await res.json()) as { data?: { domains: DomainInfo[] }; error?: { code: string; message: string } }; if (!res.ok || !body.data) throw new Error(`${body.error?.code ?? res.status}: ${body.error?.message ?? 'no answer'}`); return body.data.domains; } const args = process.argv.slice(2); const csv = args.includes('--csv'); const fileAt = args.indexOf('--file'); const sites = (fileAt >= 0 ? readFileSync(args[fileAt + 1], 'utf8').split(/\s+/) : args.filter((a) => !a.startsWith('--'))) .map((s) => s.trim().toLowerCase()) .filter(Boolean); if (!sites.length) { console.error('usage: node check.ts example.com example.org | --file sites.txt [--csv]'); process.exit(2); } const rows: DomainInfo[] = []; for (let i = 0; i < sites.length; i += 25) rows.push(...(await lookUp(sites.slice(i, i + 25)))); if (csv) { console.log('domain,rank,popularity,risk,risk_categories'); for (const r of rows) console.log([r.domain, r.popularity.rank ?? '', r.popularity.bucket, r.risk?.level ?? '', (r.risk?.categories ?? []).join(' ')].join(',')); } else { console.log(`${'Site'.padEnd(32)} ${'Rank'.padStart(9)} ${'Popularity'.padEnd(10)} Risk`); for (const r of rows) { const risk = r.risk ? `${r.risk.level} (${r.risk.categories.join(', ')})` : '-'; console.log(`${r.domain.padEnd(32)} ${String(r.popularity.rank ?? '-').padStart(9)} ${r.popularity.bucket.padEnd(10)} ${risk}`); } } ``` ## 2. Run it Node 22.18 or later runs TypeScript files as they are: ```bash export MILLIONSHORT_API_KEY=ms-YOUR_API_KEY node check.ts example.com github.com obscure-blog-xyz.net node check.ts --file sites.txt --csv > sites.csv ``` ## 3. What you get ```text Output Site Rank Popularity Risk example.com 112 top-1k - github.com 10 top-100 - obscure-blog-xyz.net - unknown - ``` A rank of `-` means the site is outside the top 1,000,000 or we do not know it; its band says which. ## 4. Change it | To | Change | |---|---| | Keep only lesser-known sites | Filter the rows on `popularity.bucket === 'long-tail'` | | Drop risky sites from a list | Filter on `risk === null` | ## Costs and limits 1 credit per call of up to 25 sites. ## When it fails | What you see | Why | Fix | |---|---|---| | `401 AUTH_MISSING_KEY` or `AUTH_INVALID_KEY` | The key is missing or wrong | Set `MILLIONSHORT_API_KEY`; keys start with `ms-` | | `400 INVALID_PARAM` | A field name or value the API does not take | The `message` names the field; the [search reference](https://millionshort.com/docs/search/parameters) lists them all | | `429 RATE_LIMITED` or `CAPACITY` | Too many calls a minute, or no free capacity right now | Wait the `Retry-After` seconds, then retry | | `429 INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; do not retry | | `400 INVALID_PARAM` on a long list | More than 25 sites in one call | Keep the batches at 25, as the script does | ## Related - [Domain info reference](https://millionshort.com/docs/api-reference/domain) and [Popularity and risk](https://millionshort.com/docs/search/popularity-and-risk). - [Long-tail finder](https://millionshort.com/docs/integrations/cookbook-long-tail-finder): the same bands, for search results. --- Source: https://millionshort.com/docs/integrations/cookbook-long-tail-finder Section: Build with # Long-tail finder The same question asked twice, with and without the most popular sites, side by side, and the pages only the second search found. Available · Python 3.9+ · One file, nothing to install · Tested 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. `remove_top_sites` leaves out the results of the N most popular sites. This script shows what that does to one query: the left column searches every site, the right one leaves out the top 1,000 (or the number you give), and the list underneath is the pages from sites the first search did not show. ## 1. Get the code ```python long_tail.py """Long-tail finder: the same question with and without the most popular sites, side by side. export MILLIONSHORT_API_KEY=ms-YOUR_API_KEY python long_tail.py "cast iron skillet restoration" [--remove 1000] No package to install: Python 3.9 or later. Two searches, 2 credits. """ import argparse import json import os import urllib.error import urllib.request API = os.environ.get("MILLIONSHORT_BASE_URL", "https://api.millionshort.com").rstrip("/") def search(query, remove_top_sites): body = {"query": query, "num_results": 10, "remove_top_sites": remove_top_sites} request = urllib.request.Request( f"{API}/v1/search", data=json.dumps(body).encode(), headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"], "Content-Type": "application/json"}, ) with urllib.request.urlopen(request, timeout=60) as response: return json.load(response)["data"]["results"] def row(result): return f"{result['site'][:28]:<28} {result['popularity']['bucket']:<9}" def main(): parser = argparse.ArgumentParser(description=__doc__.splitlines()[0]) parser.add_argument("query") parser.add_argument("--remove", type=int, default=1000, help="how many of the most popular sites to leave out (default 1000)") args = parser.parse_args() try: everything = search(args.query, 0) long_tail = search(args.query, args.remove) except urllib.error.HTTPError as failure: raise SystemExit(f"The search failed: HTTP {failure.code} {failure.read().decode(errors='replace')[:300]}") print(f"{'All sites':<38} | Without the top {args.remove:,}") print("-" * 38 + "-+-" + "-" * 38) for n in range(max(len(everything), len(long_tail))): left = row(everything[n]) if n < len(everything) else "" right = row(long_tail[n]) if n < len(long_tail) else "" print(f"{left:<38} | {right}") seen = {r["site"] for r in everything} new = [r for r in long_tail if r["site"] not in seen] print(f"\n{len(new)} of {len(long_tail)} results are on sites that the search of all sites did not show:") for r in new: print(f" {r['title'][:70]}\n {r['url']}") if __name__ == "__main__": main() ``` ## 2. Run it ```bash export MILLIONSHORT_API_KEY=ms-YOUR_API_KEY python long_tail.py "fountain pen restoration" python long_tail.py "sourdough starter" --remove 10000 ``` ## 3. What you get First the two columns: each result's site and its popularity band, from `top-100` to `top-1m`, then `long-tail`. For `"fountain pen restoration"`, the left column had an encyclopedia in the top 100 and two blog hosts in the top 1,000; the right column was long-tail sites only. Then the list: ```text Output (the end) 6 of 10 results are on sites that the search of all sites did not show: Pens Waterman [Fountain Pen] https://www.penparents.org/Waterman/pens-waterman Parker Pen renovation ⋆ Parker pen ⋆ Fountain pen. Calligraphy. https://pspbuddies.com/parker-pen/parker-pen-renovation.html Plunger filler - Vintage Fountain Pen Doctor https://vintagependoctor.com/plunger-filler/ ... ``` Some queries change little: when no top site ranks for them, both columns are the same. ## 4. Change it | To | Change | |---|---| | Cut deeper | `--remove 100000` | | Compare the mainstream view | Search the second time with `only_top_sites` in place of `remove_top_sites` | | Look at forums only | Add `"page_types": ["forums"]` to the body ([topics and page types](https://millionshort.com/docs/search/topics-and-page-types)) | ## Costs and limits Two searches, 1 credit each. ## When it fails | What you see | Why | Fix | |---|---|---| | `401 AUTH_MISSING_KEY` or `AUTH_INVALID_KEY` | The key is missing or wrong | Set `MILLIONSHORT_API_KEY`; keys start with `ms-` | | `400 INVALID_PARAM` | A field name or value the API does not take | The `message` names the field; the [search reference](https://millionshort.com/docs/search/parameters) lists them all | | `429 RATE_LIMITED` or `CAPACITY` | Too many calls a minute, or no free capacity right now | Wait the `Retry-After` seconds, then retry | | `429 INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; do not retry | ## Related - [Remove the top sites](https://millionshort.com/docs/search/remove-top-sites): what the cut does and how it is counted. - [Popularity and risk](https://millionshort.com/docs/search/popularity-and-risk): the bands in the second column. - [Domain check](https://millionshort.com/docs/integrations/cookbook-domain-check): the same bands for a list of sites. --- Source: https://millionshort.com/docs/integrations/cookbook-news-watch Section: Build with # News watch A Markdown brief of the day's new articles on your topics, with each article listed once. Available · Python 3.9+ · One file, nothing to install · Tested 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. For each topic, one search of the `news` source over the last day (`time_range: day`), with the passage of each article that best matches the topic. Articles already in an earlier brief are skipped: their addresses are kept in `seen.json` beside the script. ## 1. Get the code ```python news_watch.py """News watch: a daily brief of new articles on your topics, from the news source. export MILLIONSHORT_API_KEY=ms-YOUR_API_KEY python news_watch.py "heat pumps" "community energy" > brief.md No package to install: Python 3.9 or later. One search per topic (1 credit each). Articles already in an earlier brief are skipped: their addresses are kept in seen.json beside this file. Run it once a day, from cron or any scheduler. """ import datetime import json import os import sys import urllib.error import urllib.request from pathlib import Path API = os.environ.get("MILLIONSHORT_BASE_URL", "https://api.millionshort.com").rstrip("/") SEEN = Path(__file__).with_name("seen.json") def news(topic): body = {"query": topic, "sources": ["news"], "time_range": "day", "num_results": 10, "max_highlights": 1} request = urllib.request.Request( f"{API}/v1/search", data=json.dumps(body).encode(), headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"], "Content-Type": "application/json"}, ) with urllib.request.urlopen(request, timeout=60) as response: return json.load(response)["data"]["results"] def main(topics): seen = set(json.loads(SEEN.read_text())) if SEEN.exists() else set() print(f"# News brief, {datetime.date.today():%d %B %Y}\n") try: for topic in topics: print(f"## {topic}\n") try: fresh = [r for r in news(topic) if r["url"] not in seen] except urllib.error.HTTPError as failure: print(f"The search failed ({failure.code}); this topic is tried again next time.\n") if failure.code in (401, 429): # no key, or no credits or calls left: the next topics would fail too break continue if not fresh: print("Nothing new.\n") for r in fresh: passage = (r.get("highlights") or [r.get("snippet") or ""])[0] print(f"- [{r['title']}]({r['url']}) ({r['site']}, {r.get('published_date') or 'no date'})") if passage: print(f" {passage[:240]}") seen.add(r["url"]) print() finally: SEEN.write_text(json.dumps(sorted(seen))) if __name__ == "__main__": main(sys.argv[1:] or ["heat pumps"]) ``` ## 2. Run it ```bash export MILLIONSHORT_API_KEY=ms-YOUR_API_KEY python news_watch.py "home battery storage" "community energy" > brief.md ``` To get it every morning, run it from cron, for example `0 7 * * *` with the key in the job's environment. ## 3. What you get ```text brief.md (shortened) # News brief, 19 November 2026 ## home battery storage - [US battery storage capacity exceeds 200 GWh — Electrek](https://ua.news/en/...) (ua.news, 2026-11-19) In the third quarter of 2026, 14.3 GWh of battery storage systems were installed in the United States ... - [Why AI data centers need storage beyond conventional backup power](https://www.finanznachrichten.de/...) (finanznachrichten.de, 2026-11-19) AI data centers are changing the duty cycle expected of battery energy storage ... ## community energy - [Why hip-hop moguls are pivoting to green energy investments](https://www.wokv.com/...) (wokv.com, 2026-11-18) However, community solar lets you benefit from green energy investments ... ``` Run it again the same day and each topic says "Nothing new." Broad topics also catch loose matches (a phone with a "massive battery"): quote a phrase, or narrow with `include_domains`. ## 4. Change it | To | Change | |---|---| | A weekly brief | `"time_range": "week"`, and run it weekly | | Only smaller outlets | Add `"remove_top_sites": 1000` | | Discussions as well | `"sources": ["news", "discussions"]` (1 credit per source) | | Narrower results | Quote the exact phrase in the topic, or name the sites with `include_domains` | ## Costs and limits One search per topic a run: 1 credit each. ## When it fails | What you see | Why | Fix | |---|---|---| | `401 AUTH_MISSING_KEY` or `AUTH_INVALID_KEY` | The key is missing or wrong | Set `MILLIONSHORT_API_KEY`; keys start with `ms-` | | `400 INVALID_PARAM` | A field name or value the API does not take | The `message` names the field; the [search reference](https://millionshort.com/docs/search/parameters) lists them all | | `429 RATE_LIMITED` or `CAPACITY` | Too many calls a minute, or no free capacity right now | Wait the `Retry-After` seconds, then retry | | `429 INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; do not retry | | The same story again under a new address | Outlets republish under new URLs | Match on titles too, or keep the brief to `include_domains` you trust | ## Related - [News monitoring guide](https://millionshort.com/docs/monitor/guides/news-monitoring): longer patterns for watching a topic. - [The news source](https://millionshort.com/docs/search/sources/news): what it holds and which filters it applies. - [n8n](https://millionshort.com/docs/integrations/n8n): the same search as a scheduled workflow step. --- Source: https://millionshort.com/docs/integrations/cookbook-nextjs-search Section: Build with # Next.js search app A search page with a popularity cut and a source picker, rendered on the server so the key never reaches the browser. Available · TypeScript, Next.js 16 · Three files · Key stays on the server · Tested 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. The page is a server component: the form submits with a plain GET, the server calls `POST /v1/search` with the key from its environment, and the browser receives finished HTML. There is no client JavaScript of ours, and no route a visitor could call to use your key for other searches. ## 1. Get the code Four files: `package.json`, `lib/millionshort.ts`, `app/page.tsx` and `app/layout.tsx`. ```json package.json { "name": "millionshort-nextjs-search", "private": true, "description": "A search page on MillionShort: Next.js, the key kept on the server.", "scripts": { "dev": "next dev", "build": "next build", "start": "next start" }, "dependencies": { "next": "^16.4.6", "react": "^19.3.1", "react-dom": "^19.3.1", "server-only": "^0.0.1" }, "devDependencies": { "@types/node": "^26.6.6", "@types/react": "^19.3.0", "typescript": "^7.0.2" } } ``` ```ts lib/millionshort.ts // The one place the key is read. `server-only` makes the build fail if a client component ever // imports this module, so the key cannot reach the browser. import 'server-only'; const API = (process.env.MILLIONSHORT_BASE_URL ?? 'https://api.millionshort.com').replace(/\/$/, ''); export type Result = { position: number; title: string; url: string; site: string; snippet: string | null; published_date: string | null; popularity: { rank: number | null; bucket: string }; }; export async function search(query: string, removeTopSites: number, source: string): Promise<{ results: Result[]; credits: number }> { const res = await fetch(`${API}/v1/search`, { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json' }, body: JSON.stringify({ query, sources: [source], remove_top_sites: removeTopSites, num_results: 10 }), cache: 'no-store', }); const body = (await res.json()) as { data?: { results: Result[] }; usage?: { credits: number }; error?: { code: string; message: string } }; if (!res.ok || !body.data) throw new Error(`${body.error?.code ?? res.status}: ${body.error?.message ?? 'search failed'}`); return { results: body.data.results, credits: body.usage?.credits ?? 0 }; } ``` ```tsx app/page.tsx // Anyone who can open this page searches with your key: put it behind your own sign-in, or a rate // limit, before you make it public. import { search } from '../lib/millionshort'; const CUTS = [ ['0', 'All sites'], ['1000', 'Without the top 1,000'], ['10000', 'Without the top 10,000'], ['100000', 'Without the top 100,000'], ]; const SOURCES = ['web', 'news', 'discussions', 'academic']; export default async function Page({ searchParams }: { searchParams: Promise<{ q?: string; cut?: string; source?: string }> }) { const { q = '', cut = '1000', source = 'web' } = await searchParams; let answer: Awaited> | null = null; let problem = ''; if (q.trim()) { try { answer = await search(q.trim(), Number(cut) || 0, SOURCES.includes(source) ? source : 'web'); } catch (error) { // the API's error code and message (a missing key, no credits left, too many searches a minute) problem = error instanceof Error ? error.message : 'search failed'; } } return (

Search

{problem &&

The search did not work: {problem}

} {answer && ( <>
    {answer.results.map((r) => (
  1. {r.title}
    {r.site} · {r.popularity.bucket}{r.published_date ? ` · ${r.published_date}` : ''}
    {r.snippet &&

    {r.snippet}

    }
  2. ))}

{answer.results.length} results, {answer.credits} credit(s).

)}
); } ``` ```tsx app/layout.tsx import type { ReactNode } from 'react'; export const metadata = { title: 'Search', description: 'A search page on MillionShort.' }; export default function RootLayout({ children }: { children: ReactNode }) { return ( {children} ); } ``` ## 2. Run it ```bash npm install export MILLIONSHORT_API_KEY=ms-YOUR_API_KEY npm run dev ``` Open the address `next dev` prints, and search. To deploy, set `MILLIONSHORT_API_KEY` as a server-side environment variable of your host; nothing else is needed. ## 3. What you get A form, then ten results with each site's popularity band and date. The cut defaults to "Without the top 1,000"; the source picker switches between `web`, `news`, `discussions` and `academic`. The page says what the search cost, and when a search fails it says why (the API's error code), rather than showing an error page. ## 4. Change it | To | Change | |---|---| | Offer more sources | Add them to `SOURCES` (each searched source costs 1 credit) | | Show passages, not snippets | Add `max_highlights: 2` to the body and render `highlights` | | Let a model answer too | Call a model with the results on the server, as in [RAG with fresh pages](https://millionshort.com/docs/integrations/cookbook-rag-fresh-pages) | ## Costs and limits 1 credit per search. Anyone who can open the page can search with your key: put the page behind your own sign-in, or add a rate limit, before you make it public. ## When it fails | What you see | Why | Fix | |---|---|---| | `401 AUTH_MISSING_KEY` or `AUTH_INVALID_KEY` | The key is missing or wrong | Set `MILLIONSHORT_API_KEY`; keys start with `ms-` | | `400 INVALID_PARAM` | A field name or value the API does not take | The `message` names the field; the [search reference](https://millionshort.com/docs/search/parameters) lists them all | | `429 RATE_LIMITED` or `CAPACITY` | Too many calls a minute, or no free capacity right now | Wait the `Retry-After` seconds, then retry | | `429 INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; do not retry | | "The search did not work: `AUTH_MISSING_KEY`" after deploying | The key is not set on the host | Set `MILLIONSHORT_API_KEY` in the host's server environment, not as a public variable | | The build fails on `server-only` | A client component imports `lib/millionshort.ts` | Keep the search in server code: that error is what keeps the key out of the browser | ## Related - [Vercel AI SDK](https://millionshort.com/docs/integrations/vercel-ai-sdk): search as a tool for a model in the same kind of app. - [Search reference](https://millionshort.com/docs/search/parameters): every field the body can take. --- Source: https://millionshort.com/docs/integrations/cookbook-rag-fresh-pages Section: Build with # RAG with fresh pages One search that brings back the text of each page, then one model call that answers only from it, with citations. Available · Python 3.9+ · One file · Any OpenAI-compatible model · Tested 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. `include_content` adds the text of each page, as we hold it, to its result: no second request to the site, no scraper to run. The script asks for five pages without the 1,000 most popular sites, puts their text in the prompt as numbered sources, and tells the model to answer only from them. ## 1. Get the code ```python rag.py """RAG with fresh pages: search with the text of each page, then answer only from that text. pip install openai export MILLIONSHORT_API_KEY=ms-YOUR_API_KEY export OPENAI_API_KEY=... # or any OpenAI-compatible API: also set OPENAI_BASE_URL python rag.py "What should I check before buying a used e-bike battery?" One search (1 credit, plus 1 for the page text of up to 10 results) and one model call. MODEL picks the model (default gpt-5.4-mini). """ import json import os import sys import urllib.error import urllib.request from openai import OpenAI API = os.environ.get("MILLIONSHORT_BASE_URL", "https://api.millionshort.com").rstrip("/") MODEL = os.environ.get("MODEL", "gpt-5.4-mini") def retrieve(question, k=5): body = {"query": question, "num_results": k, "remove_top_sites": 1000, "include_content": True, "max_characters": 4000, "max_highlights": 3} request = urllib.request.Request( f"{API}/v1/search", data=json.dumps(body).encode(), headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"], "Content-Type": "application/json"}, ) with urllib.request.urlopen(request, timeout=60) as response: answer = json.load(response) docs = [] for r in answer["data"]["results"]: text = (r.get("content") or {}).get("text") or "\n".join(r.get("highlights") or [r.get("snippet") or ""]) docs.append({"title": r["title"], "url": r["url"], "text": text}) return docs, answer["usage"]["credits"] def main(question): try: docs, credits = retrieve(question) except urllib.error.HTTPError as failure: sys.exit(f"The search failed: HTTP {failure.code} {failure.read().decode(errors='replace')[:300]}") if not docs: sys.exit("No results: try other words.") sources = "\n\n".join(f"[{n}] {d['title']} ({d['url']})\n{d['text']}" for n, d in enumerate(docs, 1)) prompt = (f"Answer the question using only the sources below. Cite each claim as [n]. If the sources " f"do not answer it, say so.\n\nQuestion: {question}\n\nSources:\n{sources}") reply = OpenAI().chat.completions.create(model=MODEL, messages=[{"role": "user", "content": prompt}]) print(reply.choices[0].message.content) print("\nSources:") for n, d in enumerate(docs, 1): print(f"[{n}] {d['url']}") print(f"\n(search: {credits} credits)", file=sys.stderr) if __name__ == "__main__": main(" ".join(sys.argv[1:]) or "What should I check before buying a used e-bike battery?") ``` ## 2. Run it ```bash pip install openai export MILLIONSHORT_API_KEY=ms-YOUR_API_KEY export OPENAI_API_KEY=your-model-key python rag.py "What should I check before buying a used e-bike battery?" ``` For another OpenAI-compatible API, also set OPENAI_BASE_URL and MODEL. ## 3. What you get ```text Output (shortened) Before buying a used e-bike battery, check its condition and how much it may have been used, since used batteries can lose the ability to hold a charge after about 800 to 1,000 charge cycles [3]. Ask the seller how long they have had the bike and how often it was used [3] ... Sources: [1] https://bigringcyclery.com/used-bike-buying-guide-what-to-check-before-you-pay/ [2] https://www.pedalchef.com/post/buying-used-bike/ [3] https://www.slashgear.com/1683551/electric-bike-used-new-things-know-before-buying/ ``` A result that comes back without text falls back to its highlights, so every source has something to quote. ## 4. Change it | To | Change | |---|---| | Send less text to the model | Lower `max_characters` (500 to 50,000), or drop `include_content` and use `max_highlights` alone | | Use recent news | `"sources": ["news"]` and `"time_range": "week"` | | Keep mainstream sites | `"remove_top_sites": 0` | ## Costs and limits 1 credit for the search, plus 1 for the page text of its results (up to 10): 2 credits a question with five results. The script prints the search's cost to stderr. The model's own cost is separate. ## When it fails | What you see | Why | Fix | |---|---|---| | `401 AUTH_MISSING_KEY` or `AUTH_INVALID_KEY` | The key is missing or wrong | Set `MILLIONSHORT_API_KEY`; keys start with `ms-` | | `400 INVALID_PARAM` | A field name or value the API does not take | The `message` names the field; the [search reference](https://millionshort.com/docs/search/parameters) lists them all | | `429 RATE_LIMITED` or `CAPACITY` | Too many calls a minute, or no free capacity right now | Wait the `Retry-After` seconds, then retry | | `429 INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; do not retry | | The answer says the sources do not cover it | The five pages found do not answer the question | Reword it, or search another source | ## Related - [RAG guide](https://millionshort.com/docs/search/guides/rag): retrieval patterns, chunking and citations at more length. - [Page content](https://millionshort.com/docs/search/parameters): the `include_content` and `max_characters` fields. - [Research agent](https://millionshort.com/docs/integrations/cookbook-research-agent): the model searches by itself, as often as it needs. --- Source: https://millionshort.com/docs/integrations/cookbook-research-agent Section: Build with # Research agent A model that searches as often as it needs, reads the best passages, and answers with numbered citations. One Python file. Available · Python 3.9+ · One file · Any OpenAI-compatible model · Tested 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. The model gets one tool, `search`, and decides what to look for and how many times (up to six rounds). Each search leaves out the 1,000 most popular sites unless the model asks for them, and returns the two passages of each page that best answer the query, so the model reads evidence rather than snippets. ## 1. Get the code ```python research_agent.py """Research agent: search with MillionShort, read the passages, answer with citations. pip install openai export MILLIONSHORT_API_KEY=ms-YOUR_API_KEY export OPENAI_API_KEY=... # or any OpenAI-compatible API: also set OPENAI_BASE_URL python research_agent.py "How do repair cafes keep their volunteers?" The model decides what to search for and how often (up to six rounds), with the most popular sites left out unless it asks for them. MODEL picks the model (default gpt-5.4-mini). """ import json import os import sys import urllib.error import urllib.request from openai import OpenAI API = os.environ.get("MILLIONSHORT_BASE_URL", "https://api.millionshort.com").rstrip("/") MODEL = os.environ.get("MODEL", "gpt-5.4-mini") MAX_ROUNDS = 6 SYSTEM = """You are a careful researcher. Search before you answer anything that needs facts. Search several times with different wording when the first results are thin. By default leave out the 1,000 most popular sites (remove_top_sites 1000) to reach specialist and first-hand pages; use 0 when you need mainstream sources. Answer in a few short paragraphs. Cite every claim as [n], and end with the numbered list of the URLs you cited. Say plainly when the results do not answer the question.""" TOOLS = [{ "type": "function", "function": { "name": "search", "description": "Search the web and specialist sources with MillionShort. Returns titles, URLs, sites and the passages that best answer the query.", "parameters": { "type": "object", "properties": { "query": {"type": "string", "description": "What to search for."}, "remove_top_sites": {"type": "integer", "description": "Leave out the N most popular sites: 1000 for the long tail, 0 for everything."}, "sources": {"type": "array", "items": {"type": "string"}, "description": "Optional: web (default), news, discussions, academic, ..."}, }, "required": ["query"], }, }, }] class SearchError(Exception): """A search the API refused; `code` is the API's error code.""" def __init__(self, code, message): super().__init__(f"{code}: {message}") self.code = code def search(query, remove_top_sites=1000, sources=None): body = {"query": query, "remove_top_sites": remove_top_sites, "num_results": 6, "max_highlights": 2} if sources: body["sources"] = sources request = urllib.request.Request( f"{API}/v1/search", data=json.dumps(body).encode(), headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"], "Content-Type": "application/json"}, ) try: with urllib.request.urlopen(request, timeout=60) as response: data = json.load(response)["data"] except urllib.error.URLError as failure: if not isinstance(failure, urllib.error.HTTPError): # no answer at all: the network, or a wrong address raise SearchError("NETWORK", str(failure.reason)) from None # a body that is not the API's JSON error (a proxy's page, say) leaves only the status try: problem = json.load(failure).get("error", {}) except ValueError: problem = {} raise SearchError(problem.get("code", f"HTTP {failure.code}"), problem.get("message", "")) from None return [ {"title": r["title"], "url": r["url"], "site": r["site"], "date": r.get("published_date"), "passages": r.get("highlights") or [r.get("snippet") or ""]} for r in data["results"] ] def main(question): client = OpenAI() messages = [{"role": "system", "content": SYSTEM}, {"role": "user", "content": question}] for _ in range(MAX_ROUNDS): message = client.chat.completions.create(model=MODEL, messages=messages, tools=TOOLS).choices[0].message if not message.tool_calls: print(message.content) return messages.append(message.model_dump(exclude_none=True)) for call in message.tool_calls: try: args = json.loads(call.function.arguments or "{}") # only the arguments the tool declares; a model may add others args = {k: args[k] for k in ("query", "remove_top_sites", "sources") if k in args} print(f"searching: {args.get('query')!r} (remove_top_sites={args.get('remove_top_sites', 1000)})", file=sys.stderr) result = search(**args) except SearchError as error: if error.code == "INSUFFICIENT_CREDITS": sys.exit("Out of credits: add credits in the dashboard, then run again.") result = {"error": str(error)} except (ValueError, TypeError, KeyError) as error: # arguments that are not JSON or lack a query, or an odd answer result = {"error": f"the search could not be made: {error}"} messages.append({"role": "tool", "tool_call_id": call.id, "content": json.dumps(result)}) print(f"Stopped after {MAX_ROUNDS} rounds of searching without a final answer.") if __name__ == "__main__": main(" ".join(sys.argv[1:]) or "How do repair cafes keep their volunteers?") ``` ## 2. Run it ```bash pip install openai export MILLIONSHORT_API_KEY=ms-YOUR_API_KEY export OPENAI_API_KEY=your-model-key python research_agent.py "How do repair cafes keep their volunteers?" ``` For another OpenAI-compatible API, also set OPENAI_BASE_URL (for example `https://openrouter.ai/api/v1`) and MODEL to a model of that API that takes tools. ## 3. What you get The searches it chose go to stderr, the answer to stdout: ```text Output (shortened) searching: 'repair cafe volunteer retention how do repair cafes keep volunteers ...' (remove_top_sites=1000) searching: 'repair cafe volunteers keep coming back why volunteer retention ...' (remove_top_sites=1000) searching: 'repair café volunteer motivation community repair retention volunteers ...' (remove_top_sites=0) Repair cafes seem to keep volunteers by making the work social, meaningful, and flexible. One Repair Café page says volunteers are welcomed even if they are not handy, because the organization needs many different skill sets, including admin and promotion roles ... [1] Sources: 1. https://... ``` ## 4. Change it | To | Change | |---|---| | Search other sources | Tell the model in `SYSTEM`: the tool takes `sources`, such as `["news"]` or `["academic"]` | | Search mainstream sites first | Change the default `remove_top_sites` in `search()` to `0` | | Read more of each page | Add `"include_content": True` to the body (1 credit a call, for up to 10 results with text) | | Allow more rounds | Raise MAX_ROUNDS at the top of the file | ## Costs and limits Each round costs 1 credit per search the model makes, and a question usually takes two or three. The model's own cost is separate. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | `401 AUTH_MISSING_KEY` or `AUTH_INVALID_KEY` | The key is missing or wrong | Set `MILLIONSHORT_API_KEY`; keys start with `ms-` | | `400 INVALID_PARAM` | A field name or value the API does not take | The `message` names the field; the [search reference](https://millionshort.com/docs/search/parameters) lists them all | | `429 RATE_LIMITED` or `CAPACITY` | Too many calls a minute, or no free capacity right now | Wait the `Retry-After` seconds, then retry | | `429 INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; do not retry | | "Out of credits" and the script stops | `INSUFFICIENT_CREDITS` | Add credits, then run it again | | The model never searches | The model does not take tools | Pick a model of your API that supports tool calling | ## Related - [RAG with fresh pages](https://millionshort.com/docs/integrations/cookbook-rag-fresh-pages): one search with page text, one answer. - [Agent tool use](https://millionshort.com/docs/search/guides/agent-tool-use) and [Filters for agents](https://millionshort.com/docs/search/filters). - The same loop in a framework: [OpenAI Agents SDK](https://millionshort.com/docs/integrations/openai-agents), [LangChain](https://millionshort.com/docs/integrations/langchain). --- Source: https://millionshort.com/docs/integrations/copilot-cli Section: Build with # GitHub Copilot CLI MillionShort search in GitHub Copilot CLI, through the hosted MCP server. MCP · Hosted MCP server, nothing to install · Key read from the environment · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. ## 1. Add the server One command: ```bash With a key copilot mcp add --transport http \ --header "Authorization: Bearer ms-YOUR_API_KEY" \ millionshort https://mcp.millionshort.com/mcp ``` ```bash Without a key copilot mcp add --transport http millionshort https://mcp.millionshort.com/mcp ``` Or edit `~/.copilot/mcp-config.json`. Copilot CLI fills in `${MILLIONSHORT_API_KEY}` from the environment, and needs the `tools` field (`"*"` for all): ```json ~/.copilot/mcp-config.json { "mcpServers": { "millionshort": { "type": "http", "url": "https://mcp.millionshort.com/mcp", "headers": { "Authorization": "Bearer ${MILLIONSHORT_API_KEY}" }, "tools": ["*"] } } } ``` ## 2. Try it Ask GitHub Copilot CLI: > Search MillionShort for forum threads about restoring a cast iron skillet, with the 1,000 most popular sites removed. List the five most useful with their links. A good answer comes from a `search` call (the client shows the tool call) and links to pages you may not have seen before. ## 3. Turn off the built-in search Copilot CLI fetches pages with its own tool. Deny it when you start a session: ```bash copilot --deny-tool='url' ``` Add this line to `AGENTS.md` or `.github/copilot-instructions.md`: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## 4. Check it works Run `copilot mcp get millionshort`, or `/mcp show millionshort` in a session, to see its state and tools. With a key you should see `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them); with no key, fewer, `search` and `list_sources` among them. ## The server One address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. A key is optional. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | ## Related - [MCP server](https://millionshort.com/docs/mcp): the address, every tool, and what the no-key mode allows. - [Filters for agents](https://millionshort.com/docs/search/filters): what to ask `search` for, with recipes. - More coding agents: [Claude Code](https://millionshort.com/docs/integrations/claude-code), [Cursor](https://millionshort.com/docs/integrations/cursor), [Codex](https://millionshort.com/docs/integrations/codex), [GitHub Copilot in VS Code](https://millionshort.com/docs/integrations/vscode), and [every integration](https://millionshort.com/docs/integrations). - GitHub Copilot CLI's own documentation, read on 2026-11-19: [Add MCP servers](https://docs.github.com/en/copilot/how-tos/copilot-cli/customize-copilot/add-mcp-servers), [Command reference](https://docs.github.com/en/copilot/reference/copilot-cli-reference/cli-command-reference). --- Source: https://millionshort.com/docs/integrations/crewai Section: Build with # CrewAI MillionShort search for CrewAI agents, through the agent's MCP servers or a search tool of your own. MCP · Python · Nothing of ours to install · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. A CrewAI agent takes MCP servers in its `mcps` field. Add the MillionShort server there as an `MCPServerHTTP` with the key in a header, and the agent finds the server's tools by itself ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them). With no MCP at all, a custom tool that calls the API does the same job. ## 1. Install ```bash Python pip install crewai mcp export MILLIONSHORT_API_KEY=ms-YOUR_API_KEY ``` CrewAI's MCP support needs the `mcp` library, which is also a dependency of `crewai`. The examples use an OpenAI model id from CrewAI's docs, so they read OPENAI_API_KEY; any model CrewAI supports works. Get a MillionShort key in the [dashboard](https://millionshort.com/app/); an agent can ask for a [trial key](https://millionshort.com/docs/api-reference/agent-key) by itself. ## 2. Connect the server `MCPServerHTTP` uses streamable HTTP by default. Without a key, leave the headers out. `mcps` also takes a plain address string, but a string carries no header, so use `MCPServerHTTP` to send the key. ```python Python import os from crewai import Agent, Crew, Task from crewai.mcp import MCPServerHTTP researcher = Agent( role="Research Analyst", goal="Find useful pages outside the most popular sites", backstory="Searches the web with MillionShort and cites every source.", llm="openai/gpt-5.6-terra", mcps=[ MCPServerHTTP( url="https://mcp.millionshort.com/mcp", headers={"Authorization": f"Bearer {os.environ['MILLIONSHORT_API_KEY']}"}, cache_tools_list=True, ) ], ) task = Task( description="Find independent blogs about home espresso, without the 1,000 most popular sites.", expected_output="Five blogs, each with its URL and one line on why it is useful.", agent=researcher, ) print(Crew(agents=[researcher], tasks=[task]).kickoff()) ``` ## 3. Give the tools to an agent The agent's `role`, `goal` and `backstory` are its instructions: say there when to search. CrewAI agents have no web search of their own, so there is nothing to turn off. To give an agent only search, filter the server's tools: ```python Python import os from crewai import Agent from crewai.mcp import MCPServerHTTP from crewai.mcp.filters import create_static_tool_filter researcher = Agent( role="Research Analyst", goal="Answer with sources: use the MillionShort search tool for anything recent or niche, and cite the URLs.", backstory="Searches the web with MillionShort.", llm="openai/gpt-5.6-terra", max_iter=10, mcps=[ MCPServerHTTP( url="https://mcp.millionshort.com/mcp", headers={"Authorization": f"Bearer {os.environ['MILLIONSHORT_API_KEY']}"}, tool_filter=create_static_tool_filter(allowed_tool_names=["search"]), ) ], ) ``` CrewAI puts the server's name in front of each MCP tool's name, so the model sees them under longer names than the server's own. `max_iter` caps the agent's steps on one task. A line that works well in the agent's goal or the task description: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## 4. Check it works Run the crew from step 2 with `Crew(agents=[researcher], tasks=[task], verbose=True)`. The log shows the MCP tools CrewAI discovered and each call to `search`, and the answer should cite pages. If the server cannot be reached, CrewAI logs a warning and the agent goes on without its tools, so check the log before trusting the answer. ## Without MCP: a function tool A function with the `@tool` decorator calls `POST /v1/search`; the docstring tells the agent what it does. ```python Python import json import os import urllib.request from crewai import Agent, Crew, Task from crewai.tools import tool @tool("millionshort_search") def millionshort_search(query: str, remove_top_sites: int = 1000, num_results: int = 5) -> str: """Search the web with MillionShort. remove_top_sites leaves out the N most popular sites.""" request = urllib.request.Request( "https://api.millionshort.com/v1/search", data=json.dumps({"query": query, "remove_top_sites": remove_top_sites, "num_results": num_results}).encode(), headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"], "Content-Type": "application/json"}, ) with urllib.request.urlopen(request, timeout=30) as response: results = json.load(response)["data"]["results"] return json.dumps([{"title": r["title"], "url": r["url"], "snippet": r.get("snippet")} for r in results]) researcher = Agent(role="Researcher", goal="Find and cite useful pages", backstory="Uses MillionShort.", tools=[millionshort_search]) task = Task(description="Find independent blogs about home espresso.", expected_output="Five URLs with notes.", agent=researcher) print(Crew(agents=[researcher], tasks=[task]).kickoff()) ``` ## MCP configuration The same address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP (`streamable=True`, the default in `MCPServerHTTP`). | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Settings | Variable | Meaning | |---|---| | `MILLIONSHORT_API_KEY` | Your key, read by the examples above. Leave the header out for the no-key mode | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. An agent's `max_iter` (25 by default) is its step limit on one task. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | | The agent works, but without the MillionShort tools | CrewAI skips a server it cannot reach and only logs a warning | Run with `verbose=True`, check the warning, then the address and the key | | The agent stops before an answer | It reached `max_iter` | Raise `max_iter`, or ask for fewer results per search | ## Related - [Agent tool use](https://millionshort.com/docs/search/guides/agent-tool-use): when to give a model tools, and what to tell it. - [LangChain](https://millionshort.com/docs/integrations/langchain), [LlamaIndex](https://millionshort.com/docs/integrations/llamaindex) and [Pydantic AI](https://millionshort.com/docs/integrations/pydantic-ai). - [MCP server](https://millionshort.com/docs/mcp) and [Filters for agents](https://millionshort.com/docs/search/filters). - CrewAI's own documentation, read on 2026-11-19: [MCP servers as tools](https://docs.crewai.com/en/mcp/overview), [Streamable HTTP transport](https://docs.crewai.com/en/mcp/streamable-http), [Tools](https://docs.crewai.com/en/concepts/tools), [LLMs](https://docs.crewai.com/en/concepts/llms). --- Source: https://millionshort.com/docs/integrations/crush Section: Build with # Crush MillionShort search in Crush, through the hosted MCP server. MCP · Hosted MCP server, nothing to install · Key read from the environment · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. ## 1. Add the server Add the server to `crush.json` in your project (or the same file under `~/.config/crush/`). Crush fills in `$MILLIONSHORT_API_KEY` from the environment, and drops a header that comes out empty, so with no key set it uses the no-key mode: ```json crush.json { "$schema": "https://charm.land/crush.json", "mcp": { "millionshort": { "type": "http", "url": "https://mcp.millionshort.com/mcp", "headers": { "Authorization": "Bearer $MILLIONSHORT_API_KEY" } } } } ``` Newer releases also read a shell-style `crushrc`, where the same server is one line: ```bash crushrc mcp add millionshort --type http --url https://mcp.millionshort.com/mcp \ --header Authorization "Bearer $MILLIONSHORT_API_KEY" ``` ## 2. Try it Ask Crush: > Search MillionShort for forum threads about restoring a cast iron skillet, with the 1,000 most popular sites removed. List the five most useful with their links. A good answer comes from a `search` call (the client shows the tool call) and links to pages you may not have seen before. ## 3. Turn off the built-in search Hide Crush's own `fetch` tool, in `crush.json`: ```json crush.json { "options": { "disabled_tools": ["fetch"] } } ``` Add this line to the project's context file: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## 4. Check it works Start `crush`: the tools appear as `mcp_millionshort_search` and so on, and the permission prompt names them. With a key you should see `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them); with no key, fewer, `search` and `list_sources` among them. ## The server One address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. A key is optional. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | ## Related - [MCP server](https://millionshort.com/docs/mcp): the address, every tool, and what the no-key mode allows. - [Filters for agents](https://millionshort.com/docs/search/filters): what to ask `search` for, with recipes. - More coding agents: [Claude Code](https://millionshort.com/docs/integrations/claude-code), [Cursor](https://millionshort.com/docs/integrations/cursor), [Codex](https://millionshort.com/docs/integrations/codex), [GitHub Copilot in VS Code](https://millionshort.com/docs/integrations/vscode), and [every integration](https://millionshort.com/docs/integrations). - Crush's own documentation, read on 2026-11-19: [README](https://github.com/charmbracelet/crush/blob/main/README.md), [Configuration](https://github.com/charmbracelet/crush/blob/main/docs/config/README.md). --- Source: https://millionshort.com/docs/integrations/cursor Section: Build with # Cursor MillionShort search in Cursor, through the hosted MCP server. MCP · Hosted MCP server, nothing to install · Key read from the environment · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. ## 1. Add the server Add the server to `.cursor/mcp.json` in your project, or to `~/.cursor/mcp.json` for every project. Cursor reads the key from the environment with `${env:...}`: ```json With a key { "mcpServers": { "millionshort": { "url": "https://mcp.millionshort.com/mcp", "headers": { "Authorization": "Bearer ${env:MILLIONSHORT_API_KEY}" } } } } ``` ```json Without a key { "mcpServers": { "millionshort": { "url": "https://mcp.millionshort.com/mcp" } } } ``` A remote server cannot read an `envFile`, so set `MILLIONSHORT_API_KEY` in your shell profile or system environment, then restart Cursor. ## 2. Try it Ask Cursor: > Search MillionShort for forum threads about restoring a cast iron skillet, with the 1,000 most popular sites removed. List the five most useful with their links. A good answer comes from a `search` call (the client shows the tool call) and links to pages you may not have seen before. ## 3. Tell it when to search Cursor has no setting we could find that turns its own web search off, so say which search to use. Add a project rule, `.cursor/rules/millionshort.mdc`, with this line (or download the ready [rule file](https://millionshort.com/docs/snippets/millionshort.mdc) into that folder): > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## 4. Check it works Open **Customize** in the sidebar: `millionshort` is listed, switched on, with its tools. In the Cursor CLI, `agent mcp list-tools millionshort` prints them. Problems show under **Output**, **MCP Logs**. With a key you should see `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them); with no key, fewer, `search` and `list_sources` among them. ## Good to know - Cursor asks before each MCP tool call unless you allow the tool. Most of the tools only read; `crawl` spends credits, `crawl_cancel` stops a crawl and `create_space` saves a Space, so keep asking for those. ## The server One address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. A key is optional. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | ## Related - [MCP server](https://millionshort.com/docs/mcp): the address, every tool, and what the no-key mode allows. - [Filters for agents](https://millionshort.com/docs/search/filters): what to ask `search` for, with recipes. - More coding agents: [Claude Code](https://millionshort.com/docs/integrations/claude-code), [Codex](https://millionshort.com/docs/integrations/codex), [GitHub Copilot in VS Code](https://millionshort.com/docs/integrations/vscode), [Gemini CLI](https://millionshort.com/docs/integrations/gemini-cli), and [every integration](https://millionshort.com/docs/integrations). - Cursor's own documentation, read on 2026-11-19: [MCP](https://cursor.com/docs/mcp), [CLI and MCP](https://cursor.com/docs/cli/mcp), [Rules](https://cursor.com/docs/rules). --- Source: https://millionshort.com/docs/integrations/deer-flow Section: Build with # DeerFlow MillionShort search in DeerFlow, through the hosted MCP server. MCP · Hosted MCP server, nothing to install · Key read from the environment · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. ## 1. Add the server DeerFlow replaces a value that is a `$NAME` as a whole, and nothing inside a longer string. So the environment variable holds the whole header value, `Bearer ` included: ```bash export MILLIONSHORT_AUTH="Bearer $MILLIONSHORT_API_KEY" ``` Then add the server to `extensions_config.json` in the project root (copied from `extensions_config.example.json`) and restart DeerFlow: ```json With a key { "mcpServers": { "millionshort": { "enabled": true, "type": "http", "url": "https://mcp.millionshort.com/mcp", "headers": { "Authorization": "$MILLIONSHORT_AUTH" }, "description": "MillionShort web search" } } } ``` ```json Without a key { "mcpServers": { "millionshort": { "enabled": true, "type": "http", "url": "https://mcp.millionshort.com/mcp", "description": "MillionShort web search" } } } ``` ## 2. Try it Ask DeerFlow: > Search MillionShort for forum threads about restoring a cast iron skillet, with the 1,000 most popular sites removed. List the five most useful with their links. A good answer comes from a `search` call (the client shows the tool call) and links to pages you may not have seen before. ## 3. Turn off the built-in search DeerFlow's example `config.yaml` turns on a `web_search` tool of its own. Remove that entry under `tools:` so the agent searches with `millionshort_search`. Add this line to the agent's instructions: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## 4. Check it works After the restart the tools appear as `millionshort_search` and so on. If the variable is missing or empty, the server is skipped. Changing only the variable needs a restart too. With a key you should see `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them); with no key, fewer, `search` and `list_sources` among them. ## The server One address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. A key is optional. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | ## Related - [MCP server](https://millionshort.com/docs/mcp): the address, every tool, and what the no-key mode allows. - [Filters for agents](https://millionshort.com/docs/search/filters): what to ask `search` for, with recipes. - More research & rag: [GPT Researcher](https://millionshort.com/docs/integrations/gpt-researcher), [Hermes Agent](https://millionshort.com/docs/integrations/hermes-agent), [OpenClaw](https://millionshort.com/docs/integrations/openclaw), [Onyx](https://millionshort.com/docs/integrations/onyx), and [every integration](https://millionshort.com/docs/integrations). - DeerFlow's own documentation, read on 2026-11-19: [MCP servers](https://github.com/bytedance/deer-flow/blob/main/backend/docs/MCP_SERVER.md), [Example extensions config](https://github.com/bytedance/deer-flow/blob/main/extensions_config.example.json). --- Source: https://millionshort.com/docs/integrations/devin Section: Build with # Devin MillionShort search in Devin, through the hosted MCP server. MCP · Hosted MCP server, nothing to install · Key in a header · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. ## 1. Add the server In the Devin web app: 1. Open **Customize**, **MCPs**, then **+** and **New MCP**. 2. Name it `millionshort`, choose the **HTTP** transport and enter the server URL `https://mcp.millionshort.com/mcp`. 3. Set **Authentication method** to **Auth Header**: header `Authorization`, value `Bearer ms-YOUR_API_KEY`. For the no-key mode, choose no authentication. 4. **Add**, then **Test tools**: the server's tools are listed. In the Devin CLI, one command (`-s user` saves it for every project): ```bash With a key devin mcp add millionshort https://mcp.millionshort.com/mcp \ --header "Authorization: Bearer ms-YOUR_API_KEY" ``` ```bash Without a key devin mcp add millionshort https://mcp.millionshort.com/mcp ``` ## 2. Try it Ask Devin: > Search MillionShort for forum threads about restoring a cast iron skillet, with the 1,000 most popular sites removed. List the five most useful with their links. A good answer comes from a `search` call (the client shows the tool call) and links to pages you may not have seen before. ## 3. Turn off the built-in search In the Devin CLI, web search is its own tool, switched by **Enable Web Search** in the team settings. Turn it off there to leave search to `millionshort`. Add this line to `AGENTS.md`, or to Devin's rules under **Customize**: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## 4. Check it works In the web app, **Test tools** on the server lists its tools. In the CLI, `devin mcp get millionshort`, or `/mcp` in a session. With a key you should see `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them); with no key, fewer, `search` and `list_sources` among them. ## The server One address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. A key is optional. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | ## Related - [MCP server](https://millionshort.com/docs/mcp): the address, every tool, and what the no-key mode allows. - [Filters for agents](https://millionshort.com/docs/search/filters): what to ask `search` for, with recipes. - More coding agents: [Claude Code](https://millionshort.com/docs/integrations/claude-code), [Cursor](https://millionshort.com/docs/integrations/cursor), [Codex](https://millionshort.com/docs/integrations/codex), [GitHub Copilot in VS Code](https://millionshort.com/docs/integrations/vscode), and [every integration](https://millionshort.com/docs/integrations). - Devin's own documentation, read on 2026-11-19: [MCP](https://docs.devin.ai/work-with-devin/mcp), [Devin CLI MCP configuration](https://docs.devin.ai/cli/extensibility/mcp/configuration). --- Source: https://millionshort.com/docs/integrations/dify Section: Build with # Dify MillionShort search as a step in Dify, through the hosted MCP server or the API. MCP · Hosted MCP server, nothing to install · Key in a form field · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. > **Plugin coming soon.** A MillionShort plugin for Dify is not published yet. Everything below works today without it. ## 1. Add the MCP server Open **Integrations**, **Tools**, the **MCP** tab, and add a server: ```text With a key Name: millionshort Server URL: https://mcp.millionshort.com/mcp Server identifier: millionshort Dynamic Client Registration: off Advanced Options > Custom Headers: Authorization: Bearer ms-YOUR_API_KEY ``` ```text Without a key Name: millionshort Server URL: https://mcp.millionshort.com/mcp Server identifier: millionshort Dynamic Client Registration: off ``` Dify connects and imports the tools; add them to an Agent node, a Tool node or an agent app. Apps refer to the server by its identifier. ## 2. Or call the API in an HTTP step In a workflow, an **HTTP Request** node: ```text HTTP Request node Method: POST URL: https://api.millionshort.com/v1/search Authentication: API Key, Bearer, API Key = ms-YOUR_API_KEY Body: JSON ``` ```json Body {"query": "{{query}}", "remove_top_sites": 1000, "num_results": 5} ``` ## 3. Try it Ask Dify's agent, or run the step with this as the query: > Search MillionShort for forum threads about restoring a cast iron skillet, with the 1,000 most popular sites removed. List the five most useful with their links. A good answer comes from a `search` call (the client shows the tool call) and links to pages you may not have seen before. ## 4. Tell it when to search Dify has no setting we could find that turns its own web search off, so say which search to use. Add this line to the agent's instructions: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## 5. Check it works The MCP tab lists the server's tools (**update tool list** refreshes them). The HTTP node's run shows the response body. With a key you should see `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them); with no key, fewer, `search` and `list_sources` among them. ## The server One address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. A key is optional. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | ## Related - [MCP server](https://millionshort.com/docs/mcp): the address, every tool, and what the no-key mode allows. - [Filters for agents](https://millionshort.com/docs/search/filters): what to ask `search` for, with recipes. - More low-code builders: [n8n](https://millionshort.com/docs/integrations/n8n), [Zapier](https://millionshort.com/docs/integrations/zapier), [Make](https://millionshort.com/docs/integrations/make), [Langflow](https://millionshort.com/docs/integrations/langflow), and [every integration](https://millionshort.com/docs/integrations). - Dify's own documentation, read on 2026-11-19: [Tools](https://docs.dify.ai/en/self-host/use-dify/workspace/tools), [HTTP Request node](https://docs.dify.ai/en/self-host/use-dify/nodes/http-request). --- Source: https://millionshort.com/docs/integrations/dspy Section: Build with # DSPy MillionShort search for DSPy programs, as a function tool for dspy.ReAct or as the MCP server's tools. Recipe · Python · Nothing of ours to install · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. DSPy has no MCP client of its own, and needs none: `dspy.ReAct` takes plain Python functions as tools, so a short function that calls the MillionShort API is the simplest way in. If you would rather have the server's own tools (`search`, `get_domain_info`, `list_sources` and the tools of the other endpoints; [the MCP page](https://millionshort.com/docs/mcp#tools) lists them), the MCP Python SDK connects to it and `dspy.Tool.from_mcp_tool` converts them. ## 1. Install ```bash Python pip install "dspy[mcp]" export MILLIONSHORT_API_KEY=ms-YOUR_API_KEY ``` The `mcp` extra adds the MCP Python SDK, which only the MCP way needs. The examples use an OpenAI model through `dspy.LM`, which reads your OpenAI key from OPENAI_API_KEY; any model DSPy supports works the same way. Get a MillionShort key in the [dashboard](https://millionshort.com/app/); an agent can ask for a [trial key](https://millionshort.com/docs/api-reference/agent-key) by itself. ## 2. Minimal example A plain function is a tool: DSPy reads its name, type hints and docstring to tell the model how to call it. ```python Python import json import os import urllib.request import dspy dspy.configure(lm=dspy.LM("openai/gpt-4o-mini")) def millionshort_search(query: str, remove_top_sites: int = 1000, num_results: int = 5) -> str: """Search the web with MillionShort. remove_top_sites leaves out the N most popular sites.""" request = urllib.request.Request( "https://api.millionshort.com/v1/search", data=json.dumps({"query": query, "remove_top_sites": remove_top_sites, "num_results": num_results}).encode(), headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"], "Content-Type": "application/json"}, ) with urllib.request.urlopen(request, timeout=30) as response: results = json.load(response)["data"]["results"] return json.dumps([{"title": r["title"], "url": r["url"], "snippet": r.get("snippet")} for r in results]) react = dspy.ReAct("question -> answer", tools=[millionshort_search]) print(react(question="Find independent blogs about home espresso, without the 1,000 most popular sites.").answer) ``` ## 3. Give the tools to an agent `dspy.ReAct` takes a signature and a list of tools. The signature can be a string, as above, or a `dspy.Signature` class whose docstring says when to search: ```python Python import dspy class Research(dspy.Signature): """Use millionshort_search for anything recent or niche, and cite the URLs it returns.""" question: str = dspy.InputField() answer: str = dspy.OutputField(desc="the answer, with the URLs it is based on") ``` Then `dspy.ReAct(Research, tools=[millionshort_search], max_iters=5)`. `max_iters` caps the number of tool-calling turns (20 by default), so a looping program cannot run up many searches. DSPy has no web search of its own: the agent has only the tools you pass. ## 4. Check it works Run the example: the answer should cite pages. The prediction keeps the run, so you can see the call to `millionshort_search` and what it returned. Add these lines to the end of the example: ```python Python result = react(question="Find independent blogs about home espresso.") print(result.termination_reason) # "submit" when the agent finished normally print(result.history) # each turn's tool calls and their results ``` If the model answers from memory, say when to search in the signature's docstring: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## With MCP: the server's tools The MCP Python SDK (version 2) connects to the server. The key goes on the `httpx2.AsyncClient` you hand to the transport, with the SDK's own timeouts. MCP tools are async, so call the agent with `acall`, inside the open connection. ```python Python import asyncio import os import dspy import httpx2 from mcp import Client from mcp.client.streamable_http import streamable_http_client dspy.configure(lm=dspy.LM("openai/gpt-4o-mini")) async def main(): async with httpx2.AsyncClient( headers={"Authorization": f"Bearer {os.environ['MILLIONSHORT_API_KEY']}"}, timeout=httpx2.Timeout(30.0, read=300.0), ) as http_client: async with Client(streamable_http_client("https://mcp.millionshort.com/mcp", http_client=http_client)) as client: listed = await client.list_tools() tools = [dspy.Tool.from_mcp_tool(client, tool) for tool in listed.tools] print([tool.name for tool in tools]) # search, get_domain_info, list_sources, ... react = dspy.ReAct("question -> answer", tools=tools) result = await react.acall(question="Find independent blogs about home espresso.") print(result.answer) asyncio.run(main()) ``` Without a key, skip the `httpx2.AsyncClient` and pass the address alone: `Client("https://mcp.millionshort.com/mcp")`. The agent then gets `search` and `list_sources`. ## MCP configuration The same address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools The function tool above calls `POST /v1/search` and takes any field of the [search reference](https://millionshort.com/docs/search/parameters) you choose to add. Over MCP, the agent gets the server's tools: | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Settings | Variable | Meaning | |---|---| | `MILLIONSHORT_API_KEY` | Your key, read by the examples above. Over MCP, leave the header out for the no-key mode | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | `401 AUTH_MISSING_KEY` or `AUTH_INVALID_KEY` | The key is missing or wrong | Set `MILLIONSHORT_API_KEY`; keys start with `ms-` | | `400 INVALID_PARAM` | A field name or value the API does not take | The `message` names the field; the [search reference](https://millionshort.com/docs/search/parameters) lists them all | | `429 RATE_LIMITED` or `CAPACITY` | Too many calls a minute, or no free capacity right now | Wait the `Retry-After` seconds, then retry | | `429 INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; do not retry | | `streamable_http_client() got an unexpected keyword argument 'headers'` | Version 2 of the MCP Python SDK moved headers and timeouts to the HTTP client | Put the header on `httpx2.AsyncClient` and pass it as `http_client`, as above | | An MCP tool call fails with a read timeout | The `httpx2.AsyncClient` was built without a timeout and kept the 5-second default | Pass `timeout=httpx2.Timeout(30.0, read=300.0)` | | The agent runs, but MCP tools fail or never return | The agent was called with `react(...)`, or after the `async with` block closed | Call `await react.acall(...)` inside the block | ## Related - [Agent tool use](https://millionshort.com/docs/search/guides/agent-tool-use): when to give a model tools, and what to tell it. - [Search reference](https://millionshort.com/docs/search/parameters): every field the function tool can pass. - [Haystack](https://millionshort.com/docs/integrations/haystack) and [smolagents](https://millionshort.com/docs/integrations/smolagents): the same search in other Python frameworks. - [MCP server](https://millionshort.com/docs/mcp) and [Filters for agents](https://millionshort.com/docs/search/filters). - The products' own documentation, read on 2026-11-19: [DSPy and MCP](https://dspy.ai/tutorials/mcp/), [MCP Python SDK client transports](https://py.sdk.modelcontextprotocol.io/client/transports/). --- Source: https://millionshort.com/docs/integrations/elevenlabs Section: Build with # ElevenLabs Agents MillionShort search for an ElevenLabs voice agent, as a custom MCP server with the key in a header, or as a webhook tool. MCP · Dashboard, Python and TypeScript · Nothing of ours to install · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. ElevenLabs agents connect to external MCP servers that you add to the workspace once and then attach to agents. Added that way, the MillionShort server gives the agent its tools ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them). A webhook tool that calls the API is the other route, and the one to use where MCP is not available. Spoken answers work best with few results: ask for `num_results` 3 and `max_highlights` 1, so the model reads short passages rather than long text. Each search also adds a little latency to the turn it runs in. MCP is off by default in every ElevenLabs workspace, and ElevenLabs does not offer it to workspaces in Zero Retention Mode or with HIPAA compliance turned on. ## 1. Install Nothing to install for the dashboard steps. For the API form, the ElevenLabs SDK: ```bash Python pip install elevenlabs export MILLIONSHORT_API_KEY=ms-YOUR_API_KEY ``` ```bash TypeScript npm install @elevenlabs/elevenlabs-js export MILLIONSHORT_API_KEY=ms-YOUR_API_KEY ``` The SDKs read your ElevenLabs key from ELEVENLABS_API_KEY. Get a MillionShort key in the [dashboard](https://millionshort.com/app/). ## 2. Connect the server In the dashboard: 1. Open the **MCP server integrations** dashboard (`elevenlabs.io/app/agents/integrations`) and click **Add Custom MCP Server**. The first time anyone in the workspace does this, ElevenLabs asks you to accept its MCP server terms, which turns MCP on for the whole workspace. 2. **Name**: `MillionShort`. 3. **Description**: `Web search, including sites beyond the most popular ones`. 4. **Server URL**: `https://mcp.millionshort.com/mcp`. 5. **HTTP Headers**: add `Authorization` with the value `Bearer ms-YOUR_API_KEY`. Leave it out for the no-key mode. 6. Click **Add Integration**. ElevenLabs saves the server, tests the connection and lists its tools. ElevenLabs describes the optional **Secret Token** field only as "Authorization header value" and does not say whether it adds `Bearer ` itself, so these steps use **HTTP Headers**, where the value is sent as written. Or with the API: create the server, then attach it to an agent. Set `transport` to STREAMABLE_HTTP, as below, because the API's default is SSE. ```python Python import os from elevenlabs import ElevenLabs elevenlabs = ElevenLabs() server = elevenlabs.conversational_ai.mcp_servers.create( config={ "url": "https://mcp.millionshort.com/mcp", "name": "MillionShort", "description": "Web search, including sites beyond the most popular ones", "transport": "STREAMABLE_HTTP", "approval_policy": "auto_approve_all", "request_headers": {"Authorization": f"Bearer {os.environ['MILLIONSHORT_API_KEY']}"}, }, ) elevenlabs.conversational_ai.agents.update( agent_id="YOUR_AGENT_ID", conversation_config={"agent": {"prompt": {"mcp_server_ids": [server.id]}}}, ) ``` ```ts TypeScript import { ElevenLabsClient } from '@elevenlabs/elevenlabs-js'; const elevenlabs = new ElevenLabsClient(); const server = await elevenlabs.conversationalAi.mcpServers.create({ config: { url: 'https://mcp.millionshort.com/mcp', name: 'MillionShort', description: 'Web search, including sites beyond the most popular ones', transport: 'STREAMABLE_HTTP', approvalPolicy: 'auto_approve_all', requestHeaders: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}` }, }, }); await elevenlabs.conversationalAi.agents.update('YOUR_AGENT_ID', { conversationConfig: { agent: { prompt: { mcpServerIds: [server.id] } } }, }); ``` `auto_approve_all` lets every tool of the server run without asking, `crawl`, `crawl_cancel` and `create_space` included; step 2 below says how to keep approval on those three. A header value can also be a reference to a workspace secret, `{"secret_id": "..."}`, in place of the plain string. To turn MCP on for the workspace from code, call `conversational_ai.settings.update(can_use_mcp_servers=True)`. ## 3. Give the tools to an agent 1. Open your agent and add the **MillionShort** MCP server to it (the API form above has already done this). 2. Pick an approval mode. Most of the tools only read; `crawl` spends credits, `crawl_cancel` stops a crawl and `create_space` saves a Space. With **Fine-Grained Tool Approval** you can set each tool to **Auto-approved** or **Disabled**: auto-approve the read-only tools and keep approval on those three, or offer only `search`. The default, **Always Ask**, asks before every call. 3. In the agent's system prompt, say when to search and how to answer: > Use the MillionShort search tool for anything recent, niche, or that needs a source, with num_results 3 and max_highlights 1. Answer in two or three short sentences and name the site you used. ## 4. Check it works After **Add Integration**, the server's page lists its tools: with a key, `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them); with no key, fewer, `search` and `list_sources` among them. Then talk to the agent and ask a question that needs the web: the answer should name pages it found. If the agent answers from memory, add this line to its system prompt: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## Without MCP: a webhook tool A webhook tool calls `POST /v1/search` directly and fixes the result count, so the agent cannot ask for more than a spoken answer needs. In the dashboard, in the **Agent** section of the agent's settings, choose **Add Tool**, then **Webhook** as the tool type: 1. **Name**: `millionshort_search`. 2. **Description**: `Search the web for current or niche information. Returns titles, links and short passages.` 3. **Method**: `POST`. **URL**: `https://api.millionshort.com/v1/search`. 4. Add a header `Authorization`, choose **Secret** as its type, click **Create New Secret** and store the whole value, `Bearer ms-YOUR_API_KEY`. 5. Add a body parameter: data type `string`, identifier `query`, value type `LLM Prompt`, description `What to search for`. The dashboard pages we read do not show how to set a fixed body value, so the dashboard tool leaves `num_results` at the API's default. The API form sets fixed values with `constant_value`: ```python Python import os from elevenlabs import ElevenLabs, ToolRequestModel elevenlabs = ElevenLabs() tool = elevenlabs.conversational_ai.tools.create( request=ToolRequestModel( tool_config={ "type": "webhook", "name": "millionshort_search", "description": "Search the web for current or niche information. Returns titles, links and short passages.", "api_schema": { "url": "https://api.millionshort.com/v1/search", "method": "POST", "request_headers": {"Authorization": f"Bearer {os.environ['MILLIONSHORT_API_KEY']}"}, "request_body_schema": { "type": "object", "required": ["query"], "properties": { "query": {"type": "string", "description": "What to search for"}, "num_results": {"type": "integer", "constant_value": 3}, "max_highlights": {"type": "integer", "constant_value": 1}, "remove_top_sites": {"type": "integer", "constant_value": 1000}, }, }, }, } ) ) elevenlabs.conversational_ai.agents.update( agent_id="YOUR_AGENT_ID", conversation_config={"agent": {"prompt": {"tool_ids": [tool.id]}}}, ) ``` ## MCP configuration The same address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Settings | Variable | Meaning | |---|---| | `MILLIONSHORT_API_KEY` | Your key, read by the API examples above. In the dashboard, type it into the header value. Leave the header out for the no-key mode | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | | You cannot add an MCP server | MCP is off for the workspace, or the workspace is in Zero Retention Mode or HIPAA mode | Accept the MCP server terms in the dashboard, or use the webhook tool | | The server added with the API lists no tools | The API connects over SSE unless told otherwise | Set `transport` to STREAMABLE_HTTP | | The agent asks for permission before each search | The approval mode is **Always Ask**, the default | Choose **No Approval**, or auto-approve `search` with **Fine-Grained Tool Approval** | | Long pauses before spoken answers | Many results or long text for the model to read | Ask for `num_results` 3 and `max_highlights` 1, or use the webhook tool with fixed values | ## Related - [Vapi](https://millionshort.com/docs/integrations/vapi), [LiveKit Agents](https://millionshort.com/docs/integrations/livekit-agents) and [Pipecat](https://millionshort.com/docs/integrations/pipecat): the same server in other voice agents. - [Agent tool use](https://millionshort.com/docs/search/guides/agent-tool-use): when to give a model tools, and what to tell it. - [MCP server](https://millionshort.com/docs/mcp) and [Filters for agents](https://millionshort.com/docs/search/filters). - ElevenLabs' own documentation, read on 2026-11-19: [Model Context Protocol](https://elevenlabs.io/docs/eleven-agents/customization/tools/mcp), [Create MCP server](https://elevenlabs.io/docs/eleven-agents/api-reference/mcp/create), [Webhook tools](https://elevenlabs.io/docs/eleven-agents/customization/tools/webhook-tools), [Create tool](https://elevenlabs.io/docs/eleven-agents/api-reference/tools/create). --- Source: https://millionshort.com/docs/integrations/factory-droid Section: Build with # Factory Droid MillionShort search in Factory Droid, through the hosted MCP server. MCP · Hosted MCP server, nothing to install · Key in a header · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. ## 1. Add the server One command. `--type http` is needed (the default is a local process), and `--no-oauth` because the key is a header: ```bash With a key droid mcp add millionshort https://mcp.millionshort.com/mcp --type http \ --header "Authorization: Bearer ms-YOUR_API_KEY" --no-oauth ``` ```bash Without a key droid mcp add millionshort https://mcp.millionshort.com/mcp --type http --no-oauth ``` Or edit `~/.factory/mcp.json`, where Droid fills in `${MILLIONSHORT_API_KEY}` from the environment: ```json ~/.factory/mcp.json { "mcpServers": { "millionshort": { "type": "http", "url": "https://mcp.millionshort.com/mcp", "headers": { "Authorization": "Bearer ${MILLIONSHORT_API_KEY}" }, "oauth": false } } } ``` ## 2. Try it Ask Factory Droid: > Search MillionShort for forum threads about restoring a cast iron skillet, with the 1,000 most popular sites removed. List the five most useful with their links. A good answer comes from a `search` call (the client shows the tool call) and links to pages you may not have seen before. ## 3. Turn off the built-in search Droid's own Web Search can be turned off only by an organization admin, with the managed setting `webSearchDisabled: true`. Otherwise, say which search to use. Add this line to `AGENTS.md`: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## 4. Check it works Run `droid mcp list`: `millionshort` is connected. `/mcp` in a session shows its tools. With a key you should see `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them); with no key, fewer, `search` and `list_sources` among them. ## The server One address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. A key is optional. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | ## Related - [MCP server](https://millionshort.com/docs/mcp): the address, every tool, and what the no-key mode allows. - [Filters for agents](https://millionshort.com/docs/search/filters): what to ask `search` for, with recipes. - More coding agents: [Claude Code](https://millionshort.com/docs/integrations/claude-code), [Cursor](https://millionshort.com/docs/integrations/cursor), [Codex](https://millionshort.com/docs/integrations/codex), [GitHub Copilot in VS Code](https://millionshort.com/docs/integrations/vscode), and [every integration](https://millionshort.com/docs/integrations). - Factory Droid's own documentation, read on 2026-11-19: [MCP](https://docs.factory.com/harness/mcp), [AGENTS.md](https://docs.factory.com/harness/agents-md), [Settings](https://docs.factory.com/droid-cli/settings). --- Source: https://millionshort.com/docs/integrations/gemini Section: Build with # Gemini MillionShort search for Gemini models, as a function tool in the Google Gen AI SDK, in Python and TypeScript. Recipe · Python and TypeScript · Nothing of ours to install · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. The Gemini API has no remote MCP tool of its own: your code runs the search. In Python, pass a plain function as a tool and the SDK calls it for the model (automatic function calling). In TypeScript, declare the function and run the loop yourself. The SDKs can also take an MCP session you open to our server; Google marks that support experimental. ## 1. Install ```bash Python pip install google-genai requests mcp httpx2 export MILLIONSHORT_API_KEY=ms-YOUR_API_KEY ``` ```bash TypeScript npm install @google/genai @modelcontextprotocol/sdk zod export MILLIONSHORT_API_KEY=ms-YOUR_API_KEY ``` The SDK reads your Gemini key from GEMINI_API_KEY (or GOOGLE_API_KEY). Get a MillionShort key in the [dashboard](https://millionshort.com/app/); an agent can ask for a [trial key](https://millionshort.com/docs/api-reference/agent-key) by itself. The MCP packages (`mcp` and `httpx2`, `@modelcontextprotocol/sdk` and `zod`) are only for the MCP section further down. ## 2. Minimal example ```python Python import json import os import requests from google import genai from google.genai import types def millionshort_search(query: str) -> str: """Search the web with MillionShort, leaving out the 1,000 most popular sites. Args: query: What to search for. """ r = requests.post( "https://api.millionshort.com/v1/search", headers={"Authorization": f"Bearer {os.environ['MILLIONSHORT_API_KEY']}"}, json={"query": query, "remove_top_sites": 1000, "num_results": 5}, timeout=30, ) r.raise_for_status() return json.dumps([{"title": x["title"], "url": x["url"], "snippet": x.get("snippet")} for x in r.json()["data"]["results"]]) client = genai.Client() response = client.models.generate_content( model="gemini-4-hydrogen", contents="Find independent blogs about home espresso.", config=types.GenerateContentConfig(tools=[millionshort_search]), ) print(response.text) ``` ```ts TypeScript import { GoogleGenAI, type Content } from '@google/genai'; async function millionshortSearch(query: string): Promise { const res = await fetch('https://api.millionshort.com/v1/search', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json' }, body: JSON.stringify({ query, remove_top_sites: 1000, num_results: 5 }), }); if (!res.ok) throw new Error(`search failed: ${res.status}`); const { data } = (await res.json()) as { data: { results: { title: string; url: string; snippet?: string }[] } }; return JSON.stringify(data.results.map(({ title, url, snippet }) => ({ title, url, snippet }))); } const config = { tools: [{ functionDeclarations: [{ name: 'millionshort_search', description: 'Search the web with MillionShort, leaving out the 1,000 most popular sites.', parametersJsonSchema: { type: 'object', properties: { query: { type: 'string' } }, required: ['query'] }, }] }] }; const ai = new GoogleGenAI({}); const contents: Content[] = [{ role: 'user', parts: [{ text: 'Find independent blogs about home espresso.' }] }]; while (true) { const response = await ai.models.generateContent({ model: 'gemini-4-hydrogen', contents, config }); const calls = response.functionCalls ?? []; if (calls.length === 0 || !response.candidates?.[0]?.content) { console.log(response.text); break; } contents.push(response.candidates[0].content); const parts = []; for (const call of calls) { const result = await millionshortSearch(String(call.args?.query)); parts.push({ functionResponse: { name: call.name, id: call.id, response: { result } } }); } contents.push({ role: 'user', parts }); } ``` The Python SDK builds the tool's schema from the type hints and the docstring, so keep both. ## 3. Tell it when to search Google Search is a separate tool that runs only when you add it to `tools`, so leave it out. Then put a line like this in the system instruction (`system_instruction` in `GenerateContentConfig`, `systemInstruction` in the TypeScript config): > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## 4. Check it works Run the example, then ask: > Search MillionShort for forum threads about restoring a cast iron skillet, with the 1,000 most popular sites removed. List the five most useful with their links. In TypeScript, `response.functionCalls` on the first turn names `millionshort_search` with a `query`. In Python, `response.automatic_function_calling_history` holds the calls the SDK made for the model. ## With MCP: the hosted server Open an MCP session to our server and pass it in `tools`; the SDK lists the tools and calls them for the model. Google marks this experimental. With MCP Python SDK 2.x, the headers go on the `httpx2` client. Without a key, leave the headers out. ```python Python import asyncio import os import httpx2 from google import genai from google.genai import types from mcp import ClientSession from mcp.client.streamable_http import streamable_http_client async def main(): headers = {"Authorization": f"Bearer {os.environ['MILLIONSHORT_API_KEY']}"} async with httpx2.AsyncClient(headers=headers, timeout=httpx2.Timeout(30.0, read=300.0)) as http: async with streamable_http_client("https://mcp.millionshort.com/mcp", http_client=http) as (read, write): async with ClientSession(read, write) as session: await session.initialize() response = await genai.Client().aio.models.generate_content( model="gemini-4-hydrogen", contents="Find independent blogs about home espresso.", config=types.GenerateContentConfig(tools=[session]), ) print(response.text) asyncio.run(main()) ``` ```ts TypeScript import { GoogleGenAI, mcpToTool } from '@google/genai'; import { Client } from '@modelcontextprotocol/sdk/client/index.js'; import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js'; const transport = new StreamableHTTPClientTransport(new URL('https://mcp.millionshort.com/mcp'), { requestInit: { headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}` } }, }); const mcp = new Client({ name: 'millionshort-example', version: '1.0.0' }); await mcp.connect(transport); const response = await new GoogleGenAI({}).models.generateContent({ model: 'gemini-4-hydrogen', contents: 'Find independent blogs about home espresso.', config: { tools: [mcpToTool(mcp)] }, }); console.log(response.text); await mcp.close(); ``` The TypeScript SDK's README says automatic function calling from `generateContent` will move to its `Chats` module in a future major version; if this stops calling tools after an upgrade, use `ai.chats.create` with the same `config`. ## MCP configuration The same address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | The function tool in step 2 is `search` alone; the MCP session gives the model every tool of the server. ## Settings | Variable | Meaning | |---|---| | `MILLIONSHORT_API_KEY` | Your key, read by the examples above | | GEMINI_API_KEY | Your Gemini key, read by the SDK | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | `401 AUTH_MISSING_KEY` or `AUTH_INVALID_KEY` | The key is missing or wrong | Set `MILLIONSHORT_API_KEY`; keys start with `ms-` | | `400 INVALID_PARAM` | A field name or value the API does not take | The `message` names the field; the [search reference](https://millionshort.com/docs/search/parameters) lists them all | | `429 RATE_LIMITED` or `CAPACITY` | Too many calls a minute, or no free capacity right now | Wait the `Retry-After` seconds, then retry | | `429 INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; do not retry | | The model answers without calling the tool | Nothing told it when to search, or the function has no docstring for the Python SDK to read | Add the line from step 3, and keep the docstring | | `streamable_http_client()` rejects `headers` | MCP Python SDK 2.x moved headers to the `httpx2` client | Pass `http_client=` as in the MCP example | ## Related - [Agent tool use](https://millionshort.com/docs/search/guides/agent-tool-use): when to give a model tools, and what to tell it. - [Gemini CLI](https://millionshort.com/docs/integrations/gemini-cli) and [Antigravity](https://millionshort.com/docs/integrations/antigravity): the same server in Google's agents. - Other model APIs: [OpenAI](https://millionshort.com/docs/integrations/openai), [Anthropic](https://millionshort.com/docs/integrations/anthropic), [OpenRouter](https://millionshort.com/docs/integrations/openrouter), [Ollama](https://millionshort.com/docs/integrations/ollama). - [Search API reference](https://millionshort.com/docs/search/parameters) and [MCP server](https://millionshort.com/docs/mcp). - Google's own documentation, read on 2026-11-19: [Function calling](https://aistudio.google.com/docs/function-calling?generate-content=true), [Google Gen AI Python SDK](https://github.com/googleapis/python-genai), [Google Gen AI JavaScript SDK](https://github.com/googleapis/js-genai). --- Source: https://millionshort.com/docs/integrations/gemini-cli Section: Build with # Gemini CLI MillionShort search in Gemini CLI, through the hosted MCP server. MCP · Hosted MCP server, nothing to install · Key read from the environment · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. ## 1. Add the server One command; `--scope user` saves it for every project. Gemini CLI fills in `${MILLIONSHORT_API_KEY}` from the environment each time it loads its settings, and the single quotes keep it that way: ```bash With a key gemini mcp add --transport http --scope user \ --header 'Authorization: Bearer ${MILLIONSHORT_API_KEY}' \ millionshort https://mcp.millionshort.com/mcp ``` ```bash Without a key gemini mcp add --transport http --scope user millionshort https://mcp.millionshort.com/mcp ``` Or edit `~/.gemini/settings.json` (or `.gemini/settings.json` in a project). Use `httpUrl`: in Gemini CLI, `url` means the older SSE transport. ```json settings.json { "mcpServers": { "millionshort": { "httpUrl": "https://mcp.millionshort.com/mcp", "headers": { "Authorization": "Bearer ${MILLIONSHORT_API_KEY}" } } } } ``` ## 2. Try it Ask Gemini CLI: > Search MillionShort for forum threads about restoring a cast iron skillet, with the 1,000 most popular sites removed. List the five most useful with their links. A good answer comes from a `search` call (the client shows the tool call) and links to pages you may not have seen before. ## 3. Turn off the built-in search Leave Gemini CLI's own search and fetch tools out, in the same `settings.json`, then restart it: ```json settings.json { "tools": { "exclude": ["google_web_search", "web_fetch"] } } ``` Add this line to `GEMINI.md`: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## 4. Check it works Type `/mcp` in Gemini CLI: `millionshort` is connected and its tools are listed. `gemini mcp list` does the same from a shell. With a key you should see `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them); with no key, fewer, `search` and `list_sources` among them. ## The server One address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. A key is optional. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | ## Related - [MCP server](https://millionshort.com/docs/mcp): the address, every tool, and what the no-key mode allows. - [Filters for agents](https://millionshort.com/docs/search/filters): what to ask `search` for, with recipes. - More coding agents: [Claude Code](https://millionshort.com/docs/integrations/claude-code), [Cursor](https://millionshort.com/docs/integrations/cursor), [Codex](https://millionshort.com/docs/integrations/codex), [GitHub Copilot in VS Code](https://millionshort.com/docs/integrations/vscode), and [every integration](https://millionshort.com/docs/integrations). - Gemini CLI's own documentation, read on 2026-11-19: [MCP servers](https://geminicli.com/docs/tools/mcp-server/), [Configuration](https://geminicli.com/docs/reference/configuration/), [GEMINI.md](https://geminicli.com/docs/cli/gemini-md/). --- Source: https://millionshort.com/docs/integrations/genkit Section: Build with # Genkit MillionShort search as tools for a Genkit generate call, in TypeScript. MCP · TypeScript · Nothing of ours to install · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. Genkit's MCP plugin connects to the MillionShort MCP server by URL and turns its tools into Genkit tools, so any model Genkit runs can call `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints, such as `extract`, `places`, `map` and `crawl` ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them all). Without MCP, a tool defined with `ai.defineTool` that calls the API does the same job. Remote MCP servers are a feature of the TypeScript plugin. Genkit's Python MCP plugin is in preview and its docs describe only servers it starts as a local process, so this page is TypeScript only. ## 1. Install ```bash TypeScript npm install genkit @genkit-ai/mcp @genkit-ai/google-genai export MILLIONSHORT_API_KEY=ms-YOUR_API_KEY ``` The examples use the Google AI plugin, which reads your Gemini key from GEMINI_API_KEY; any model plugin works. Get a MillionShort key in the [dashboard](https://millionshort.com/app/); an agent can ask for a [trial key](https://millionshort.com/docs/api-reference/agent-key) by itself. ## 2. Connect the server `createMcpHost` manages one or more MCP servers. The key under `mcpServers` names the server, and the key goes in `requestInit.headers`. Without a key, leave `requestInit` out. ```ts TypeScript import { googleAI } from '@genkit-ai/google-genai'; import { createMcpHost } from '@genkit-ai/mcp'; import { genkit } from 'genkit'; const mcpHost = createMcpHost({ name: 'myMcpClients', mcpServers: { millionshort: { url: 'https://mcp.millionshort.com/mcp', requestInit: { headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}` } }, }, }, }); const ai = genkit({ plugins: [googleAI()] }); ``` ## 3. Give the tools to a generate call `getActiveTools` returns the server's tools as Genkit tools; pass them to `ai.generate`, a prompt or a chat. ```ts TypeScript import { googleAI } from '@genkit-ai/google-genai'; import { createMcpHost } from '@genkit-ai/mcp'; import { genkit } from 'genkit'; const mcpHost = createMcpHost({ name: 'myMcpClients', mcpServers: { millionshort: { url: 'https://mcp.millionshort.com/mcp', requestInit: { headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}` } }, }, }, }); const ai = genkit({ plugins: [googleAI()] }); try { const { text } = await ai.generate({ model: googleAI.model('gemini-flash-latest'), system: 'Use the millionshort search tool for anything recent or niche, and cite the URLs.', prompt: 'Find independent blogs about home espresso, without the 1,000 most popular sites.', tools: await mcpHost.getActiveTools(ai), }); console.log(text); } finally { await mcpHost.close(); } ``` For one server you can use `createMcpClient` instead. Its `name` becomes the namespace of the tools: ```ts TypeScript import { createMcpClient } from '@genkit-ai/mcp'; export const millionshort = createMcpClient({ name: 'millionshort', mcpServer: { url: 'https://mcp.millionshort.com/mcp', requestInit: { headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}` } }, }, }); // await millionshort.ready(); then pass await millionshort.getActiveTools(ai) as tools ``` ## 4. Check it works Run the example: the answer should cite pages. To see the tools without a model, list their names. Genkit namespaces them by the server's key, so expect `millionshort/search`, `millionshort/get_domain_info`, `millionshort/list_sources` and the rest of the server's tools under the same prefix: ```ts TypeScript import { createMcpHost } from '@genkit-ai/mcp'; import { genkit } from 'genkit'; const mcpHost = createMcpHost({ name: 'myMcpClients', mcpServers: { millionshort: { url: 'https://mcp.millionshort.com/mcp', requestInit: { headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}` } }, }, }, }); const ai = genkit({}); const tools = await mcpHost.getActiveTools(ai); console.log(tools.map((tool) => tool.__action.name)); await mcpHost.close(); ``` The Genkit Developer UI also lists the tools once the host is set up. If the model answers from memory, say when to search in its instructions: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## Without MCP: a function tool A tool defined with `ai.defineTool` that calls `POST /v1/search` works with any model Genkit runs: ```ts TypeScript import { googleAI } from '@genkit-ai/google-genai'; import { genkit, z } from 'genkit'; const ai = genkit({ plugins: [googleAI()], model: googleAI.model('gemini-flash-latest') }); const millionshortSearch = ai.defineTool( { name: 'millionshortSearch', description: 'Search the web with MillionShort. remove_top_sites leaves out the N most popular sites.', inputSchema: z.object({ query: z.string(), remove_top_sites: z.number().int().default(1000) }), outputSchema: z.array(z.object({ title: z.string(), url: z.string(), snippet: z.string().optional() })), }, async ({ query, remove_top_sites }) => { const res = await fetch('https://api.millionshort.com/v1/search', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json' }, body: JSON.stringify({ query, remove_top_sites, num_results: 5 }), }); if (!res.ok) throw new Error(`search failed: ${res.status}`); const { data } = (await res.json()) as { data: { results: { title: string; url: string; snippet?: string }[] } }; return data.results.map(({ title, url, snippet }) => ({ title, url, snippet })); }, ); const { text } = await ai.generate({ prompt: 'Find independent blogs about home espresso.', tools: [millionshortSearch] }); console.log(text); ``` ## MCP configuration The same address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Settings | Variable | Meaning | |---|---| | `MILLIONSHORT_API_KEY` | Your key, read by the examples above. Leave the header out for the no-key mode | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | | `getActiveTools` returns no MillionShort tools | The connection failed, or the server entry has `disabled: true` | Check the URL and the header, then list the tools as in step 4 | ## Related - [Agent tool use](https://millionshort.com/docs/search/guides/agent-tool-use): when to give a model tools, and what to tell it. - [Vercel AI SDK](https://millionshort.com/docs/integrations/vercel-ai-sdk) and [OpenAI Agents SDK](https://millionshort.com/docs/integrations/openai-agents): the same server in other TypeScript frameworks. - [MCP server](https://millionshort.com/docs/mcp) and [Filters for agents](https://millionshort.com/docs/search/filters). - Genkit's own documentation, read on 2026-11-19: [Model Context Protocol](https://genkit.dev/docs/js/model-context-protocol/), [Tool calling](https://genkit.dev/docs/js/tool-calling/), [Google Generative AI plugin](https://genkit.dev/docs/js/integrations/google-genai/). --- Source: https://millionshort.com/docs/integrations/google-adk Section: Build with # Google ADK MillionShort search for agents built with Google's Agent Development Kit, in Python and TypeScript. MCP · Python and TypeScript · Nothing of ours to install · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. ADK connects to the MillionShort MCP server through an MCP toolset (`McpToolset` in Python, `MCPToolset` in TypeScript) placed in an agent's `tools`. The toolset finds the server's tools, `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them all), and calls them for the agent. With no MCP at all, a function tool that calls the API does the same job. ## 1. Install ```bash Python pip install "google-adk[mcp]" export MILLIONSHORT_API_KEY=ms-YOUR_API_KEY ``` ```bash TypeScript npm install @google/adk zod npm install -D @google/adk-devtools export MILLIONSHORT_API_KEY=ms-YOUR_API_KEY ``` ADK needs Python 3.10 or later, or Node.js 24.13 or later. The examples use a Gemini model, as ADK's docs do: put your Gemini key in the agent's `.env` file, as GOOGLE_API_KEY for Python or GEMINI_API_KEY for TypeScript. Get a MillionShort key in the [dashboard](https://millionshort.com/app/); an agent can ask for a [trial key](https://millionshort.com/docs/api-reference/agent-key) by itself. ## 2. Connect the server An ADK agent is a `root_agent` (`rootAgent` in TypeScript). In Python it lives in `agent.py` inside an agent folder, such as the one `adk create millionshort_agent` makes; in TypeScript, in `agent.ts`. Add the toolset to its `tools`. Without a key, leave the headers out. ```python Python import os from google.adk.agents import LlmAgent from google.adk.tools.mcp_tool import McpToolset from google.adk.tools.mcp_tool.mcp_session_manager import StreamableHTTPConnectionParams root_agent = LlmAgent( model="gemini-flash-latest", name="researcher", instruction="Use the MillionShort search tool for anything recent or niche, and cite the URLs.", tools=[ McpToolset( connection_params=StreamableHTTPConnectionParams( url="https://mcp.millionshort.com/mcp", headers={"Authorization": f"Bearer {os.environ['MILLIONSHORT_API_KEY']}"}, ) ) ], ) ``` ```ts TypeScript import { LlmAgent, MCPToolset } from '@google/adk'; export const rootAgent = new LlmAgent({ model: 'gemini-flash-latest', name: 'researcher', instruction: 'Use the MillionShort search tool for anything recent or niche, and cite the URLs.', tools: [ new MCPToolset({ type: 'StreamableHTTPConnectionParams', url: 'https://mcp.millionshort.com/mcp', transportOptions: { requestInit: { headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}` } }, }, }), ], }); ``` Constructing the toolset does not connect: it opens the session the first time the agent asks for its tools. ## 3. Give the tools to an agent Run the agent with ADK's command line, from the folder that holds the agent folder (Python) or the project folder (TypeScript): ```bash Python adk run millionshort_agent ``` ```bash TypeScript npx adk run agent.ts ``` `adk web` (`npx adk web`) opens ADK's development web page instead, where the event trace shows each tool call. ADK adds no web search of its own: its Google Search tool is only there if you put it in `tools`, so leave it out. To give the agent only search, add `tool_filter=["search"]` to the Python toolset. A line that works well in the agent's `instruction`: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## 4. Check it works Ask the agent something recent, for example: > Search MillionShort for forum threads about restoring a cast iron skillet, with the 1,000 most popular sites removed. List the five most useful with their links. The trace in `adk web` should show a call to `search`. To see the tools without a model, list them from the toolset: ```python Python import asyncio import os from google.adk.tools.mcp_tool import McpToolset from google.adk.tools.mcp_tool.mcp_session_manager import StreamableHTTPConnectionParams async def main(): params = StreamableHTTPConnectionParams(url="https://mcp.millionshort.com/mcp", headers={"Authorization": f"Bearer {os.environ['MILLIONSHORT_API_KEY']}"}) toolset = McpToolset(connection_params=params) try: print([tool.name for tool in await toolset.get_tools()]) # search, get_domain_info, list_sources, ... finally: await toolset.close() asyncio.run(main()) ``` ```ts TypeScript import { MCPToolset } from '@google/adk'; const toolset = new MCPToolset({ type: 'StreamableHTTPConnectionParams', url: 'https://mcp.millionshort.com/mcp', transportOptions: { requestInit: { headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}` } } }, }); try { console.log((await toolset.getTools()).map((tool) => tool.name)); // search, get_domain_info, list_sources, ... } finally { await toolset.close(); } ``` ## Without MCP: a function tool In Python, a plain function in `tools` becomes a function tool, described by its docstring; ADK wraps a return value that is not a dictionary as `{"result": ...}`. In TypeScript, a `FunctionTool` takes a zod schema. ```python Python import json import os import urllib.request from google.adk.agents import LlmAgent def millionshort_search(query: str, remove_top_sites: int = 1000, num_results: int = 5) -> dict: """Search the web with MillionShort. remove_top_sites leaves out the N most popular sites.""" request = urllib.request.Request( "https://api.millionshort.com/v1/search", data=json.dumps({"query": query, "remove_top_sites": remove_top_sites, "num_results": num_results}).encode(), headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"], "Content-Type": "application/json"}, ) with urllib.request.urlopen(request, timeout=30) as response: results = json.load(response)["data"]["results"] return {"results": [{"title": r["title"], "url": r["url"], "snippet": r.get("snippet")} for r in results]} root_agent = LlmAgent( model="gemini-flash-latest", name="researcher", instruction="Use millionshort_search for anything recent or niche, and cite the URLs.", tools=[millionshort_search], ) ``` ```ts TypeScript import { FunctionTool, LlmAgent } from '@google/adk'; import { z } from 'zod'; const millionshortSearch = new FunctionTool({ name: 'millionshort_search', description: 'Search the web with MillionShort. remove_top_sites leaves out the N most popular sites.', parameters: z.object({ query: z.string(), remove_top_sites: z.number().int().default(1000) }), execute: async ({ query, remove_top_sites }) => { const res = await fetch('https://api.millionshort.com/v1/search', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json' }, body: JSON.stringify({ query, remove_top_sites, num_results: 5 }), }); if (!res.ok) return { status: 'error', message: `search failed: ${res.status}` }; const { data } = (await res.json()) as { data: { results: { title: string; url: string; snippet?: string }[] } }; return { status: 'success', results: data.results.map(({ title, url, snippet }) => ({ title, url, snippet })) }; }, }); export const rootAgent = new LlmAgent({ model: 'gemini-flash-latest', name: 'researcher', instruction: 'Use millionshort_search for anything recent or niche, and cite the URLs.', tools: [millionshortSearch], }); ``` ## MCP configuration The same address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. In ADK that is `StreamableHTTPConnectionParams`, not the SSE parameters. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Settings | Variable | Meaning | |---|---| | `MILLIONSHORT_API_KEY` | Your key, read by the examples above. Leave the header out for the no-key mode | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | | The connection times out | The Python toolset's connection timeout is 5 seconds by default | Pass a larger `timeout` to `StreamableHTTPConnectionParams`; in TypeScript, `timeout` goes in the `MCPToolset` options | | `adk run` does not find the agent | It was started from the wrong folder | Run it from the folder that holds the agent folder (Python) or the project folder (TypeScript) | ## Related - [Agent tool use](https://millionshort.com/docs/search/guides/agent-tool-use): when to give a model tools, and what to tell it. - [Gemini](https://millionshort.com/docs/integrations/gemini): a search function for the Gemini API, with no framework. - [OpenAI Agents SDK](https://millionshort.com/docs/integrations/openai-agents) and [Claude Agent SDK](https://millionshort.com/docs/integrations/claude-agent-sdk). - [MCP server](https://millionshort.com/docs/mcp) and [Filters for agents](https://millionshort.com/docs/search/filters). - ADK's own documentation, read on 2026-11-19: [MCP tools](https://adk.dev/tools-custom/mcp-tools/), [Function tools](https://adk.dev/tools-custom/function-tools/), [Python quickstart](https://adk.dev/get-started/python/), [TypeScript quickstart](https://adk.dev/get-started/typescript/). --- Source: https://millionshort.com/docs/integrations/goose Section: Build with # Goose MillionShort search in Goose, through the hosted MCP server. MCP · Hosted MCP server, nothing to install · Key in a header · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. ## 1. Add the server Add a streamable HTTP extension to `~/.config/goose/config.yaml`. Note the key is `uri`, not `url`: ```yaml With a key extensions: millionshort: type: streamable_http name: millionshort uri: https://mcp.millionshort.com/mcp enabled: true headers: Authorization: Bearer ms-YOUR_API_KEY timeout: 300 ``` ```yaml Without a key extensions: millionshort: type: streamable_http name: millionshort uri: https://mcp.millionshort.com/mcp enabled: true timeout: 300 ``` Or run `goose configure`, **Add Extension**, **Remote Extension (Streamable HTTP)**, and follow the prompts. In Goose Desktop: **Extensions**, **Add custom extension**, type Streamable HTTP. To try it in one session without saving anything, with no key: ```bash goose session --with-streamable-http-extension "https://mcp.millionshort.com/mcp" ``` ## 2. Try it Ask Goose: > Search MillionShort for forum threads about restoring a cast iron skillet, with the 1,000 most popular sites removed. List the five most useful with their links. A good answer comes from a `search` call (the client shows the tool call) and links to pages you may not have seen before. ## 3. Tell it when to search Goose has no setting we could find that turns its own web search off, so say which search to use. Add this line to `AGENTS.md` or `.goosehints`: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## 4. Check it works In Goose Desktop, **Extensions** shows `millionshort` switched on. In the CLI, start `goose session` and ask it which tools it has. With a key you should see `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them); with no key, fewer, `search` and `list_sources` among them. ## The server One address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. A key is optional. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | ## Related - [MCP server](https://millionshort.com/docs/mcp): the address, every tool, and what the no-key mode allows. - [Filters for agents](https://millionshort.com/docs/search/filters): what to ask `search` for, with recipes. - More coding agents: [Claude Code](https://millionshort.com/docs/integrations/claude-code), [Cursor](https://millionshort.com/docs/integrations/cursor), [Codex](https://millionshort.com/docs/integrations/codex), [GitHub Copilot in VS Code](https://millionshort.com/docs/integrations/vscode), and [every integration](https://millionshort.com/docs/integrations). - Goose's own documentation, read on 2026-11-19: [Using extensions](https://goose-docs.ai/docs/getting-started/using-extensions), [Configuration files](https://goose-docs.ai/docs/guides/config-files), [Goose hints](https://goose-docs.ai/docs/guides/context-engineering/using-goosehints). --- Source: https://millionshort.com/docs/integrations/gpt-researcher Section: Build with # GPT Researcher MillionShort search in GPT Researcher, through the hosted MCP server. MCP · Hosted MCP server, nothing to install · Key read from the environment · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. ## 1. Add the server as a retriever GPT Researcher reads MCP servers as a retriever. Set `RETRIEVER` to `mcp` (or add `mcp` to a comma-separated list of retrievers) and pass the server in `mcp_configs`. Send the key in `connection_headers`: GPT Researcher does not turn `connection_token` into an `Authorization` header. ```bash pip install gpt-researcher ``` Then, in Python: ```python import asyncio import os from gpt_researcher import GPTResearcher os.environ["RETRIEVER"] = "mcp" async def main(): researcher = GPTResearcher( query="How do community repair cafes keep volunteers coming back?", mcp_configs=[{ "name": "millionshort", "connection_url": "https://mcp.millionshort.com/mcp", "connection_headers": {"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, }], ) await researcher.conduct_research() print(await researcher.write_report()) asyncio.run(main()) ``` Without a key, leave `connection_headers` out. The model that plans the research and writes the report is the one GPT Researcher is set up with, from its own settings. ## 2. Try it Ask GPT Researcher: > Search MillionShort for forum threads about restoring a cast iron skillet, with the 1,000 most popular sites removed. List the five most useful with their links. A good answer comes from a `search` call (the client shows the tool call) and links to pages you may not have seen before. ## 3. Use only this search `RETRIEVER=mcp` alone makes the server the only source. Any other retriever left in the list keeps searching too. To steer the queries it writes, add this to the research query or to the model's instructions: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## 4. Check it works Run one query and read the log: it says it found one MCP server configuration, then which of the tools it chose. With none it says so. With a key you should see `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them); with no key, fewer, `search` and `list_sources` among them. ## The server One address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. A key is optional. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | ## Related - [MCP server](https://millionshort.com/docs/mcp): the address, every tool, and what the no-key mode allows. - [Filters for agents](https://millionshort.com/docs/search/filters): what to ask `search` for, with recipes. - More research & rag: [Hermes Agent](https://millionshort.com/docs/integrations/hermes-agent), [OpenClaw](https://millionshort.com/docs/integrations/openclaw), [Onyx](https://millionshort.com/docs/integrations/onyx), [nanobot](https://millionshort.com/docs/integrations/nanobot), and [every integration](https://millionshort.com/docs/integrations). - GPT Researcher's own documentation, read on 2026-11-19: [MCP configuration](https://github.com/assafelovic/gpt-researcher/blob/main/docs/docs/gpt-researcher/retrievers/mcp-configs.mdx), [MCP client](https://github.com/assafelovic/gpt-researcher/blob/main/gpt_researcher/mcp/client.py). --- Source: https://millionshort.com/docs/integrations/grok-build Section: Build with # Grok Build MillionShort search in Grok Build, through the hosted MCP server. MCP · Hosted MCP server, nothing to install · Key read from the environment · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. ## 1. Add the server One command (it writes `~/.grok/config.toml`; add `--scope project` for this project). Single quotes keep `${...}` for Grok Build to fill in from the environment each time: ```bash With a key grok mcp add --transport http millionshort https://mcp.millionshort.com/mcp \ --header 'Authorization: Bearer ${MILLIONSHORT_API_KEY}' ``` ```bash Without a key grok mcp add --transport http millionshort https://mcp.millionshort.com/mcp ``` ```toml ~/.grok/config.toml [mcp_servers.millionshort] url = "https://mcp.millionshort.com/mcp" headers = { "Authorization" = "Bearer ${MILLIONSHORT_API_KEY}" } ``` ## 2. Try it Ask Grok Build: > Search MillionShort for forum threads about restoring a cast iron skillet, with the 1,000 most popular sites removed. List the five most useful with their links. A good answer comes from a `search` call (the client shows the tool call) and links to pages you may not have seen before. ## 3. Turn off the built-in search Deny Grok Build's own web search when you start it: ```bash grok --deny WebSearch ``` Add this line to `AGENTS.md`: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## 4. Check it works Run `grok mcp doctor millionshort`: it checks the settings and the connection. In the TUI, `/mcps`. The tools are named `millionshort__search` and so on. With a key you should see `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them); with no key, fewer, `search` and `list_sources` among them. ## The server One address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. A key is optional. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | ## Related - [MCP server](https://millionshort.com/docs/mcp): the address, every tool, and what the no-key mode allows. - [Filters for agents](https://millionshort.com/docs/search/filters): what to ask `search` for, with recipes. - More coding agents: [Claude Code](https://millionshort.com/docs/integrations/claude-code), [Cursor](https://millionshort.com/docs/integrations/cursor), [Codex](https://millionshort.com/docs/integrations/codex), [GitHub Copilot in VS Code](https://millionshort.com/docs/integrations/vscode), and [every integration](https://millionshort.com/docs/integrations). - Grok Build's own documentation, read on 2026-11-19: [MCP servers](https://docs.x.ai/build/features/mcp-servers), [Permissions](https://docs.x.ai/build/features/permissions), [Project rules](https://docs.x.ai/build/features/project-rules). --- Source: https://millionshort.com/docs/integrations/groq Section: Build with # Groq MillionShort search for models on Groq, as a remote MCP tool in its Responses API or a function tool, in Python and TypeScript. MCP · Python and TypeScript · Nothing of ours to install · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. Groq's Responses API is compatible with OpenAI's, remote MCP included: point the OpenAI SDK at Groq, list the MillionShort server as an `mcp` tool, and Groq lists and calls the server's tools for the model ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them). Groq runs remote MCP on its models that support tool use. For a loop you run yourself, the Groq SDK takes a function tool. ## 1. Install ```bash Python pip install openai groq requests export MILLIONSHORT_API_KEY=ms-YOUR_API_KEY ``` ```bash TypeScript npm install openai groq-sdk export MILLIONSHORT_API_KEY=ms-YOUR_API_KEY ``` Both SDKs here read your Groq key from GROQ_API_KEY. Get a MillionShort key in the [dashboard](https://millionshort.com/app/); an agent can ask for a [trial key](https://millionshort.com/docs/api-reference/agent-key) by itself. The `groq` packages and `requests` are only for the function tool further down. ## 2. Connect the server The key goes in the tool's `headers`, which Groq redacts from its logs. Without a key, leave `headers` out. ```python Python import os from openai import OpenAI client = OpenAI(api_key=os.environ["GROQ_API_KEY"], base_url="https://api.groq.com/openai/v1") response = client.responses.create( model="openai/gpt-oss-120b", input="Find independent blogs about home espresso, without the 1,000 most popular sites.", tools=[ { "type": "mcp", "server_label": "millionshort", "server_description": "Web search that can leave out the most popular sites.", "server_url": "https://mcp.millionshort.com/mcp", "headers": {"Authorization": f"Bearer {os.environ['MILLIONSHORT_API_KEY']}"}, "require_approval": "never", } ], ) print(response.output_text) ``` ```ts TypeScript import OpenAI from 'openai'; const client = new OpenAI({ apiKey: process.env.GROQ_API_KEY, baseURL: 'https://api.groq.com/openai/v1' }); const response = await client.responses.create({ model: 'openai/gpt-oss-120b', input: 'Find independent blogs about home espresso, without the 1,000 most popular sites.', tools: [ { type: 'mcp', server_label: 'millionshort', server_description: 'Web search that can leave out the most popular sites.', server_url: 'https://mcp.millionshort.com/mcp', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}` }, require_approval: 'never', }, ], }); console.log(response.output_text); ``` Groq makes the calls from its own servers, so our server must be reachable from the internet, which it is. `require_approval` is `never`, so the model calls the tools without asking. Most of them only read; `crawl` spends credits, `crawl_cancel` stops a crawl and `create_space` saves a Space, so give the model a key with a [monthly cap](https://millionshort.com/docs/dashboard#monthly-cap-per-key). ## 3. Tell it when to search Groq's browser search is a built-in tool (`browser_search`) that runs only when you list it in `tools`, so leave it out. Then put a line like this in the request's `instructions`: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. To offer only some of the tools, add `"allowed_tools": ["search", "list_sources"]` to the `mcp` tool. ## 4. Check it works The response's `output` holds an `mcp_list_tools` item with the server's tools, the model's reasoning, one `mcp_call` item per call (with its output), and the final message: ```python Python import os from openai import OpenAI client = OpenAI(api_key=os.environ["GROQ_API_KEY"], base_url="https://api.groq.com/openai/v1") server = {"type": "mcp", "server_label": "millionshort", "server_url": "https://mcp.millionshort.com/mcp", "require_approval": "never", "headers": {"Authorization": f"Bearer {os.environ['MILLIONSHORT_API_KEY']}"}} response = client.responses.create(model="openai/gpt-oss-120b", input="Search for home espresso blogs.", tools=[server]) for item in response.output: if item.type == "mcp_list_tools": print([tool.name for tool in item.tools]) # search, get_domain_info, list_sources, ... elif item.type == "mcp_call": print(item.name, item.arguments) ``` ```ts TypeScript import OpenAI from 'openai'; const client = new OpenAI({ apiKey: process.env.GROQ_API_KEY, baseURL: 'https://api.groq.com/openai/v1' }); const response = await client.responses.create({ model: 'openai/gpt-oss-120b', input: 'Search for home espresso blogs.', tools: [{ type: 'mcp', server_label: 'millionshort', server_url: 'https://mcp.millionshort.com/mcp', require_approval: 'never', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}` } }], }); for (const item of response.output) { if (item.type === 'mcp_list_tools') console.log(item.tools.map((tool) => tool.name)); else if (item.type === 'mcp_call') console.log(item.name, item.arguments); } ``` With no key you see two tools, `search` and `list_sources`. To try it, ask: > Search MillionShort for forum threads about restoring a cast iron skillet, with the 1,000 most popular sites removed. List the five most useful with their links. ## Without MCP: a function tool Groq calls this local tool calling: your code runs the search, and the loop goes on until the model stops asking for it. ```python Python import json import os import requests from groq import Groq def millionshort_search(query: str) -> str: r = requests.post( "https://api.millionshort.com/v1/search", headers={"Authorization": f"Bearer {os.environ['MILLIONSHORT_API_KEY']}"}, json={"query": query, "remove_top_sites": 1000, "num_results": 5}, timeout=30, ) r.raise_for_status() return json.dumps([{"title": x["title"], "url": x["url"], "snippet": x.get("snippet")} for x in r.json()["data"]["results"]]) tools = [{"type": "function", "function": { "name": "millionshort_search", "description": "Search the web with MillionShort, leaving out the 1,000 most popular sites.", "parameters": {"type": "object", "properties": {"query": {"type": "string"}}, "required": ["query"]}, }}] client = Groq() messages = [{"role": "user", "content": "Find independent blogs about home espresso."}] while True: message = client.chat.completions.create(model="openai/gpt-oss-120b", messages=messages, tools=tools).choices[0].message messages.append(message) if not message.tool_calls: break for call in message.tool_calls: result = millionshort_search(**json.loads(call.function.arguments)) messages.append({"role": "tool", "tool_call_id": call.id, "name": call.function.name, "content": result}) print(message.content) ``` ```ts TypeScript import Groq from 'groq-sdk'; async function millionshortSearch(query: string): Promise { const res = await fetch('https://api.millionshort.com/v1/search', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json' }, body: JSON.stringify({ query, remove_top_sites: 1000, num_results: 5 }), }); if (!res.ok) throw new Error(`search failed: ${res.status}`); const { data } = (await res.json()) as { data: { results: { title: string; url: string; snippet?: string }[] } }; return JSON.stringify(data.results.map(({ title, url, snippet }) => ({ title, url, snippet }))); } const tools: Groq.Chat.ChatCompletionTool[] = [{ type: 'function', function: { name: 'millionshort_search', description: 'Search the web with MillionShort, leaving out the 1,000 most popular sites.', parameters: { type: 'object', properties: { query: { type: 'string' } }, required: ['query'] }, } }]; const client = new Groq(); const messages: Groq.Chat.ChatCompletionMessageParam[] = [{ role: 'user', content: 'Find independent blogs about home espresso.' }]; while (true) { const message = (await client.chat.completions.create({ model: 'openai/gpt-oss-120b', messages, tools })).choices[0].message; messages.push(message); if (!message.tool_calls?.length) { console.log(message.content); break; } for (const call of message.tool_calls) { const content = await millionshortSearch(JSON.parse(call.function.arguments).query); messages.push({ role: 'tool', tool_call_id: call.id, content }); } } ``` ## MCP configuration The same address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Settings | Variable | Meaning | |---|---| | `MILLIONSHORT_API_KEY` | Your key, read by the examples above. Leave the header out for the no-key mode | | GROQ_API_KEY | Your Groq key | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | | The model never calls a tool | Remote MCP runs only on Groq models that support tool use | Use a Groq model that does, such as `openai/gpt-oss-120b` | | The MCP tool fails, the function tool works | Groq's servers could not reach ours | Try again, or use the function tool | ## Related - [Agent tool use](https://millionshort.com/docs/search/guides/agent-tool-use): when to give a model tools, and what to tell it. - Other model APIs: [OpenAI](https://millionshort.com/docs/integrations/openai) (the same `mcp` tool), [xAI](https://millionshort.com/docs/integrations/xai), [Anthropic](https://millionshort.com/docs/integrations/anthropic), [OpenRouter](https://millionshort.com/docs/integrations/openrouter). - [MCP server](https://millionshort.com/docs/mcp) and [Filters for agents](https://millionshort.com/docs/search/filters). - Groq's own documentation, read on 2026-11-19: [Remote Tools and MCP](https://console.groq.com/docs/tool-use/remote-mcp), [Local Tool Calling](https://console.groq.com/docs/tool-use/local-tool-calling), [Browser Search](https://console.groq.com/docs/tool-use/built-in-tools/browser-search). --- Source: https://millionshort.com/docs/integrations/gumloop Section: Build with # Gumloop MillionShort search as a step in Gumloop, through the hosted MCP server or the API. MCP · Hosted MCP server, nothing to install · Key in a form field · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. ## 1. Add the MCP server 1. **Customize**, **Connectors**, **+** (**Add Custom MCP**). 2. MCP server URL `https://mcp.millionshort.com/mcp`, **Connect**. 3. For your key, **Authentication**, **API Key / Credentials**, and paste it (Gumloop sends it as `Authorization: Bearer`). For the no-key mode, skip this. 4. In your agent, **Connectors**, **+ Add**, pick the server, **Save**. ## 2. Try it Ask Gumloop's agent, or run the step with this as the query: > Search MillionShort for forum threads about restoring a cast iron skillet, with the 1,000 most popular sites removed. List the five most useful with their links. A good answer comes from a `search` call (the client shows the tool call) and links to pages you may not have seen before. ## 3. Tell it when to search Gumloop has no setting we could find that turns its own web search off, so say which search to use. Add this line to the agent's instructions: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## 4. Check it works After **Connect**, Gumloop shows the server's tools. With a key you should see `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them); with no key, fewer, `search` and `list_sources` among them. ## The server One address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. A key is optional. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | ## Related - [MCP server](https://millionshort.com/docs/mcp): the address, every tool, and what the no-key mode allows. - [Filters for agents](https://millionshort.com/docs/search/filters): what to ask `search` for, with recipes. - More low-code builders: [n8n](https://millionshort.com/docs/integrations/n8n), [Zapier](https://millionshort.com/docs/integrations/zapier), [Make](https://millionshort.com/docs/integrations/make), [Dify](https://millionshort.com/docs/integrations/dify), and [every integration](https://millionshort.com/docs/integrations). - Gumloop's own documentation, read on 2026-11-19: [Custom MCP servers](https://docs.gumloop.com/nodes/mcp/custom_mcp_servers). --- Source: https://millionshort.com/docs/integrations/haystack Section: Build with # Haystack MillionShort search for Haystack agents and pipelines, through the MCP integration or a tool of your own. MCP · Python · Nothing of ours to install · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. Haystack's MCP integration (`mcp-haystack`) loads the MillionShort MCP server's tools into one `MCPToolset`, which an `Agent` or a chat generator takes like any other toolset: `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints, such as `extract`, `places`, `map` and `crawl` ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them all). With no MCP at all, a `@tool` function that calls the API does the same job. ## 1. Install ```bash Python pip install mcp-haystack haystack-ai export MILLIONSHORT_API_KEY=ms-YOUR_API_KEY ``` The examples use `OpenAIChatGenerator`, which reads your OpenAI key from OPENAI_API_KEY; any Haystack chat generator works the same way. Get a MillionShort key in the [dashboard](https://millionshort.com/app/); an agent can ask for a [trial key](https://millionshort.com/docs/api-reference/agent-key) by itself. ## 2. Connect the server `StreamableHttpServerInfo` holds the address. Its `token` is sent as `Authorization: Bearer `, and `Secret.from_env_var` reads it from the environment when the connection opens, so the key never sits in your code or in a serialised pipeline. ```python Python from haystack.utils import Secret from haystack_integrations.tools.mcp import MCPToolset, StreamableHttpServerInfo millionshort = MCPToolset( server_info=StreamableHttpServerInfo( url="https://mcp.millionshort.com/mcp", token=Secret.from_env_var("MILLIONSHORT_API_KEY"), ), ) ``` Without a key, leave `token` out: the toolset then has `search` and `list_sources`. ## 3. Give the tools to an agent Pass the toolset as the agent's `tools`. The agent warms it up (connects and lists the tools) before it runs. ```python Python from haystack.components.agents import Agent from haystack.components.generators.chat import OpenAIChatGenerator from haystack.dataclasses import ChatMessage from haystack.utils import Secret from haystack_integrations.tools.mcp import MCPToolset, StreamableHttpServerInfo millionshort = MCPToolset( server_info=StreamableHttpServerInfo(url="https://mcp.millionshort.com/mcp", token=Secret.from_env_var("MILLIONSHORT_API_KEY")), ) agent = Agent( chat_generator=OpenAIChatGenerator(), tools=millionshort, system_prompt="Use the millionshort search tool for anything recent or niche, and cite the URLs.", ) response = agent.run(messages=[ChatMessage.from_user("Find independent blogs about home espresso, without the 1,000 most popular sites.")]) print(response["last_message"].text) ``` To give the agent fewer tools, name them: `MCPToolset(server_info=..., tool_names=["search"])`. Haystack agents have no web search of their own, so there is nothing to turn off. ## 4. Check it works Run the example: the answer should cite pages, and `response["messages"]` holds the call to `search`. To see the tools without a model, warm the toolset up yourself and list it: ```python Python from haystack.tools import warm_up_tools from haystack.utils import Secret from haystack_integrations.tools.mcp import MCPToolset, StreamableHttpServerInfo millionshort = MCPToolset( server_info=StreamableHttpServerInfo(url="https://mcp.millionshort.com/mcp", token=Secret.from_env_var("MILLIONSHORT_API_KEY")), ) warm_up_tools(millionshort) print([tool.name for tool in millionshort]) # search, get_domain_info, list_sources, ... millionshort.close() ``` If the model answers from memory, say when to search in its system prompt: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## Without MCP: a function tool The `@tool` decorator turns a function into a Haystack `Tool`, with its parameters and docstring as the description the model reads: ```python Python import json import os import urllib.request from haystack.components.agents import Agent from haystack.components.generators.chat import OpenAIChatGenerator from haystack.dataclasses import ChatMessage from haystack.tools import tool @tool def millionshort_search(query: str, remove_top_sites: int = 1000, num_results: int = 5) -> str: """Search the web with MillionShort. remove_top_sites leaves out the N most popular sites.""" request = urllib.request.Request( "https://api.millionshort.com/v1/search", data=json.dumps({"query": query, "remove_top_sites": remove_top_sites, "num_results": num_results}).encode(), headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"], "Content-Type": "application/json"}, ) with urllib.request.urlopen(request, timeout=30) as response: results = json.load(response)["data"]["results"] return json.dumps([{"title": r["title"], "url": r["url"], "snippet": r.get("snippet")} for r in results]) agent = Agent(chat_generator=OpenAIChatGenerator(), tools=[millionshort_search]) print(agent.run(messages=[ChatMessage.from_user("Find independent blogs about home espresso.")])["last_message"].text) ``` ## MCP configuration The same address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Settings | Variable | Meaning | |---|---| | `MILLIONSHORT_API_KEY` | Your key, read by `Secret.from_env_var` and by the function tool. Leave `token` out for the no-key mode | `StreamableHttpServerInfo` also takes `timeout` (seconds, 30 by default). `MCPToolset` takes `connection_timeout` and `invocation_timeout` (30 seconds each by default). ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | | "None of the following authentication environment variables are set" | `Secret.from_env_var` is strict: it fails when MILLIONSHORT_API_KEY is missing | Export the key, or leave `token` out for the no-key mode | | A chat generator, outside an agent, sees no MillionShort tools | Only the `Agent` warms the toolset up by itself | Call `warm_up_tools(toolset)` from `haystack.tools` first | ## Related - [Agent tool use](https://millionshort.com/docs/search/guides/agent-tool-use): when to give a model tools, and what to tell it. - [OpenAI Agents SDK](https://millionshort.com/docs/integrations/openai-agents) and [Semantic Kernel](https://millionshort.com/docs/integrations/semantic-kernel): the same server in other agent frameworks. - [MCP server](https://millionshort.com/docs/mcp) and [Filters for agents](https://millionshort.com/docs/search/filters). - Haystack's own documentation, read on 2026-11-19: [MCPToolset](https://docs.haystack.deepset.ai/docs/mcptoolset), [MCP integration](https://haystack.deepset.ai/integrations/mcp). --- Source: https://millionshort.com/docs/integrations/hermes-agent Section: Build with # Hermes Agent MillionShort search in Hermes Agent, through the hosted MCP server. MCP · Hosted MCP server, nothing to install · Key read from the environment · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. ## 1. Add the server Put the key in `~/.hermes/.env` and the server in `~/.hermes/config.yaml`. Hermes fills in `${MILLIONSHORT_API_KEY}` from that file or the environment, and refuses to connect when it is not set: ```bash ~/.hermes/.env MILLIONSHORT_API_KEY=ms-YOUR_API_KEY ``` ```yaml With a key mcp_servers: millionshort: url: "https://mcp.millionshort.com/mcp" headers: Authorization: "Bearer ${MILLIONSHORT_API_KEY}" ``` ```yaml Without a key mcp_servers: millionshort: url: "https://mcp.millionshort.com/mcp" ``` Streamable HTTP is Hermes's default for a URL. In a running session, `/reload-mcp` picks up the change. ## 2. Try it Ask Hermes Agent: > Search MillionShort for forum threads about restoring a cast iron skillet, with the 1,000 most popular sites removed. List the five most useful with their links. A good answer comes from a `search` call (the client shows the tool call) and links to pages you may not have seen before. ## 3. Turn off the built-in search Hermes's own `web_search` and `web_extract` are its `web` toolset. Turn the toolset off with `hermes tools`, or leave `web` out of `hermes chat --toolsets ...`. Add this line to the agent's instructions: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## 4. Check it works Run `hermes mcp test millionshort`: it connects and lists the tools, which Hermes names `mcp_millionshort_search` and so on. `hermes mcp list` shows every server. With a key you should see `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them); with no key, fewer, `search` and `list_sources` among them. ## The server One address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. A key is optional. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | ## Related - [MCP server](https://millionshort.com/docs/mcp): the address, every tool, and what the no-key mode allows. - [Filters for agents](https://millionshort.com/docs/search/filters): what to ask `search` for, with recipes. - More research & rag: [GPT Researcher](https://millionshort.com/docs/integrations/gpt-researcher), [OpenClaw](https://millionshort.com/docs/integrations/openclaw), [Onyx](https://millionshort.com/docs/integrations/onyx), [nanobot](https://millionshort.com/docs/integrations/nanobot), and [every integration](https://millionshort.com/docs/integrations). - Hermes Agent's own documentation, read on 2026-11-19: [MCP](https://github.com/NousResearch/hermes-agent/blob/main/website/docs/user-guide/features/mcp.md), [MCP configuration reference](https://github.com/NousResearch/hermes-agent/blob/main/website/docs/reference/mcp-config-reference.md), [Web search](https://github.com/NousResearch/hermes-agent/blob/main/website/docs/user-guide/features/web-search.md). --- Source: https://millionshort.com/docs/integrations/jetbrains Section: Build with # JetBrains Junie and AI Assistant MillionShort search in JetBrains Junie and AI Assistant, through the hosted MCP server. MCP · Hosted MCP server, nothing to install · Key in a header · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. ## 1. Add the server **Junie** (in the IDE and the CLI): add the server to `~/.junie/mcp/mcp.json` (every project), or `.junie/mcp/mcp.json` in a project. In the IDE, open Junie's MCP settings page and use the edit button to open the file. ```json With a key { "mcpServers": { "millionshort": { "url": "https://mcp.millionshort.com/mcp", "headers": { "Authorization": "Bearer ms-YOUR_API_KEY" } } } } ``` ```json Without a key { "mcpServers": { "millionshort": { "url": "https://mcp.millionshort.com/mcp" } } } ``` **AI Assistant**: open **Settings**, **Tools**, **AI Assistant**, **Model Context Protocol (MCP)**, click **Add**, paste the no-key JSON above, choose the level (global or this project), then **OK** and **Apply**. JetBrains documents a URL there but not a header, so AI Assistant gets the no-key mode; for your key, use Junie. ## 2. Try it Ask JetBrains Junie and AI Assistant: > Search MillionShort for forum threads about restoring a cast iron skillet, with the 1,000 most popular sites removed. List the five most useful with their links. A good answer comes from a `search` call (the client shows the tool call) and links to pages you may not have seen before. ## 3. Tell it when to search JetBrains Junie and AI Assistant has no setting we could find that turns its own web search off, so say which search to use. For Junie, add this line to `AGENTS.md` at the project root: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## 4. Check it works AI Assistant: the MCP settings table shows the server's status, and its tools icon lists the tools. Junie CLI: `/mcp` lists the server as Active. With a key you should see `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them); with no key, fewer, `search` and `list_sources` among them. ## Good to know - Keep a project-level `mcp.json` with a key out of version control; the user-level file is the place for it. ## The server One address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. A key is optional. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | ## Related - [MCP server](https://millionshort.com/docs/mcp): the address, every tool, and what the no-key mode allows. - [Filters for agents](https://millionshort.com/docs/search/filters): what to ask `search` for, with recipes. - More coding agents: [Claude Code](https://millionshort.com/docs/integrations/claude-code), [Cursor](https://millionshort.com/docs/integrations/cursor), [Codex](https://millionshort.com/docs/integrations/codex), [GitHub Copilot in VS Code](https://millionshort.com/docs/integrations/vscode), and [every integration](https://millionshort.com/docs/integrations). - JetBrains Junie and AI Assistant's own documentation, read on 2026-11-19: [Junie MCP configuration](https://junie.jetbrains.com/docs/junie-cli-mcp-configuration.html), [Junie MCP settings in the IDE](https://junie.jetbrains.com/docs/junie-plugin-mcp-settings.html), [AI Assistant and MCP](https://www.jetbrains.com/help/ai-assistant/mcp.html). --- Source: https://millionshort.com/docs/integrations/kilo-code Section: Build with # Kilo Code MillionShort search in Kilo Code, through the hosted MCP server. MCP · Hosted MCP server, nothing to install · Key in a header · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. ## 1. Add the server Add the server under `mcp` in `~/.config/kilo/kilo.jsonc` (every project; the VS Code and JetBrains extensions and the `kilo` CLI read the same file). In this file Kilo fills in `{env:...}` from the environment: ```json With a key { "mcp": { "millionshort": { "type": "remote", "url": "https://mcp.millionshort.com/mcp", "headers": { "Authorization": "Bearer {env:MILLIONSHORT_API_KEY}" }, "enabled": true } } } ``` ```json Without a key { "mcp": { "millionshort": { "type": "remote", "url": "https://mcp.millionshort.com/mcp", "enabled": true } } } ``` In VS Code you can also use **Settings**, **Agent Behaviour**, **MCP Servers**, **Add Server**, **Remote (HTTP)**, and enter the URL and the header. `{env:...}` is filled in only in that global file. In a project's `kilo.jsonc` it is not, so write the key there, or keep the server global. ## 2. Try it Ask Kilo Code: > Search MillionShort for forum threads about restoring a cast iron skillet, with the 1,000 most popular sites removed. List the five most useful with their links. A good answer comes from a `search` call (the client shows the tool call) and links to pages you may not have seen before. ## 3. Tell it when to search Kilo Code has no setting we could find that turns its own web search off, so say which search to use. Add this line to `AGENTS.md`: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## 4. Check it works **Settings**, **Agent Behaviour**, **MCP Servers** shows its state and tools. In the CLI, `/mcps`. With a key you should see `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them); with no key, fewer, `search` and `list_sources` among them. ## The server One address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. A key is optional. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | ## Related - [MCP server](https://millionshort.com/docs/mcp): the address, every tool, and what the no-key mode allows. - [Filters for agents](https://millionshort.com/docs/search/filters): what to ask `search` for, with recipes. - More coding agents: [Claude Code](https://millionshort.com/docs/integrations/claude-code), [Cursor](https://millionshort.com/docs/integrations/cursor), [Codex](https://millionshort.com/docs/integrations/codex), [GitHub Copilot in VS Code](https://millionshort.com/docs/integrations/vscode), and [every integration](https://millionshort.com/docs/integrations). - Kilo Code's own documentation, read on 2026-11-19: [MCP in Kilo Code](https://kilo.ai/docs/automate/mcp/using-in-kilo-code), [Kilo CLI](https://kilo.ai/docs/code-with-ai/platforms/cli). --- Source: https://millionshort.com/docs/integrations/kimi-code Section: Build with # Kimi Code MillionShort search in Kimi Code, through the hosted MCP server. MCP · Hosted MCP server, nothing to install · Key in a header · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. ## 1. Add the server One command (it writes `~/.kimi/mcp.json`): ```bash With a key kimi mcp add --transport http millionshort https://mcp.millionshort.com/mcp \ --header "Authorization: Bearer ms-YOUR_API_KEY" ``` ```bash Without a key kimi mcp add --transport http millionshort https://mcp.millionshort.com/mcp ``` ## 2. Try it Ask Kimi Code: > Search MillionShort for forum threads about restoring a cast iron skillet, with the 1,000 most popular sites removed. List the five most useful with their links. A good answer comes from a `search` call (the client shows the tool call) and links to pages you may not have seen before. ## 3. Turn off the built-in search Kimi Code has its own `SearchWeb` and `FetchURL` tools. Leave them out with an agent file that extends the default agent, and start with `kimi --agent-file ./agent.yaml`: ```yaml agent.yaml version: 1 agent: extend: default exclude_tools: - "kimi_cli.tools.web:SearchWeb" - "kimi_cli.tools.web:FetchURL" ``` Add this line to `AGENTS.md`: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## 4. Check it works Run `kimi mcp test millionshort`, or `/mcp` inside Kimi Code to see the server and its tools. With a key you should see `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them); with no key, fewer, `search` and `list_sources` among them. ## The server One address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. A key is optional. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | ## Related - [MCP server](https://millionshort.com/docs/mcp): the address, every tool, and what the no-key mode allows. - [Filters for agents](https://millionshort.com/docs/search/filters): what to ask `search` for, with recipes. - More coding agents: [Claude Code](https://millionshort.com/docs/integrations/claude-code), [Cursor](https://millionshort.com/docs/integrations/cursor), [Codex](https://millionshort.com/docs/integrations/codex), [GitHub Copilot in VS Code](https://millionshort.com/docs/integrations/vscode), and [every integration](https://millionshort.com/docs/integrations). - Kimi Code's own documentation, read on 2026-11-19: [MCP](https://moonshotai.github.io/kimi-cli/en/customization/mcp.html), [Agents](https://moonshotai.github.io/kimi-cli/en/customization/agents.html). --- Source: https://millionshort.com/docs/integrations/kiro Section: Build with # Kiro MillionShort search in Kiro, through the hosted MCP server. MCP · Hosted MCP server, nothing to install · Key read from the environment · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. ## 1. Add the server Add the server to `~/.kiro/settings/mcp.json` (every workspace) or `.kiro/settings/mcp.json` (this one). In the IDE, the command **Kiro: Open user MCP config (JSON)** opens the first; saving reconnects. The Kiro CLI reads the same files. ```json With a key { "mcpServers": { "millionshort": { "url": "https://mcp.millionshort.com/mcp", "headers": { "Authorization": "Bearer ${MILLIONSHORT_API_KEY}" } } } } ``` ```json Without a key { "mcpServers": { "millionshort": { "url": "https://mcp.millionshort.com/mcp" } } } ``` Kiro fills in `${MILLIONSHORT_API_KEY}` only once you approve that variable: it asks the first time, and lists approved ones under the setting **Mcp Approved Env Vars**. ## 2. Try it Ask Kiro: > Search MillionShort for forum threads about restoring a cast iron skillet, with the 1,000 most popular sites removed. List the five most useful with their links. A good answer comes from a `search` call (the client shows the tool call) and links to pages you may not have seen before. ## 3. Turn off the built-in search Kiro has its own `web_search` and `web_fetch` tools. Deny them with permission rules in your agent's configuration: ```yaml rules: - capability: web_search effect: deny - capability: web_fetch effect: deny ``` Add this line to a steering file in `.kiro/steering/`, or to `AGENTS.md`: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## 4. Check it works The MCP servers tab of the Kiro panel shows `millionshort` connected, with its tools. In the CLI, `/mcp`. With a key you should see `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them); with no key, fewer, `search` and `list_sources` among them. ## Good to know - The Amazon Q Developer CLI is now the Kiro CLI, so this page covers it. ## The server One address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. A key is optional. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | ## Related - [MCP server](https://millionshort.com/docs/mcp): the address, every tool, and what the no-key mode allows. - [Filters for agents](https://millionshort.com/docs/search/filters): what to ask `search` for, with recipes. - More coding agents: [Claude Code](https://millionshort.com/docs/integrations/claude-code), [Cursor](https://millionshort.com/docs/integrations/cursor), [Codex](https://millionshort.com/docs/integrations/codex), [GitHub Copilot in VS Code](https://millionshort.com/docs/integrations/vscode), and [every integration](https://millionshort.com/docs/integrations). - Kiro's own documentation, read on 2026-11-19: [MCP configuration](https://kiro.dev/docs/mcp/configuration/), [Web tools](https://kiro.dev/docs/tools/web), [Steering](https://kiro.dev/docs/steering/). --- Source: https://millionshort.com/docs/integrations/langflow Section: Build with # Langflow MillionShort search as a step in Langflow, through the hosted MCP server or the API. MCP · Hosted MCP server, nothing to install · Key in a form field · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. ## 1. Add the MCP server Register the server once: **Settings**, **MCP Servers**, **Add MCP Server**, **HTTP/SSE**: ```text With a key Name: millionshort URL: https://mcp.millionshort.com/mcp Headers: Authorization = Bearer ms-YOUR_API_KEY ``` ```text Without a key Name: millionshort URL: https://mcp.millionshort.com/mcp ``` Then, in a flow: 1. From the MCP sidebar, drag `millionshort` onto the canvas (an MCP Tools component). 2. Leave **Tool** empty to offer every tool of the server. 3. In the component's menu, turn on **Tool mode**, and connect its **Toolset** port to the Agent component's **Tools** port. A header value can be the name of a Langflow global variable, so the key is not in the flow. ## 2. Try it Ask Langflow's agent, or run the step with this as the query: > Search MillionShort for forum threads about restoring a cast iron skillet, with the 1,000 most popular sites removed. List the five most useful with their links. A good answer comes from a `search` call (the client shows the tool call) and links to pages you may not have seen before. ## 3. Tell it when to search Langflow has no setting we could find that turns its own web search off, so say which search to use. Add this line to the Agent component's instructions: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## 4. Check it works The server is a tile in the MCP sidebar, and the component's **Tool** field lists its tools. Then ask in the **Playground**. With a key you should see `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them); with no key, fewer, `search` and `list_sources` among them. ## The server One address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. A key is optional. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | ## Related - [MCP server](https://millionshort.com/docs/mcp): the address, every tool, and what the no-key mode allows. - [Filters for agents](https://millionshort.com/docs/search/filters): what to ask `search` for, with recipes. - More low-code builders: [n8n](https://millionshort.com/docs/integrations/n8n), [Zapier](https://millionshort.com/docs/integrations/zapier), [Make](https://millionshort.com/docs/integrations/make), [Dify](https://millionshort.com/docs/integrations/dify), and [every integration](https://millionshort.com/docs/integrations). - Langflow's own documentation, read on 2026-11-19: [MCP client](https://docs.langflow.org/mcp-client). --- Source: https://millionshort.com/docs/integrations/langroid Section: Build with # Langroid MillionShort search for Langroid agents, as MCP tools over streamable HTTP. MCP · Python · Nothing of ours to install · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. Langroid turns each tool of an MCP server into a `ToolMessage` class, which you enable on a `ChatAgent` like any other Langroid tool. It connects through a FastMCP transport; for the MillionShort MCP server that is `StreamableHttpTransport`, with the key in its headers. The agent gets the server's tools ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them). Without MCP, a `ToolMessage` of your own that calls the API does the same job. ## 1. Install ```bash Python pip install langroid export MILLIONSHORT_API_KEY=ms-YOUR_API_KEY ``` `fastmcp` comes with `langroid`. Langroid's default model is an OpenAI model, which reads your key from OPENAI_API_KEY; any model you configure through `OpenAIGPTConfig` that can call tools works. Get a MillionShort key in the [dashboard](https://millionshort.com/app/); an agent can ask for a [trial key](https://millionshort.com/docs/api-reference/agent-key) by itself. ## 2. Connect the server `get_tools_async` lists the server's tools and returns one `ToolMessage` class per tool. Pass it a function that makes a fresh transport, as Langroid recommends, or a transport itself. Without a key, leave `headers` out. ```python Python import os from fastmcp.client.transports import StreamableHttpTransport from langroid.agent.tools.mcp import get_tools_async def millionshort(): return StreamableHttpTransport( url="https://mcp.millionshort.com/mcp", headers={"Authorization": f"Bearer {os.environ['MILLIONSHORT_API_KEY']}"}, ) # inside an async function: # tools = await get_tools_async(millionshort) ``` Langroid's docs show this pattern with `SSETransport` and say other FastMCP transports work the same way; `StreamableHttpTransport` is FastMCP's streamable HTTP transport, and we checked the pair against our server with `langroid` 0.70 and `fastmcp` 4.2. ## 3. Give the tools to an agent Enable the tool classes on the agent and run a task. With `handle_llm_no_tool=NonToolAction.DONE`, the task ends when the model answers without calling a tool: ```python Python import asyncio import os import langroid as lr from fastmcp.client.transports import StreamableHttpTransport from langroid.agent.tools.mcp import get_tools_async from langroid.mytypes import NonToolAction def millionshort(): return StreamableHttpTransport( url="https://mcp.millionshort.com/mcp", headers={"Authorization": f"Bearer {os.environ['MILLIONSHORT_API_KEY']}"}, ) async def main(): tools = await get_tools_async(millionshort) agent = lr.ChatAgent( lr.ChatAgentConfig( name="Researcher", system_message="Use the millionshort search tool for anything recent or niche, and cite the URLs.", handle_llm_no_tool=NonToolAction.DONE, ) ) agent.enable_message(tools) task = lr.Task(agent, interactive=False) result = await task.run_async("Find independent blogs about home espresso, without the 1,000 most popular sites.") print(result.content if result else "") asyncio.run(main()) ``` With several MCP servers, `get_tools_async(millionshort, tool_name_prefix="ms")` names the tools `ms__search` and so on, so they cannot clash. To change what the model sees from one tool, decorate a class with `@mcp_tool(millionshort, "search")` and override `handle_async`, as Langroid's MCP page shows. ## 4. Check it works List the tools without a model: ```python Python import asyncio import os from fastmcp.client.transports import StreamableHttpTransport from langroid.agent.tools.mcp import get_tools_async async def main(): transport = StreamableHttpTransport( url="https://mcp.millionshort.com/mcp", headers={"Authorization": f"Bearer {os.environ['MILLIONSHORT_API_KEY']}"} ) tools = await get_tools_async(transport) print([tool.default_value("request") for tool in tools]) # search, get_domain_info, list_sources, ... asyncio.run(main()) ``` With no key you see `search` and `list_sources`. Then run step 3: the answer should cite pages. If the agent answers from memory, say when to search in its system message: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## Without MCP: a tool message A `ToolMessage` of your own: `request` is the tool's name, `purpose` tells the model when to use it, and `handle` runs it. This one calls `POST /v1/search`: ```python Python import json import os import urllib.request import langroid as lr class MillionShortSearch(lr.ToolMessage): request: str = "millionshort_search" purpose: str = "Search the web for , leaving out the most popular sites." query: str remove_top_sites: int = 1000 def handle(self) -> str: request = urllib.request.Request( "https://api.millionshort.com/v1/search", data=json.dumps({"query": self.query, "remove_top_sites": self.remove_top_sites, "num_results": 5}).encode(), headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"], "Content-Type": "application/json"}, ) with urllib.request.urlopen(request, timeout=30) as response: results = json.load(response)["data"]["results"] return json.dumps([{"title": r["title"], "url": r["url"], "snippet": r.get("snippet")} for r in results]) agent = lr.ChatAgent(lr.ChatAgentConfig(system_message="Search before you answer, and cite the URLs.")) agent.enable_message(MillionShortSearch) ``` ## MCP configuration The same address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Settings | Variable | Meaning | |---|---| | `MILLIONSHORT_API_KEY` | Your key, read by the examples above. Leave `headers` out for the no-key mode | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | | `enable_message` refuses a tool name that is taken | Another server's tool has the same name, such as `search` | Pass `tool_name_prefix` to `get_tools_async` | ## Related - [Agent tool use](https://millionshort.com/docs/search/guides/agent-tool-use): when to give a model tools, and what to tell it. - [CAMEL-AI](https://millionshort.com/docs/integrations/camel-ai) and [PraisonAI](https://millionshort.com/docs/integrations/praisonai): the same server in other Python agent frameworks. - [MCP server](https://millionshort.com/docs/mcp) and [Filters for agents](https://millionshort.com/docs/search/filters). - Langroid's own documentation, read on 2026-11-19: [MCP tools](https://langroid.github.io/langroid/notes/mcp-tools/). --- Source: https://millionshort.com/docs/integrations/le-chat Section: Build with # Mistral Le Chat MillionShort search in Mistral Le Chat, through the hosted MCP server. MCP · Hosted MCP server, nothing to install · Key in a form field · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. ## 1. Add the server An administrator adds the connector (on Free, Pro and Student plans, the account's owner): 1. Open **Connectors**, **+ Add Connector**, and the **Custom MCP Connector** tab. 2. Connector name `millionshort`, server URL `https://mcp.millionshort.com/mcp`. 3. **Connect**. Mistral detects how the server signs in: choose **HTTP Bearer Token** with your key, or **No authentication** for the no-key mode. ## 2. Try it Ask Mistral Le Chat: > Search MillionShort for forum threads about restoring a cast iron skillet, with the 1,000 most popular sites removed. List the five most useful with their links. A good answer comes from a `search` call (the client shows the tool call) and links to pages you may not have seen before. ## 3. Tell it when to search Mistral Le Chat has no setting we could find that turns its own web search off, so say which search to use. Add this line to your custom instructions: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## 4. Check it works Under **My Connectors**, the connector's **Functions** tab lists the tools; **Always allow** stops it asking each time. With a key you should see `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them); with no key, fewer, `search` and `list_sources` among them. ## Good to know - Mistral's documentation now describes these connectors under Vibe Work. ## The server One address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. A key is optional. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | ## Related - [MCP server](https://millionshort.com/docs/mcp): the address, every tool, and what the no-key mode allows. - [Filters for agents](https://millionshort.com/docs/search/filters): what to ask `search` for, with recipes. - More chat apps: [Claude](https://millionshort.com/docs/integrations/claude), [ChatGPT](https://millionshort.com/docs/integrations/chatgpt), [Open WebUI](https://millionshort.com/docs/integrations/open-webui), [LibreChat](https://millionshort.com/docs/integrations/librechat), and [every integration](https://millionshort.com/docs/integrations). - Mistral Le Chat's own documentation, read on 2026-11-19: [Custom MCP connectors](https://docs.mistral.ai/vibe/work/web/connectors/mcp-connectors), [Connectors](https://docs.mistral.ai/vibe/work/web/connectors). --- Source: https://millionshort.com/docs/integrations/letta Section: Build with # Letta MillionShort search for Letta agents, registered as an MCP server in Python or TypeScript. MCP · Python and TypeScript · Nothing of ours to install · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. Letta connects to MCP servers in two ways. With the Letta API client (the V1 SDK, Python and TypeScript), you register the MillionShort server once, and Letta's servers call it for any agent you attach its tools to. With the newer Letta Agent SDK (TypeScript only), your Node.js process connects to the server for one session. Either way the agent gets the server's tools ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them). Letta marks the V1 SDK as legacy and recommends the Agent SDK for new work; the V1 SDK is the one with a Python client. ## 1. Install ```bash Python pip install letta-client export MILLIONSHORT_API_KEY=ms-YOUR_API_KEY ``` ```bash TypeScript npm install @letta-ai/letta-client npm install @letta-ai/letta-agent-sdk export MILLIONSHORT_API_KEY=ms-YOUR_API_KEY ``` The second npm line is only for the Agent SDK session in step 3. The Letta clients read your Letta key from LETTA_API_KEY. Get a MillionShort key in the [dashboard](https://millionshort.com/app/); an agent can ask for a [trial key](https://millionshort.com/docs/api-reference/agent-key) by itself. ## 2. Register the server Register MillionShort as a streamable HTTP server, then list its tools. Letta stores the key with the server and sends it as the `Authorization` header. Without a key, leave `auth_header` and `auth_token` out. ```python Python import os from letta_client import Letta client = Letta() # reads LETTA_API_KEY server = client.mcp_servers.create( server_name="millionshort", config={ "mcp_server_type": "streamable_http", "server_url": "https://mcp.millionshort.com/mcp", "auth_header": "Authorization", "auth_token": f"Bearer {os.environ['MILLIONSHORT_API_KEY']}", }, ) tools = client.mcp_servers.tools.list(server.id) for tool in tools: print(tool.name) # search, get_domain_info, list_sources, ... ``` ```ts TypeScript import Letta from '@letta-ai/letta-client'; const client = new Letta(); // reads LETTA_API_KEY const server = await client.mcpServers.create({ server_name: 'millionshort', config: { mcp_server_type: 'streamable_http', server_url: 'https://mcp.millionshort.com/mcp', auth_header: 'Authorization', auth_token: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, }, }); const tools = await client.mcpServers.tools.list(server.id!); for (const tool of tools) console.log(tool.name); // search, get_domain_info, list_sources, ... ``` Letta's MCP page writes the tool list as `mcp_servers.list_tools` / `mcpServers.listTools`; in the current clients (1.12) it is `mcp_servers.tools.list` / `mcpServers.tools.list`, as above. ## 3. Give the tools to an agent Attach the tool ids when you create the agent, then send it a message: ```python Python from letta_client import Letta client = Letta() server = next(s for s in client.mcp_servers.list() if s.server_name == "millionshort") tools = client.mcp_servers.tools.list(server.id) agent = client.agents.create( name="researcher", model="openai/gpt-4.1", system="Use the millionshort search tool for anything recent or niche, and cite the URLs.", tool_ids=[tool.id for tool in tools], ) response = client.agents.messages.create(agent.id, input="Find independent blogs about home espresso.") for message in response.messages: print(message) ``` ```ts TypeScript import Letta from '@letta-ai/letta-client'; const client = new Letta(); const server = (await client.mcpServers.list()).find((s) => s.server_name === 'millionshort'); if (!server?.id) throw new Error('register the millionshort server first'); const tools = await client.mcpServers.tools.list(server.id); const agent = await client.agents.create({ name: 'researcher', model: 'openai/gpt-4.1', system: 'Use the millionshort search tool for anything recent or niche, and cite the URLs.', tool_ids: tools.map((tool) => tool.id), }); const response = await client.agents.messages.create(agent.id, { input: 'Find independent blogs about home espresso.' }); for (const message of response.messages) console.log(message); ``` ### Or: a session in the Agent SDK The Agent SDK (TypeScript only) takes MCP servers per session. Your process holds the connection, and the tools are named `mcp__millionshort__search` and so on: ```ts TypeScript import { LettaAgentClient } from '@letta-ai/letta-agent-sdk'; const client = new LettaAgentClient({ backend: 'cloud', apiKey: process.env.LETTA_API_KEY }); const agentId = await client.createAgent(); const session = client.resumeSession(agentId, { mcpServers: { millionshort: { type: 'http', url: 'https://mcp.millionshort.com/mcp', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}` }, }, }, }); try { await session.send('Find independent blogs about home espresso, and cite the URLs.'); for await (const message of session.stream()) { if (message.type === 'assistant') process.stdout.write(message.content); } } finally { await session[Symbol.asyncDispose](); // closes the MCP connection await client.close(); } ``` Letta's docs write this with `await using session = ...`, which does the same disposal where your runtime supports it. If you pass `allowedTools`, include `mcp__millionshort__*` in it, or the tools are hidden. ## 4. Check it works The tool list in step 2 should print `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints (with no key, fewer, `search` and `list_sources` among them). Then run step 3: the agent's messages should include a call to `search` and an answer that cites pages. If the agent answers from memory, say when to search in its system prompt: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## MCP configuration The same address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Settings | Variable | Meaning | |---|---| | `MILLIONSHORT_API_KEY` | Your key, read by the examples above. Leave the auth fields or header out for the no-key mode | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | | `list_tools` is not found on `mcp_servers` | The docs' method name is older than the client | Use `client.mcp_servers.tools.list(server.id)` | | The agent never calls the tools | The tool ids were not attached, or `allowedTools` leaves them out | Pass `tool_ids` when creating the agent, or add `mcp__millionshort__*` to `allowedTools` | ## Related - [Agent tool use](https://millionshort.com/docs/search/guides/agent-tool-use): when to give a model tools, and what to tell it. - [OpenAI Agents SDK](https://millionshort.com/docs/integrations/openai-agents) and [Genkit](https://millionshort.com/docs/integrations/genkit): the same server in other frameworks. - [MCP server](https://millionshort.com/docs/mcp) and [Filters for agents](https://millionshort.com/docs/search/filters). - Letta's own documentation, read on 2026-11-19: [MCP tools (V1 SDK)](https://docs.letta.com/v1-sdk/tools/mcp-tools), [MCP and client tools (Agent SDK)](https://docs.letta.com/agent-sdk/mcp/), [V1 SDK quickstart](https://docs.letta.com/v1-sdk/). --- Source: https://millionshort.com/docs/integrations/librechat Section: Build with # LibreChat MillionShort search in LibreChat, through the hosted MCP server. MCP · Hosted MCP server, nothing to install · Key read from the environment · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. ## 1. Add the server Add the server to `librechat.yaml`, then restart LibreChat. Pick one way to give it a key: ```yaml One key for all mcpServers: millionshort: type: streamable-http url: https://mcp.millionshort.com/mcp headers: Authorization: "Bearer ${MILLIONSHORT_API_KEY}" ``` ```yaml Each user's own key mcpServers: millionshort: type: streamable-http url: https://mcp.millionshort.com/mcp headers: Authorization: "Bearer {{MILLIONSHORT_API_KEY}}" customUserVars: MILLIONSHORT_API_KEY: title: "MillionShort API key" description: "Your key, starting with ms-" sensitive: true ``` ```yaml Without a key mcpServers: millionshort: type: streamable-http url: https://mcp.millionshort.com/mcp ``` With one key for all, set `MILLIONSHORT_API_KEY` in LibreChat's `.env`. With a key per user, each user is asked for theirs in the chat's MCP menu. ## 2. Try it Ask LibreChat: > Search MillionShort for forum threads about restoring a cast iron skillet, with the 1,000 most popular sites removed. List the five most useful with their links. A good answer comes from a `search` call (the client shows the tool call) and links to pages you may not have seen before. ## 3. Tell it when to search LibreChat has no setting we could find that turns its own web search off, so say which search to use. Add this line to the agent's instructions in the Agent Builder: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## 4. Check it works After the restart, `millionshort` is in the chat's MCP menu. Turn it on in an agent or a chat and its tools are listed. With a key you should see `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them); with no key, fewer, `search` and `list_sources` among them. ## The server One address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. A key is optional. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | ## Related - [MCP server](https://millionshort.com/docs/mcp): the address, every tool, and what the no-key mode allows. - [Filters for agents](https://millionshort.com/docs/search/filters): what to ask `search` for, with recipes. - More chat apps: [Claude](https://millionshort.com/docs/integrations/claude), [ChatGPT](https://millionshort.com/docs/integrations/chatgpt), [Open WebUI](https://millionshort.com/docs/integrations/open-webui), [AnythingLLM](https://millionshort.com/docs/integrations/anythingllm), and [every integration](https://millionshort.com/docs/integrations). - LibreChat's own documentation, read on 2026-11-19: [MCP servers in librechat.yaml](https://www.librechat.ai/docs/configuration/librechat_yaml/object_structure/mcp_servers). --- Source: https://millionshort.com/docs/integrations/lindy Section: Build with # Lindy MillionShort search as a step in Lindy, through the hosted MCP server or the API. MCP · Hosted MCP server, nothing to install · Key in a form field · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. ## 1. Add the MCP server 1. **Integrations**, **+ Add**, **MCP**. 2. Server URL `https://mcp.millionshort.com/mcp`, display name `MillionShort`. 3. For your key, open **Advanced** and send it as an `Authorization` bearer token. For the no-key mode, leave it. 4. **Connect**. Lindy makes one action per tool, all switched on. ## 2. Try it Ask Lindy's agent, or run the step with this as the query: > Search MillionShort for forum threads about restoring a cast iron skillet, with the 1,000 most popular sites removed. List the five most useful with their links. A good answer comes from a `search` call (the client shows the tool call) and links to pages you may not have seen before. ## 3. Tell it when to search Lindy has no setting we could find that turns its own web search off, so say which search to use. Add this line to your agent's instructions: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## 4. Check it works The server is in **Integrations** with its tool count; open it to see an action per tool, each with a switch. With a key you should see `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them); with no key, fewer, `search` and `list_sources` among them. ## The server One address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. A key is optional. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | ## Related - [MCP server](https://millionshort.com/docs/mcp): the address, every tool, and what the no-key mode allows. - [Filters for agents](https://millionshort.com/docs/search/filters): what to ask `search` for, with recipes. - More low-code builders: [n8n](https://millionshort.com/docs/integrations/n8n), [Zapier](https://millionshort.com/docs/integrations/zapier), [Make](https://millionshort.com/docs/integrations/make), [Dify](https://millionshort.com/docs/integrations/dify), and [every integration](https://millionshort.com/docs/integrations). - Lindy's own documentation, read on 2026-11-19: [MCP](https://docs.lindy.ai/integrations/mcp). --- Source: https://millionshort.com/docs/integrations/litellm Section: Build with # LiteLLM MillionShort search as an MCP server in the LiteLLM proxy, for every model behind it. MCP · Proxy config, Python and TypeScript clients · Nothing of ours to install · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. The LiteLLM proxy connects to the MillionShort MCP server for you. You add it once to the proxy's `config.yaml`, with the key; then any client of the proxy can give any model behind it the server's tools ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them), without seeing the key. The LiteLLM Python SDK can also load the tools straight from the server, with no proxy. ## 1. Install ```bash Python pip install 'litellm[proxy]' openai mcp export MILLIONSHORT_API_KEY=ms-YOUR_API_KEY ``` ```bash TypeScript npm install openai export MILLIONSHORT_API_KEY=ms-YOUR_API_KEY ``` The proxy needs `litellm[proxy]` (Python 3.10 or later). The clients below use the OpenAI SDK pointed at the proxy, so the TypeScript side needs only `openai`. Get a MillionShort key in the [dashboard](https://millionshort.com/app/); an agent can ask for a [trial key](https://millionshort.com/docs/api-reference/agent-key) by itself. ## 2. Add the server to the proxy Add an entry under `mcp_servers`. The name you give it (`millionshort`) is the server's alias. `auth_type: "bearer_token"` sends `Authorization: Bearer `, so put the key alone in `auth_value`, without the word Bearer. `os.environ/` reads it from the proxy's environment. ```yaml config.yaml model_list: - model_name: gpt-6.1-sol litellm_params: model: openai/gpt-6.1-sol api_key: os.environ/OPENAI_API_KEY mcp_servers: millionshort: url: "https://mcp.millionshort.com/mcp" transport: "http" description: "MillionShort web search" auth_type: "bearer_token" auth_value: "os.environ/MILLIONSHORT_API_KEY" ``` Without a key, leave `auth_type` and `auth_value` out. Set `transport: "http"` (streamable HTTP) explicitly: it is the default in `config.yaml`, but LiteLLM's management API defaults to SSE. Then start the proxy: ```bash litellm --config config.yaml ``` In the Admin UI you can do the same under **MCP Servers**, **Add New MCP Server**: the URL, transport Streamable HTTP, then the authentication. ## 3. Use it from a client Send a request to the proxy's Responses API with an `mcp` tool whose `server_url` is `litellm_proxy/mcp/millionshort`. That tells the proxy to use the server from its config; do not put the proxy's own address there. With `require_approval: "never"` the proxy runs the tool calls itself. Authenticate with your LiteLLM key (LITELLM_API_KEY here), not the MillionShort key. ```python Python import os from openai import OpenAI client = OpenAI(base_url="https://your-litellm-proxy.example.com", api_key=os.environ["LITELLM_API_KEY"]) response = client.responses.create( model="gpt-6.1-sol", instructions="Use the millionshort search tool for anything recent or niche, and cite the URLs.", input="Find independent blogs about home espresso, without the 1,000 most popular sites.", tools=[ { "type": "mcp", "server_label": "millionshort", "server_url": "litellm_proxy/mcp/millionshort", "require_approval": "never", } ], ) print(response.output_text) ``` ```ts TypeScript import OpenAI from 'openai'; const client = new OpenAI({ baseURL: 'https://your-litellm-proxy.example.com', apiKey: process.env.LITELLM_API_KEY }); const response = await client.responses.create({ model: 'gpt-6.1-sol', instructions: 'Use the millionshort search tool for anything recent or niche, and cite the URLs.', input: 'Find independent blogs about home espresso, without the 1,000 most popular sites.', tools: [ { type: 'mcp', server_label: 'millionshort', server_url: 'litellm_proxy/mcp/millionshort', require_approval: 'never', }, ], }); console.log(response.output_text); ``` `server_url: "litellm_proxy"` gives the model every MCP server the key may use. The proxy's `/v1/chat/completions` endpoint takes the same `mcp` tool definition. MCP clients that connect directly (an IDE, an agent framework) use the proxy's gateway address for one server, `https://your-litellm-proxy.example.com/millionshort/mcp`, with the header `x-litellm-api-key: Bearer `. ## 4. Check it works List the server's tools through the proxy, without a model: ```bash curl -s "https://your-litellm-proxy.example.com/mcp-rest/tools/list?server_id=millionshort" \ -H "Authorization: Bearer $LITELLM_API_KEY" ``` You should see `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints (with no key, fewer, `search` and `list_sources` among them). In the Admin UI, **MCP Servers** lists `millionshort`. When a model sees tools from several servers, LiteLLM prefixes each with the server's name and a hyphen: `millionshort-search`. If the model answers from memory, say when to search in its instructions: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## Without the proxy: the Python SDK The LiteLLM Python SDK can load MCP tools from a session in OpenAI's format, so any model LiteLLM calls can use them. You run the tool calls with `call_openai_tool`. This uses the MCP Python SDK 2.x client: ```python Python import asyncio import os import httpx2 import litellm from litellm import mcp_client from mcp import ClientSession from mcp.client.streamable_http import streamable_http_client async def main(): headers = {"Authorization": f"Bearer {os.environ['MILLIONSHORT_API_KEY']}"} async with httpx2.AsyncClient(headers=headers, timeout=httpx2.Timeout(30.0, read=300.0)) as http: async with streamable_http_client("https://mcp.millionshort.com/mcp", http_client=http) as (read, write): async with ClientSession(read, write) as session: await session.initialize() tools = await mcp_client.load_mcp_tools(session=session, format="openai") messages = [{"role": "user", "content": "Find independent blogs about home espresso."}] response = await litellm.acompletion(model="gpt-6.1-sol", messages=messages, tools=tools) message = response.choices[0].message messages.append(message) for call in message.tool_calls or []: result = await mcp_client.call_openai_tool(session=session, openai_tool=call) messages.append({"role": "tool", "tool_call_id": call.id, "content": result.content[0].text}) final = await litellm.acompletion(model="gpt-6.1-sol", messages=messages, tools=tools) print(final.choices[0].message.content) asyncio.run(main()) ``` Without a key, create the `httpx2.AsyncClient` with no headers. `litellm.experimental_mcp_client` is the older, deprecated name of `litellm.mcp_client`. ## MCP configuration The same address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Settings | Variable | Meaning | |---|---| | `MILLIONSHORT_API_KEY` | Your key. The proxy reads it through `os.environ/MILLIONSHORT_API_KEY`; the SDK example reads it directly. Leave it out for the no-key mode | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. Every search a model makes through the proxy counts against the one key in `config.yaml`, whoever sent the request. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | | The model gets no MillionShort tools | `server_url` is the proxy's own address, or the alias does not match | Use `litellm_proxy/mcp/millionshort`, with the name from `mcp_servers` | | The server shows no tools, or fails to connect | `transport` is SSE (the management API's default) | Set `transport: "http"` | | A virtual key gets no tools that the master key gets | LiteLLM limits MCP servers per key and team | Give the key or its team access to `millionshort` in the Admin UI | ## Related - [Agent tool use](https://millionshort.com/docs/search/guides/agent-tool-use): when to give a model tools, and what to tell it. - [OpenAI](https://millionshort.com/docs/integrations/openai) and [OpenAI Agents SDK](https://millionshort.com/docs/integrations/openai-agents): the same server with OpenAI's own clients. - [MCP server](https://millionshort.com/docs/mcp) and [Filters for agents](https://millionshort.com/docs/search/filters). - LiteLLM's own documentation, read on 2026-11-19: [MCP Gateway](https://docs.litellm.ai/docs/mcp), [MCP REST API](https://docs.litellm.ai/docs/mcp_rest_api), [Proxy quick start](https://docs.litellm.ai/docs/proxy/docker_quick_start). --- Source: https://millionshort.com/docs/integrations/livekit-agents Section: Build with # LiveKit Agents MillionShort search inside a LiveKit voice agent, through the hosted MCP server or a function tool, in Python and Node.js. MCP · Python and Node.js · Nothing of ours to install · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. LiveKit Agents connects to the MillionShort MCP server itself: wrap the server in an `MCPToolset` and pass it in the agent's `tools`. The voice agent then gets the server's tools ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them). With no MCP at all, a function tool that calls the API does the same job. Spoken answers work best with few results: ask for `num_results` 3 and `max_highlights` 1, so the model reads short passages rather than long text. Each search also adds a little latency to the turn it runs in. ## 1. Install ```bash Python pip install "livekit-agents[mcp]~=1.8" httpx export MILLIONSHORT_API_KEY=ms-YOUR_API_KEY ``` ```bash TypeScript npm install @livekit/agents @modelcontextprotocol/client zod export MILLIONSHORT_API_KEY=ms-YOUR_API_KEY ``` `httpx` is only for the function tool further down. The Node.js MCP client needs Node.js 20 or later. Start from LiveKit's own starter project (`lk agent init`) for the rest of the agent: the room, the speech models and the LiveKit keys. Get a MillionShort key in the [dashboard](https://millionshort.com/app/); an agent can ask for a [trial key](https://millionshort.com/docs/api-reference/agent-key) by itself. ## 2. Connect the server Pass an `MCPToolset` to the agent. Without a key, leave the headers out. ```python Python import os from livekit import agents from livekit.agents import Agent, AgentServer, AgentSession, inference, mcp class Assistant(Agent): def __init__(self) -> None: super().__init__( instructions="You are a voice assistant. For anything recent or niche, call the millionshort search tool " "with num_results 3 and max_highlights 1, then answer in two or three short sentences.", tools=[ mcp.MCPToolset( id="millionshort", mcp_server=mcp.MCPServerHTTP( "https://mcp.millionshort.com/mcp", transport_type="streamable_http", headers={"Authorization": f"Bearer {os.environ['MILLIONSHORT_API_KEY']}"}, ), ) ], ) server = AgentServer() @server.rtc_session(agent_name="my-agent") async def my_agent(ctx: agents.JobContext): session = AgentSession( stt=inference.STT(model="assemblyai/assemblyai-stt-3-7-realtime-agent", language="en"), llm=inference.LLM(model="google/gemma-4-31b-it"), tts=inference.TTS(model="fishaudio/s2.1-pro", voice="fa4c9eb3dccc4806b382b40d61c6b10a"), ) await session.start(room=ctx.room, agent=Assistant()) if __name__ == "__main__": agents.cli.run_app(server) ``` ```ts TypeScript import { llm, voice } from '@livekit/agents'; // agent.ts in LiveKit's Node.js starter: the session in main.ts starts this agent. export function createAgent() { return voice.Agent.create({ instructions: 'You are a voice assistant. For anything recent or niche, call the millionshort search tool ' + 'with num_results 3 and max_highlights 1, then answer in two or three short sentences.', tools: [ new llm.MCPToolset({ id: 'millionshort', mcpServer: new llm.MCPServerHTTP({ url: 'https://mcp.millionshort.com/mcp', transportType: 'streamable_http', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}` }, }), }), ], }); } ``` The speech and language models are the ones in LiveKit's quickstart; any model that can call tools works. LiveKit picks streamable HTTP for an address that ends in `/mcp`; `transport_type` says so explicitly. ## 3. Give the tools to every agent in a session A toolset on an `Agent` closes when the session hands over to another agent. To keep search across handoffs, put the same `MCPToolset` in the `tools` of the `AgentSession` instead. To offer only `search`, add `allowed_tools=["search"]` to `MCPServerHTTP` (`allowedTools` in Node.js). ## 4. Check it works Run the agent with `lk agent dev`, open the Agent Console link it prints, and ask a question that needs the web. The console's tool panes show each tool call: you should see `search`, and the answer should name pages it found. If one MCP server fails to connect, LiveKit logs the error and starts the agent without its tools, so read the log when no tool call appears. If the model answers from memory, say when to search in its instructions: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## Without MCP: a function tool A function tool that calls `POST /v1/search` pins the result count and the highlights, so the model cannot ask for more than a spoken answer needs: ```python Python import os from typing import Any import httpx from livekit.agents import Agent, RunContext, function_tool class Assistant(Agent): def __init__(self) -> None: super().__init__(instructions="You are a voice assistant. Use millionshort_search for anything recent or niche.") @function_tool() async def millionshort_search(self, context: RunContext, query: str) -> dict[str, Any]: """Search the web with MillionShort, leaving out the 1,000 most popular sites. Args: query: What to search for. """ async with httpx.AsyncClient(timeout=15) as http: response = await http.post( "https://api.millionshort.com/v1/search", headers={"Authorization": f"Bearer {os.environ['MILLIONSHORT_API_KEY']}"}, json={"query": query, "remove_top_sites": 1000, "num_results": 3, "max_highlights": 1}, ) response.raise_for_status() results = response.json()["data"]["results"] return {"results": [{"title": r["title"], "url": r["url"], "highlights": r.get("highlights")} for r in results]} ``` ```ts TypeScript import { llm, voice } from '@livekit/agents'; import { z } from 'zod'; const millionshortSearch = llm.tool({ name: 'millionshort_search', description: 'Search the web with MillionShort, leaving out the 1,000 most popular sites.', parameters: z.object({ query: z.string().describe('What to search for.') }), execute: async ({ query }) => { const res = await fetch('https://api.millionshort.com/v1/search', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json' }, body: JSON.stringify({ query, remove_top_sites: 1000, num_results: 3, max_highlights: 1 }), }); if (!res.ok) throw new Error(`search failed: ${res.status}`); const { data } = (await res.json()) as { data: { results: { title: string; url: string; highlights?: string[] }[] } }; return data.results.map(({ title, url, highlights }) => ({ title, url, highlights })); }, }); export const agent = voice.Agent.create({ instructions: 'You are a voice assistant. Use millionshort_search for anything recent or niche.', tools: [millionshortSearch], }); ``` ## MCP configuration The same address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Settings | Variable | Meaning | |---|---| | `MILLIONSHORT_API_KEY` | Your key, read by the examples above. Leave the header out for the no-key mode | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | | The agent talks but never searches, and the log shows a connection error | A server that fails to connect does not stop the agent; it starts without those tools | Check the address and the key in the log line, then restart the agent | | Node.js refuses the address | `MCPServerHTTP` in Node.js takes `https:` addresses only | Use `https://mcp.millionshort.com/mcp` exactly as written | | Long pauses before spoken answers | Many results or long text for the model to read | Ask for `num_results` 3 and `max_highlights` 1, or use the function tool, which pins both | ## Related - [Pipecat](https://millionshort.com/docs/integrations/pipecat), [Vapi](https://millionshort.com/docs/integrations/vapi) and [ElevenLabs Agents](https://millionshort.com/docs/integrations/elevenlabs): the same server in other voice agents. - [Agent tool use](https://millionshort.com/docs/search/guides/agent-tool-use): when to give a model tools, and what to tell it. - [MCP server](https://millionshort.com/docs/mcp) and [Filters for agents](https://millionshort.com/docs/search/filters). - LiveKit's own documentation, read on 2026-11-19: [Model Context Protocol](https://docs.livekit.io/agents/logic/tools/mcp/), [Function tools](https://docs.livekit.io/agents/logic/tools/definition/), [Voice AI quickstart](https://docs.livekit.io/agents/start/voice-ai-quickstart/). --- Source: https://millionshort.com/docs/integrations/llamaindex Section: Build with # LlamaIndex MillionShort search for LlamaIndex agents, through its MCP tool spec or a plain function tool. MCP · Python · Nothing of ours to install · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. LlamaIndex connects to the MillionShort MCP server with the `llama-index-tools-mcp` package: a `BasicMCPClient` holds the address and the key, and an `McpToolSpec` turns the server's tools, `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them all), into LlamaIndex tools for an agent. With no MCP at all, a plain function tool that calls the API does the same job. ## 1. Install ```bash Python pip install llama-index-tools-mcp llama-index-llms-openai export MILLIONSHORT_API_KEY=ms-YOUR_API_KEY ``` The examples use an OpenAI model, as LlamaIndex's starter tutorial does, so they read OPENAI_API_KEY; any LlamaIndex LLM that supports function calling works. Get a MillionShort key in the [dashboard](https://millionshort.com/app/); an agent can ask for a [trial key](https://millionshort.com/docs/api-reference/agent-key) by itself. LlamaIndex's TypeScript packages do not document an MCP client, so this page is Python only. ## 2. Connect the server `BasicMCPClient` treats an address that does not end in `/sse` as streamable HTTP, and sends `headers` with every request. Without a key, leave the headers out. ```python Python import asyncio import os from llama_index.tools.mcp import BasicMCPClient, McpToolSpec client = BasicMCPClient( "https://mcp.millionshort.com/mcp", headers={"Authorization": f"Bearer {os.environ['MILLIONSHORT_API_KEY']}"}, ) async def main(): tools = await McpToolSpec(client=client).to_tool_list_async() print([tool.metadata.name for tool in tools]) # search, get_domain_info, list_sources, ... asyncio.run(main()) ``` ## 3. Give the tools to an agent A `FunctionAgent` takes the tools, an LLM and a system prompt. LlamaIndex agents have no web search of their own, so the MillionShort tools are the only search the agent has. ```python Python import asyncio import os from llama_index.core.agent.workflow import FunctionAgent from llama_index.llms.openai import OpenAI from llama_index.tools.mcp import BasicMCPClient, McpToolSpec client = BasicMCPClient("https://mcp.millionshort.com/mcp", headers={"Authorization": f"Bearer {os.environ['MILLIONSHORT_API_KEY']}"}) async def main(): tools = await McpToolSpec(client=client).to_tool_list_async() agent = FunctionAgent( tools=tools, llm=OpenAI(model="gpt-4o-mini"), system_prompt="Use the MillionShort search tool for anything recent or niche, and cite the URLs.", ) response = await agent.run(user_msg="Find independent blogs about home espresso, without the 1,000 most popular sites.") print(response) asyncio.run(main()) ``` To give the agent only search, pass `allowed_tools=["search"]` to `McpToolSpec`. `agent.run(..., max_iterations=10)` caps the steps of one run. A line that works well in the system prompt: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## 4. Check it works The example in step 2 lists the tools with no model involved. To see a call made directly, as the agent would make it: ```python Python import asyncio import os from llama_index.tools.mcp import BasicMCPClient client = BasicMCPClient("https://mcp.millionshort.com/mcp", headers={"Authorization": f"Bearer {os.environ['MILLIONSHORT_API_KEY']}"}) async def main(): result = await client.call_tool("search", {"query": "restoring a cast iron skillet", "remove_top_sites": 1000, "num_results": 3}) print(result.content[0].text[:600]) asyncio.run(main()) ``` ## Without MCP: a function tool A `FunctionAgent` takes plain Python functions as tools, described by their name, type hints and docstring. ```python Python import asyncio import json import os import urllib.request from llama_index.core.agent.workflow import FunctionAgent from llama_index.llms.openai import OpenAI def millionshort_search(query: str, remove_top_sites: int = 1000, num_results: int = 5) -> str: """Search the web with MillionShort. remove_top_sites leaves out the N most popular sites.""" request = urllib.request.Request( "https://api.millionshort.com/v1/search", data=json.dumps({"query": query, "remove_top_sites": remove_top_sites, "num_results": num_results}).encode(), headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"], "Content-Type": "application/json"}, ) with urllib.request.urlopen(request, timeout=30) as response: results = json.load(response)["data"]["results"] return json.dumps([{"title": r["title"], "url": r["url"], "snippet": r.get("snippet")} for r in results]) async def main(): agent = FunctionAgent(tools=[millionshort_search], llm=OpenAI(model="gpt-4o-mini")) print(await agent.run(user_msg="Find independent blogs about home espresso.")) asyncio.run(main()) ``` ## MCP configuration The same address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Settings | Variable | Meaning | |---|---| | `MILLIONSHORT_API_KEY` | Your key, read by the examples above. Leave the header out for the no-key mode | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. `max_iterations` on `agent.run` is the step limit. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | | The header is not sent | `BasicMCPClient` was given an `http_client` of your own, which replaces its `headers` and `timeout` | Set the header on your own client, or leave `http_client` out | | The run stops before an answer | The agent reached `max_iterations` | Raise `max_iterations`, or ask for fewer results per search | ## Related - [Agent tool use](https://millionshort.com/docs/search/guides/agent-tool-use): when to give a model tools, and what to tell it. - [LangChain](https://millionshort.com/docs/integrations/langchain), [Pydantic AI](https://millionshort.com/docs/integrations/pydantic-ai) and [CrewAI](https://millionshort.com/docs/integrations/crewai). - [MCP server](https://millionshort.com/docs/mcp) and [Filters for agents](https://millionshort.com/docs/search/filters). - LlamaIndex's own documentation, read on 2026-11-19: [MCP tools package](https://github.com/run-llama/llama_index/tree/main/llama-index-integrations/tools/llama-index-tools-mcp), [Model Context Protocol](https://developers.llamaindex.ai/python/framework/module_guides/mcp/), [Building an agent](https://developers.llamaindex.ai/python/framework/understanding/agent/). --- Source: https://millionshort.com/docs/integrations/lm-studio Section: Build with # LM Studio MillionShort search in LM Studio, through the hosted MCP server. MCP · Hosted MCP server, nothing to install · Key in a header · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. ## 1. Add the server LM Studio 0.3.17 or later. In the right-hand sidebar open the **Program** tab, **Install**, **Edit mcp.json**, and add: ```json With a key { "mcpServers": { "millionshort": { "url": "https://mcp.millionshort.com/mcp", "headers": { "Authorization": "Bearer ms-YOUR_API_KEY" } } } } ``` ```json Without a key { "mcpServers": { "millionshort": { "url": "https://mcp.millionshort.com/mcp" } } } ``` Use a model that takes tools. Small local models call tools less reliably, and the tool list takes some of their context. ## 2. Try it Ask LM Studio: > Search MillionShort for forum threads about restoring a cast iron skillet, with the 1,000 most popular sites removed. List the five most useful with their links. A good answer comes from a `search` call (the client shows the tool call) and links to pages you may not have seen before. ## 3. Tell it when to search LM Studio has no web search of its own, so say which search to use. Add this line to the chat's system prompt: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## 4. Check it works After saving, the server is in the **Program** tab's list with its tools. With a key you should see `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them); with no key, fewer, `search` and `list_sources` among them. ## The server One address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. A key is optional. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | ## Related - [MCP server](https://millionshort.com/docs/mcp): the address, every tool, and what the no-key mode allows. - [Filters for agents](https://millionshort.com/docs/search/filters): what to ask `search` for, with recipes. - More chat apps: [Claude](https://millionshort.com/docs/integrations/claude), [ChatGPT](https://millionshort.com/docs/integrations/chatgpt), [Open WebUI](https://millionshort.com/docs/integrations/open-webui), [LibreChat](https://millionshort.com/docs/integrations/librechat), and [every integration](https://millionshort.com/docs/integrations). - LM Studio's own documentation, read on 2026-11-19: [MCP in LM Studio](https://lmstudio.ai/docs/app/mcp). --- Source: https://millionshort.com/docs/integrations/lobechat Section: Build with # LobeChat MillionShort search in LobeChat, through the hosted MCP server. MCP · Hosted MCP server, nothing to install · Key in a header · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. ## 1. Add the server LobeChat (now LobeHub) calls its plugins skills. Open **Add Custom MCP Skill** and fill in: - **MCP type**: HTTP (streamable HTTP). - **Identifier**: `millionshort`. - **Streamable HTTP Endpoint URL**: `https://mcp.millionshort.com/mcp`. - **Auth type**: **No auth**. For your key, open **Advanced**, **HTTP Headers**, and add a row: `Authorization` with the value `Bearer ms-YOUR_API_KEY`. Test the connection, then save. ## 2. Try it Ask LobeChat: > Search MillionShort for forum threads about restoring a cast iron skillet, with the 1,000 most popular sites removed. List the five most useful with their links. A good answer comes from a `search` call (the client shows the tool call) and links to pages you may not have seen before. ## 3. Tell it when to search LobeChat has no setting we could find that turns its own web search off, so say which search to use. Add this line to the agent's system prompt: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## 4. Check it works The dialog's test lists the tools. After saving, turn the skill on for your agent and ask for a search. With a key you should see `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them); with no key, fewer, `search` and `list_sources` among them. ## Good to know - LobeHub's user docs for this dialog were not online when we checked, so the field names come from its own source code (linked below). ## The server One address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. A key is optional. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | ## Related - [MCP server](https://millionshort.com/docs/mcp): the address, every tool, and what the no-key mode allows. - [Filters for agents](https://millionshort.com/docs/search/filters): what to ask `search` for, with recipes. - More chat apps: [Claude](https://millionshort.com/docs/integrations/claude), [ChatGPT](https://millionshort.com/docs/integrations/chatgpt), [Open WebUI](https://millionshort.com/docs/integrations/open-webui), [LibreChat](https://millionshort.com/docs/integrations/librechat), and [every integration](https://millionshort.com/docs/integrations). - LobeChat's own documentation, read on 2026-11-19: [MCP form (source)](https://github.com/lobehub/lobehub/blob/main/src/features/PluginDevModal/MCPManifestForm/index.tsx), [Form labels](https://github.com/lobehub/lobehub/blob/main/locales/en-US/plugin.json). --- Source: https://millionshort.com/docs/integrations/lovable Section: Build with # Lovable MillionShort search in Lovable, through the hosted MCP server. MCP · Hosted MCP server, nothing to install · Key in a form field · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. ## 1. Add the server 1. Open **Connectors**, **Add custom**, **MCP server**. 2. Server name `millionshort`, connection **Direct connection**, server URL `https://mcp.millionshort.com/mcp`. 3. Authentication: **Bearer token or API key** with your key, or **No authentication** for the no-key mode. 4. **Add server**. If the option is greyed out, a workspace admin has switched custom MCP off. ## 2. Try it In project chat, ask: > Search MillionShort for forum threads about restoring a cast iron skillet, with the 1,000 most popular sites removed. List the five most useful with their links. A good answer comes from a `search` call (the client shows the tool call) and links to pages you may not have seen before. ## 3. Tell it when to search Lovable has no setting we could find that turns its own web search off, so say which search to use. Add this line to your Lovable instructions: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## 4. Check it works The server is in your list of chat connectors. Ask something only a search can answer, naming `millionshort`. With a key you should see `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them); with no key, fewer, `search` and `list_sources` among them. ## Good to know - It is a chat connector: Lovable uses it while it builds. Your published app cannot call it. To search from the app, have Lovable call `POST https://api.millionshort.com/v1/search` with the key kept as a secret ([quickstart](https://millionshort.com/docs/quickstart)). ## The server One address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. A key is optional. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | ## Related - [MCP server](https://millionshort.com/docs/mcp): the address, every tool, and what the no-key mode allows. - [Filters for agents](https://millionshort.com/docs/search/filters): what to ask `search` for, with recipes. - More coding agents: [Claude Code](https://millionshort.com/docs/integrations/claude-code), [Cursor](https://millionshort.com/docs/integrations/cursor), [Codex](https://millionshort.com/docs/integrations/codex), [GitHub Copilot in VS Code](https://millionshort.com/docs/integrations/vscode), and [every integration](https://millionshort.com/docs/integrations). - Lovable's own documentation, read on 2026-11-19: [Custom MCP](https://docs.lovable.dev/integrations/custom-mcp), [Chat connectors](https://docs.lovable.dev/integrations/chat-connectors). --- Source: https://millionshort.com/docs/integrations/make Section: Build with # Make MillionShort search as a step in Make, through the hosted MCP server or the API. MCP · Hosted MCP server, nothing to install · Key in a form field · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. > **App coming soon.** A MillionShort app for Make is not published yet. Everything below works today without it. ## 1. Add the MCP server Make's **MCP Client** app (in open beta) connects a server by its address: add an MCP Client module, **Create a connection**, **+ New MCP Server**, URL `https://mcp.millionshort.com/mcp`, and leave **API Key / Access token** empty to use the no-key mode. Then **Call a tool** to test it, or give the connection to an AI agent (**AI Agents**, the agent, **MCP**, **Add**). Make does not say how it sends the access token, so for your key use the HTTP module below. ## 2. Or call the API in an HTTP step An **HTTP**, **Make a request** module: ```text Make a request URL: https://api.millionshort.com/v1/search Method: POST Headers: Authorization = Bearer ms-YOUR_API_KEY Body content type: application/JSON Body input method: JSON string Request content: {"query": "...", "remove_top_sites": 1000, "num_results": 5} Parse response: Yes ``` ## 3. Try it Ask Make's agent, or run the step with this as the query: > Search MillionShort for forum threads about restoring a cast iron skillet, with the 1,000 most popular sites removed. List the five most useful with their links. A good answer comes from a `search` call (the client shows the tool call) and links to pages you may not have seen before. ## 4. Tell it when to search Make has no setting we could find that turns its own web search off, so say which search to use. Add this line to the AI agent's instructions: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## 5. Check it works Run the module once; with **Parse response** on, later modules can map `data` and its `results`. In the MCP Client app, the **Tools** field lists the server's tools. With a key you should see `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them); with no key, fewer, `search` and `list_sources` among them. ## The server One address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. A key is optional. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | ## Related - [MCP server](https://millionshort.com/docs/mcp): the address, every tool, and what the no-key mode allows. - [Filters for agents](https://millionshort.com/docs/search/filters): what to ask `search` for, with recipes. - More low-code builders: [n8n](https://millionshort.com/docs/integrations/n8n), [Zapier](https://millionshort.com/docs/integrations/zapier), [Dify](https://millionshort.com/docs/integrations/dify), [Langflow](https://millionshort.com/docs/integrations/langflow), and [every integration](https://millionshort.com/docs/integrations). - Make's own documentation, read on 2026-11-19: [HTTP app](https://apps.make.com/http), [MCP tools for AI agents](https://help.make.com/mcp-tools-for-ai-agents). --- Source: https://millionshort.com/docs/integrations/mastra Section: Build with # Mastra MillionShort search for Mastra agents, through Mastra's MCP client or a tool of your own, in TypeScript. MCP · TypeScript · Nothing of ours to install · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. Mastra's `MCPClient` connects to the MillionShort MCP server over HTTP, and `listTools()` returns its tools ready for an agent: `millionshort_search`, `millionshort_get_domain_info`, `millionshort_list_sources` and the tools of the other endpoints, such as `millionshort_extract` and `millionshort_places` (Mastra puts the server's name in front of each tool's name; [the MCP page](https://millionshort.com/docs/mcp#tools) lists them all). With no MCP at all, a `createTool` tool that calls the API does the same job. Mastra is TypeScript only. ## 1. Install ```bash TypeScript npm install @mastra/core @mastra/mcp zod export MILLIONSHORT_API_KEY=ms-YOUR_API_KEY ``` The examples use the model id from Mastra's own examples, `openai/gpt-6.1-sol`, which reads your OpenAI key from OPENAI_API_KEY; any model id your Mastra setup supports works the same way. Get a MillionShort key in the [dashboard](https://millionshort.com/app/); an agent can ask for a [trial key](https://millionshort.com/docs/api-reference/agent-key) by itself. ## 2. Connect the server Each server in `servers` gets a key of your choosing (here `millionshort`) and a `url`. The header goes in `requestInit`, the options Mastra passes to `fetch`. ```ts TypeScript import { Agent } from '@mastra/core/agent'; import { MCPClient } from '@mastra/mcp'; const mcp = new MCPClient({ id: 'millionshort-client', servers: { millionshort: { url: new URL('https://mcp.millionshort.com/mcp'), requestInit: { headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}` } }, }, }, }); const agent = new Agent({ id: 'researcher', name: 'Researcher', instructions: 'Use the millionshort search tool for anything recent or niche, and cite the URLs.', model: 'openai/gpt-6.1-sol', tools: await mcp.listTools(), }); try { const result = await agent.generate('Find independent blogs about home espresso, without the 1,000 most popular sites.'); console.log(result.text); } finally { await mcp.disconnect(); } ``` Without a key, leave `requestInit` out: the agent gets `search` and `list_sources`. ## 3. Give the tools to an agent `tools: await mcp.listTools()` fixes the tools, and the key, when the agent is created. In an app where each user brings their own key, create a client per request and pass its tools to that call only, with `listToolsets()`: ```ts TypeScript import { Agent } from '@mastra/core/agent'; import { MCPClient } from '@mastra/mcp'; const agent = new Agent({ id: 'researcher', name: 'Researcher', instructions: 'Use the millionshort search tool for anything recent or niche, and cite the URLs.', model: 'openai/gpt-6.1-sol', }); export async function answer(question: string, userKey: string) { const mcp = new MCPClient({ id: `millionshort-${crypto.randomUUID()}`, servers: { millionshort: { url: new URL('https://mcp.millionshort.com/mcp'), requestInit: { headers: { Authorization: `Bearer ${userKey}` } } } }, }); try { return (await agent.generate(question, { toolsets: await mcp.listToolsets() })).text; } finally { await mcp.disconnect(); } } ``` In a toolset, the tools keep the server's own names (`search`, not `millionshort_search`). A Mastra agent has no web search of its own: it has only the tools you pass. ## 4. Check it works Run the example: the answer should cite pages, and `result.toolCalls` lists the call to `millionshort_search`. To see the tools without a model: ```ts TypeScript import { MCPClient } from '@mastra/mcp'; const mcp = new MCPClient({ servers: { millionshort: { url: new URL('https://mcp.millionshort.com/mcp'), requestInit: { headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}` } }, }, }, }); console.log(Object.keys(await mcp.listTools())); // millionshort_search, millionshort_get_domain_info, millionshort_list_sources, ... await mcp.disconnect(); ``` If the model answers from memory, say when to search in its instructions: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## Without MCP: a function tool `createTool` takes an id, a description, an input schema and `execute`, which receives the validated input and a context with an `abortSignal`: ```ts TypeScript import { Agent } from '@mastra/core/agent'; import { createTool } from '@mastra/core/tools'; import { z } from 'zod'; const millionshortSearch = createTool({ id: 'millionshort-search', description: 'Search the web with MillionShort. remove_top_sites leaves out the N most popular sites.', inputSchema: z.object({ query: z.string(), remove_top_sites: z.number().int().default(1000) }), execute: async ({ query, remove_top_sites }, { abortSignal }) => { const res = await fetch('https://api.millionshort.com/v1/search', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json' }, body: JSON.stringify({ query, remove_top_sites, num_results: 5 }), signal: abortSignal, }); if (!res.ok) throw new Error(`search failed: ${res.status}`); const { data } = (await res.json()) as { data: { results: { title: string; url: string; snippet?: string }[] } }; return data.results.map(({ title, url, snippet }) => ({ title, url, snippet })); }, }); const agent = new Agent({ id: 'researcher', name: 'Researcher', instructions: 'Use millionshortSearch for anything recent or niche, and cite the URLs.', model: 'openai/gpt-6.1-sol', tools: { millionshortSearch }, }); console.log((await agent.generate('Find independent blogs about home espresso.')).text); ``` ## MCP configuration The same address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Settings | Variable | Meaning | |---|---| | `MILLIONSHORT_API_KEY` | Your key, read by the examples above. Leave `requestInit` out for the no-key mode | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | | One user's searches use another user's credits | Tools from `listTools()` carry the key they were created with | Create a client per user and pass `listToolsets()` per call, as in step 3 | ## Related - [Agent tool use](https://millionshort.com/docs/search/guides/agent-tool-use): when to give a model tools, and what to tell it. - [Vercel AI SDK](https://millionshort.com/docs/integrations/vercel-ai-sdk) and [Strands Agents](https://millionshort.com/docs/integrations/strands): the same server in other TypeScript frameworks. - [MCP server](https://millionshort.com/docs/mcp) and [Filters for agents](https://millionshort.com/docs/search/filters). - Mastra's own documentation, read on 2026-11-19: [MCP](https://mastra.ai/docs/connections/mcp), [MCPClient reference](https://mastra.ai/reference/tools/mcp-client), [Tools](https://mastra.ai/docs/agents/tools). --- Source: https://millionshort.com/docs/integrations/microsoft-agent-framework Section: Build with # Microsoft Agent Framework MillionShort search for Microsoft Agent Framework agents, as an MCP tool over streamable HTTP or a function tool, in Python. MCP · Python · Nothing of ours to install · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. Agent Framework's `MCPStreamableHTTPTool` connects to the MillionShort MCP server and gives an agent its tools: `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints, such as `extract`, `places`, `map` and `crawl` ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them all). With no MCP at all, a Python function that calls the API does the same job. This page covers the Python package. ## 1. Install ```bash Python pip install agent-framework export MILLIONSHORT_API_KEY=ms-YOUR_API_KEY ``` The full package includes MCP support (the MCP Python SDK 2.x). On a minimal install, add `"mcp>=2.2.0,<3"`, as the framework's docs say. The examples use `OpenAIChatClient`, which reads your OpenAI key from OPENAI_API_KEY and the model name from OPENAI_CHAT_MODEL (for example gpt-4o-mini, as in the framework's docs); any chat client works the same way. Get a MillionShort key in the [dashboard](https://millionshort.com/app/); an agent can ask for a [trial key](https://millionshort.com/docs/api-reference/agent-key) by itself. ## 2. Connect the server The key is fixed, so it goes in `static_headers`. Passing the tool to the agent and opening the agent with `async with` connects the tool too, and closes it at the end. ```python Python import asyncio import os from agent_framework import Agent, MCPStreamableHTTPTool from agent_framework.openai import OpenAIChatClient async def main(): async with Agent( client=OpenAIChatClient(), name="Researcher", instructions="Use the millionshort search tool for anything recent or niche, and cite the URLs.", tools=MCPStreamableHTTPTool( name="millionshort", url="https://mcp.millionshort.com/mcp", static_headers={"Authorization": f"Bearer {os.environ['MILLIONSHORT_API_KEY']}"}, load_prompts=False, ), ) as agent: result = await agent.run("Find independent blogs about home espresso, without the 1,000 most popular sites.") print(result.text) asyncio.run(main()) ``` Without a key, leave `static_headers` out: the agent gets `search` and `list_sources`. ## 3. Give the tools to an agent The tool can also be given to a single run instead of to the agent, as the framework's MCP examples do. Open the tool and the agent together, then pass `tools` to `run`: ```python Python import asyncio import os from agent_framework import Agent, MCPStreamableHTTPTool from agent_framework.openai import OpenAIChatClient async def main(): async with ( MCPStreamableHTTPTool( name="millionshort", url="https://mcp.millionshort.com/mcp", static_headers={"Authorization": f"Bearer {os.environ['MILLIONSHORT_API_KEY']}"}, load_prompts=False, ) as millionshort, Agent(client=OpenAIChatClient(), name="Researcher", instructions="Cite the URLs you use.") as agent, ): result = await agent.run("Find independent blogs about home espresso.", tools=millionshort) print(result.text) asyncio.run(main()) ``` When the key differs from run to run (one per user), use `header_provider` instead of `static_headers`: a function that returns the headers for each run. The agent has only the tools you give it. ## 4. Check it works Run the example: the answer should cite pages. To see the tools without a model, open the tool and list its functions: ```python Python import asyncio import os from agent_framework import MCPStreamableHTTPTool async def main(): async with MCPStreamableHTTPTool( name="millionshort", url="https://mcp.millionshort.com/mcp", static_headers={"Authorization": f"Bearer {os.environ['MILLIONSHORT_API_KEY']}"}, load_prompts=False, ) as millionshort: print([function.name for function in millionshort.functions]) # search, get_domain_info, list_sources, ... asyncio.run(main()) ``` If the model answers from memory, say when to search in its instructions: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## Without MCP: a function tool The `@tool` decorator names the function for the model; the docstring or `description` and the type hints say how to call it: ```python Python import asyncio import json import os import urllib.request from agent_framework import Agent, tool from agent_framework.openai import OpenAIChatClient @tool(name="millionshort_search", description="Search the web with MillionShort. remove_top_sites leaves out the N most popular sites.") def millionshort_search(query: str, remove_top_sites: int = 1000, num_results: int = 5) -> str: request = urllib.request.Request( "https://api.millionshort.com/v1/search", data=json.dumps({"query": query, "remove_top_sites": remove_top_sites, "num_results": num_results}).encode(), headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"], "Content-Type": "application/json"}, ) with urllib.request.urlopen(request, timeout=30) as response: results = json.load(response)["data"]["results"] return json.dumps([{"title": r["title"], "url": r["url"], "snippet": r.get("snippet")} for r in results]) async def main(): agent = Agent(client=OpenAIChatClient(), name="Researcher", tools=millionshort_search) print((await agent.run("Find independent blogs about home espresso.")).text) asyncio.run(main()) ``` ## MCP configuration The same address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Settings | Variable | Meaning | |---|---| | `MILLIONSHORT_API_KEY` | Your key, read by the examples above. Leave `static_headers` out for the no-key mode | `MCPStreamableHTTPTool` also takes `request_timeout` (seconds, 30 by default), `allowed_tools` to load only the tools you name, and `tool_name_prefix` to put a prefix before each tool's name. ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | | "Failed to create MCP session: The API key was not accepted." | The key is wrong, or sent without `Bearer ` | Check MILLIONSHORT_API_KEY and the header, or leave `static_headers` out to use the no-key mode | | "Model must be specified via the 'model' parameter" | `OpenAIChatClient()` found no model name | Set OPENAI_CHAT_MODEL, or pass `model` | ## Related - [Agent tool use](https://millionshort.com/docs/search/guides/agent-tool-use): when to give a model tools, and what to tell it. - [Semantic Kernel](https://millionshort.com/docs/integrations/semantic-kernel): the same server in Microsoft's other agent library. - [OpenAI Agents SDK](https://millionshort.com/docs/integrations/openai-agents): the same server in another agent framework. - [MCP server](https://millionshort.com/docs/mcp) and [Filters for agents](https://millionshort.com/docs/search/filters). - The Agent Framework documentation, read on 2026-11-19: [Using MCP tools](https://learn.microsoft.com/en-us/agent-framework/agents/tools/local-mcp-tools), [Function tools](https://learn.microsoft.com/en-us/agent-framework/agents/tools/function-tools), [OpenAI](https://learn.microsoft.com/en-us/agent-framework/integrations/by-component/model-providers/openai). --- Source: https://millionshort.com/docs/integrations/mistral Section: Build with # Mistral MillionShort search for Mistral models, as a function tool with the Mistral SDKs in Python and TypeScript, or the hosted MCP server in Mistral's Agents SDK. Recipe · Python and TypeScript · Nothing of ours to install · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. With the Mistral SDKs, `chat.complete` takes function tools: the model asks for a call, your code runs the search, and the loop sends the results back until the model answers. Mistral's separate Agents SDK for Python (the `mistralai-agents` package) can also reach our hosted MCP server itself, which gives the agent every tool of the server ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them). ## 1. Install ```bash Python pip install mistralai mistralai-agents requests export MILLIONSHORT_API_KEY=ms-YOUR_API_KEY ``` ```bash TypeScript npm install @mistralai/mistralai export MILLIONSHORT_API_KEY=ms-YOUR_API_KEY ``` The examples read your Mistral key from MISTRAL_API_KEY. Get a MillionShort key in the [dashboard](https://millionshort.com/app/); an agent can ask for a [trial key](https://millionshort.com/docs/api-reference/agent-key) by itself. `mistralai-agents` is only for the MCP section further down. ## 2. Minimal example ```python Python import json import os import requests from mistralai.client import Mistral def millionshort_search(query: str) -> str: r = requests.post( "https://api.millionshort.com/v1/search", headers={"Authorization": f"Bearer {os.environ['MILLIONSHORT_API_KEY']}"}, json={"query": query, "remove_top_sites": 1000, "num_results": 5}, timeout=30, ) r.raise_for_status() return json.dumps([{"title": x["title"], "url": x["url"], "snippet": x.get("snippet")} for x in r.json()["data"]["results"]]) tools = [{"type": "function", "function": { "name": "millionshort_search", "description": "Search the web with MillionShort, leaving out the 1,000 most popular sites.", "parameters": {"type": "object", "properties": {"query": {"type": "string"}}, "required": ["query"]}, }}] client = Mistral(api_key=os.environ["MISTRAL_API_KEY"]) messages = [{"role": "user", "content": "Find independent blogs about home espresso."}] while True: message = client.chat.complete(model="mistral-large-latest", messages=messages, tools=tools).choices[0].message messages.append(message) if not message.tool_calls: break for call in message.tool_calls: args = call.function.arguments # a JSON string or an already parsed dict content = millionshort_search(**(json.loads(args) if isinstance(args, str) else args)) messages.append({"role": "tool", "name": call.function.name, "tool_call_id": call.id, "content": content}) print(message.content) ``` ```ts TypeScript import { Mistral } from '@mistralai/mistralai'; async function millionshortSearch(query: string): Promise { const res = await fetch('https://api.millionshort.com/v1/search', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json' }, body: JSON.stringify({ query, remove_top_sites: 1000, num_results: 5 }), }); if (!res.ok) throw new Error(`search failed: ${res.status}`); const { data } = (await res.json()) as { data: { results: { title: string; url: string; snippet?: string }[] } }; return JSON.stringify(data.results.map(({ title, url, snippet }) => ({ title, url, snippet }))); } const tools = [{ type: 'function' as const, function: { name: 'millionshort_search', description: 'Search the web with MillionShort, leaving out the 1,000 most popular sites.', parameters: { type: 'object', properties: { query: { type: 'string' } }, required: ['query'] }, } }]; const client = new Mistral({ apiKey: process.env.MISTRAL_API_KEY }); const messages: Parameters[0]['messages'] = [{ role: 'user', content: 'Find independent blogs about home espresso.' }]; while (true) { const message = (await client.chat.complete({ model: 'mistral-large-latest', messages, tools })).choices[0]?.message; if (!message?.toolCalls?.length) { console.log(message?.content); break; } messages.push({ ...message, role: 'assistant' }); for (const call of message.toolCalls) { const args = typeof call.function.arguments === 'string' ? JSON.parse(call.function.arguments) : call.function.arguments; messages.push({ role: 'tool', name: call.function.name, toolCallId: call.id, content: await millionshortSearch(String(args.query)) }); } } ``` ## 3. Tell it when to search Mistral's built-in web search is a tool of its Agents and Conversations APIs that runs only when you add it, and `chat.complete` has only the tools you pass. Put a line like this in a system message at the start of `messages` (or in `instructions=` on an Agents SDK agent): > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## 4. Check it works Run the example, then ask: > Search MillionShort for forum threads about restoring a cast iron skillet, with the 1,000 most popular sites removed. List the five most useful with their links. After the first call, the message's tool calls (`tool_calls` in Python, `toolCalls` in TypeScript) name `millionshort_search` with a `query`. ## With MCP: the Agents SDK In the Agents SDK, `agents.RemoteMCP` is an MCP server the agent reaches over HTTP. It does not take the key itself: `auth_header_env_vars` maps a header to the name of an environment variable that holds the header's full value, so put the whole `Bearer` value in one (here MILLIONSHORT_AUTH_HEADER). Without a key, leave `auth_header_env_vars` out. The Agents SDK needs Python 3.12 or later. ```python Python # export MILLIONSHORT_AUTH_HEADER="Bearer ms-YOUR_API_KEY" import asyncio from mistralai import agents agent = agents.Agent( model="mistral-large-4", instructions="Use the millionshort search tool for anything recent or niche, and cite the URLs.", mcps={"millionshort": agents.RemoteMCP(url="https://mcp.millionshort.com/mcp", auth_header_env_vars={"Authorization": "MILLIONSHORT_AUTH_HEADER"})}, ) async def main() -> None: result = await agent.run("Find independent blogs about home espresso, without the 1,000 most popular sites.") if isinstance(result, agents.Completed): print(result.text) print([call.name for call in result.tool_calls]) # e.g. millionshort.search asyncio.run(main()) ``` The tools are named `.`, so the agent sees `millionshort.search`, `millionshort.get_domain_info`, `millionshort.list_sources` and so on. A missing variable fails before the run starts. ## MCP configuration The same address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | The function tool in step 2 is `search` alone; the Agents SDK server gives the agent every tool of the server. ## Settings | Variable | Meaning | |---|---| | `MILLIONSHORT_API_KEY` | Your key, read by the function tool | | MILLIONSHORT_AUTH_HEADER | The full header value, `Bearer ms-...`, read by the Agents SDK for `RemoteMCP` | | MISTRAL_API_KEY | Your Mistral key | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | `401 AUTH_MISSING_KEY` or `AUTH_INVALID_KEY` | The key is missing or wrong | Set `MILLIONSHORT_API_KEY`; keys start with `ms-` | | `400 INVALID_PARAM` | A field name or value the API does not take | The `message` names the field; the [search reference](https://millionshort.com/docs/search/parameters) lists them all | | `429 RATE_LIMITED` or `CAPACITY` | Too many calls a minute, or no free capacity right now | Wait the `Retry-After` seconds, then retry | | `429 INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; do not retry | | The Agents SDK stops before the run with a missing variable | The variable named in `auth_header_env_vars` is not set where the agent runs | Export it with the full `Bearer ms-...` value | | `401` from the MCP server with the Agents SDK | The variable holds the bare key without `Bearer ` | Put `Bearer ` in front of the key in the variable | ## Related - [Agent tool use](https://millionshort.com/docs/search/guides/agent-tool-use): when to give a model tools, and what to tell it. - [Le Chat](https://millionshort.com/docs/integrations/le-chat): the same server in Mistral's assistant. - Other model APIs: [OpenAI](https://millionshort.com/docs/integrations/openai), [Cohere](https://millionshort.com/docs/integrations/cohere), [OpenRouter](https://millionshort.com/docs/integrations/openrouter), [Ollama](https://millionshort.com/docs/integrations/ollama). - [Search API reference](https://millionshort.com/docs/search/parameters) and [MCP server](https://millionshort.com/docs/mcp). - Mistral's own documentation, read on 2026-11-19: [Function calling](https://docs.mistral.ai/inference/conversations/function-calling), [Connectors and MCP in agents](https://docs.mistral.ai/studio/agents/learn/agent/connectors), [MCP reference](https://docs.mistral.ai/studio/agents/reference/connectors-and-mcp). --- Source: https://millionshort.com/docs/integrations/msty Section: Build with # Msty MillionShort search in Msty, through the hosted MCP server. MCP · Hosted MCP server, nothing to install · Key in a form field · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. ## 1. Add the server 1. Open **Toolbox**, **Tools**, **Add New Tool**, and name it `millionshort`. 2. Choose **HTTP** and enter the MCP server URL `https://mcp.millionshort.com/mcp`. 3. Authentication: a bearer token with your key, or none for the no-key mode. 4. **Test tool**, then **Save**. 5. Add the tool to a toolset, and pick that toolset in a conversation with a model that takes tools. ## 2. Try it Ask Msty: > Search MillionShort for forum threads about restoring a cast iron skillet, with the 1,000 most popular sites removed. List the five most useful with their links. A good answer comes from a `search` call (the client shows the tool call) and links to pages you may not have seen before. ## 3. Tell it when to search Msty has no setting we could find that turns its own web search off, so say which search to use. Add this line to your persona's prompt: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## 4. Check it works **Test tool** lists the server's tools. In a conversation, the toolset selector shows it. With a key you should see `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them); with no key, fewer, `search` and `list_sources` among them. ## The server One address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. A key is optional. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | ## Related - [MCP server](https://millionshort.com/docs/mcp): the address, every tool, and what the no-key mode allows. - [Filters for agents](https://millionshort.com/docs/search/filters): what to ask `search` for, with recipes. - More chat apps: [Claude](https://millionshort.com/docs/integrations/claude), [ChatGPT](https://millionshort.com/docs/integrations/chatgpt), [Open WebUI](https://millionshort.com/docs/integrations/open-webui), [LibreChat](https://millionshort.com/docs/integrations/librechat), and [every integration](https://millionshort.com/docs/integrations). - Msty's own documentation, read on 2026-11-19: [Tools (Msty Studio 3)](https://docs.msty.ai/studio/v3/toolbox/tools). --- Source: https://millionshort.com/docs/integrations/n8n Section: Build with # n8n MillionShort search as a step in n8n, through the hosted MCP server or the API. MCP · Hosted MCP server, nothing to install · Key in a form field · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. > **Node coming soon.** A MillionShort node for n8n is not published yet. Everything below works today without it. ## 1. Add the MCP server For an **AI Agent** node: click **+** under **Tool**, choose **MCP Client Tool**, and set: ```text With a key Endpoint: https://mcp.millionshort.com/mcp Server Transport: HTTP Streamable Authentication: Bearer Auth Credential: a new Bearer Auth credential, Bearer Token = ms-YOUR_API_KEY Tools to Include: All ``` ```text Without a key Endpoint: https://mcp.millionshort.com/mcp Server Transport: HTTP Streamable Authentication: None ``` The **Server Transport** field came with version 1.2 of the node; n8n's docs page still shows the older single SSE field, so these names come from the node itself. ## 2. Or call the API in an HTTP step Anywhere in a workflow, an **HTTP Request** node: ```text HTTP Request node Method: POST URL: https://api.millionshort.com/v1/search Authentication: Generic Credential Type, Bearer Auth (Bearer Token = ms-YOUR_API_KEY) Send Body: on Body Content Type: JSON Specify Body: Using JSON ``` ```json JSON {"query": "{{ $json.query }}", "remove_top_sites": 1000, "num_results": 5} ``` In the next node, an expression reads the results from `$json.data.results`. Keep the key in the credential, not in the node: an exported workflow carries its nodes' fields. ## 3. Try it Ask n8n's agent, or run the step with this as the query: > Search MillionShort for forum threads about restoring a cast iron skillet, with the 1,000 most popular sites removed. List the five most useful with their links. A good answer comes from a `search` call (the client shows the tool call) and links to pages you may not have seen before. ## 4. Tell it when to search n8n's AI Agent has no search of its own and uses only the tools you attach, so say which search to use. Add this line to the AI Agent node's **System Message**: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## 5. Check it works In the MCP Client Tool node, switch **Tools to Include** to **Selected**: the server's tools are listed once the credential works. For the HTTP Request node, **Execute step** and read the output. With a key you should see `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them); with no key, fewer, `search` and `list_sources` among them. ## The server One address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. A key is optional. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | | Numbers arrive as strings | The node was made with **Import cURL**, which turns every value into a string | Set the body to **Using JSON**, as above | ## Related - [MCP server](https://millionshort.com/docs/mcp): the address, every tool, and what the no-key mode allows. - [Filters for agents](https://millionshort.com/docs/search/filters): what to ask `search` for, with recipes. - More low-code builders: [Zapier](https://millionshort.com/docs/integrations/zapier), [Make](https://millionshort.com/docs/integrations/make), [Dify](https://millionshort.com/docs/integrations/dify), [Langflow](https://millionshort.com/docs/integrations/langflow), and [every integration](https://millionshort.com/docs/integrations). - n8n's own documentation, read on 2026-11-19: [MCP Client Tool node](https://docs.n8n.io/integrations/builtin/cluster-nodes/sub-nodes/n8n-nodes-langchain.toolmcp/), [HTTP Request node](https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.httprequest/), [MCP Client Tool node (source)](https://github.com/n8n-io/n8n/blob/master/packages/@n8n/nodes-langchain/nodes/mcp/McpClientTool/McpClientTool.node.ts). --- Source: https://millionshort.com/docs/integrations/nanobot Section: Build with # nanobot MillionShort search in nanobot, through the hosted MCP server. MCP · Hosted MCP server, nothing to install · Key read from the environment · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. ## 1. Add the server Add the server under `tools.mcpServers` in `~/.nanobot/config.json`. nanobot fills in `${MILLIONSHORT_API_KEY}` from the environment it starts in: ```json With a key { "tools": { "mcpServers": { "millionshort": { "type": "streamableHttp", "url": "https://mcp.millionshort.com/mcp", "headers": { "Authorization": "Bearer ${MILLIONSHORT_API_KEY}" } } } } } ``` ```json Without a key { "tools": { "mcpServers": { "millionshort": { "type": "streamableHttp", "url": "https://mcp.millionshort.com/mcp" } } } } ``` In the web UI (`nanobot webui`) the same is **Apps**, **MCP**, **Add MCP server**, **Custom**, **HTTP**. ## 2. Try it Ask nanobot: > Search MillionShort for forum threads about restoring a cast iron skillet, with the 1,000 most popular sites removed. List the five most useful with their links. A good answer comes from a `search` call (the client shows the tool call) and links to pages you may not have seen before. ## 3. Turn off the built-in search nanobot's own web tools are on by default. Turn them off in the same file (or in the web UI under **Settings**, **Capabilities**, **Web access**): ```json ~/.nanobot/config.json { "tools": { "web": { "enable": false } } } ``` Add this line to the agent's instructions: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## 4. Check it works Run `nanobot gateway --verbose` and look for the server's tools in the registration log. In the web UI, **Apps**, **MCP** shows the server connected. With a key you should see `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them); with no key, fewer, `search` and `list_sources` among them. ## The server One address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. A key is optional. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | ## Related - [MCP server](https://millionshort.com/docs/mcp): the address, every tool, and what the no-key mode allows. - [Filters for agents](https://millionshort.com/docs/search/filters): what to ask `search` for, with recipes. - More research & rag: [GPT Researcher](https://millionshort.com/docs/integrations/gpt-researcher), [Hermes Agent](https://millionshort.com/docs/integrations/hermes-agent), [OpenClaw](https://millionshort.com/docs/integrations/openclaw), [Onyx](https://millionshort.com/docs/integrations/onyx), and [every integration](https://millionshort.com/docs/integrations). - nanobot's own documentation, read on 2026-11-19: [Configuration](https://github.com/HKUDS/nanobot/blob/main/docs/configuration.md), [MCP tools](https://github.com/HKUDS/nanobot/blob/main/docs/guides/configure-mcp-tools.md), [Web search](https://github.com/HKUDS/nanobot/blob/main/docs/guides/configure-web-search.md). --- Source: https://millionshort.com/docs/integrations/nemo-agent-toolkit Section: Build with # NVIDIA NeMo Agent Toolkit MillionShort search in a NeMo Agent Toolkit workflow, as an MCP client in the workflow's YAML. MCP · YAML workflow config · Nothing of ours to install · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. The toolkit's `mcp_client` function group connects a workflow to an MCP server, finds its tools and registers them as functions. Point one at the MillionShort MCP server and list the group in the agent's `tool_names`, and the agent gets the server's tools: `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints, such as `extract`, `places`, `map` and `crawl` ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them all). Everything is in the workflow's YAML file. ## 1. Install ```bash uv pip install "nvidia-nat[mcp,langchain]" export MILLIONSHORT_API_KEY=ms-YOUR_API_KEY ``` The `mcp` extra is the MCP client; the `langchain` extra brings the `react_agent` workflow used below. The NIM model in the example reads your key from NVIDIA_API_KEY; any LLM the toolkit supports works. Get a MillionShort key in the [dashboard](https://millionshort.com/app/). ## 2. Connect the server Add an `mcp_client` function group with the streamable HTTP transport. The key comes from an `api_key` authentication provider, which sends `Authorization: Bearer ` (its default scheme). The toolkit fills `${MILLIONSHORT_API_KEY}` from the environment when it loads the file. ```yaml config.yml authentication: millionshort_auth: _type: api_key raw_key: ${MILLIONSHORT_API_KEY} function_groups: millionshort: _type: mcp_client server: transport: streamable-http url: "https://mcp.millionshort.com/mcp" auth_provider: millionshort_auth ``` Without a key, leave out the `authentication` block and the `auth_provider` line (the provider refuses an empty key). Release 1.9.0 also takes headers directly on the server, for streamable HTTP only. The toolkit's MCP client page does not list this option yet; it is in the client's configuration model: ```yaml config.yml function_groups: millionshort: _type: mcp_client server: transport: streamable-http url: "https://mcp.millionshort.com/mcp" custom_headers: Authorization: "Bearer ${MILLIONSHORT_API_KEY}" ``` ## 3. Give the tools to an agent Name the function group in the workflow's `tool_names`, and the agent gets every tool the server lists. A complete file: ```yaml config.yml authentication: millionshort_auth: _type: api_key raw_key: ${MILLIONSHORT_API_KEY} function_groups: millionshort: _type: mcp_client server: transport: streamable-http url: "https://mcp.millionshort.com/mcp" auth_provider: millionshort_auth llms: nim_llm: _type: nim model_name: nvidia/nemotron-3.5-lightning-30b-a3b temperature: 0.0 workflow: _type: react_agent tool_names: - millionshort llm_name: nim_llm verbose: true ``` Then run it: ```bash nat run --config_file config.yml --input "Find independent blogs about home espresso, without the 1,000 most popular sites." ``` To give the agent only some tools, add `include:` with tool names under the function group; `tool_overrides` renames a tool or changes its description. ## 4. Check it works `nat validate --config_file config.yml` checks the file. To list the server's tools from the command line: ```bash nat mcp client tool list --url https://mcp.millionshort.com/mcp ``` That command has no option for a bearer key, so it connects in the no-key mode and lists fewer tools, `search` and `list_sources` among them; with the key, the workflow also gets `get_domain_info` and the rest. Inside the workflow, the tools are named after the group: `millionshort__search`, and so on. With `verbose: true`, `nat run` logs each tool call. If the agent answers from memory, say when to search in its instructions: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## MCP configuration The same address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Settings | Variable | Meaning | |---|---| | `MILLIONSHORT_API_KEY` | Your key, read into `config.yml` as `${MILLIONSHORT_API_KEY}`. Leave the authentication out for the no-key mode | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | | `nat validate` rejects `react_agent` | The LangChain plugin is not installed | `uv pip install "nvidia-nat[mcp,langchain]"` | | The `api_key` provider rejects the key | MILLIONSHORT_API_KEY is empty or unset, so `raw_key` is too short | Export the key, or use the no-key form | | `custom_headers` is rejected | It works only with `transport: streamable-http`, and only in releases that have it | Use the `api_key` provider instead | ## Related - [Agent tool use](https://millionshort.com/docs/search/guides/agent-tool-use): when to give a model tools, and what to tell it. - [LangChain](https://millionshort.com/docs/integrations/langchain) and [CAMEL-AI](https://millionshort.com/docs/integrations/camel-ai): the same server in other Python frameworks. - [MCP server](https://millionshort.com/docs/mcp) and [Filters for agents](https://millionshort.com/docs/search/filters). - The toolkit's own documentation, read on 2026-11-19: [NeMo Agent Toolkit as an MCP client](https://docs.nvidia.com/nemo/agent-toolkit/latest/build-workflows/mcp-client.html), [Installation](https://docs.nvidia.com/nemo/agent-toolkit/latest/get-started/installation.html), and the `api_key` authentication provider and MCP client configuration in the [toolkit's repository](https://github.com/NVIDIA/NeMo-Agent-Toolkit). --- Source: https://millionshort.com/docs/integrations/ollama Section: Build with # Ollama MillionShort search for local models in Ollama, as a function tool in Python and TypeScript. Recipe · Python and TypeScript · Nothing of ours to install · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. Ollama's libraries take tools in `chat`: the model asks for a call, your code runs the search, and the loop sends the results back until the model answers. The model must support tools; Ollama's own examples use `qwen3`. The model runs on your machine, and only the search goes out to MillionShort. ## 1. Install ```bash Python pip install ollama requests export MILLIONSHORT_API_KEY=ms-YOUR_API_KEY ``` ```bash TypeScript npm install ollama export MILLIONSHORT_API_KEY=ms-YOUR_API_KEY ``` Pull a model that supports tools before you start (`ollama pull qwen3`). Both libraries talk to your Ollama with their default settings, so the examples set no address. Get a MillionShort key in the [dashboard](https://millionshort.com/app/); an agent can ask for a [trial key](https://millionshort.com/docs/api-reference/agent-key) by itself. ## 2. Minimal example ```python Python import json import os import requests from ollama import chat def millionshort_search(query: str) -> str: """Search the web with MillionShort, leaving out the 1,000 most popular sites. Args: query: What to search for. """ r = requests.post( "https://api.millionshort.com/v1/search", headers={"Authorization": f"Bearer {os.environ['MILLIONSHORT_API_KEY']}"}, json={"query": query, "remove_top_sites": 1000, "num_results": 5}, timeout=30, ) r.raise_for_status() return json.dumps([{"title": x["title"], "url": x["url"], "snippet": x.get("snippet")} for x in r.json()["data"]["results"]]) messages = [{"role": "user", "content": "Find independent blogs about home espresso."}] while True: response = chat(model="qwen3", messages=messages, tools=[millionshort_search]) messages.append(response.message) if not response.message.tool_calls: break for call in response.message.tool_calls: result = millionshort_search(**call.function.arguments) messages.append({"role": "tool", "tool_name": call.function.name, "content": result}) print(response.message.content) ``` ```ts TypeScript import ollama, { type Message } from 'ollama'; async function millionshortSearch(query: string): Promise { const res = await fetch('https://api.millionshort.com/v1/search', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json' }, body: JSON.stringify({ query, remove_top_sites: 1000, num_results: 5 }), }); if (!res.ok) throw new Error(`search failed: ${res.status}`); const { data } = (await res.json()) as { data: { results: { title: string; url: string; snippet?: string }[] } }; return JSON.stringify(data.results.map(({ title, url, snippet }) => ({ title, url, snippet }))); } const tools = [{ type: 'function', function: { name: 'millionshort_search', description: 'Search the web with MillionShort, leaving out the 1,000 most popular sites.', parameters: { type: 'object', required: ['query'], properties: { query: { type: 'string', description: 'What to search for' } } }, } }]; const messages: Message[] = [{ role: 'user', content: 'Find independent blogs about home espresso.' }]; while (true) { const response = await ollama.chat({ model: 'qwen3', messages, tools }); messages.push(response.message); const calls = response.message.tool_calls ?? []; if (calls.length === 0) { console.log(response.message.content); break; } for (const call of calls) { const content = await millionshortSearch(String(call.function.arguments.query)); messages.push({ role: 'tool', tool_name: call.function.name, content }); } } ``` The Python library builds the tool's schema from the function's type hints and its docstring (with the `Args:` section), so keep both. A model can ask for several searches in one turn; the loop runs each of them. Models that think, such as `qwen3`, also take `think=True` (`think: true`), as in Ollama's examples. ## 3. Tell it when to search Ollama searches nothing unless your code does, so there is no built-in search to turn off. Small models call tools less readily: add a system message with a line like this: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## 4. Check it works Run the example, then ask: > Search MillionShort for forum threads about restoring a cast iron skillet, with the 1,000 most popular sites removed. List the five most useful with their links. After the first `chat` call, `response.message.tool_calls` should name `millionshort_search` with a `query`. If it is empty every time, the model probably does not support tools: try another. ## Tools The function tool above is `search` alone. For the server's other tools as well ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them), run Ollama behind an agent framework that speaks MCP and connect our [MCP server](https://millionshort.com/docs/mcp): | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Settings | Variable | Meaning | |---|---| | `MILLIONSHORT_API_KEY` | Your key, read by the examples above | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. The model itself runs on your machine and costs nothing per call. ## When it fails | What you see | Why | Fix | |---|---|---| | `401 AUTH_MISSING_KEY` or `AUTH_INVALID_KEY` | The key is missing or wrong | Set `MILLIONSHORT_API_KEY`; keys start with `ms-` | | `400 INVALID_PARAM` | A field name or value the API does not take | The `message` names the field; the [search reference](https://millionshort.com/docs/search/parameters) lists them all | | `429 RATE_LIMITED` or `CAPACITY` | Too many calls a minute, or no free capacity right now | Wait the `Retry-After` seconds, then retry | | `429 INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; do not retry | | The model never calls the tool | The model does not support tools, or nothing told it when to search | Pull a model that does, such as `qwen3` | | The call to the model cannot connect | Ollama is not running, or runs somewhere other than the libraries' default | Start Ollama, or pass its address to the client as Ollama's library docs describe | ## Related - [Agent tool use](https://millionshort.com/docs/search/guides/agent-tool-use): when to give a model tools, and what to tell it. - Local models elsewhere: [LM Studio](https://millionshort.com/docs/integrations/lm-studio), [Open WebUI](https://millionshort.com/docs/integrations/open-webui), [AnythingLLM](https://millionshort.com/docs/integrations/anythingllm). - Other model APIs: [OpenRouter](https://millionshort.com/docs/integrations/openrouter), [Gemini](https://millionshort.com/docs/integrations/gemini), [Mistral](https://millionshort.com/docs/integrations/mistral). - [Search API reference](https://millionshort.com/docs/search/parameters) and [MCP server](https://millionshort.com/docs/mcp). - Ollama's own documentation, read on 2026-11-19: [Tool calling](https://docs.ollama.com/capabilities/tool-calling). --- Source: https://millionshort.com/docs/integrations/onyx Section: Build with # Onyx MillionShort search in Onyx, through the hosted MCP server. MCP · Hosted MCP server, nothing to install · Key in a form field · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. ## 1. Add the server An admin adds the server: 1. **Admin Panel**, **Plugins**, **Add**, **MCP**, **Add custom MCP server** (before Onyx 5.0, MCP servers had their own admin page). 2. Server name `millionshort`, MCP server URL `https://mcp.millionshort.com/mcp`. Onyx checks the address. 3. Choose who may use it, and whether it is on in the default chat. 4. **Authentication Method**: **API Key**, shared by everyone, with your key (Onyx sends it as `Authorization: Bearer`); or each user's own; or **No authentication** for the no-key mode. 5. **Connect**: Onyx lists the tools. Leave the transport on Streamable HTTP. ## 2. Try it Ask Onyx: > Search MillionShort for forum threads about restoring a cast iron skillet, with the 1,000 most popular sites removed. List the five most useful with their links. A good answer comes from a `search` call (the client shows the tool call) and links to pages you may not have seen before. ## 3. Use only this search Onyx's own web search appears only once an admin connects a search engine under **Admin Panel**, **Web Search**. Leave that unset and its assistants search with `millionshort`. Add this line to the assistant's instructions: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## 4. Check it works After **Connect**, the server's **Tools** tab lists the tools. In a chat, each search shows as a tool step. With a key you should see `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them); with no key, fewer, `search` and `list_sources` among them. ## The server One address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. A key is optional. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | ## Related - [MCP server](https://millionshort.com/docs/mcp): the address, every tool, and what the no-key mode allows. - [Filters for agents](https://millionshort.com/docs/search/filters): what to ask `search` for, with recipes. - More research & rag: [GPT Researcher](https://millionshort.com/docs/integrations/gpt-researcher), [Hermes Agent](https://millionshort.com/docs/integrations/hermes-agent), [OpenClaw](https://millionshort.com/docs/integrations/openclaw), [nanobot](https://millionshort.com/docs/integrations/nanobot), and [every integration](https://millionshort.com/docs/integrations). - Onyx's own documentation, read on 2026-11-19: [MCP](https://docs.onyx.app/admins/plugins/mcp), [Web search](https://docs.onyx.app/admins/actions/web_search). --- Source: https://millionshort.com/docs/integrations/open-webui Section: Build with # Open WebUI MillionShort search in Open WebUI, through the hosted MCP server. MCP · Hosted MCP server, nothing to install · Key in a form field · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. ## 1. Add the server Open WebUI 0.6.31 or later; an admin adds the server: 1. **Settings**, **Integrations** (admin section), **External Tool Servers**, **+ Add Connection**. 2. **Type**: **MCP (Streamable HTTP)**, not OpenAPI. **URL**: `https://mcp.millionshort.com/mcp`. 3. **Auth**: **Bearer**, with your key in **Key**. For the no-key mode choose **None**: Bearer with an empty key sends an empty header. 4. **Save**. Under access control, choose which users and groups may use it. The model needs reliable native tool calling. ## 2. Try it Ask Open WebUI: > Search MillionShort for forum threads about restoring a cast iron skillet, with the 1,000 most popular sites removed. List the five most useful with their links. A good answer comes from a `search` call (the client shows the tool call) and links to pages you may not have seen before. ## 3. Turn off the built-in search Turn Open WebUI's own search off for everyone under admin **Settings**, **Web Search**, **Enable Web Search**, or for one model under its **Capabilities**. In a chat, switch its web search toggle off. Add this line to the model's system prompt (**Workspace**, **Models**): > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## 4. Check it works The connection's verify button reports success. In a chat, the tools menu lists the server's tools, named with the connection's id first. With a key you should see `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them); with no key, fewer, `search` and `list_sources` among them. ## The server One address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. A key is optional. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | ## Related - [MCP server](https://millionshort.com/docs/mcp): the address, every tool, and what the no-key mode allows. - [Filters for agents](https://millionshort.com/docs/search/filters): what to ask `search` for, with recipes. - More chat apps: [Claude](https://millionshort.com/docs/integrations/claude), [ChatGPT](https://millionshort.com/docs/integrations/chatgpt), [LibreChat](https://millionshort.com/docs/integrations/librechat), [AnythingLLM](https://millionshort.com/docs/integrations/anythingllm), and [every integration](https://millionshort.com/docs/integrations). - Open WebUI's own documentation, read on 2026-11-19: [MCP](https://docs.openwebui.com/features/extensibility/mcp), [Agentic search](https://docs.openwebui.com/features/chat-conversations/web-search/agentic-search). --- Source: https://millionshort.com/docs/integrations/openai Section: Build with # OpenAI MillionShort search in the OpenAI Responses API, as a remote MCP tool or a function tool, in Python and TypeScript. MCP · Python and TypeScript · Nothing of ours to install · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. The Responses API connects to the MillionShort MCP server for you: list it as an `mcp` tool and OpenAI's servers call the server's tools (`search`, `get_domain_info`, `list_sources` and the tools of the other endpoints; [the MCP page](https://millionshort.com/docs/mcp#tools) lists them all) while the model works, all in one request. If you would rather run the search yourself, a function tool that calls the API does the same job. ## 1. Install ```bash Python pip install openai requests export MILLIONSHORT_API_KEY=ms-YOUR_API_KEY ``` ```bash TypeScript npm install openai export MILLIONSHORT_API_KEY=ms-YOUR_API_KEY ``` The SDK reads your OpenAI key from OPENAI_API_KEY. Get a MillionShort key in the [dashboard](https://millionshort.com/app/); an agent can ask for a [trial key](https://millionshort.com/docs/api-reference/agent-key) by itself. `requests` is only for the function tool further down. ## 2. Connect the server Add the server as an `mcp` tool, with the key in its `authorization` field. OpenAI does not store that field's value and does not show it in the response object (a key in `headers` gets no such promise), so send it with every request. Without a key, leave `authorization` out. ```python Python import os from openai import OpenAI client = OpenAI() response = client.responses.create( model="gpt-6.2-astra", input="Find independent blogs about home espresso, without the 1,000 most popular sites.", tools=[ { "type": "mcp", "server_label": "millionshort", "server_description": "Web search that can leave out the most popular sites.", "server_url": "https://mcp.millionshort.com/mcp", "authorization": os.environ["MILLIONSHORT_API_KEY"], "require_approval": "never", } ], ) print(response.output_text) ``` ```ts TypeScript import OpenAI from 'openai'; const client = new OpenAI(); const response = await client.responses.create({ model: 'gpt-6.2-astra', input: 'Find independent blogs about home espresso, without the 1,000 most popular sites.', tools: [ { type: 'mcp', server_label: 'millionshort', server_description: 'Web search that can leave out the most popular sites.', server_url: 'https://mcp.millionshort.com/mcp', authorization: process.env.MILLIONSHORT_API_KEY, require_approval: 'never', }, ], }); console.log(response.output_text); ``` `require_approval` defaults to `always`; with `never`, every tool of the server runs without asking. Most of them only read; `crawl` spends credits, `crawl_cancel` stops a crawl and `create_space` saves a Space, so keep `always` if the model should not do those unasked. OpenAI's servers make the calls, so our server must be reachable from the internet, which it is. ## 3. Tell it when to search Built-in web search is a separate tool in the Responses API: it runs only when you list it in `tools`, so leave it out. Then put a line like this in the request's `instructions`: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. To offer only some of the tools, add `"allowed_tools": ["search", "list_sources"]` to the `mcp` tool. ## 4. Check it works The response's `output` holds an `mcp_list_tools` item with the server's tools, then one `mcp_call` item per tool call. Print them: ```python Python import os from openai import OpenAI server = {"type": "mcp", "server_label": "millionshort", "server_url": "https://mcp.millionshort.com/mcp", "require_approval": "never", "authorization": os.environ["MILLIONSHORT_API_KEY"]} response = OpenAI().responses.create(model="gpt-6.2-astra", input="Search for home espresso blogs.", tools=[server]) for item in response.output: if item.type == "mcp_list_tools": print([tool.name for tool in item.tools]) # search, get_domain_info, list_sources, ... elif item.type == "mcp_call": print(item.name, item.arguments) ``` ```ts TypeScript import OpenAI from 'openai'; const response = await new OpenAI().responses.create({ model: 'gpt-6.2-astra', input: 'Search for home espresso blogs.', tools: [{ type: 'mcp', server_label: 'millionshort', server_url: 'https://mcp.millionshort.com/mcp', require_approval: 'never', authorization: process.env.MILLIONSHORT_API_KEY }], }); for (const item of response.output) { if (item.type === 'mcp_list_tools') console.log(item.tools.map((tool) => tool.name)); else if (item.type === 'mcp_call') console.log(item.name, item.arguments); } ``` With no key you see two tools, `search` and `list_sources`. To try it, ask: > Search MillionShort for forum threads about restoring a cast iron skillet, with the 1,000 most popular sites removed. List the five most useful with their links. ## Without MCP: a function tool Your code runs the search and hands the results back, so this works wherever the Responses API runs, and our server need not be reachable from OpenAI. The loop ends when the model stops asking for the tool. ```python Python import json import os import requests from openai import OpenAI def millionshort_search(query: str) -> str: r = requests.post( "https://api.millionshort.com/v1/search", headers={"Authorization": f"Bearer {os.environ['MILLIONSHORT_API_KEY']}"}, json={"query": query, "remove_top_sites": 1000, "num_results": 5}, timeout=30, ) r.raise_for_status() return json.dumps([{"title": x["title"], "url": x["url"], "snippet": x.get("snippet")} for x in r.json()["data"]["results"]]) tools = [{ "type": "function", "name": "millionshort_search", "description": "Search the web with MillionShort, leaving out the 1,000 most popular sites.", "parameters": {"type": "object", "properties": {"query": {"type": "string"}}, "required": ["query"], "additionalProperties": False}, "strict": True, }] client = OpenAI() items = [{"role": "user", "content": "Find independent blogs about home espresso."}] while True: response = client.responses.create(model="gpt-6.2-astra", tools=tools, input=items) items += response.output calls = [item for item in response.output if item.type == "function_call"] if not calls: break for call in calls: items.append({"type": "function_call_output", "call_id": call.call_id, "output": millionshort_search(**json.loads(call.arguments))}) print(response.output_text) ``` ```ts TypeScript import OpenAI from 'openai'; import { toResponseInputItems } from 'openai/lib/responses/ResponseInputItems'; async function millionshortSearch(query: string): Promise { const res = await fetch('https://api.millionshort.com/v1/search', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json' }, body: JSON.stringify({ query, remove_top_sites: 1000, num_results: 5 }), }); if (!res.ok) throw new Error(`search failed: ${res.status}`); const { data } = (await res.json()) as { data: { results: { title: string; url: string; snippet?: string }[] } }; return JSON.stringify(data.results.map(({ title, url, snippet }) => ({ title, url, snippet }))); } const tools: OpenAI.Responses.Tool[] = [{ type: 'function', name: 'millionshort_search', description: 'Search the web with MillionShort, leaving out the 1,000 most popular sites.', parameters: { type: 'object', properties: { query: { type: 'string' } }, required: ['query'], additionalProperties: false }, strict: true, }]; const client = new OpenAI(); const input: OpenAI.Responses.ResponseInput = [{ role: 'user', content: 'Find independent blogs about home espresso.' }]; while (true) { const response = await client.responses.create({ model: 'gpt-6.2-astra', tools, input }); input.push(...toResponseInputItems(response.output)); const calls = response.output.filter((item) => item.type === 'function_call'); if (calls.length === 0) { console.log(response.output_text); break; } for (const call of calls) { input.push({ type: 'function_call_output', call_id: call.call_id, output: await millionshortSearch(JSON.parse(call.arguments).query) }); } } ``` ## MCP configuration The same address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Settings | Variable | Meaning | |---|---| | `MILLIONSHORT_API_KEY` | Your key, read by the examples above. Leave the header out for the no-key mode | | OPENAI_API_KEY | Your OpenAI key, read by the SDK | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. On OpenAI's side you pay for the tokens that importing the tool list and making the calls use; OpenAI charges no fee per tool call. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | | Nothing is called and the output has an `mcp_approval_request` | `require_approval` was left at its default, `always` | Set `"require_approval": "never"` | | The MCP tool fails, the function tool works | OpenAI's servers could not reach ours, or the model does not take MCP tools | Try again, or use the function tool | ## Related - [Agent tool use](https://millionshort.com/docs/search/guides/agent-tool-use): when to give a model tools, and what to tell it. - [OpenAI Agents SDK](https://millionshort.com/docs/integrations/openai-agents): the same server with an agent framework on top. - Other model APIs: [Anthropic](https://millionshort.com/docs/integrations/anthropic), [Gemini](https://millionshort.com/docs/integrations/gemini), [Groq](https://millionshort.com/docs/integrations/groq), [xAI](https://millionshort.com/docs/integrations/xai), [OpenRouter](https://millionshort.com/docs/integrations/openrouter). - [MCP server](https://millionshort.com/docs/mcp) and [Filters for agents](https://millionshort.com/docs/search/filters). - OpenAI's own documentation, read on 2026-11-19: [MCP and connectors](https://developers.openai.com/api/docs/guides/tools-connectors-mcp), [Function calling](https://developers.openai.com/api/docs/guides/function-calling), [Create a response](https://developers.openai.com/api/reference/resources/responses/methods/create). --- Source: https://millionshort.com/docs/integrations/openai-agents Section: Build with # OpenAI Agents SDK MillionShort search for agents built with the OpenAI Agents SDK, in Python and TypeScript. MCP · Python and TypeScript · Nothing of ours to install · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. The SDK connects to the MillionShort MCP server in two ways: your process connects to it (`MCPServerStreamableHttp`), or OpenAI's servers connect to it for the model (`HostedMCPTool`, Responses API models only). Either way the agent gets the server's tools: `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints, such as `extract`, `places`, `map` and `crawl` ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them all). With no MCP at all, a function tool that calls the API does the same job. ## 1. Install ```bash Python pip install openai-agents export MILLIONSHORT_API_KEY=ms-YOUR_API_KEY ``` ```bash TypeScript npm install @openai/agents zod export MILLIONSHORT_API_KEY=ms-YOUR_API_KEY ``` The SDK reads your OpenAI key from the OPENAI_API_KEY environment variable. Get a MillionShort key in the [dashboard](https://millionshort.com/app/); an agent can ask for a [trial key](https://millionshort.com/docs/api-reference/agent-key) by itself. ## 2. Connect the server Your process opens the connection, lists the tools and calls them for the agent. Without a key, leave the headers out. ```python Python import asyncio import os from agents import Agent, Runner from agents.mcp import MCPServerStreamableHttp async def main(): async with MCPServerStreamableHttp( name="millionshort", params={ "url": "https://mcp.millionshort.com/mcp", "headers": {"Authorization": f"Bearer {os.environ['MILLIONSHORT_API_KEY']}"}, }, cache_tools_list=True, ) as server: agent = Agent( name="Researcher", instructions="Use the millionshort search tool for anything recent or niche, and cite the URLs.", mcp_servers=[server], ) result = await Runner.run(agent, "Find independent blogs about home espresso, without the 1,000 most popular sites.") print(result.final_output) asyncio.run(main()) ``` ```ts TypeScript import { Agent, MCPServerStreamableHttp, run } from '@openai/agents'; const server = new MCPServerStreamableHttp({ name: 'millionshort', url: 'https://mcp.millionshort.com/mcp', requestInit: { headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}` } }, }); const agent = new Agent({ name: 'Researcher', instructions: 'Use the millionshort search tool for anything recent or niche, and cite the URLs.', mcpServers: [server], }); await server.connect(); try { const result = await run(agent, 'Find independent blogs about home espresso, without the 1,000 most popular sites.'); console.log(result.finalOutput); } finally { await server.close(); } ``` ## 3. Or let OpenAI connect for you With a model on the Responses API, a hosted MCP tool has OpenAI's servers call ours, so your process holds no connection. The SDK passes `authorization` on as the bearer key. ```python Python import os from agents import Agent, HostedMCPTool, Runner agent = Agent( name="Researcher", tools=[ HostedMCPTool( tool_config={ "type": "mcp", "server_label": "millionshort", "server_url": "https://mcp.millionshort.com/mcp", "authorization": os.environ["MILLIONSHORT_API_KEY"], "require_approval": "never", } ) ], ) print(Runner.run_sync(agent, "Find independent blogs about home espresso.").final_output) ``` ```ts TypeScript import { Agent, hostedMcpTool, run } from '@openai/agents'; const agent = new Agent({ name: 'Researcher', tools: [ hostedMcpTool({ serverLabel: 'millionshort', serverUrl: 'https://mcp.millionshort.com/mcp', authorization: process.env.MILLIONSHORT_API_KEY, requireApproval: 'never', }), ], }); console.log((await run(agent, 'Find independent blogs about home espresso.')).finalOutput); ``` With `require_approval` set to `never`, every tool of the server runs without asking. Most of them only read; `crawl` spends credits, `crawl_cancel` stops a crawl and `create_space` saves a Space, so keep approval on if the model should not do those unasked. ## 4. Check it works Run the example: the answer should cite pages, and the run's items include a call to `search`. To see the tools without a model, list them from the connected server: ```python Python import asyncio import os from agents.mcp import MCPServerStreamableHttp async def main(): params = {"url": "https://mcp.millionshort.com/mcp", "headers": {"Authorization": f"Bearer {os.environ['MILLIONSHORT_API_KEY']}"}} async with MCPServerStreamableHttp(name="millionshort", params=params) as server: print([tool.name for tool in await server.list_tools()]) # search, get_domain_info, list_sources, ... asyncio.run(main()) ``` If the model answers from memory, say when to search in its instructions: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## Without MCP: a function tool A plain function that calls `POST /v1/search` works with any model the SDK runs: ```python Python import json import os import urllib.request from agents import Agent, Runner, function_tool @function_tool def millionshort_search(query: str, remove_top_sites: int = 1000, num_results: int = 5) -> str: """Search the web with MillionShort. remove_top_sites leaves out the N most popular sites.""" request = urllib.request.Request( "https://api.millionshort.com/v1/search", data=json.dumps({"query": query, "remove_top_sites": remove_top_sites, "num_results": num_results}).encode(), headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"], "Content-Type": "application/json"}, ) with urllib.request.urlopen(request, timeout=30) as response: results = json.load(response)["data"]["results"] return json.dumps([{"title": r["title"], "url": r["url"], "snippet": r.get("snippet")} for r in results]) agent = Agent(name="Researcher", tools=[millionshort_search]) print(Runner.run_sync(agent, "Find independent blogs about home espresso.").final_output) ``` ```ts TypeScript import { Agent, run, tool } from '@openai/agents'; import { z } from 'zod'; const millionshortSearch = tool({ name: 'millionshort_search', description: 'Search the web with MillionShort. remove_top_sites leaves out the N most popular sites.', parameters: z.object({ query: z.string(), remove_top_sites: z.number().int().default(1000) }), execute: async ({ query, remove_top_sites }) => { const res = await fetch('https://api.millionshort.com/v1/search', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json' }, body: JSON.stringify({ query, remove_top_sites, num_results: 5 }), }); if (!res.ok) throw new Error(`search failed: ${res.status}`); const { data } = (await res.json()) as { data: { results: { title: string; url: string; snippet?: string }[] } }; return JSON.stringify(data.results.map(({ title, url, snippet }) => ({ title, url, snippet }))); }, }); const agent = new Agent({ name: 'Researcher', tools: [millionshortSearch] }); console.log((await run(agent, 'Find independent blogs about home espresso.')).finalOutput); ``` ## MCP configuration The same address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Settings | Variable | Meaning | |---|---| | `MILLIONSHORT_API_KEY` | Your key, read by the examples above. Leave the header out for the no-key mode | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | | The hosted tool fails, the local one works | `HostedMCPTool` needs a model on the Responses API, and OpenAI's servers must reach ours | Use `MCPServerStreamableHttp`, or a Responses API model | ## Related - [Agent tool use](https://millionshort.com/docs/search/guides/agent-tool-use): when to give a model tools, and what to tell it. - [OpenAI](https://millionshort.com/docs/integrations/openai): the same server in the Responses API, with no SDK. - [MCP server](https://millionshort.com/docs/mcp) and [Filters for agents](https://millionshort.com/docs/search/filters). - The SDK's own documentation, read on 2026-11-19: [MCP (Python)](https://openai.github.io/openai-agents-python/mcp/), [MCP (TypeScript)](https://openai.github.io/openai-agents-js/guides/mcp/). --- Source: https://millionshort.com/docs/integrations/openclaw Section: Build with # OpenClaw MillionShort search in OpenClaw, through the hosted MCP server. MCP · Hosted MCP server, nothing to install · Key read from the environment · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. > **Skill coming soon.** A MillionShort skill for OpenClaw is not published yet. Everything below works today without it. ## 1. Add the server Save the server with one command. OpenClaw fills in `${MILLIONSHORT_API_KEY}` from the environment; single quotes keep it as it is: ```bash With a key openclaw mcp set millionshort '{"url":"https://mcp.millionshort.com/mcp","transport":"streamable-http","headers":{"Authorization":"Bearer ${MILLIONSHORT_API_KEY}"}}' ``` ```bash Without a key openclaw mcp set millionshort '{"url":"https://mcp.millionshort.com/mcp","transport":"streamable-http"}' ``` It goes under `mcp.servers` in `~/.openclaw/openclaw.json`, which you can also edit by hand; the gateway reloads it. In the Control UI: **Settings**, **MCP**, **Add server**, then the header in the config editor below it. Do not set `auth: "oauth"`: with it, a fixed `Authorization` header is ignored. ## 2. Try it Ask OpenClaw: > Search MillionShort for forum threads about restoring a cast iron skillet, with the 1,000 most popular sites removed. List the five most useful with their links. A good answer comes from a `search` call (the client shows the tool call) and links to pages you may not have seen before. ## 3. Turn off the built-in search Turn off OpenClaw's own web search in its configuration: ```json openclaw.json { "tools": { "web": { "search": { "enabled": false } } } } ``` Add this line to the agent's instructions: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## 4. Check it works Run `openclaw mcp doctor millionshort --probe`: it checks the saved server, connects, and lists the tools. With a key you should see `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them); with no key, fewer, `search` and `list_sources` among them. ## Good to know - A MillionShort skill for ClawHub is coming. Until then the server is the whole set-up. ## The server One address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. A key is optional. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | ## Related - [MCP server](https://millionshort.com/docs/mcp): the address, every tool, and what the no-key mode allows. - [Filters for agents](https://millionshort.com/docs/search/filters): what to ask `search` for, with recipes. - More research & rag: [GPT Researcher](https://millionshort.com/docs/integrations/gpt-researcher), [Hermes Agent](https://millionshort.com/docs/integrations/hermes-agent), [Onyx](https://millionshort.com/docs/integrations/onyx), [nanobot](https://millionshort.com/docs/integrations/nanobot), and [every integration](https://millionshort.com/docs/integrations). - OpenClaw's own documentation, read on 2026-11-19: [MCP](https://github.com/openclaw/openclaw/blob/main/docs/tools/mcp.md), [MCP transports](https://github.com/openclaw/openclaw/blob/main/docs/cli/mcp/transports.md), [Web tools](https://github.com/openclaw/openclaw/blob/main/docs/tools/web.md). --- Source: https://millionshort.com/docs/integrations/opencode Section: Build with # OpenCode MillionShort search in OpenCode, through the hosted MCP server. MCP · Hosted MCP server, nothing to install · Key read from the environment · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. ## 1. Add the server Add the server to `opencode.jsonc` in your project. OpenCode fills in `{env:...}` from the environment; `oauth: false` tells it not to start a sign-in: ```json With a key { "$schema": "https://opencode.ai/config.json", "mcp": { "servers": { "millionshort": { "type": "remote", "url": "https://mcp.millionshort.com/mcp", "oauth": false, "headers": { "Authorization": "Bearer {env:MILLIONSHORT_API_KEY}" } } } } } ``` ```json Without a key { "$schema": "https://opencode.ai/config.json", "mcp": { "servers": { "millionshort": { "type": "remote", "url": "https://mcp.millionshort.com/mcp", "oauth": false } } } } ``` Or one command (single quotes keep `{env:...}` as it is; add `--global` for every project): ```bash opencode mcp add millionshort --url https://mcp.millionshort.com/mcp \ --header 'Authorization=Bearer {env:MILLIONSHORT_API_KEY}' ``` This is the format of OpenCode's current docs (`mcp.servers`). Older releases took a flat `mcp.` with `enabled: true`. ## 2. Try it Ask OpenCode: > Search MillionShort for forum threads about restoring a cast iron skillet, with the 1,000 most popular sites removed. List the five most useful with their links. A good answer comes from a `search` call (the client shows the tool call) and links to pages you may not have seen before. ## 3. Turn off the built-in search Turn off OpenCode's web search and deny its fetch tool in the same `opencode.jsonc`: ```json opencode.jsonc { "$schema": "https://opencode.ai/config.json", "websearch": false, "permissions": [ { "action": "webfetch", "resource": "*", "effect": "deny" } ] } ``` Add this line to `AGENTS.md`: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## 4. Check it works Run `opencode mcp list`: it shows `millionshort connected`. Inside OpenCode, `/mcps`. With a key you should see `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them); with no key, fewer, `search` and `list_sources` among them. ## The server One address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. A key is optional. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | ## Related - [MCP server](https://millionshort.com/docs/mcp): the address, every tool, and what the no-key mode allows. - [Filters for agents](https://millionshort.com/docs/search/filters): what to ask `search` for, with recipes. - More coding agents: [Claude Code](https://millionshort.com/docs/integrations/claude-code), [Cursor](https://millionshort.com/docs/integrations/cursor), [Codex](https://millionshort.com/docs/integrations/codex), [GitHub Copilot in VS Code](https://millionshort.com/docs/integrations/vscode), and [every integration](https://millionshort.com/docs/integrations). - OpenCode's own documentation, read on 2026-11-19: [MCP servers](https://opencode.ai/docs/mcp-servers/), [Web search](https://opencode.ai/docs/websearch), [Permissions](https://opencode.ai/docs/permissions). --- Source: https://millionshort.com/docs/integrations/openrouter Section: Build with # OpenRouter MillionShort search for any OpenRouter model that takes tools, as a function tool in Python or a tool and the hosted MCP server in OpenRouter's TypeScript Agent SDK. Recipe · Python and TypeScript · Nothing of ours to install · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. OpenRouter's API is compatible with OpenAI's, so in Python the OpenAI SDK runs a function tool loop against it. In TypeScript, OpenRouter's Agent SDK (`@openrouter/agent`) runs the loop for you, and its `@openrouter/mcp` package connects our hosted MCP server. Either way, pick a model that supports tool calling: [OpenRouter's model list](https://openrouter.ai/models?supported_parameters=tools) filters for them. ## 1. Install ```bash Python pip install openai requests export MILLIONSHORT_API_KEY=ms-YOUR_API_KEY ``` ```bash TypeScript npm install @openrouter/agent @openrouter/mcp zod export MILLIONSHORT_API_KEY=ms-YOUR_API_KEY ``` The examples read your OpenRouter key from OPENROUTER_API_KEY. Get a MillionShort key in the [dashboard](https://millionshort.com/app/); an agent can ask for a [trial key](https://millionshort.com/docs/api-reference/agent-key) by itself. ## 2. Minimal example ```python Python import json import os import requests from openai import OpenAI def millionshort_search(query: str) -> str: r = requests.post( "https://api.millionshort.com/v1/search", headers={"Authorization": f"Bearer {os.environ['MILLIONSHORT_API_KEY']}"}, json={"query": query, "remove_top_sites": 1000, "num_results": 5}, timeout=30, ) r.raise_for_status() return json.dumps([{"title": x["title"], "url": x["url"], "snippet": x.get("snippet")} for x in r.json()["data"]["results"]]) tools = [{ "type": "function", "name": "millionshort_search", "description": "Search the web with MillionShort, leaving out the 1,000 most popular sites.", "parameters": {"type": "object", "properties": {"query": {"type": "string"}}, "required": ["query"]}, }] client = OpenAI(base_url="https://openrouter.ai/api/v1", api_key=os.environ["OPENROUTER_API_KEY"]) items = [{"role": "user", "content": "Find independent blogs about home espresso."}] while True: response = client.responses.create(model="google/gemini-3-flash-preview", tools=tools, input=items) items += response.output calls = [item for item in response.output if item.type == "function_call"] if not calls: break for call in calls: items.append({"type": "function_call_output", "call_id": call.call_id, "output": millionshort_search(**json.loads(call.arguments))}) print(response.output_text) ``` ```ts TypeScript import { OpenRouter, tool } from '@openrouter/agent'; import { callModel } from '@openrouter/agent/call-model'; import { z } from 'zod'; const millionshortSearch = tool({ name: 'millionshort_search', description: 'Search the web with MillionShort, leaving out the 1,000 most popular sites.', inputSchema: z.object({ query: z.string().describe('What to search for') }), execute: async ({ query }) => { const res = await fetch('https://api.millionshort.com/v1/search', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json' }, body: JSON.stringify({ query, remove_top_sites: 1000, num_results: 5 }), }); if (!res.ok) throw new Error(`search failed: ${res.status}`); const { data } = (await res.json()) as { data: { results: { title: string; url: string; snippet?: string }[] } }; return data.results.map(({ title, url, snippet }) => ({ title, url, snippet })); }, }); const client = new OpenRouter({ apiKey: process.env.OPENROUTER_API_KEY }); const result = callModel(client, { model: 'google/gemini-3-flash-preview', input: 'Find independent blogs about home espresso.', tools: [millionshortSearch], }); console.log(await result.getText()); ``` The Agent SDK calls the tool and feeds the result back for as many turns as the model needs. ## 3. Tell it when to search OpenRouter's own web search is a server tool (`openrouter:web_search`) that runs only when you list it in `tools`, so leave it out. Then put a line like this in `instructions` (a field of both `responses.create` and `callModel`): > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## 4. Check it works Run the example, then ask: > Search MillionShort for forum threads about restoring a cast iron skillet, with the 1,000 most popular sites removed. List the five most useful with their links. In Python, the first response's `output` has a `function_call` item named `millionshort_search`. In TypeScript, `await result.getToolCalls()` lists the calls from the first response, with their parsed arguments. ## With MCP: the hosted server `@openrouter/mcp` connects to a remote MCP server over streamable HTTP and turns its tools into Agent SDK tools, so the model gets the server's tools: `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them all). OpenRouter documents this for TypeScript only. Without a key, leave `auth` out. ```ts TypeScript import { OpenRouter } from '@openrouter/agent'; import { callModel } from '@openrouter/agent/call-model'; import { createMCPTools } from '@openrouter/mcp'; const client = new OpenRouter({ apiKey: process.env.OPENROUTER_API_KEY }); const mcp = await createMCPTools({ url: 'https://mcp.millionshort.com/mcp', auth: { kind: 'bearer', token: process.env.MILLIONSHORT_API_KEY ?? '' }, }); const result = callModel(client, { model: 'google/gemini-3-flash-preview', input: 'Find independent blogs about home espresso, without the 1,000 most popular sites.', tools: mcp.tools, }); console.log(await result.getText()); await mcp.close(); ``` ## MCP configuration The same address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | The function tool in step 2 is `search` alone; the MCP handle gives the model every tool of the server. ## Settings | Variable | Meaning | |---|---| | `MILLIONSHORT_API_KEY` | Your key, read by the examples above | | OPENROUTER_API_KEY | Your OpenRouter key, read by the examples above | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | `401 AUTH_MISSING_KEY` or `AUTH_INVALID_KEY` | The key is missing or wrong | Set `MILLIONSHORT_API_KEY`; keys start with `ms-` | | `400 INVALID_PARAM` | A field name or value the API does not take | The `message` names the field; the [search reference](https://millionshort.com/docs/search/parameters) lists them all | | `429 RATE_LIMITED` or `CAPACITY` | Too many calls a minute, or no free capacity right now | Wait the `Retry-After` seconds, then retry | | `429 INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; do not retry | | The model never calls the tool | The model does not support tool calling, or nothing told it when to search | Pick one from the model list filtered for tools, and add the line from step 3 | ## Related - [Agent tool use](https://millionshort.com/docs/search/guides/agent-tool-use): when to give a model tools, and what to tell it. - Other model APIs: [OpenAI](https://millionshort.com/docs/integrations/openai), [Anthropic](https://millionshort.com/docs/integrations/anthropic), [Gemini](https://millionshort.com/docs/integrations/gemini), [Ollama](https://millionshort.com/docs/integrations/ollama). - [Search API reference](https://millionshort.com/docs/search/parameters) and [MCP server](https://millionshort.com/docs/mcp). - OpenRouter's own documentation, read on 2026-11-19: [Tool calling](https://openrouter.ai/docs/guides/features/tool-calling), [Agent SDK tools](https://openrouter.ai/docs/agent-sdk/call-model/tools), [MCP tools](https://openrouter.ai/docs/agent-sdk/call-model/mcp-tools), [Web search](https://openrouter.ai/docs/guides/features/server-tools/web-search). --- Source: https://millionshort.com/docs/integrations/pi Section: Build with # Pi MillionShort search in Pi, through the hosted MCP server. MCP · Hosted MCP server, nothing to install · Key read from the environment · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. ## 1. Add the server One command. It writes `~/.pi/agent/mcp.json`, and reads the key from the environment on each start: ```bash With a key pi mcp add millionshort --url https://mcp.millionshort.com/mcp \ --bearer-token-env-var MILLIONSHORT_API_KEY --exposure direct ``` ```bash Without a key pi mcp add millionshort --url https://mcp.millionshort.com/mcp --exposure direct ``` `--exposure direct` gives the model the server's tools as tools. Without it, Pi reaches MCP tools through its code mode, and the model does not see `search` by name. The same server in `mcp.json`: ```json ~/.pi/agent/mcp.json { "mcpServers": { "millionshort": { "url": "https://mcp.millionshort.com/mcp", "headers": { "Authorization": "Bearer ${MILLIONSHORT_API_KEY}" }, "exposure": "direct" } } } ``` ## 2. Try it Ask Pi: > Search MillionShort for forum threads about restoring a cast iron skillet, with the 1,000 most popular sites removed. List the five most useful with their links. A good answer comes from a `search` call (the client shows the tool call) and links to pages you may not have seen before. ## 3. Tell it when to search Pi has no web search of its own, so say which search to use. Add this line to `AGENTS.md`: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## 4. Check it works Run `pi mcp list`: it connects and prints the tools. In a session, `/mcp`; after editing the file, `/reload`. With a key you should see `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them); with no key, fewer, `search` and `list_sources` among them. ## The server One address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. A key is optional. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | ## Related - [MCP server](https://millionshort.com/docs/mcp): the address, every tool, and what the no-key mode allows. - [Filters for agents](https://millionshort.com/docs/search/filters): what to ask `search` for, with recipes. - More coding agents: [Claude Code](https://millionshort.com/docs/integrations/claude-code), [Cursor](https://millionshort.com/docs/integrations/cursor), [Codex](https://millionshort.com/docs/integrations/codex), [GitHub Copilot in VS Code](https://millionshort.com/docs/integrations/vscode), and [every integration](https://millionshort.com/docs/integrations). - Pi's own documentation, read on 2026-11-19: [MCP](https://github.com/badlogic/pi-mono/blob/main/packages/coding-agent/docs/mcp.md), [CLI](https://github.com/badlogic/pi-mono/blob/main/packages/coding-agent/docs/cli.md). --- Source: https://millionshort.com/docs/integrations/pipecat Section: Build with # Pipecat MillionShort search inside a Pipecat voice bot, through the hosted MCP server or a direct function, in Python. MCP · Python · Nothing of ours to install · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. Pipecat's `MCPClient` connects to the MillionShort MCP server, reads its tools and hands them to the LLM service with their handlers attached. The bot then gets the server's tools, `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them all), or only the ones you name. With no MCP at all, a direct function that calls the API does the same job. Spoken answers work best with few results: ask for `num_results` 3 and `max_highlights` 1, so the model reads short passages rather than long text. Each search also adds a little latency to the turn it runs in. ## 1. Install ```bash Python pip install "pipecat-ai[mcp]" export MILLIONSHORT_API_KEY=ms-YOUR_API_KEY ``` `MCPClient` needs version 2.1.1 or later of the MCP Python SDK, which the `mcp` extra installs. Build the rest of the bot (transport, speech-to-text, LLM, text-to-speech) as in Pipecat's quickstart. Get a MillionShort key in the [dashboard](https://millionshort.com/app/); an agent can ask for a [trial key](https://millionshort.com/docs/api-reference/agent-key) by itself. ## 2. Connect the server `tools()` opens the connection on its first call and returns the tools, ready for the context. The connection closes when the pipeline ends. Without a key, leave the headers out. ```python Python import os from mcp.client.session_group import StreamableHttpParameters from pipecat.processors.aggregators.llm_context import LLMContext from pipecat.processors.aggregators.llm_response_universal import LLMContextAggregatorPair from pipecat.services.mcp_service import MCPClient async def millionshort_context(): mcp = MCPClient( server_params=StreamableHttpParameters( url="https://mcp.millionshort.com/mcp", headers={"Authorization": f"Bearer {os.environ['MILLIONSHORT_API_KEY']}"}, ), tools_filter=["search"], tools_arguments={"search": {"num_results": 3, "max_highlights": 1}}, ) context = LLMContext(tools=await mcp.tools()) return context, LLMContextAggregatorPair(context) ``` `tools_filter` offers the model only `search`. `tools_arguments` fixes `num_results` and `max_highlights` on every call and hides them from the model, so it cannot ask for more than a spoken answer needs. ## 3. Give the tools to the bot Put the two aggregators around the LLM service in the pipeline, as for any Pipecat tool: ```python Python from pipecat.pipeline.pipeline import Pipeline def build_pipeline(transport, stt, llm, tts, aggregators): user_aggregator, assistant_aggregator = aggregators return Pipeline([ transport.input(), stt, user_aggregator, llm, tts, transport.output(), assistant_aggregator, ]) ``` Tell the LLM service when to search in its system instruction, and to answer in a few short sentences. ## 4. Check it works To see the tools without a model, list them from the client: ```python Python import asyncio import os from mcp.client.session_group import StreamableHttpParameters from pipecat.services.mcp_service import MCPClient async def main(): params = StreamableHttpParameters(url="https://mcp.millionshort.com/mcp", headers={"Authorization": f"Bearer {os.environ['MILLIONSHORT_API_KEY']}"}) async with MCPClient(server_params=params) as mcp: print([tool.name for tool in (await mcp.tools()).standard_tools]) # search, get_domain_info, list_sources, ... asyncio.run(main()) ``` Then run the bot and ask a question that needs the web: the answer should name pages it found. If the model answers from memory, say when to search in its instructions: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## Without MCP: a direct function A direct function is both the handler and the schema; Pipecat reads the name, the description and the arguments from its signature and docstring. ```python Python import os import aiohttp from pipecat.processors.aggregators.llm_context import LLMContext from pipecat.services.llm_service import FunctionCallParams async def millionshort_search(params: FunctionCallParams, query: str): """Search the web with MillionShort, leaving out the 1,000 most popular sites. Args: query: What to search for. """ async with aiohttp.ClientSession(timeout=aiohttp.ClientTimeout(total=15)) as http: async with http.post( "https://api.millionshort.com/v1/search", headers={"Authorization": f"Bearer {os.environ['MILLIONSHORT_API_KEY']}"}, json={"query": query, "remove_top_sites": 1000, "num_results": 3, "max_highlights": 1}, ) as response: response.raise_for_status() results = (await response.json())["data"]["results"] await params.result_callback([{"title": r["title"], "url": r["url"], "highlights": r.get("highlights")} for r in results]) context = LLMContext(tools=[millionshort_search]) ``` `aiohttp` is installed with Pipecat. Use the context's aggregator pair in the pipeline, as in step 3. ## MCP configuration The same address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Settings | Variable | Meaning | |---|---| | `MILLIONSHORT_API_KEY` | Your key, read by the examples above. Leave the header out for the no-key mode | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | | The bot never calls the tools | The tools were not put in the `LLMContext` the aggregators use | Pass `await mcp.tools()` to `LLMContext(tools=...)` and use that context's aggregator pair | | Connecting times out | `StreamableHttpParameters` waits 5 seconds by default | Pass a longer `timeout` | | Long pauses before spoken answers | Many results or long text for the model to read | Fix `num_results` 3 and `max_highlights` 1 with `tools_arguments` | ## Related - [LiveKit Agents](https://millionshort.com/docs/integrations/livekit-agents), [Vapi](https://millionshort.com/docs/integrations/vapi) and [ElevenLabs Agents](https://millionshort.com/docs/integrations/elevenlabs): the same server in other voice agents. - [Agent tool use](https://millionshort.com/docs/search/guides/agent-tool-use): when to give a model tools, and what to tell it. - [MCP server](https://millionshort.com/docs/mcp) and [Filters for agents](https://millionshort.com/docs/search/filters). - Pipecat's own documentation, read on 2026-11-19: [MCPClient](https://docs.pipecat.ai/api-reference/server/utilities/mcp/mcp), [Function calling](https://docs.pipecat.ai/pipecat/learn/function-calling). --- Source: https://millionshort.com/docs/integrations/praisonai Section: Build with # PraisonAI MillionShort search for PraisonAI agents, by giving MCP the server's URL. MCP · Python · Nothing of ours to install · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. PraisonAI's `MCP` class takes the MillionShort MCP server's URL and gives an agent its tools: `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints, such as `extract`, `places`, `map` and `crawl` ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them all). Without MCP, a plain Python function as a tool does the same job. ## 1. Install ```bash Python pip install "praisonaiagents[mcp]" export MILLIONSHORT_API_KEY=ms-YOUR_API_KEY ``` Install the `mcp` extra. PraisonAI's streamable HTTP client uses a function of the MCP Python SDK that SDK 2.0 removed, and the extra pins `mcp>=1.20.0,<2`. If something else in your environment upgraded `mcp` to 2.x, connecting fails until you run `pip install "mcp<2"`; we checked both with `praisonaiagents` 1.7.24. With no model set, PraisonAI uses `gpt-4o-mini` when OPENAI_API_KEY is set (OPENAI_MODEL_NAME overrides it), or pass `llm=` to the agent. Get a MillionShort key in the [dashboard](https://millionshort.com/app/); an agent can ask for a [trial key](https://millionshort.com/docs/api-reference/agent-key) by itself. ## 2. Connect the server `MCP` picks the transport from the URL: an address ending in `/mcp` is streamable HTTP. PraisonAI uses the URL exactly as given, so keep the `/mcp` path. The key goes in `headers`; without a key, leave `headers` out. ```python Python import os from praisonaiagents import MCP millionshort = MCP( "https://mcp.millionshort.com/mcp", headers={"Authorization": f"Bearer {os.environ['MILLIONSHORT_API_KEY']}"}, timeout=60, ) ``` ## 3. Give the tools to an agent Pass the `MCP` object as the agent's tools: ```python Python import os from praisonaiagents import MCP, Agent agent = Agent( name="Researcher", instructions="Use the millionshort search tool for anything recent or niche, and cite the URLs.", tools=MCP( "https://mcp.millionshort.com/mcp", headers={"Authorization": f"Bearer {os.environ['MILLIONSHORT_API_KEY']}"}, timeout=60, ), ) agent.start("Find independent blogs about home espresso, without the 1,000 most popular sites.") ``` `allowed_tools=["search"]` on `MCP` limits the agent to the tools you name. ## 4. Check it works Ask the agent "List the tools you have": it should name `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them); with no key, fewer, `search` and `list_sources` among them. To see them without a model: ```python Python import os from praisonaiagents import MCP millionshort = MCP("https://mcp.millionshort.com/mcp", headers={"Authorization": f"Bearer {os.environ['MILLIONSHORT_API_KEY']}"}, timeout=60) print([tool["function"]["name"] for tool in millionshort.to_openai_tool()]) ``` If the agent answers from memory, say when to search in its instructions: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## Without MCP: a function tool A plain function with type hints and a docstring works as a PraisonAI tool. This one calls `POST /v1/search`: ```python Python import json import os import urllib.request from praisonaiagents import Agent def millionshort_search(query: str, remove_top_sites: int = 1000) -> str: """Search the web with MillionShort. remove_top_sites leaves out the N most popular sites.""" request = urllib.request.Request( "https://api.millionshort.com/v1/search", data=json.dumps({"query": query, "remove_top_sites": remove_top_sites, "num_results": 5}).encode(), headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"], "Content-Type": "application/json"}, ) with urllib.request.urlopen(request, timeout=30) as response: results = json.load(response)["data"]["results"] return json.dumps([{"title": r["title"], "url": r["url"], "snippet": r.get("snippet")} for r in results]) agent = Agent(name="Researcher", instructions="Search before you answer, and cite the URLs.", tools=[millionshort_search]) agent.start("Find independent blogs about home espresso.") ``` ## MCP configuration The same address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Settings | Variable | Meaning | |---|---| | `MILLIONSHORT_API_KEY` | Your key, read by the examples above. Leave `headers` out for the no-key mode | PraisonAI's debug logs hide credentials in URLs but not in headers, so keep the key in the environment and the logs to yourself. ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | | Connecting fails with "does not provide the Streamable HTTP client" | MCP Python SDK 2.x is installed | `pip install "mcp<2"`, or reinstall `praisonaiagents[mcp]` | | "Session terminated" | The URL has no `/mcp` path, so the request went to `/` | Use `https://mcp.millionshort.com/mcp` exactly | ## Related - [Agent tool use](https://millionshort.com/docs/search/guides/agent-tool-use): when to give a model tools, and what to tell it. - [CAMEL-AI](https://millionshort.com/docs/integrations/camel-ai) and [Langroid](https://millionshort.com/docs/integrations/langroid): the same server in other Python agent frameworks. - [MCP server](https://millionshort.com/docs/mcp) and [Filters for agents](https://millionshort.com/docs/search/filters). - PraisonAI's own documentation, read on 2026-11-19: [MCP transports](https://praison.ai/docs/mcp/transports), [MCP](https://praison.ai/docs/features/mcp/). --- Source: https://millionshort.com/docs/integrations/pydantic-ai Section: Build with # Pydantic AI MillionShort search for Pydantic AI agents, as an MCP toolset or a typed function tool. MCP · Python · Nothing of ours to install · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. Pydantic AI connects to the MillionShort MCP server through an `MCPToolset`: you give it the address and the key, and register it with an agent in `toolsets`. The agent then has the server's tools: `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints, such as `extract`, `places`, `map` and `crawl` ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them all). With no MCP at all, a plain function tool that calls the API does the same job. ## 1. Install ```bash Python pip install pydantic-ai export MILLIONSHORT_API_KEY=ms-YOUR_API_KEY ``` The full `pydantic-ai` package includes the MCP client and the model providers. The slim install works too: `pip install "pydantic-ai-slim[mcp]"`, plus the extra for your model provider. The examples use an OpenAI model, as Pydantic AI's docs do, so they read OPENAI_API_KEY; any model Pydantic AI supports works. Get a MillionShort key in the [dashboard](https://millionshort.com/app/); an agent can ask for a [trial key](https://millionshort.com/docs/api-reference/agent-key) by itself. ## 2. Connect the server An `MCPToolset` takes the address as its first argument (streamable HTTP, since the path does not end in `/sse`) and the key in `headers`. Without a key, leave the headers out. ```python Python import asyncio import os from pydantic_ai import Agent from pydantic_ai.mcp import MCPToolset millionshort = MCPToolset( "https://mcp.millionshort.com/mcp", headers={"Authorization": f"Bearer {os.environ['MILLIONSHORT_API_KEY']}"}, ) agent = Agent("openai:gpt-6.1-sol", toolsets=[millionshort]) async def main(): result = await agent.run("Find independent blogs about home espresso, without the 1,000 most popular sites.") print(result.output) asyncio.run(main()) ``` The toolset connects when a run needs it. `async with agent:` holds the connection open across several runs. `MCPToolset("https://mcp.millionshort.com/mcp", auth=key)` sends the same bearer header. ## 3. Give the tools to an agent Say when to search in `instructions`, and cap the tool calls of a run with `UsageLimits`. Pydantic AI adds no web search of its own unless you add one, so there is nothing to turn off. ```python Python import os from pydantic_ai import Agent, UsageLimits from pydantic_ai.mcp import MCPToolset millionshort = MCPToolset("https://mcp.millionshort.com/mcp", headers={"Authorization": f"Bearer {os.environ['MILLIONSHORT_API_KEY']}"}) agent = Agent( "openai:gpt-6.1-sol", instructions="Use the MillionShort search tool for anything recent or niche, and cite the URLs.", toolsets=[millionshort], ) result = agent.run_sync("Find independent blogs about home espresso.", usage_limits=UsageLimits(tool_calls_limit=5)) print(result.output) ``` If the agent has other toolsets with a tool called `search`, `millionshort.prefixed("millionshort")` renames ours to `millionshort_search` and so on. A line that works well in the instructions: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## 4. Check it works List the tools without a model: ```python Python import asyncio import os from pydantic_ai.mcp import MCPToolset async def main(): millionshort = MCPToolset("https://mcp.millionshort.com/mcp", headers={"Authorization": f"Bearer {os.environ['MILLIONSHORT_API_KEY']}"}) async with millionshort: print([tool.name for tool in await millionshort.list_tools()]) # search, get_domain_info, list_sources, ... asyncio.run(main()) ``` After a run, `result.all_messages()` holds the model's tool calls; one of them should be `search`. ## Without MCP: a function tool A plain function registered with `@agent.tool_plain` calls `POST /v1/search`. Pydantic AI builds the tool's schema from the signature and the docstring. ```python Python import json import os import urllib.request from pydantic_ai import Agent agent = Agent("openai:gpt-6.1-sol") @agent.tool_plain def millionshort_search(query: str, remove_top_sites: int = 1000, num_results: int = 5) -> str: """Search the web with MillionShort. remove_top_sites leaves out the N most popular sites.""" request = urllib.request.Request( "https://api.millionshort.com/v1/search", data=json.dumps({"query": query, "remove_top_sites": remove_top_sites, "num_results": num_results}).encode(), headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"], "Content-Type": "application/json"}, ) with urllib.request.urlopen(request, timeout=30) as response: results = json.load(response)["data"]["results"] return json.dumps([{"title": r["title"], "url": r["url"], "snippet": r.get("snippet")} for r in results]) print(agent.run_sync("Find independent blogs about home espresso.").output) ``` ## MCP configuration The same address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Settings | Variable | Meaning | |---|---| | `MILLIONSHORT_API_KEY` | Your key, read by the examples above. Leave the header out for the no-key mode | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. `UsageLimits(tool_calls_limit=...)` on a run is the step limit. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | | The run stops with a usage limit message | The run reached its `UsageLimits` | Raise `tool_calls_limit` or `request_limit`, or ask for fewer results per search | | The model's provider is not installed | The slim install has no extra for that provider | Install `pydantic-ai`, or add the provider's extra to `pydantic-ai-slim` | ## Related - [Agent tool use](https://millionshort.com/docs/search/guides/agent-tool-use): when to give a model tools, and what to tell it. - [OpenAI Agents SDK](https://millionshort.com/docs/integrations/openai-agents), [LangChain](https://millionshort.com/docs/integrations/langchain) and [Claude Agent SDK](https://millionshort.com/docs/integrations/claude-agent-sdk). - [MCP server](https://millionshort.com/docs/mcp) and [Filters for agents](https://millionshort.com/docs/search/filters). - Pydantic AI's own documentation, read on 2026-11-19: [MCP client](https://ai.pydantic.dev/mcp/client/), [MCPToolset reference](https://pydantic.dev/docs/ai/api/pydantic-ai/mcp/), [Function tools](https://pydantic.dev/docs/ai/tools-toolsets/tools/). --- Source: https://millionshort.com/docs/integrations/qwen-code Section: Build with # Qwen Code MillionShort search in Qwen Code, through the hosted MCP server. MCP · Hosted MCP server, nothing to install · Key in a header · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. ## 1. Add the server One command (it writes `~/.qwen/settings.json`; add `--scope project` for this project only): ```bash With a key qwen mcp add --transport http millionshort https://mcp.millionshort.com/mcp \ --header "Authorization: Bearer ms-YOUR_API_KEY" ``` ```bash Without a key qwen mcp add --transport http millionshort https://mcp.millionshort.com/mcp ``` In `settings.json` the entry uses `httpUrl` (`url` is for the older SSE transport): ```json settings.json { "mcpServers": { "millionshort": { "httpUrl": "https://mcp.millionshort.com/mcp", "headers": { "Authorization": "Bearer ms-YOUR_API_KEY" } } } } ``` ## 2. Try it Ask Qwen Code: > Search MillionShort for forum threads about restoring a cast iron skillet, with the 1,000 most popular sites removed. List the five most useful with their links. A good answer comes from a `search` call (the client shows the tool call) and links to pages you may not have seen before. ## 3. Turn off the built-in search Where Qwen Code has its own `web_search` tool (it depends on how you sign in), turn it off in `settings.json`, or set `ENABLE_WEB_SEARCH=false`: ```json settings.json { "tools": { "webSearch": { "enabled": false } } } ``` Add this line to `QWEN.md`: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## 4. Check it works Type `/mcp` in Qwen Code: the dialog lists `millionshort` and its tools. If Qwen Code was running when you added it, restart it. With a key you should see `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them); with no key, fewer, `search` and `list_sources` among them. ## The server One address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. A key is optional. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | ## Related - [MCP server](https://millionshort.com/docs/mcp): the address, every tool, and what the no-key mode allows. - [Filters for agents](https://millionshort.com/docs/search/filters): what to ask `search` for, with recipes. - More coding agents: [Claude Code](https://millionshort.com/docs/integrations/claude-code), [Cursor](https://millionshort.com/docs/integrations/cursor), [Codex](https://millionshort.com/docs/integrations/codex), [GitHub Copilot in VS Code](https://millionshort.com/docs/integrations/vscode), and [every integration](https://millionshort.com/docs/integrations). - Qwen Code's own documentation, read on 2026-11-19: [MCP](https://github.com/QwenLM/qwen-code/blob/main/docs/users/features/mcp.md), [Web search tool](https://github.com/QwenLM/qwen-code/blob/main/docs/developers/tools/web-search.md), [Memory](https://github.com/QwenLM/qwen-code/blob/main/docs/users/features/memory.md). --- Source: https://millionshort.com/docs/integrations/ragflow Section: Build with # RAGFlow MillionShort search as a step in RAGFlow, through the hosted MCP server or the API. MCP · Hosted MCP server, nothing to install · Key in a form field · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. ## 1. Add the MCP server Click your profile picture, **User settings**, **MCP**, **Add MCP**: ```text With a key Name: millionshort URL: https://mcp.millionshort.com/mcp Server type: streamable-http Authorization Token: ms-YOUR_API_KEY ``` ```text Without a key Name: millionshort URL: https://mcp.millionshort.com/mcp Server type: streamable-http ``` Click refresh under **Tools available** (RAGFlow sends the token as `Authorization: Bearer`), then **Save**: it stays disabled until a test finds the tools. Then add the tools to an Agent component. ## 2. Try it Ask RAGFlow's agent, or run the step with this as the query: > Search MillionShort for forum threads about restoring a cast iron skillet, with the 1,000 most popular sites removed. List the five most useful with their links. A good answer comes from a `search` call (the client shows the tool call) and links to pages you may not have seen before. ## 3. Tell it when to search RAGFlow has no setting we could find that turns its own web search off, so say which search to use. Add this line to the Agent component's system prompt: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## 4. Check it works **Tools available** lists the server's tools after refresh. In an agent run, each call shows which tool it used. With a key you should see `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them); with no key, fewer, `search` and `list_sources` among them. ## The server One address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. A key is optional. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | ## Related - [MCP server](https://millionshort.com/docs/mcp): the address, every tool, and what the no-key mode allows. - [Filters for agents](https://millionshort.com/docs/search/filters): what to ask `search` for, with recipes. - More low-code builders: [n8n](https://millionshort.com/docs/integrations/n8n), [Zapier](https://millionshort.com/docs/integrations/zapier), [Make](https://millionshort.com/docs/integrations/make), [Dify](https://millionshort.com/docs/integrations/dify), and [every integration](https://millionshort.com/docs/integrations). - RAGFlow's own documentation, read on 2026-11-19: [Connect an external MCP server](https://github.com/infiniflow/ragflow/blob/main/docs/develop/mcp/connect_an_external_mcp_to_ragflow.md). --- Source: https://millionshort.com/docs/integrations/relevance-ai Section: Build with # Relevance AI MillionShort search as a step in Relevance AI, through the hosted MCP server or the API. MCP · Hosted MCP server, nothing to install · Key in a form field · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. ## 1. Add the MCP server In the agent builder, **Tools**, **Add MCP**, **Connect my own**: the server URL `https://mcp.millionshort.com/mcp` and a label. With no authentication it uses the no-key mode. ## 2. Or call the API in an HTTP step For your key, save it under **Integrations & API Keys**, **Custom API Keys** (named `millionshort_key` here), and make a tool with an **API** step: ```text API step Method: POST URL: https://api.millionshort.com/v1/search Headers: Authorization = Bearer {{secrets.millionshort_key}} Content-Type = application/json Body: {"query": "{{query}}", "remove_top_sites": 1000, "num_results": 5} ``` ## 3. Try it Ask Relevance AI's agent, or run the step with this as the query: > Search MillionShort for forum threads about restoring a cast iron skillet, with the 1,000 most popular sites removed. List the five most useful with their links. A good answer comes from a `search` call (the client shows the tool call) and links to pages you may not have seen before. ## 4. Tell it when to search Relevance AI has no setting we could find that turns its own web search off, so say which search to use. Add this line to the agent's prompt: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## 5. Check it works The agent's **Tools** tab lists the server's tools, marked with the connection's label. Run the API step once to see the results. With a key you should see `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them); with no key, fewer, `search` and `list_sources` among them. ## The server One address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. A key is optional. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | ## Related - [MCP server](https://millionshort.com/docs/mcp): the address, every tool, and what the no-key mode allows. - [Filters for agents](https://millionshort.com/docs/search/filters): what to ask `search` for, with recipes. - More low-code builders: [n8n](https://millionshort.com/docs/integrations/n8n), [Zapier](https://millionshort.com/docs/integrations/zapier), [Make](https://millionshort.com/docs/integrations/make), [Dify](https://millionshort.com/docs/integrations/dify), and [every integration](https://millionshort.com/docs/integrations). - Relevance AI's own documentation, read on 2026-11-19: [MCP client](https://relevanceai.com/docs/integrations/mcp/mcp-client), [API tool step](https://relevanceai.com/docs/build/tools/tool-steps/api). --- Source: https://millionshort.com/docs/integrations/replit-agent Section: Build with # Replit Agent MillionShort search in Replit Agent, through the hosted MCP server. MCP · Hosted MCP server, nothing to install · Key in a form field · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. ## 1. Add the server 1. Open **Settings**, **Integrations**, **Your integrations**. 2. Choose **Add custom**, **Add personal MCP server**. 3. Display name `millionshort`, server URL `https://mcp.millionshort.com/mcp`. 4. Under **Advanced settings**, add a custom header: name `Authorization`, value `Bearer ms-YOUR_API_KEY`. Leave it empty for the no-key mode. 5. **Test & save**. If **Add custom** is missing, a workspace admin has not made custom MCP servers available to you. ## 2. Try it Ask the Agent, naming the server: > Search MillionShort for forum threads about restoring a cast iron skillet, with the 1,000 most popular sites removed. List the five most useful with their links. A good answer comes from a `search` call (the client shows the tool call) and links to pages you may not have seen before. ## 3. Tell it when to search Replit Agent has no setting we could find that turns its own web search off, so say which search to use. Tell the Agent in your prompt: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## 4. Check it works After **Test & save**, the server is listed under MCP servers with its state. The Agent loads its tools when you mention it. With a key you should see `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them); with no key, fewer, `search` and `list_sources` among them. ## Good to know - The server gives the Agent search while it builds. The app it builds does not get it: to search from your app, keep the key in the app's secrets and call `POST https://api.millionshort.com/v1/search` ([quickstart](https://millionshort.com/docs/quickstart)). ## The server One address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. A key is optional. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | ## Related - [MCP server](https://millionshort.com/docs/mcp): the address, every tool, and what the no-key mode allows. - [Filters for agents](https://millionshort.com/docs/search/filters): what to ask `search` for, with recipes. - More coding agents: [Claude Code](https://millionshort.com/docs/integrations/claude-code), [Cursor](https://millionshort.com/docs/integrations/cursor), [Codex](https://millionshort.com/docs/integrations/codex), [GitHub Copilot in VS Code](https://millionshort.com/docs/integrations/vscode), and [every integration](https://millionshort.com/docs/integrations). - Replit Agent's own documentation, read on 2026-11-19: [Connect via MCP](https://docs.replit.com/build/connect-via-mcp), [MCP overview](https://docs.replit.com/features/mcp/overview). --- Source: https://millionshort.com/docs/integrations/retool Section: Build with # Retool MillionShort search as a step in Retool, through the hosted MCP server or the API. MCP · Hosted MCP server, nothing to install · Key in a form field · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. ## 1. Add the MCP server **Resources**, **Create new**, **Resource**, **MCP Server**: server URL `https://mcp.millionshort.com/mcp`, authentication **Bearer Token** with your key (Retool sends it as `Authorization: Bearer`). **Test connection**, **Create resource**. Then in an agent: **Configuration**, **Add new tool**, **Connect to MCP Server**, and pick it. ## 2. Or call the API in an HTTP step For apps and workflows, a **REST API** resource: base URL `https://api.millionshort.com/v1`, authentication **Bearer token** with your key. A query is then `POST /search` with the JSON body: ```json Body {"query": "...", "remove_top_sites": 1000, "num_results": 5} ``` ## 3. Try it Ask Retool's agent, or run the step with this as the query: > Search MillionShort for forum threads about restoring a cast iron skillet, with the 1,000 most popular sites removed. List the five most useful with their links. A good answer comes from a `search` call (the client shows the tool call) and links to pages you may not have seen before. ## 4. Tell it when to search Retool has no setting we could find that turns its own web search off, so say which search to use. Add this line to the agent's instructions: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## 5. Check it works **Test connection** reaches the server and lists its tools. In an agent, they appear as its tools. With a key you should see `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them); with no key, fewer, `search` and `list_sources` among them. ## The server One address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. A key is optional. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | ## Related - [MCP server](https://millionshort.com/docs/mcp): the address, every tool, and what the no-key mode allows. - [Filters for agents](https://millionshort.com/docs/search/filters): what to ask `search` for, with recipes. - More low-code builders: [n8n](https://millionshort.com/docs/integrations/n8n), [Zapier](https://millionshort.com/docs/integrations/zapier), [Make](https://millionshort.com/docs/integrations/make), [Dify](https://millionshort.com/docs/integrations/dify), and [every integration](https://millionshort.com/docs/integrations). - Retool's own documentation, read on 2026-11-19: [Connect to an MCP server](https://docs.retool.com/agents/guides/tools/connect-to-mcp-server), [MCP resource](https://docs.retool.com/data-sources/guides/connect/mcp), [REST API resource](https://docs.retool.com/data-sources/guides/connect/rest). --- Source: https://millionshort.com/docs/integrations/rovo-dev Section: Build with # Rovo Dev MillionShort search in Rovo Dev, through the hosted MCP server. MCP · Hosted MCP server, nothing to install · Key in a header · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. ## 1. Add the server Run `acli rovodev mcp` to open `~/.rovodev/mcp.json`, and add: ```json With a key { "mcpServers": { "millionshort": { "url": "https://mcp.millionshort.com/mcp", "transport": "http", "headers": { "Authorization": "Bearer ms-YOUR_API_KEY" } } } } ``` ```json Without a key { "mcpServers": { "millionshort": { "url": "https://mcp.millionshort.com/mcp", "transport": "http" } } } ``` ## 2. Try it Ask Rovo Dev: > Search MillionShort for forum threads about restoring a cast iron skillet, with the 1,000 most popular sites removed. List the five most useful with their links. A good answer comes from a `search` call (the client shows the tool call) and links to pages you may not have seen before. ## 3. Tell it when to search Rovo Dev has no setting we could find that turns its own web search off, so say which search to use. Add this line to `AGENTS.md` in the workspace: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## 4. Check it works In interactive mode, `/mcp` shows `millionshort`, its state and its tools. With a key you should see `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them); with no key, fewer, `search` and `list_sources` among them. ## The server One address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. A key is optional. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | ## Related - [MCP server](https://millionshort.com/docs/mcp): the address, every tool, and what the no-key mode allows. - [Filters for agents](https://millionshort.com/docs/search/filters): what to ask `search` for, with recipes. - More coding agents: [Claude Code](https://millionshort.com/docs/integrations/claude-code), [Cursor](https://millionshort.com/docs/integrations/cursor), [Codex](https://millionshort.com/docs/integrations/codex), [GitHub Copilot in VS Code](https://millionshort.com/docs/integrations/vscode), and [every integration](https://millionshort.com/docs/integrations). - Rovo Dev's own documentation, read on 2026-11-19: [Connect to an MCP server](https://support.atlassian.com/rovo/docs/connect-to-an-mcp-server-in-rovo-dev-cli/), [Memory](https://support.atlassian.com/rovo/docs/use-memory-in-rovo-dev-cli/). --- Source: https://millionshort.com/docs/integrations/semantic-kernel Section: Build with # Semantic Kernel MillionShort search for Semantic Kernel agents, as an MCP plugin over streamable HTTP or a plugin of your own, in Python. MCP · Python · Nothing of ours to install · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. Semantic Kernel turns an MCP server into a plugin: `MCPStreamableHttpPlugin` connects to the MillionShort MCP server and its tools become the plugin's functions: `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints, such as `extract`, `places`, `map` and `crawl` ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them all). Give the plugin to a `ChatCompletionAgent` or add it to a kernel. With no MCP at all, a plugin class whose `kernel_function` calls the API does the same job. This page covers Python: Semantic Kernel's MCP documentation for .NET and Java is not published yet. ## 1. Install ```bash Python pip install "semantic-kernel[mcp]" export MILLIONSHORT_API_KEY=ms-YOUR_API_KEY ``` Semantic Kernel keeps the MCP Python SDK below version 2, so install it in its own environment, apart from packages that need the SDK 2.x. The examples use `OpenAIChatCompletion`, which reads your OpenAI key from OPENAI_API_KEY and the model name from OPENAI_CHAT_MODEL_ID (or a `.env` file); any chat completion service works the same way. Get a MillionShort key in the [dashboard](https://millionshort.com/app/); an agent can ask for a [trial key](https://millionshort.com/docs/api-reference/agent-key) by itself. ## 2. Connect the server `async with` opens the connection and loads the tools as functions; the plugin closes when the block ends. `load_prompts=False` skips asking for prompts, which the server does not offer. ```python Python import asyncio import os from semantic_kernel import Kernel from semantic_kernel.connectors.mcp import MCPStreamableHttpPlugin async def main(): async with MCPStreamableHttpPlugin( name="millionshort", description="MillionShort web search", url="https://mcp.millionshort.com/mcp", headers={"Authorization": f"Bearer {os.environ['MILLIONSHORT_API_KEY']}"}, load_prompts=False, ) as millionshort: kernel = Kernel() kernel.add_plugin(millionshort) print(list(kernel.plugins["millionshort"].functions)) asyncio.run(main()) ``` Without a key, leave `headers` out: the plugin has `search` and `list_sources`. ## 3. Give the tools to an agent A `ChatCompletionAgent` takes the plugin in `plugins` and calls its functions when the model asks for them: ```python Python import asyncio import os from semantic_kernel.agents import ChatCompletionAgent from semantic_kernel.connectors.ai.open_ai import OpenAIChatCompletion from semantic_kernel.connectors.mcp import MCPStreamableHttpPlugin async def main(): async with MCPStreamableHttpPlugin( name="millionshort", url="https://mcp.millionshort.com/mcp", headers={"Authorization": f"Bearer {os.environ['MILLIONSHORT_API_KEY']}"}, load_prompts=False, ) as millionshort: agent = ChatCompletionAgent( service=OpenAIChatCompletion(), name="Researcher", instructions="Use the millionshort search tool for anything recent or niche, and cite the URLs.", plugins=[millionshort], ) response = await agent.get_response(messages="Find independent blogs about home espresso, without the 1,000 most popular sites.") print(response.content) asyncio.run(main()) ``` The agent has only the plugins you give it, so nothing else competes with MillionShort for its searches. ## 4. Check it works Run the example in step 2: it prints the plugin's functions: `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them). Then run step 3: the answer should cite pages. If the model answers from memory, say when to search in its instructions: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## Without MCP: a function tool A class with a `kernel_function` method is a plugin; its description and the `Annotated` hint tell the model how to call it: ```python Python import asyncio import json import os import urllib.request from typing import Annotated from semantic_kernel.agents import ChatCompletionAgent from semantic_kernel.connectors.ai.open_ai import OpenAIChatCompletion from semantic_kernel.functions import kernel_function class MillionShort: @kernel_function(name="search", description="Search the web with MillionShort, without the 1,000 most popular sites.") def search(self, query: Annotated[str, "What to search for"]) -> str: request = urllib.request.Request( "https://api.millionshort.com/v1/search", data=json.dumps({"query": query, "remove_top_sites": 1000, "num_results": 5}).encode(), headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"], "Content-Type": "application/json"}, ) with urllib.request.urlopen(request, timeout=30) as response: results = json.load(response)["data"]["results"] return json.dumps([{"title": r["title"], "url": r["url"], "snippet": r.get("snippet")} for r in results]) async def main(): agent = ChatCompletionAgent(service=OpenAIChatCompletion(), name="Researcher", plugins=[MillionShort()]) print((await agent.get_response(messages="Find independent blogs about home espresso.")).content) asyncio.run(main()) ``` ## MCP configuration The same address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Settings | Variable | Meaning | |---|---| | `MILLIONSHORT_API_KEY` | Your key, read by the examples above. Leave `headers` out for the no-key mode | `MCPStreamableHttpPlugin` also takes `request_timeout` (seconds), so a server that does not answer cannot hold your app. ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | | Connecting hangs | Loading prompts can hang on a server that has none, as Semantic Kernel's docs note | Pass `load_prompts=False`, as above | | Installing beside another framework downgrades or breaks the MCP SDK | Semantic Kernel needs the MCP Python SDK below 2, and some packages need 2.x | Give Semantic Kernel its own virtual environment | | "The OpenAI model ID is required." | `OpenAIChatCompletion()` found no model id | Set OPENAI_CHAT_MODEL_ID, or pass `ai_model_id` | ## Related - [Agent tool use](https://millionshort.com/docs/search/guides/agent-tool-use): when to give a model tools, and what to tell it. - [Microsoft Agent Framework](https://millionshort.com/docs/integrations/microsoft-agent-framework): Microsoft's agent framework, with the same server. - [Haystack](https://millionshort.com/docs/integrations/haystack): the same server in another Python framework. - [MCP server](https://millionshort.com/docs/mcp) and [Filters for agents](https://millionshort.com/docs/search/filters). - Semantic Kernel's own documentation, read on 2026-11-19: [Give agents access to MCP servers](https://learn.microsoft.com/en-us/semantic-kernel/concepts/plugins/adding-mcp-plugins), [ChatCompletionAgent](https://learn.microsoft.com/en-us/semantic-kernel/frameworks/agent/agent-types/chat-completion-agent). --- Source: https://millionshort.com/docs/integrations/smolagents Section: Build with # smolagents MillionShort search for smolagents agents, through its MCP client or a tool of your own. MCP · Python · Nothing of ours to install · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. smolagents' `MCPClient` connects to the MillionShort MCP server over streamable HTTP and returns its tools as smolagents tools: `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints, such as `extract`, `places`, `map` and `crawl` ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them all). With no MCP at all, a `@tool` function that calls the API does the same job. ## 1. Install ```bash Python pip install "smolagents[mcp]" "mcp<2" export MILLIONSHORT_API_KEY=ms-YOUR_API_KEY ``` Keep `"mcp<2"` for now. `MCPClient` relies on the `mcpadapt` package, and its current release (0.1.20) still imports a function that version 2 of the MCP Python SDK removed. `pip install "smolagents[mcp]"` on its own installs the MCP SDK 2.x, and `MCPClient` then fails as it starts. The function tool below needs no pin. The examples use `InferenceClientModel`, which reads your Hugging Face token from HF_TOKEN; any smolagents model works the same way. Get a MillionShort key in the [dashboard](https://millionshort.com/app/); an agent can ask for a [trial key](https://millionshort.com/docs/api-reference/agent-key) by itself. ## 2. Connect the server `MCPClient` takes a dict: the address, the transport, and the headers to send. Used with `with`, it connects, returns the tools and disconnects at the end. ```python Python import os from smolagents import CodeAgent, InferenceClientModel, MCPClient server = { "url": "https://mcp.millionshort.com/mcp", "transport": "streamable-http", "headers": {"Authorization": f"Bearer {os.environ['MILLIONSHORT_API_KEY']}"}, } with MCPClient(server, structured_output=False) as tools: agent = CodeAgent( tools=tools, model=InferenceClientModel(), instructions="Use the millionshort search tool for anything recent or niche, and cite the URLs.", ) print(agent.run("Find independent blogs about home espresso, without the 1,000 most popular sites.")) ``` Without a key, leave `"headers"` out: the agent gets `search` and `list_sources`. ## 3. Give the tools to an agent The tools from `MCPClient` go to `CodeAgent` or `ToolCallingAgent` as they are. Two things to keep in mind: - Leave `add_base_tools` off (the default). Its base tools include a web search of their own, which the agent may pick instead of MillionShort. - `structured_output` is set explicitly because smolagents warns that its default will change. `False` gives the agent the text of each result; `True` also uses the structured content of a tool's answer. ## 4. Check it works Run the example: the agent's steps show the code that calls `search`, and the answer should cite pages. To see the tools without a model: ```python Python import os from smolagents import MCPClient server = { "url": "https://mcp.millionshort.com/mcp", "transport": "streamable-http", "headers": {"Authorization": f"Bearer {os.environ['MILLIONSHORT_API_KEY']}"}, } with MCPClient(server, structured_output=False) as tools: print([tool.name for tool in tools]) # search, get_domain_info, list_sources, ... ``` If the model answers from memory, say when to search in its instructions: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## Without MCP: a function tool The `@tool` decorator needs type hints and a docstring with an `Args:` section; smolagents builds the tool's description from them. ```python Python import json import os import urllib.request from smolagents import CodeAgent, InferenceClientModel, tool @tool def millionshort_search(query: str, remove_top_sites: int = 1000, num_results: int = 5) -> str: """Search the web with MillionShort. Args: query: What to search for. remove_top_sites: Leave out the N most popular sites. num_results: How many results to return. """ request = urllib.request.Request( "https://api.millionshort.com/v1/search", data=json.dumps({"query": query, "remove_top_sites": remove_top_sites, "num_results": num_results}).encode(), headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"], "Content-Type": "application/json"}, ) with urllib.request.urlopen(request, timeout=30) as response: results = json.load(response)["data"]["results"] return json.dumps([{"title": r["title"], "url": r["url"], "snippet": r.get("snippet")} for r in results]) agent = CodeAgent(tools=[millionshort_search], model=InferenceClientModel()) print(agent.run("Find independent blogs about home espresso.")) ``` ## MCP configuration The same address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Settings | Variable | Meaning | |---|---| | `MILLIONSHORT_API_KEY` | Your key, read by the examples above. Leave the header out for the no-key mode | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | | `cannot import name 'streamablehttp_client'` when `MCPClient` starts | The MCP Python SDK 2.x is installed, and `mcpadapt` still needs 1.x | `pip install "mcp<2"` in the same environment | | "Couldn't connect to the MCP server after 30 seconds" | Often a rejected key: the `401` appears in the log above the message | Check the key and the `Bearer ` prefix, or leave the header out to use the no-key mode | ## Related - [Agent tool use](https://millionshort.com/docs/search/guides/agent-tool-use): when to give a model tools, and what to tell it. - [OpenAI Agents SDK](https://millionshort.com/docs/integrations/openai-agents) and [Agno](https://millionshort.com/docs/integrations/agno): the same server in other agent frameworks. - [MCP server](https://millionshort.com/docs/mcp) and [Filters for agents](https://millionshort.com/docs/search/filters). - smolagents' own documentation, read on 2026-11-19: [Tools (MCPClient)](https://huggingface.co/docs/smolagents/tutorials/tools), [Guided tour](https://huggingface.co/docs/smolagents/guided_tour). --- Source: https://millionshort.com/docs/integrations/spring-ai Section: Build with # Spring AI MillionShort search for a Spring AI ChatClient, through the MCP client starter. MCP · Java · Nothing of ours to install · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. Spring AI's MCP client Boot starter connects to the servers named in your application properties, discovers their tools and exposes them as a `SyncMcpToolCallbackProvider` bean. Add the MillionShort MCP server as a streamable HTTP connection, add the key with a request customizer, and pass the provider to a `ChatClient`; the model then gets the server's tools: `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints, such as `extract`, `places`, `map` and `crawl` ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them all). ## 1. Install Add the MCP client starter (its version comes from the Spring AI BOM; 2.0.2 is current) next to the starter for your model: ```text Maven org.springframework.ai spring-ai-starter-mcp-client ``` ```bash export MILLIONSHORT_API_KEY=ms-YOUR_API_KEY ``` This starter uses the JDK `HttpClient`. Spring recommends the WebFlux starter, `spring-ai-starter-mcp-client-webflux`, for production; its headers are set differently (see Settings below). Get a MillionShort key in the [dashboard](https://millionshort.com/app/). ## 2. Connect the server Name the connection under `streamable-http`. Spring builds the address from `url` and `endpoint` (default `/mcp`); the endpoint is an absolute path, so it replaces the path of `url`, and the full address works as `url`: ```yaml application.yml spring: ai: mcp: client: streamable-http: connections: millionshort: url: https://mcp.millionshort.com/mcp endpoint: /mcp ``` The connection properties carry no headers. With the `spring-ai-starter-mcp-client` starter, the key goes in a `McpSyncHttpClientRequestCustomizer` bean, which sees every request the HttpClient transports send, so it checks the address before adding the key. Without a key, leave the bean out. ```text Java import io.modelcontextprotocol.client.transport.customizer.McpSyncHttpClientRequestCustomizer; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @Configuration class MillionShortMcpConfig { @Bean McpSyncHttpClientRequestCustomizer millionshortAuth(@Value("${MILLIONSHORT_API_KEY}") String apiKey) { return (builder, method, endpoint, body, context) -> { if ("https://mcp.millionshort.com/mcp".equals(endpoint.toString())) { builder.header("Authorization", "Bearer " + apiKey); } }; } } ``` ## 3. Give the tools to a ChatClient Spring does not add MCP tools to a `ChatClient` by itself. Inject the provider and pass it as default tools, or per call with `.tools(mcpTools)`: ```text Java @Autowired SyncMcpToolCallbackProvider mcpTools; ChatClient chatClient = ChatClient.builder(chatModel) .defaultTools(mcpTools) .build(); String answer = chatClient.prompt() .user("Find independent blogs about home espresso, without the 1,000 most popular sites.") .call() .content(); ``` ## 4. Check it works Start the application: the starter connects to `millionshort` at startup. `mcpTools.getToolCallbacks()` should hold `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them); with no key, fewer, `search` and `list_sources` among them. Spring adds a prefix to a tool's name only when two connections have tools of the same name. Then ask the question in step 3: the answer should cite pages. If the model answers from memory, say when to search in its system prompt: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## MCP configuration The same address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Settings | Variable | Meaning | |---|---| | `MILLIONSHORT_API_KEY` | Your key, read by the customizer bean as a Spring property. Leave the bean out for the no-key mode | With the WebFlux starter, Spring's docs say to configure a `WebClient.Builder` bean (for example with an `ExchangeFilterFunction`) instead of the customizer; they show it for OAuth only, so we do not give a sample. The client is application-scoped: one MCP session per connection, shared by every request, which is fine for our stateless server. ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | | The model never sees the tools | The provider was not passed to the `ChatClient` | Pass `mcpTools` with `.defaultTools(...)` or `.tools(...)` | | Requests go out with no key | The customizer is for the HttpClient starter, and you use the WebFlux one | Set the header on the `WebClient.Builder` instead | ## Related - [Agent tool use](https://millionshort.com/docs/search/guides/agent-tool-use): when to give a model tools, and what to tell it. - [LangChain](https://millionshort.com/docs/integrations/langchain) and [Genkit](https://millionshort.com/docs/integrations/genkit): the same server in other frameworks. - [MCP server](https://millionshort.com/docs/mcp) and [Filters for agents](https://millionshort.com/docs/search/filters). - Spring AI's own documentation, read on 2026-11-19: [MCP Client Boot Starter](https://docs.spring.io/spring-ai/reference/api/mcp/mcp-client-boot-starter-docs.html), [MCP Security](https://docs.spring.io/spring-ai/reference/api/mcp/mcp-security.html), [Tool Calling](https://docs.spring.io/spring-ai/reference/api/tools.html). --- Source: https://millionshort.com/docs/integrations/stackai Section: Build with # StackAI MillionShort search as a step in StackAI, through the hosted MCP server or the API. MCP · Hosted MCP server, nothing to install · Key in a form field · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. ## 1. Add the MCP server **Settings**, **Connections**, add an **MCP** connection: ```text With a key Base URL: https://mcp.millionshort.com/mcp Authorization Type: Bearer API Key: ms-YOUR_API_KEY Description: MillionShort ``` ```text Without a key Base URL: https://mcp.millionshort.com/mcp Description: MillionShort ``` Save, check the connection's status, then choose it when you add an MCP action to an agent. ## 2. Try it Ask StackAI's agent, or run the step with this as the query: > Search MillionShort for forum threads about restoring a cast iron skillet, with the 1,000 most popular sites removed. List the five most useful with their links. A good answer comes from a `search` call (the client shows the tool call) and links to pages you may not have seen before. ## 3. Tell it when to search StackAI has no setting we could find that turns its own web search off, so say which search to use. Add this line to the agent's instructions: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## 4. Check it works The connection shows as connected, and the agent's MCP action lists the tools. With a key you should see `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them); with no key, fewer, `search` and `list_sources` among them. ## The server One address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. A key is optional. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | ## Related - [MCP server](https://millionshort.com/docs/mcp): the address, every tool, and what the no-key mode allows. - [Filters for agents](https://millionshort.com/docs/search/filters): what to ask `search` for, with recipes. - More low-code builders: [n8n](https://millionshort.com/docs/integrations/n8n), [Zapier](https://millionshort.com/docs/integrations/zapier), [Make](https://millionshort.com/docs/integrations/make), [Dify](https://millionshort.com/docs/integrations/dify), and [every integration](https://millionshort.com/docs/integrations). - StackAI's own documentation, read on 2026-11-19: [Custom MCP](https://docs.stackai.com/integrations/catalog/custom-mcp), [MCP tools in an agent](https://docs.stackai.com/guides-and-quickstarts/using-tools-and-actions/mcp-tools-in-an-agent). --- Source: https://millionshort.com/docs/integrations/strands Section: Build with # Strands Agents MillionShort search for Strands agents, through the SDK's MCP client or a tool of your own, in Python and TypeScript. MCP · Python and TypeScript · Nothing of ours to install · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. The Strands MCP client connects to the MillionShort MCP server over streamable HTTP and acts as a tool provider: pass it to the agent and the agent gets the server's tools: `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints, such as `extract`, `places`, `map` and `crawl` ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them all). With no MCP at all, a function tool that calls the API does the same job. ## 1. Install ```bash Python pip install strands-agents export MILLIONSHORT_API_KEY=ms-YOUR_API_KEY ``` ```bash TypeScript npm install @strands-agents/sdk @modelcontextprotocol/sdk zod export MILLIONSHORT_API_KEY=ms-YOUR_API_KEY ``` With no model given, a Strands agent uses a model on Amazon Bedrock, so it needs AWS credentials; pass `model` to use another provider. Get a MillionShort key in the [dashboard](https://millionshort.com/app/); an agent can ask for a [trial key](https://millionshort.com/docs/api-reference/agent-key) by itself. ## 2. Connect the server In Python, `MCPClient` builds the streamable HTTP transport from `url` and `headers`. In TypeScript, `McpClient` takes a transport from the MCP TypeScript SDK, with the header in `requestInit`. ```python Python import os from strands import Agent from strands.tools.mcp import MCPClient millionshort = MCPClient( url="https://mcp.millionshort.com/mcp", headers={"Authorization": f"Bearer {os.environ['MILLIONSHORT_API_KEY']}"}, ) agent = Agent( tools=[millionshort], system_prompt="Use the millionshort search tool for anything recent or niche, and cite the URLs.", ) agent("Find independent blogs about home espresso, without the 1,000 most popular sites.") ``` ```ts TypeScript import { Agent, McpClient } from '@strands-agents/sdk'; import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js'; const millionshort = new McpClient({ transport: new StreamableHTTPClientTransport(new URL('https://mcp.millionshort.com/mcp'), { requestInit: { headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}` } }, }), }); const agent = new Agent({ tools: [millionshort], systemPrompt: 'Use the millionshort search tool for anything recent or niche, and cite the URLs.', }); console.log(String(await agent.invoke('Find independent blogs about home espresso, without the 1,000 most popular sites.'))); await millionshort.disconnect(); ``` Without a key, leave the headers out: the agent gets `search` and `list_sources`. ## 3. Give the tools to an agent Passing the client itself in `tools`, as above, is the SDK's recommended way: the agent opens the connection when it needs it and manages it from there. If you want to hold the connection yourself, in Python open it with `with` and pass the tools it lists: ```python Python import os from strands import Agent from strands.tools.mcp import MCPClient millionshort = MCPClient( url="https://mcp.millionshort.com/mcp", headers={"Authorization": f"Bearer {os.environ['MILLIONSHORT_API_KEY']}"}, ) with millionshort: agent = Agent(tools=millionshort.list_tools_sync()) agent("Find independent blogs about home espresso.") # must run inside the with block ``` Strands loads no web search of its own: the agent has only the tools you pass. ## 4. Check it works Run the example: the agent prints the call to `search` as it runs, and the answer should cite pages. To see the tools without a model, list them: ```python Python import os from strands.tools.mcp import MCPClient millionshort = MCPClient( url="https://mcp.millionshort.com/mcp", headers={"Authorization": f"Bearer {os.environ['MILLIONSHORT_API_KEY']}"}, ) with millionshort: print([tool.tool_name for tool in millionshort.list_tools_sync()]) # search, get_domain_info, list_sources, ... ``` ```ts TypeScript import { McpClient } from '@strands-agents/sdk'; import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js'; const millionshort = new McpClient({ transport: new StreamableHTTPClientTransport(new URL('https://mcp.millionshort.com/mcp'), { requestInit: { headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}` } }, }), }); console.log((await millionshort.listTools()).map((tool) => tool.name)); // search, get_domain_info, list_sources, ... await millionshort.disconnect(); ``` If the model answers from memory, say when to search in its system prompt: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## Without MCP: a function tool ```python Python import json import os import urllib.request from strands import Agent, tool @tool def millionshort_search(query: str, remove_top_sites: int = 1000, num_results: int = 5) -> str: """Search the web with MillionShort. remove_top_sites leaves out the N most popular sites.""" request = urllib.request.Request( "https://api.millionshort.com/v1/search", data=json.dumps({"query": query, "remove_top_sites": remove_top_sites, "num_results": num_results}).encode(), headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"], "Content-Type": "application/json"}, ) with urllib.request.urlopen(request, timeout=30) as response: results = json.load(response)["data"]["results"] return json.dumps([{"title": r["title"], "url": r["url"], "snippet": r.get("snippet")} for r in results]) agent = Agent(tools=[millionshort_search]) agent("Find independent blogs about home espresso.") ``` ```ts TypeScript import { Agent, tool } from '@strands-agents/sdk'; import { z } from 'zod'; const millionshortSearch = tool({ name: 'millionshort_search', description: 'Search the web with MillionShort. remove_top_sites leaves out the N most popular sites.', inputSchema: z.object({ query: z.string(), remove_top_sites: z.number().int().default(1000) }), callback: async ({ query, remove_top_sites }) => { const res = await fetch('https://api.millionshort.com/v1/search', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json' }, body: JSON.stringify({ query, remove_top_sites, num_results: 5 }), }); if (!res.ok) throw new Error(`search failed: ${res.status}`); const { data } = (await res.json()) as { data: { results: { title: string; url: string; snippet?: string }[] } }; return JSON.stringify(data.results.map(({ title, url, snippet }) => ({ title, url, snippet }))); }, }); const agent = new Agent({ tools: [millionshortSearch] }); console.log(String(await agent.invoke('Find independent blogs about home espresso.'))); ``` ## MCP configuration The same address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Settings | Variable | Meaning | |---|---| | `MILLIONSHORT_API_KEY` | Your key, read by the examples above. Leave the header out for the no-key mode | The Python `MCPClient` also takes `startup_timeout` (seconds, 30 by default) and `prefix`: with `prefix="ms"` the tools are named `ms_search` and so on, useful when another server has a `search` tool too. ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | | "Unable to locate credentials" (Python) before any tool is called | No `model` was given, so Strands uses Amazon Bedrock | Configure AWS credentials, or pass `model` for another provider | | Python: a call fails after the `with` block | Tools from `list_tools_sync()` work only while the connection is open | Run the agent inside the block, or pass the client itself in `tools` | ## Related - [Agent tool use](https://millionshort.com/docs/search/guides/agent-tool-use): when to give a model tools, and what to tell it. - [OpenAI Agents SDK](https://millionshort.com/docs/integrations/openai-agents) and [Mastra](https://millionshort.com/docs/integrations/mastra): the same server in other agent frameworks. - [MCP server](https://millionshort.com/docs/mcp) and [Filters for agents](https://millionshort.com/docs/search/filters). - The Strands Agents documentation, read on 2026-11-19: [MCP tools](https://strandsagents.com/docs/user-guide/sdk/tools/mcp-tools/), [MCP transports](https://strandsagents.com/docs/user-guide/sdk/tools/mcp-transports/), [Tools](https://strandsagents.com/docs/user-guide/sdk/tools/). --- Source: https://millionshort.com/docs/integrations/surfsense Section: Build with # SurfSense MillionShort search in SurfSense, through the hosted MCP server. MCP · Hosted MCP server, nothing to install · Key in a form field · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. ## 1. Add the server 1. **Settings**, **Plugins**: turn on **Allow third-party plugins** (a server added by its address counts as one). 2. **Add custom plugin**. Name `millionshort`, server URL `https://mcp.millionshort.com/mcp`. 3. **Advanced settings**, **Headers**: name `Authorization`, value `Bearer ms-YOUR_API_KEY`. Leave it empty for the no-key mode. 4. **Add**. SurfSense lists the tools before it saves. ## 2. Try it Ask SurfSense: > Search MillionShort for forum threads about restoring a cast iron skillet, with the 1,000 most popular sites removed. List the five most useful with their links. A good answer comes from a `search` call (the client shows the tool call) and links to pages you may not have seen before. ## 3. Use only this search Plugins work in agentic chats. Switch off (or never connect) the built-in search plugin under **Settings**, **Plugins**, so the agent uses `millionshort`. Add this line to the chat's instructions: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## 4. Check it works **Settings**, **Plugins**, **Yours** shows `millionshort` on; open it to see its tools. After a change, use **Refresh tools**. With a key you should see `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them); with no key, fewer, `search` and `list_sources` among them. ## The server One address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. A key is optional. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | ## Related - [MCP server](https://millionshort.com/docs/mcp): the address, every tool, and what the no-key mode allows. - [Filters for agents](https://millionshort.com/docs/search/filters): what to ask `search` for, with recipes. - More research & rag: [GPT Researcher](https://millionshort.com/docs/integrations/gpt-researcher), [Hermes Agent](https://millionshort.com/docs/integrations/hermes-agent), [OpenClaw](https://millionshort.com/docs/integrations/openclaw), [Onyx](https://millionshort.com/docs/integrations/onyx), and [every integration](https://millionshort.com/docs/integrations). - SurfSense's own documentation, read on 2026-11-19: [Plugins](https://github.com/MODSetter/SurfSense/blob/main/www/content/docs/v2/plugins/index.mdx), [Third-party plugins](https://github.com/MODSetter/SurfSense/blob/main/www/content/docs/v2/plugins/third-party.mdx). --- Source: https://millionshort.com/docs/integrations/tavus Section: Build with # Tavus MillionShort search for a Tavus PAL, as an MCP connector that the PAL hands searches to while it keeps talking. MCP · API · Nothing of ours to install · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. Tavus calls an MCP server a connector. You register the MillionShort server once, then attach it to a PAL. During a conversation the PAL hands a search to a background agent, which calls our tools, while the PAL says it is checking and keeps talking; when the result lands, the PAL speaks it. This is different from a Tavus LLM tool, where one call returns one result. Spoken answers work best with few results: ask for `num_results` 3 and `max_highlights` 1, so the background agent reads short passages rather than long text. Each search also adds a little latency, here to the task rather than to the conversation, which carries on while the task runs. Registering your own MCP server is documented through the Tavus API. Tavus' pre-built connectors are in its Developer Portal under **Tools and Connectors**. ## 1. Connect the server Register the server with Create Connector. Here TAVUS_API_KEY is your Tavus key, sent as `x-api-key`: ```bash curl -X POST https://tavusapi.com/v2/connectors \ -H "x-api-key: $TAVUS_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "name": "MillionShort", "server_url": "https://mcp.millionshort.com/mcp", "auth_config": { "type": "api_key", "name": "Authorization", "value": "Bearer ms-YOUR_API_KEY", "location": "header" } }' ``` The `api_key` type sends the header exactly as written. For the no-key mode, leave `auth_config` out: its default is `{ "type": "none" }`. Tavus stores the key encrypted and never returns it. The answer carries the connector's `connector_id`; the connector is usable at once. ## 2. Give the tools to a PAL Set `layers.mcp.connectors` to the connector's ID, on Create PAL (`POST /v2/pals`) or on an existing PAL. `connector_tools` limits the PAL to `search`; leave it out to allow every tool of the server ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them). ```json { "pal_name": "Research assistant", "system_prompt": "When the user asks about something recent, niche or that needs a source, delegate a web search that says exactly what to find. Tell them you are checking, keep talking, and share the result in two or three short sentences when it arrives.", "layers": { "mcp": { "connectors": ["YOUR_CONNECTOR_ID"], "connector_tools": { "YOUR_CONNECTOR_ID": ["search"] }, "prompt": "Use the search tool with num_results 3 and max_highlights 1. To reach lesser-known sites, set remove_top_sites to 1000. Return the best answer with the site it came from." } } } ``` On an existing PAL, Patch PAL takes JSON Patch operations, not a merge body: ```bash curl -X PATCH https://tavusapi.com/v2/pals/YOUR_PAL_ID \ -H "x-api-key: $TAVUS_API_KEY" \ -H "Content-Type: application/json" \ -d '[{ "op": "add", "path": "/layers/mcp/connectors", "value": ["YOUR_CONNECTOR_ID"] }]' ``` Use `replace` in place of `add` once the PAL already has `layers.mcp.connectors`. ## 3. Tell the PAL when to search Two prompts are read by two different models: | Prompt | Read by | Put here | |---|---|---| | The PAL's `system_prompt` | The PAL holding the conversation | When to hand off a search, and what to ask for. Not tool names | | `layers.mcp.prompt` | The background agent that calls our tools | How to search: `search` with `num_results` 3 and `max_highlights` 1, and the filters to use | The line below belongs in `layers.mcp.prompt`, where tool names are read: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## 4. Check it works `GET /v2/connectors/YOUR_CONNECTOR_ID/preview` (Preview Connector Tools) returns our server's own tool list: with a key, `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them); with no key, fewer, `search` and `list_sources` among them. A call reaches the server by a different path from the preview, so also run Runtime Check Connector: ```bash curl -X POST https://tavusapi.com/v2/connectors/YOUR_CONNECTOR_ID/runtime_check \ -H "x-api-key: $TAVUS_API_KEY" ``` `ok: true` means a conversation can reach our server; `ok: false` comes with the reason in `error.message`. In the Developer Portal, **Test runtime connection** in the connector's **Manage tools** dialog runs the same check. Then start a conversation and ask a question that needs the web: your client receives a `conversation.agent_start` event and, with the answer, a `conversation.agent_stop` event for the same `task_id`. ## MCP configuration The same address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Settings | Field | Meaning | |---|---| | `auth_config` | On the connector: `api_key` with `name` `Authorization` and `value` `Bearer ms-YOUR_API_KEY`. Leave it out for the no-key mode | | `layers.mcp.connector_tools` | On the PAL: the tools it may call, by connector ID, for example only `search` | | `layers.mcp.prompt` | On the PAL: how the background agent should search. Up to 10,000 characters | | `layers.mcp.spoken_updates` | On the PAL: `outcome` (the default) speaks the result once; `all` also speaks updates while a task runs; `none` says nothing unless asked | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. Tavus allows 10 connectors a PAL, 5 tasks running at once in a conversation, and 120 seconds a task. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | | The preview works, but a conversation cannot reach the server | A call takes a different path from the preview | Run Runtime Check Connector and read `error.message` | | The PAL says to ask again in a moment | Five tasks were already running in the conversation | Ask for one search at a time in the PAL's `system_prompt` | | The PAL never hands off a search | Its `system_prompt` does not say when to | Say when to delegate in `system_prompt`, and how to search in `layers.mcp.prompt` | | A `connector_tools` patch is rejected | An empty list is not allowed | List at least one tool, or detach the connector | ## Related - [ElevenLabs Agents](https://millionshort.com/docs/integrations/elevenlabs), [Vapi](https://millionshort.com/docs/integrations/vapi) and [LiveKit Agents](https://millionshort.com/docs/integrations/livekit-agents): the same server in other voice agents. - [Agent tool use](https://millionshort.com/docs/search/guides/agent-tool-use): when to give a model tools, and what to tell it. - [MCP server](https://millionshort.com/docs/mcp) and [Filters for agents](https://millionshort.com/docs/search/filters). - Tavus' own documentation, read on 2026-11-19: [MCP Connectors](https://docs.tavus.io/sections/conversational-video-interface/pal/mcp-connectors), [Create Connector](https://docs.tavus.io/api-reference/connectors/create-connector), [Patch PAL](https://docs.tavus.io/api-reference/pals/patch-pal). --- Source: https://millionshort.com/docs/integrations/tines Section: Build with # Tines MillionShort search as a step in Tines, through the hosted MCP server or the API. MCP · Hosted MCP server, nothing to install · Key in a form field · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. ## 1. Add the MCP server In an **AI Agent** action, add a remote MCP server as a tool: URL `https://mcp.millionshort.com/mcp`, streamable HTTP, bearer authentication with your key (or none for the no-key mode). ## 2. Or call the API in an HTTP step Keep the key in a credential called `millionshort`, then an **HTTP Request** action: ```json HTTP Request action { "url": "https://api.millionshort.com/v1/search", "method": "post", "content_type": "json", "headers": { "Authorization": "Bearer <>" }, "payload": { "query": "<>", "remove_top_sites": 1000, "num_results": 5 } } ``` Its event carries `body`, `headers` and `code`; the results are at `body.data.results`. ## 3. Try it Ask Tines's agent, or run the step with this as the query: > Search MillionShort for forum threads about restoring a cast iron skillet, with the 1,000 most popular sites removed. List the five most useful with their links. A good answer comes from a `search` call (the client shows the tool call) and links to pages you may not have seen before. ## 4. Turn off the built-in search A tenant owner can turn the AI Agent action's own web search off in the tenant's AI settings. Add this line to the AI Agent action's prompt: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## 5. Check it works The server's tools appear with the agent's other tools; run it and read the tool calls in the event. The HTTP action's event shows `code` 200. With a key you should see `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them); with no key, fewer, `search` and `list_sources` among them. ## The server One address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. A key is optional. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | ## Related - [MCP server](https://millionshort.com/docs/mcp): the address, every tool, and what the no-key mode allows. - [Filters for agents](https://millionshort.com/docs/search/filters): what to ask `search` for, with recipes. - More low-code builders: [n8n](https://millionshort.com/docs/integrations/n8n), [Zapier](https://millionshort.com/docs/integrations/zapier), [Make](https://millionshort.com/docs/integrations/make), [Dify](https://millionshort.com/docs/integrations/dify), and [every integration](https://millionshort.com/docs/integrations). - Tines's own documentation, read on 2026-11-19: [AI Agent action](https://www.tines.com/llm/stories/docs/actions/types/ai-agent.md), [HTTP Request action](https://www.tines.com/llm/stories/docs/actions/types/http-request.md), [Credentials](https://www.tines.com/llm/stories/docs/credentials/http-request.md). --- Source: https://millionshort.com/docs/integrations/v0 Section: Build with # v0 MillionShort search in v0, through the hosted MCP server. MCP · Hosted MCP server, nothing to install · Key in a form field · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. ## 1. Add the server 1. In the prompt form, open the **+** menu and choose **MCPs**. 2. Add a custom MCP server: name `millionshort`, URL `https://mcp.millionshort.com/mcp`. 3. Authentication: **Bearer Token** with your key, or **No Auth** for the no-key mode. ## 2. Try it Start a chat and ask: > Search MillionShort for forum threads about restoring a cast iron skillet, with the 1,000 most popular sites removed. List the five most useful with their links. A good answer comes from a `search` call (the client shows the tool call) and links to pages you may not have seen before. ## 3. Tell it when to search v0 has no setting we could find that turns its own web search off, so say which search to use. Say in your prompt: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## 4. Check it works v0 considers connected MCP servers on its own while it generates. Ask it to use `millionshort` by name. With a key you should see `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them); with no key, fewer, `search` and `list_sources` among them. ## Good to know - MCP servers give v0 tools while it generates; the app it generates cannot call them. To search from the app, store the key in its environment variables and call `POST https://api.millionshort.com/v1/search` ([quickstart](https://millionshort.com/docs/quickstart)). ## The server One address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. A key is optional. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | ## Related - [MCP server](https://millionshort.com/docs/mcp): the address, every tool, and what the no-key mode allows. - [Filters for agents](https://millionshort.com/docs/search/filters): what to ask `search` for, with recipes. - More coding agents: [Claude Code](https://millionshort.com/docs/integrations/claude-code), [Cursor](https://millionshort.com/docs/integrations/cursor), [Codex](https://millionshort.com/docs/integrations/codex), [GitHub Copilot in VS Code](https://millionshort.com/docs/integrations/vscode), and [every integration](https://millionshort.com/docs/integrations). - v0's own documentation, read on 2026-11-19: [v0 docs (MCP integrations)](https://v0.app/docs/llms.txt). --- Source: https://millionshort.com/docs/integrations/vapi Section: Build with # Vapi MillionShort search for a Vapi voice assistant, as an MCP tool with the key in a header, from the dashboard or the API. MCP · Dashboard and API · Nothing of ours to install · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. A Vapi MCP tool points an assistant at one MCP server. When a call or chat starts, Vapi asks the MillionShort server for its tools and gives them to the model: `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints, such as `extract`, `places`, `map` and `crawl` ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them all). Every tool call then opens its own short session with the server. Spoken answers work best with few results: ask for `num_results` 3 and `max_highlights` 1, so the model reads short passages rather than long text. Vapi passes the whole result to the model without shortening it. Each search also adds a little latency to the turn it runs in. ## 1. Connect the server In the Vapi dashboard: 1. Go to **Tools**, click **Create Tool**, and select **MCP**. 2. Under **Tool Settings**, enter a **Tool Name** (`MillionShort`) and a **Description** (`Web search`). These only identify the tool for you; the model sees the server's own tools. 3. Under **Server Settings**, set **Server URL** to `https://mcp.millionshort.com/mcp`. Leave **Timeout** at 20 seconds. 4. Under **HTTP Headers**, add `Authorization` with the value `Bearer ms-YOUR_API_KEY`. Leave it out for the no-key mode. Or select a saved Bearer token credential under **Authorization**, so the key is not in the tool itself. 5. Under **Messages**, click **Add Message** and set what the caller hears while a search runs, for example "Let me look that up." 6. Under **MCP Settings**, keep **Streamable HTTP** selected. 7. Save. Vapi asks the server for its tools and lists them under **Available Tools**. ## 2. Or create it with the API Only `type` and `server.url` are required. The key goes in `server.headers`, or a saved credential's ID goes in `server.credentialId`: ```bash curl -X POST https://api.vapi.ai/tool \ -H "Authorization: Bearer $VAPI_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "type": "mcp", "server": { "url": "https://mcp.millionshort.com/mcp", "timeoutSeconds": 20, "headers": { "Authorization": "Bearer ms-YOUR_API_KEY" } }, "metadata": { "protocol": "shttp" }, "messages": [{ "type": "request-start", "content": "Let me look that up." }] }' ``` Here VAPI_API_KEY is your Vapi private key. Creating the tool does not contact our server; the first request comes when a call or chat uses it. The answer carries the tool's `id`. ## 3. Give the tools to an assistant Open your assistant, add the MCP tool to its tools, and publish. With the API, put the tool's ID in the assistant's `model.toolIds`: ```json { "model": { "provider": "openai", "model": "gpt-4.1", "toolIds": ["YOUR_MCP_TOOL_ID"] } } ``` Vapi puts the main part of the server's domain in front of each tool name, so the model sees `millionshort-search`, `millionshort-get_domain_info`, `millionshort-list_sources` and so on. Use those names in the system prompt: > Use the millionshort-search tool for anything recent, niche, or that needs a source, with num_results 3 and max_highlights 1. Answer in two or three short sentences and name the site you used. Vapi has no setting to offer only some of a server's tools, so the assistant gets every tool of the server (fewer in the no-key mode). ## 4. Check it works After you save, **Available Tools** lists the server's tools: with a key, `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them); with no key, fewer, `search` and `list_sources` among them. If the list is empty, check the URL and the header, save again and click refresh. Then place a test call and ask a question that needs the web. On the call's page, **Messages** shows a `tool_calls` message for `millionshort-search`, followed by a `tool_call_result` message with what our server returned. If the assistant answers from memory, add this line to its system prompt: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## MCP configuration The same address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Settings | Field | Meaning | |---|---| | `server.headers` | `Authorization: Bearer ms-YOUR_API_KEY`. Leave it out for the no-key mode | | `server.credentialId` | A saved Bearer token credential, in place of the header. A header named `Authorization` wins over the credential | | `server.timeoutSeconds` | How long Vapi waits for each request to the server. The default, 20, is enough for a search | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | | **Available Tools** stays empty, or the assistant says it cannot search | The tool list request failed when the call started; Vapi's call logs do not show this | Check the URL, `metadata.protocol` and the header. Do not put a Vapi variable in the `Authorization` header: variables are not filled in for the tool list | | A search fails with a connection error | The URL or protocol is wrong, or the request took longer than the timeout | Use `https://mcp.millionshort.com/mcp` with `shttp`, and raise `server.timeoutSeconds` | | The caller hears "Give me a moment" before each search | Vapi's default phrase plays when no `request-start` message is set | Set a `request-start` message | | Long pauses before spoken answers | Many results or long text for the model to read | Ask for `num_results` 3 and `max_highlights` 1 in the system prompt | ## Related - [ElevenLabs Agents](https://millionshort.com/docs/integrations/elevenlabs), [LiveKit Agents](https://millionshort.com/docs/integrations/livekit-agents) and [Pipecat](https://millionshort.com/docs/integrations/pipecat): the same server in other voice agents. - [Agent tool use](https://millionshort.com/docs/search/guides/agent-tool-use): when to give a model tools, and what to tell it. - [MCP server](https://millionshort.com/docs/mcp) and [Filters for agents](https://millionshort.com/docs/search/filters). - Vapi's own documentation, read on 2026-11-19: [MCP tools](https://docs.vapi.ai/tools/mcp), [Configure MCP tools](https://docs.vapi.ai/tools/mcp/configure), [Messages and results](https://docs.vapi.ai/tools/mcp/messages-and-results), [Troubleshooting](https://docs.vapi.ai/tools/mcp/troubleshooting). --- Source: https://millionshort.com/docs/integrations/visual-studio Section: Build with # Visual Studio MillionShort search in Visual Studio, through the hosted MCP server. MCP · Hosted MCP server, nothing to install · Key in a header · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. ## 1. Add the server With GitHub Copilot in Visual Studio 2022 (17.14 or later) or Visual Studio 2026: in the Copilot Chat pane, switch to Agent mode, open **Tools**, press **+** and add a custom MCP server with the address above. Or create `.mcp.json` in your user folder (every solution) or the solution folder. The top-level key is `servers`: ```json Without a key { "servers": { "millionshort": { "type": "http", "url": "https://mcp.millionshort.com/mcp" } } } ``` Visual Studio's page shows the address only, not a header. It reads the same file format as VS Code, where a key goes in `"headers": { "Authorization": "Bearer ms-YOUR_API_KEY" }`; if your version does not take it, the server still works with no key. ## 2. Try it Ask Visual Studio: > Search MillionShort for forum threads about restoring a cast iron skillet, with the 1,000 most popular sites removed. List the five most useful with their links. A good answer comes from a `search` call (the client shows the tool call) and links to pages you may not have seen before. ## 3. Tell it when to search Visual Studio has no setting we could find that turns its own web search off, so say which search to use. Add this line to `.github/copilot-instructions.md` (switch custom instructions on under **Tools**, **Options**, **GitHub**, **Copilot**): > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## 4. Check it works In Agent mode, open the **Tools** picker: the server's tools are listed, switched off at first. Switch them on. Above the server in `.mcp.json`, a CodeLens shows its state. With a key you should see `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them); with no key, fewer, `search` and `list_sources` among them. ## The server One address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. A key is optional. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | ## Related - [MCP server](https://millionshort.com/docs/mcp): the address, every tool, and what the no-key mode allows. - [Filters for agents](https://millionshort.com/docs/search/filters): what to ask `search` for, with recipes. - More coding agents: [Claude Code](https://millionshort.com/docs/integrations/claude-code), [Cursor](https://millionshort.com/docs/integrations/cursor), [Codex](https://millionshort.com/docs/integrations/codex), [GitHub Copilot in VS Code](https://millionshort.com/docs/integrations/vscode), and [every integration](https://millionshort.com/docs/integrations). - Visual Studio's own documentation, read on 2026-11-19: [MCP servers in Visual Studio](https://learn.microsoft.com/en-us/visualstudio/ide/mcp-servers), [Custom instructions](https://learn.microsoft.com/en-us/visualstudio/ide/copilot-chat-context). --- Source: https://millionshort.com/docs/integrations/voiceflow Section: Build with # Voiceflow MillionShort search as a step in Voiceflow, through the hosted MCP server or the API. MCP · Hosted MCP server, nothing to install · Key in a form field · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. ## 1. Add the MCP server In a playbook's **Tools** menu choose **MCP**: server name `millionshort`, server URL `https://mcp.millionshort.com/mcp`, and a header `Authorization` = `Bearer ms-YOUR_API_KEY` (none for the no-key mode). Then pick the tools to switch on. ## 2. Or call the API in an HTTP step Or an **API tool**, with the key from the **Secrets** tab (type `{` in the header value to insert it): ```text API tool Method: POST URL: https://api.millionshort.com/v1/search Headers: Authorization = Bearer {your secret} Content-Type = application/json Body: Raw {"query": "{query}", "remove_top_sites": 1000, "num_results": 5} ``` ## 3. Try it Ask Voiceflow's agent, or run the step with this as the query: > Search MillionShort for forum threads about restoring a cast iron skillet, with the 1,000 most popular sites removed. List the five most useful with their links. A good answer comes from a `search` call (the client shows the tool call) and links to pages you may not have seen before. ## 4. Tell it when to search Voiceflow has no setting we could find that turns its own web search off, so say which search to use. Add this line to the playbook's instructions: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## 5. Check it works After connecting, Voiceflow fetches the server's tools for you to choose. An API tool has a **Run** button that shows the response. With a key you should see `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them); with no key, fewer, `search` and `list_sources` among them. ## The server One address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. A key is optional. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | ## Related - [MCP server](https://millionshort.com/docs/mcp): the address, every tool, and what the no-key mode allows. - [Filters for agents](https://millionshort.com/docs/search/filters): what to ask `search` for, with recipes. - More low-code builders: [n8n](https://millionshort.com/docs/integrations/n8n), [Zapier](https://millionshort.com/docs/integrations/zapier), [Make](https://millionshort.com/docs/integrations/make), [Dify](https://millionshort.com/docs/integrations/dify), and [every integration](https://millionshort.com/docs/integrations). - Voiceflow's own documentation, read on 2026-11-19: [MCP tool](https://www.voiceflow.com/docs/documentation/build/tools/mcp-tool), [API tool](https://www.voiceflow.com/docs/documentation/build/tools/api-tool). --- Source: https://millionshort.com/docs/integrations/vscode Section: Build with # GitHub Copilot in VS Code MillionShort search in GitHub Copilot in VS Code, through the hosted MCP server. MCP · Hosted MCP server, nothing to install · Key read from the environment · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. ## 1. Add the server Add a `.mcp.json` at the workspace root (or `~/.copilot/mcp-config.json` for every workspace). VS Code fills in `${MILLIONSHORT_API_KEY}` from the environment: ```json With a key { "mcpServers": { "millionshort": { "type": "http", "url": "https://mcp.millionshort.com/mcp", "headers": { "Authorization": "Bearer ${MILLIONSHORT_API_KEY}" }, "tools": ["*"] } } } ``` ```json Without a key { "mcpServers": { "millionshort": { "type": "http", "url": "https://mcp.millionshort.com/mcp", "tools": ["*"] } } } ``` Or from a shell, for your user profile: ```bash code --add-mcp '{"name":"millionshort","type":"http","url":"https://mcp.millionshort.com/mcp","headers":{"Authorization":"Bearer ${env:MILLIONSHORT_API_KEY}"}}' ``` An older `.vscode/mcp.json` (with `servers` and `inputs`) still works, but VS Code now prefers the files above, and a server that asks for its key with an input prompt is not passed on to Copilot sessions. ## 2. Try it Ask GitHub Copilot in VS Code: > Search MillionShort for forum threads about restoring a cast iron skillet, with the 1,000 most popular sites removed. List the five most useful with their links. A good answer comes from a `search` call (the client shows the tool call) and links to pages you may not have seen before. ## 3. Turn off the built-in search In the chat input, open **Configure Tools** and clear the built-in web and fetch tools, so the agent searches with `millionshort` only. Add this line to `.github/copilot-instructions.md` or `AGENTS.md`: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## 4. Check it works Run **MCP: List Servers** from the Command Palette: `millionshort` is running. In chat, type `#` to see its tools. With a key you should see `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them); with no key, fewer, `search` and `list_sources` among them. ## The server One address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. A key is optional. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | ## Related - [MCP server](https://millionshort.com/docs/mcp): the address, every tool, and what the no-key mode allows. - [Filters for agents](https://millionshort.com/docs/search/filters): what to ask `search` for, with recipes. - More coding agents: [Claude Code](https://millionshort.com/docs/integrations/claude-code), [Cursor](https://millionshort.com/docs/integrations/cursor), [Codex](https://millionshort.com/docs/integrations/codex), [Gemini CLI](https://millionshort.com/docs/integrations/gemini-cli), and [every integration](https://millionshort.com/docs/integrations). - GitHub Copilot in VS Code's own documentation, read on 2026-11-19: [MCP configuration](https://code.visualstudio.com/docs/agents/reference/mcp-configuration), [MCP servers](https://code.visualstudio.com/docs/agent-customization/mcp-servers), [Custom instructions](https://code.visualstudio.com/docs/agent-customization/custom-instructions). --- Source: https://millionshort.com/docs/integrations/warp Section: Build with # Warp MillionShort search in Warp, through the hosted MCP server. MCP · Hosted MCP server, nothing to install · Key in a header · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. ## 1. Add the server Open **Settings**, **Agents**, **MCP servers**, click **+ Add**, and paste: ```json With a key { "mcpServers": { "millionshort": { "url": "https://mcp.millionshort.com/mcp", "headers": { "Authorization": "Bearer ms-YOUR_API_KEY" } } } } ``` ```json Without a key { "mcpServers": { "millionshort": { "url": "https://mcp.millionshort.com/mcp" } } } ``` Start it from the list. The same block in `~/.warp/.mcp.json` makes it start on its own. ## 2. Try it Ask Warp: > Search MillionShort for forum threads about restoring a cast iron skillet, with the 1,000 most popular sites removed. List the five most useful with their links. A good answer comes from a `search` call (the client shows the tool call) and links to pages you may not have seen before. ## 3. Turn off the built-in search Open **Settings**, **Agents**, **Profiles**, **Edit** next to your profile, and turn off **Call web tools**. Add this line to `AGENTS.md`: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## 4. Check it works The MCP servers page shows `millionshort` running, with its tools; **View Logs** shows what went wrong if it is not. With a key you should see `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them); with no key, fewer, `search` and `list_sources` among them. ## The server One address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. A key is optional. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | ## Related - [MCP server](https://millionshort.com/docs/mcp): the address, every tool, and what the no-key mode allows. - [Filters for agents](https://millionshort.com/docs/search/filters): what to ask `search` for, with recipes. - More coding agents: [Claude Code](https://millionshort.com/docs/integrations/claude-code), [Cursor](https://millionshort.com/docs/integrations/cursor), [Codex](https://millionshort.com/docs/integrations/codex), [GitHub Copilot in VS Code](https://millionshort.com/docs/integrations/vscode), and [every integration](https://millionshort.com/docs/integrations). - Warp's own documentation, read on 2026-11-19: [MCP](https://docs.warp.dev/agents/capabilities/mcp), [Rules](https://docs.warp.dev/agents/capabilities/rules), [Web search](https://docs.warp.dev/agents/capabilities/web-search). --- Source: https://millionshort.com/docs/integrations/weknora Section: Build with # WeKnora MillionShort search in WeKnora, through the hosted MCP server. MCP · Hosted MCP server, nothing to install · Key in a form field · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. ## 1. Add the server A space admin opens **Toolbox**, **MCP Services**, creates a service and uses **Import from code** to fill the form from this JSON. WeKnora does not fill in environment variables here: type the key. ```json With a key { "mcpServers": { "millionshort": { "type": "http", "url": "https://mcp.millionshort.com/mcp", "headers": { "Authorization": "Bearer ms-YOUR_API_KEY" } } } } ``` ```json Without a key { "mcpServers": { "millionshort": { "type": "http", "url": "https://mcp.millionshort.com/mcp" } } } ``` Save and test the connection, then in the second step sync the tools, write a short usage note, and pick the service in an agent. WeKnora's docs are in Chinese; the labels here are translated. ## 2. Try it Ask WeKnora: > Search MillionShort for forum threads about restoring a cast iron skillet, with the 1,000 most popular sites removed. List the five most useful with their links. A good answer comes from a `search` call (the client shows the tool call) and links to pages you may not have seen before. ## 3. Use only this search WeKnora's own web search is used only by an agent that has a search configuration selected. Leave it unselected in the agent. Add this line to the service's usage note: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## 4. Check it works After saving, the connection test passes and the second step lists the tools. In an agent chat, each search shows as a tool step. With a key you should see `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them); with no key, fewer, `search` and `list_sources` among them. ## The server One address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. A key is optional. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | ## Related - [MCP server](https://millionshort.com/docs/mcp): the address, every tool, and what the no-key mode allows. - [Filters for agents](https://millionshort.com/docs/search/filters): what to ask `search` for, with recipes. - More research & rag: [GPT Researcher](https://millionshort.com/docs/integrations/gpt-researcher), [Hermes Agent](https://millionshort.com/docs/integrations/hermes-agent), [OpenClaw](https://millionshort.com/docs/integrations/openclaw), [Onyx](https://millionshort.com/docs/integrations/onyx), and [every integration](https://millionshort.com/docs/integrations). - WeKnora's own documentation, read on 2026-11-19: [MCP services](https://github.com/Tencent/WeKnora/blob/main/website-docs/03-features/08-mcp.md), [Web search](https://github.com/Tencent/WeKnora/blob/main/website-docs/03-features/11-web-search.md). --- Source: https://millionshort.com/docs/integrations/windmill Section: Build with # Windmill MillionShort search as a step in Windmill, through the hosted MCP server or the API. Recipe · Hosted MCP server, nothing to install · Key in a form field · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. ## 1. Add the MCP server An **AI Agent** step takes MCP servers that speak streamable HTTP. Create an MCP resource with name `millionshort` and URL `https://mcp.millionshort.com/mcp` (leave the auth token empty for the no-key mode), and add it to the step as a tool; the agent finds the tools itself. ## 2. Or call the API in an HTTP step A TypeScript script step: ```ts Script export async function main(query: string) { const res = await fetch('https://api.millionshort.com/v1/search', { method: 'POST', headers: { 'Content-Type': 'application/json', Authorization: 'Bearer ms-YOUR_API_KEY' }, body: JSON.stringify({ query, remove_top_sites: 1000, num_results: 5 }), }); if (!res.ok) throw new Error(`search failed: ${res.status}`); return await res.json(); } ``` Keep the key in a Windmill secret variable rather than in the script. ## 3. Try it Ask Windmill's agent, or run the step with this as the query: > Search MillionShort for forum threads about restoring a cast iron skillet, with the 1,000 most popular sites removed. List the five most useful with their links. A good answer comes from a `search` call (the client shows the tool call) and links to pages you may not have seen before. ## 4. Tell it when to search Windmill has no setting we could find that turns its own web search off, so say which search to use. Add this line to the AI Agent step's instructions: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## 5. Check it works The AI Agent step lists the server's tools. Run the script once: its result has `data.results`. With a key you should see `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them); with no key, fewer, `search` and `list_sources` among them. ## The server One address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. A key is optional. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | ## Related - [MCP server](https://millionshort.com/docs/mcp): the address, every tool, and what the no-key mode allows. - [Filters for agents](https://millionshort.com/docs/search/filters): what to ask `search` for, with recipes. - More low-code builders: [n8n](https://millionshort.com/docs/integrations/n8n), [Zapier](https://millionshort.com/docs/integrations/zapier), [Make](https://millionshort.com/docs/integrations/make), [Dify](https://millionshort.com/docs/integrations/dify), and [every integration](https://millionshort.com/docs/integrations). - Windmill's own documentation, read on 2026-11-19: [AI agents](https://www.windmill.dev/docs/core_concepts/ai_agents), [TypeScript scripts](https://www.windmill.dev/docs/getting_started/scripts_quickstart/typescript). --- Source: https://millionshort.com/docs/integrations/windsurf Section: Build with # Windsurf (Devin Desktop) MillionShort search in Windsurf (Devin Desktop), through the hosted MCP server. MCP · Hosted MCP server, nothing to install · Key in a header · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. Windsurf is now Devin Desktop, and its agent reads the Devin MCP files below. ## 1. Add the server Put the server with your key in `.devin/mcp_config.local.json` (personal, kept out of git), or in `~/.config/devin/mcp_config.json` for every project. A server with no key can go in the shared `.devin/mcp_config.json`: ```json With a key { "mcpServers": { "millionshort": { "url": "https://mcp.millionshort.com/mcp", "transport": "http", "headers": { "Authorization": "Bearer ms-YOUR_API_KEY" } } } } ``` ```json Without a key { "mcpServers": { "millionshort": { "url": "https://mcp.millionshort.com/mcp", "transport": "http" } } } ``` In the app, the same servers are under the agent sidebar's **Customize**, **MCPs**, with a button to open the file. ## 2. Try it Ask Windsurf (Devin Desktop): > Search MillionShort for forum threads about restoring a cast iron skillet, with the 1,000 most popular sites removed. List the five most useful with their links. A good answer comes from a `search` call (the client shows the tool call) and links to pages you may not have seen before. ## 3. Tell it when to search Windsurf (Devin Desktop) has no setting we could find that turns its own web search off, so say which search to use. Add this line to `AGENTS.md` at the project root: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## 4. Check it works **Customize**, **MCPs**, **This computer** shows `millionshort` connected. From a shell, `devin mcp list`. With a key you should see `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them); with no key, fewer, `search` and `list_sources` among them. ## Good to know - The agent asks before each MCP tool call; allow the read-only tools to skip the prompt. `crawl` spends credits, `crawl_cancel` stops a crawl and `create_space` saves a Space. ## The server One address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. A key is optional. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | ## Related - [MCP server](https://millionshort.com/docs/mcp): the address, every tool, and what the no-key mode allows. - [Filters for agents](https://millionshort.com/docs/search/filters): what to ask `search` for, with recipes. - More coding agents: [Claude Code](https://millionshort.com/docs/integrations/claude-code), [Cursor](https://millionshort.com/docs/integrations/cursor), [Codex](https://millionshort.com/docs/integrations/codex), [GitHub Copilot in VS Code](https://millionshort.com/docs/integrations/vscode), and [every integration](https://millionshort.com/docs/integrations). - Windsurf (Devin Desktop)'s own documentation, read on 2026-11-19: [Devin Local customizations](https://docs.devin.ai/desktop/devin-local/customizations), [MCP configuration](https://docs.devin.ai/cli/extensibility/mcp/configuration). --- Source: https://millionshort.com/docs/integrations/workato Section: Build with # Workato MillionShort search as a step in Workato, through the hosted MCP server or the API. MCP · Hosted MCP server, nothing to install · Key in a form field · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. ## 1. Add the MCP server 1. **AI Hub**, **Agent Studio**, open the genie, **Edit**. 2. **Enterprise skills**, **+ Add**, **MCP server**, **+ Custom MCP server**, **Next**. 3. Connection name `millionshort`, a project folder, MCP server URL `https://mcp.millionshort.com/mcp`. 4. **Authentication Type**: token authentication, with your key sent in a header. 5. **Connect**, tick the tools, **Done**. One token is shared by everyone who uses the genie. ## 2. Try it Ask Workato's agent, or run the step with this as the query: > Search MillionShort for forum threads about restoring a cast iron skillet, with the 1,000 most popular sites removed. List the five most useful with their links. A good answer comes from a `search` call (the client shows the tool call) and links to pages you may not have seen before. ## 3. Tell it when to search Workato has no setting we could find that turns its own web search off, so say which search to use. Add this line to the genie's instructions: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## 4. Check it works After **Connect** the tools are listed with checkboxes; the ones you tick show under **Enterprise skills** on the genie's overview. With a key you should see `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them); with no key, fewer, `search` and `list_sources` among them. ## The server One address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. A key is optional. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | ## Related - [MCP server](https://millionshort.com/docs/mcp): the address, every tool, and what the no-key mode allows. - [Filters for agents](https://millionshort.com/docs/search/filters): what to ask `search` for, with recipes. - More low-code builders: [n8n](https://millionshort.com/docs/integrations/n8n), [Zapier](https://millionshort.com/docs/integrations/zapier), [Make](https://millionshort.com/docs/integrations/make), [Dify](https://millionshort.com/docs/integrations/dify), and [every integration](https://millionshort.com/docs/integrations). - Workato's own documentation, read on 2026-11-19: [Genies as MCP clients](https://docs.workato.com/en/mcp/genies-as-mcp-clients). --- Source: https://millionshort.com/docs/integrations/xai Section: Build with # xAI MillionShort search for Grok models, as a remote MCP tool in the xAI API or a function tool, in Python and TypeScript. MCP · Python and TypeScript · Nothing of ours to install · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. The xAI API connects to the MillionShort MCP server for you: list it as an `mcp` tool and xAI lists and calls the server's tools (`search`, `get_domain_info`, `list_sources` and the tools of the other endpoints; [the MCP page](https://millionshort.com/docs/mcp#tools) lists them all) while Grok works. It works through the OpenAI SDK pointed at xAI, and through xAI's own Python SDK. For a loop you run yourself, a function tool that calls our API does the same job. ## 1. Install ```bash Python pip install openai xai-sdk requests export MILLIONSHORT_API_KEY=ms-YOUR_API_KEY ``` ```bash TypeScript npm install openai export MILLIONSHORT_API_KEY=ms-YOUR_API_KEY ``` The examples read your xAI key from XAI_API_KEY. Get a MillionShort key in the [dashboard](https://millionshort.com/app/); an agent can ask for a [trial key](https://millionshort.com/docs/api-reference/agent-key) by itself. `xai-sdk` is only for step 4 and `requests` only for the function tool. ## 2. Connect the server The key goes in the tool's `headers` as a bearer header. xAI also has an `authorization` field that sets the `Authorization` header, but its docs do not say whether it adds `Bearer ` itself, so the header is written out here. The key travels with each request to xAI: use one you can revoke. Without a key, leave `headers` out. ```python Python import os from openai import OpenAI client = OpenAI(api_key=os.environ["XAI_API_KEY"], base_url="https://api.x.ai/v1") response = client.responses.create( model="grok-4.7", input="Find independent blogs about home espresso, without the 1,000 most popular sites.", tools=[ { "type": "mcp", "server_label": "millionshort", "server_description": "Web search that can leave out the most popular sites.", "server_url": "https://mcp.millionshort.com/mcp", "headers": {"Authorization": f"Bearer {os.environ['MILLIONSHORT_API_KEY']}"}, } ], ) print(response.output_text) ``` ```ts TypeScript import OpenAI from 'openai'; const client = new OpenAI({ apiKey: process.env.XAI_API_KEY, baseURL: 'https://api.x.ai/v1' }); const response = await client.responses.create({ model: 'grok-4.7', input: 'Find independent blogs about home espresso, without the 1,000 most popular sites.', tools: [ { type: 'mcp', server_label: 'millionshort', server_description: 'Web search that can leave out the most popular sites.', server_url: 'https://mcp.millionshort.com/mcp', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}` }, }, ], }); console.log(response.output_text); ``` xAI does not support `require_approval` (or `connector_id`), so leave it out: calls run without asking. Most of the tools only read; `crawl` spends credits, `crawl_cancel` stops a crawl and `create_space` saves a Space, so tell the model in its instructions when it may use those. xAI makes the calls from its own servers, over streamable HTTP, so our server must be reachable from the internet, which it is. ## 3. Tell it when to search Grok's web search and X search are server-side tools that run only when you list them in `tools`, so leave them out. Then add a line like this to the conversation as a system message: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. To offer only some of the tools, add `"allowed_tools": ["search", "list_sources"]` to the `mcp` tool (`allowed_tool_names` in xAI's own SDK). ## 4. Check it works xAI's own SDK shows each server-side tool call as it happens. The same server, with the key in `extra_headers`: ```python Python import os from xai_sdk import Client from xai_sdk.chat import user from xai_sdk.tools import mcp client = Client(api_key=os.environ["XAI_API_KEY"]) server = mcp( server_url="https://mcp.millionshort.com/mcp", server_label="millionshort", extra_headers={"Authorization": f"Bearer {os.environ['MILLIONSHORT_API_KEY']}"}, ) chat = client.chat.create(model="grok-4.7", tools=[server]) chat.append(user("Search MillionShort for home espresso blogs.")) for response, chunk in chat.stream(): for call in chunk.tool_calls: print("calling", call.function.name, call.function.arguments) print(chunk.content, end="") ``` Expect a call to `search` before the answer. To try it, ask: > Search MillionShort for forum threads about restoring a cast iron skillet, with the 1,000 most popular sites removed. List the five most useful with their links. ## Without MCP: a function tool Your code runs the search; each round sends the results back with `previous_response_id`, until the model stops asking. ```python Python import json import os import requests from openai import OpenAI def millionshort_search(query: str) -> str: r = requests.post( "https://api.millionshort.com/v1/search", headers={"Authorization": f"Bearer {os.environ['MILLIONSHORT_API_KEY']}"}, json={"query": query, "remove_top_sites": 1000, "num_results": 5}, timeout=30, ) r.raise_for_status() return json.dumps([{"title": x["title"], "url": x["url"], "snippet": x.get("snippet")} for x in r.json()["data"]["results"]]) tools = [{ "type": "function", "name": "millionshort_search", "description": "Search the web with MillionShort, leaving out the 1,000 most popular sites.", "parameters": {"type": "object", "properties": {"query": {"type": "string"}}, "required": ["query"]}, }] client = OpenAI(api_key=os.environ["XAI_API_KEY"], base_url="https://api.x.ai/v1") response = client.responses.create(model="grok-4.7", input="Find independent blogs about home espresso.", tools=tools) while calls := [item for item in response.output if item.type == "function_call"]: outputs = [{"type": "function_call_output", "call_id": c.call_id, "output": millionshort_search(**json.loads(c.arguments))} for c in calls] response = client.responses.create(model="grok-4.7", input=outputs, tools=tools, previous_response_id=response.id) print(response.output_text) ``` ```ts TypeScript import OpenAI from 'openai'; async function millionshortSearch(query: string): Promise { const res = await fetch('https://api.millionshort.com/v1/search', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json' }, body: JSON.stringify({ query, remove_top_sites: 1000, num_results: 5 }), }); if (!res.ok) throw new Error(`search failed: ${res.status}`); const { data } = (await res.json()) as { data: { results: { title: string; url: string; snippet?: string }[] } }; return JSON.stringify(data.results.map(({ title, url, snippet }) => ({ title, url, snippet }))); } const tools: OpenAI.Responses.Tool[] = [{ type: 'function', name: 'millionshort_search', description: 'Search the web with MillionShort, leaving out the 1,000 most popular sites.', parameters: { type: 'object', properties: { query: { type: 'string' } }, required: ['query'] }, strict: false, }]; const client = new OpenAI({ apiKey: process.env.XAI_API_KEY, baseURL: 'https://api.x.ai/v1' }); let response = await client.responses.create({ model: 'grok-4.7', input: 'Find independent blogs about home espresso.', tools }); for (;;) { const calls = response.output.filter((item) => item.type === 'function_call'); if (calls.length === 0) break; const input: OpenAI.Responses.ResponseInput = []; for (const call of calls) { input.push({ type: 'function_call_output', call_id: call.call_id, output: await millionshortSearch(JSON.parse(call.arguments).query) }); } response = await client.responses.create({ model: 'grok-4.7', input, tools, previous_response_id: response.id }); } console.log(response.output_text); ``` ## MCP configuration The same address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Settings | Variable | Meaning | |---|---| | `MILLIONSHORT_API_KEY` | Your key, read by the examples above. Leave the header out for the no-key mode | | XAI_API_KEY | Your xAI key, read by the examples above | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | | The MCP tool fails, the function tool works | xAI's servers could not reach ours | Try again, or use the function tool | ## Related - [Agent tool use](https://millionshort.com/docs/search/guides/agent-tool-use): when to give a model tools, and what to tell it. - [Grok Build](https://millionshort.com/docs/integrations/grok-build): the same server in xAI's coding agent. - Other model APIs: [OpenAI](https://millionshort.com/docs/integrations/openai) (the same `mcp` tool), [Groq](https://millionshort.com/docs/integrations/groq), [Anthropic](https://millionshort.com/docs/integrations/anthropic). - [MCP server](https://millionshort.com/docs/mcp) and [Filters for agents](https://millionshort.com/docs/search/filters). - xAI's own documentation, read on 2026-11-19: [Remote MCP Tools](https://docs.x.ai/developers/tools/remote-mcp), [Function Calling](https://docs.x.ai/developers/tools/function-calling). --- Source: https://millionshort.com/docs/integrations/zapier Section: Build with # Zapier MillionShort search as a step in Zapier, with one call to the API. Recipe · An HTTP step · Key in a form field · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. > **App coming soon.** A MillionShort app for Zapier is not published yet. Everything below works today without it. ## 1. Call the API in an HTTP step Add an action step: **Webhooks by Zapier**, event **Custom Request**: ```text Custom Request Method: POST URL: https://api.millionshort.com/v1/search Data: {"query": "...", "remove_top_sites": 1000, "num_results": 5} Headers: Content-Type = application/json Authorization = Bearer ms-YOUR_API_KEY ``` Map the query from an earlier step into `Data`. The key is in the step's headers, where anyone who can edit the Zap can read it: use a key you can revoke. ## 2. Try it Ask Zapier's agent, or run the step with this as the query: > Search MillionShort for forum threads about restoring a cast iron skillet, with the 1,000 most popular sites removed. List the five most useful with their links. A good answer comes from a `search` call (the client shows the tool call) and links to pages you may not have seen before. ## 3. Tell it when to search Zapier has no search of its own in a Zap, so say which search to use. If an AI step reads the results, tell it: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## 4. Check it works **Test step** in the Zap editor, then read the response fields in the step's output. A search that worked returns `data.results`, each with a `title`, a `url` and a `snippet`, and `usage.credits`: what it cost. ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | `401 AUTH_MISSING_KEY` or `AUTH_INVALID_KEY` | The key is missing or wrong | Set `MILLIONSHORT_API_KEY`; keys start with `ms-` | | `400 INVALID_PARAM` | A field name or value the API does not take | The `message` names the field; the [search reference](https://millionshort.com/docs/search/parameters) lists them all | | `429 RATE_LIMITED` or `CAPACITY` | Too many calls a minute, or no free capacity right now | Wait the `Retry-After` seconds, then retry | | `429 INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; do not retry | ## Related - [MCP server](https://millionshort.com/docs/mcp): the address, every tool, and what the no-key mode allows. - [Filters for agents](https://millionshort.com/docs/search/filters): what to ask `search` for, with recipes. - More low-code builders: [n8n](https://millionshort.com/docs/integrations/n8n), [Make](https://millionshort.com/docs/integrations/make), [Dify](https://millionshort.com/docs/integrations/dify), [Langflow](https://millionshort.com/docs/integrations/langflow), and [every integration](https://millionshort.com/docs/integrations). - Zapier's own documentation, read on 2026-11-19: [Webhooks by Zapier](https://zapier.com/apps/webhook/integrations). --- Source: https://millionshort.com/docs/integrations/zed Section: Build with # Zed MillionShort search in Zed, through the hosted MCP server. MCP · Hosted MCP server, nothing to install · Key in a header · Works with no key · Checked 2026-11-19 > **For agents.** Read the API key from the `MILLIONSHORT_API_KEY` environment variable. Never print it; where a client needs it in a settings file, use a file that is not committed. > The MCP address is https://mcp.millionshort.com/mcp (streamable HTTP; send `Authorization: Bearer `, or no header for the no-key mode). > On `INSUFFICIENT_CREDITS` stop and ask a person; on `RATE_LIMITED` or `CAPACITY` wait the `Retry-After` seconds, then retry once. > Set-up steps written for agents: https://millionshort.com/docs/auth.md. Every integration: https://millionshort.com/docs/integrations.md. ## 1. Add the server Open **Settings**, **AI**, **MCP Servers**, **Add Server**, **Add Remote Server**, or add the entry to your `settings.json` yourself (`zed: open settings file`): ```json With a key { "context_servers": { "millionshort": { "url": "https://mcp.millionshort.com/mcp", "headers": { "Authorization": "Bearer ms-YOUR_API_KEY" } } } } ``` ```json Without a key { "context_servers": { "millionshort": { "url": "https://mcp.millionshort.com/mcp" } } } ``` Zed starts a sign-in when a remote server has no `Authorization` header. The no-key mode has no sign-in, so if Zed asks you to sign in, use a key. ## 2. Try it Ask Zed: > Search MillionShort for forum threads about restoring a cast iron skillet, with the 1,000 most popular sites removed. List the five most useful with their links. A good answer comes from a `search` call (the client shows the tool call) and links to pages you may not have seen before. ## 3. Turn off the built-in search A profile decides which tools the agent has, and lists each one it may use. Open the profile selector in the agent panel, click **Configure** (or run `agent: manage profiles`), **fork** the **Write** profile, and in the copy switch off the built-in `fetch` and `search_web` tools and switch on the three `millionshort` tools. Then pick that profile. A profile you write from scratch starts with no tools at all, so forking keeps the agent able to read and edit files. Add this line to `AGENTS.md` at the project root: > Use the MillionShort `search` tool for anything recent, niche, or that needs a source. To reach lesser-known sites, set `remove_top_sites` (for example 1000). Cite the URLs it returns. ## 4. Check it works **Settings**, **AI**, **MCP Servers**: a green dot next to `millionshort` means the server is active. With a key you should see `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them); with no key, fewer, `search` and `list_sources` among them. ## Good to know - Zed does not fill environment variables into headers, so the key is in your settings file: keep it out of any settings you commit. ## The server One address for every client: `https://mcp.millionshort.com/mcp`, streamable HTTP. A key is optional. | Mode | How | What the agent gets | |---|---|---| | API key | Send `Authorization: Bearer ms-YOUR_API_KEY` | Every tool, at your plan's limits; calls use your credits | | No key | Send no `Authorization` header | `search`, `list_sources` and a few more; one source and up to 5 results a search, 10 free searches a day | ## Tools | Tool | What it does | Without a key | Cost | |---|---|---|---| | `search` | Searches the web and the specialist sources, with the popularity, domain, page-type, topic, site and date filters | Yes: one source, up to 5 results | 1 credit per source searched, first 10 results | | `get_domain_info` | Popularity and risk for up to 25 sites | No | 1 credit | | `list_sources` | The sources, page types and topics `search` accepts | Yes: source names | Free | | The tools of the other endpoints | `extract`, `map`, `crawl`, `places` and more: [the MCP page](https://millionshort.com/docs/mcp#tools) lists them | A few, such as `places` | What the API call behind each costs | ## Costs and limits A tool call costs what the API call behind it costs: 1 credit per source searched for the first 10 results, 1 credit for a domain lookup, nothing for the list of sources, the price of the endpoint for the other tools, and nothing at all in the no-key mode. An agent that loops can make many calls: give it a step limit, and ask for fewer results when a few will do. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the numbers. ## When it fails | What you see | Why | Fix | |---|---|---| | The server does not connect, or no tools are listed | The address or the transport is not the one the server speaks | Use exactly `https://mcp.millionshort.com/mcp` and the streamable HTTP transport (often called `http`), not SSE | | `401` or "unauthorized" | The key is wrong, or it was sent without `Bearer ` | Send `Authorization: Bearer ms-...`, or leave the header out to use the no-key mode | | "10 free searches a day without a key" | The no-key mode's daily searches are used up | Add a key: it is free in the [dashboard](https://millionshort.com/app/) | | `INSUFFICIENT_CREDITS` | The plan's credits are used up | Stop and add credits; retrying does not help | | The agent answers from memory, or uses another search | Nothing told it when to use this one | Turn off its own search where it can be (this page says how), and add the line for its instructions | ## Related - [MCP server](https://millionshort.com/docs/mcp): the address, every tool, and what the no-key mode allows. - [Filters for agents](https://millionshort.com/docs/search/filters): what to ask `search` for, with recipes. - More coding agents: [Claude Code](https://millionshort.com/docs/integrations/claude-code), [Cursor](https://millionshort.com/docs/integrations/cursor), [Codex](https://millionshort.com/docs/integrations/codex), [GitHub Copilot in VS Code](https://millionshort.com/docs/integrations/vscode), and [every integration](https://millionshort.com/docs/integrations). - Zed's own documentation, read on 2026-11-19: [MCP](https://zed.dev/docs/ai/mcp), [Agent profiles](https://zed.dev/docs/ai/agent-profiles), [Instructions](https://zed.dev/docs/ai/instructions). --- Source: https://millionshort.com/docs/spaces Section: Build with # Spaces API Create, list, change, delete and import Spaces: the saved scopes a search uses with one parameter. A Space is a saved, named scope for [`POST /v1/search`](https://millionshort.com/docs/search/parameters): a list of sites, a popularity cut, page types and topics to keep or leave out, what to boost, bury or block, site filters, default sources and safe search. Name it once, then pass `space` on any search. [Spaces, under Search](https://millionshort.com/docs/search/spaces), says when one is worth making. **Spaces are free.** Creating, keeping, reading, changing and deleting a Space costs 0 credits. A search that uses a Space costs what that search costs without it. ## Endpoints | Endpoint | What it does | |---|---| | `POST /v1/spaces` | Create a Space. Answers `201` with the Space | | `GET /v1/spaces` | List Spaces: your team's, the curated ones, or both | | `GET /v1/spaces/{id}` | Read one | | `PATCH /v1/spaces/{id}` | Change the fields you send. The others stay | | `DELETE /v1/spaces/{id}` | Delete it | | `POST /v1/spaces/import` | Load Spaces exported from the MillionShort search site | | `POST /v1/search` with `space` | [Search with a Space](#using-a-space-on-a-search) | All of them are free. The two reads do not count against your requests a minute. `{id}` is any of three things, here and in `space` on a search: | Form | Example | Means | |---|---|---| | An id | `spc_01jd3v9k2m8q4r6s0t1u2v3w4x` | `spc_` and 26 characters. Ours, and it never changes | | A slug | `baking` | A Space of your team, by the slug you gave it | | `curated:` and a slug | `curated:home-cooking` | One of [our curated Spaces](#curated-spaces) | ## Create a Space Only `name` is required. ```bash curl https://api.millionshort.com/v1/spaces \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "name": "Baking", "sites": ["example.org", "example.com/blog", "docs.example.net"], "remove_top_sites": 1000 }' ``` ```python import os from millionshort import MillionShort client = MillionShort(api_key=os.environ["MILLIONSHORT_API_KEY"]) baking = client.create_space( "Baking", sites=["example.org", "example.com/blog", "docs.example.net"], remove_top_sites=1000, ) print(baking.id, baking.slug) ``` ```ts import { MillionShort } from 'millionshort'; const client = new MillionShort({ apiKey: process.env.MILLIONSHORT_API_KEY }); const baking = await client.createSpace('Baking', { sites: ['example.org', 'example.com/blog', 'docs.example.net'], removeTopSites: 1000, }); console.log(baking.id, baking.slug); ``` The answer is the Space: ```json { "data": { "id": "spc_01jd3v9k2m8q4r6s0t1u2v3w4x", "slug": "baking", "name": "Baking", "description": null, "emoji": null, "curated": false, "mode": "only", "sites": ["example.org", "example.com/blog", "docs.example.net"], "exclude_sites": [], "remove_top_sites": 1000, "only_top_sites": 0, "page_types": [], "topics": [], "exclude_page_types": [], "exclude_topics": [], "lens": { "boost": [], "bury": [], "block": [] }, "sources": null, "safe_search": null, "popularity_buckets": [], "traffic_trend": [], "popular_in": [], "site_tech": [], "exclude_risky": false, "created_at": "2026-11-18T10:00:00Z", "updated_at": "2026-11-18T10:00:00Z" }, "usage": null, "warnings": [], "request_id": "req_..." } ``` The values are an illustration; the fields are exact. `usage` is `null` on the Space endpoints: nothing is metered. A Space that prefers some sites instead of searching inside them, with a lens and a site filter: ```bash curl https://api.millionshort.com/v1/spaces \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "name": "Primary sources", "mode": "boost", "sites": ["example.org", "example.edu"], "lens": { "boost": ["type:research"], "bury": ["type:listicles"], "block": ["topic:adult", "site:example.net"] }, "exclude_risky": true }' ``` ```python import os import requests r = requests.post( "https://api.millionshort.com/v1/spaces", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, json={ "name": "Primary sources", "mode": "boost", "sites": [ "example.org", "example.edu" ], "lens": { "boost": [ "type:research" ], "bury": [ "type:listicles" ], "block": [ "topic:adult", "site:example.net" ] }, "exclude_risky": True }, timeout=30, ) r.raise_for_status() print(r.json()["data"]) ``` ```ts const res = await fetch('https://api.millionshort.com/v1/spaces', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ "name": "Primary sources", "mode": "boost", "sites": [ "example.org", "example.edu" ], "lens": { "boost": [ "type:research" ], "bury": [ "type:listicles" ], "block": [ "topic:adult", "site:example.net" ] }, "exclude_risky": true }), }); if (!res.ok) throw new Error(`POST /v1/spaces failed: ${res.status}`); const { data } = (await res.json()) as { data: unknown }; console.log(data); ``` ## The Space object | Field | Type | Default | Notes | |---|---|---|---| | `id` | string | | `spc_` and 26 characters. Set by us; it never changes | | `slug` | string, 1 to 40 characters | made from `name` | Lower-case letters, digits and hyphens, starting with a letter or a digit. Unique in your team. Made from `name` when not sent; if that one is taken it gets `-2`, `-3` and so on | | `name` | string, 1 to 60 characters | | Required when creating | | `description` | string or null, up to 200 characters | `null` | | | `emoji` | string or null, up to 16 characters | `null` | | | `curated` | boolean | | `true` for a Space of ours: readable by everyone, and read-only. Set by us | | `mode` | `only` or `boost` | `"only"` | What `sites` means: search **inside** these sites, or **prefer** them | | `sites` | array of strings, up to 200 | `[]` | A host (`example.com`, `docs.example.com`) or a host with a path prefix (`example.com/blog`). May be empty | | `exclude_sites` | array of strings, up to 150 | `[]` | Hosts. Never return results from these. The limit of 150 is shared with the `site:` targets of `lens.block` | | `remove_top_sites` | integer, 0 to 1,000,000 | `0` | Remove results from the N most popular sites. 0 is off | | `only_top_sites` | integer, 0 to 1,000,000 | `0` | Keep only the N most popular sites. Cannot be set together with `remove_top_sites` | | `page_types` | array of strings | `[]` | Keep only these page types. Slugs from [`GET /v1/sources`](https://millionshort.com/docs/api-reference/sources) | | `topics` | array of strings | `[]` | Keep only these topics | | `exclude_page_types` | array of strings | `[]` | Leave these page types out | | `exclude_topics` | array of strings | `[]` | Leave these topics out | | `lens` | object | | `boost`, `bury` and `block`: three lists of targets. See below | | `sources` | array of strings, 1 to 5 items, or null | `null` | Default sources for a search with this Space. `null`: the search's own `sources`, or `web` | | `safe_search` | `off`, `moderate`, `strict` or null | `null` | `null`: the search's own, or `moderate` | | `popularity_buckets` | array of strings | `[]` | As on a search | | `traffic_trend` | array of strings | `[]` | As on a search | | `popular_in` | array of strings, up to 10 | `[]` | Two-letter country codes, as on a search | | `site_tech` | array of strings, up to 10 | `[]` | As on a search | | `exclude_risky` | boolean | `false` | As on a search | | `created_at`, `updated_at` | date and time | | UTC | `id`, `curated`, `created_at` and `updated_at` are ours: sending one is a `400 INVALID_PARAM`, like any field this table does not list. ### The lens `lens` holds three lists, `boost`, `bury` and `block`, of up to 100 targets each. A target is one of: | Target | Example | Acts on | |---|---|---| | `site:` and a host | `site:example.org` | Results from that site | | `type:` and a page type slug | `type:forums` | Results of that kind of page | | `topic:` and a topic slug | `topic:science` | Results on that topic | A target can be in one of the three lists only. Boost moves results ahead, bury moves them to the end, block removes them: the same verbs as the [lenses](https://millionshort.com/docs/search/lenses) of a search. Blocking through the lens and through the plain fields is the same thing. `lens.block` with a `site:` target does what `exclude_sites` does, and with a `type:` or `topic:` target what `exclude_page_types` or `exclude_topics` does. Both spellings are stored as you sent them and applied together. ### Rules Each of these is a `400 INVALID_PARAM`: - a field the table does not list; - a site that is not a host name; - a page type, topic or source that does not exist; - a `lens` target that does not start with `site:`, `type:` or `topic:`; - a `lens` target that is in two of the three lists; - a slug kept and left out at once: in both `page_types` and `exclude_page_types`, or in both `topics` and `exclude_topics`. A `type:` or `topic:` target of `lens.block` counts as left out; - `remove_top_sites` and `only_top_sites` both above 0; - a `slug` another Space of your team already has. ## Limits | Plan | Spaces per team | |---|---| | Trial key, Free | 10 | | Starter, Growth, Scale | 100 | | Business, Enterprise | 1,000 | Creating one more than the plan allows is refused with `403 QUOTA_EXCEEDED`; `error.details.limit` is the plan's number. Delete a Space or move to a larger plan. ## List Spaces ```bash curl "https://api.millionshort.com/v1/spaces?scope=all" \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" ``` ```python import os import requests r = requests.get( "https://api.millionshort.com/v1/spaces?scope=all", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, timeout=30, ) r.raise_for_status() print(r.json()["data"]) ``` ```ts const res = await fetch('https://api.millionshort.com/v1/spaces?scope=all', { headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}` }, }); if (!res.ok) throw new Error(`GET /v1/spaces failed: ${res.status}`); const { data } = (await res.json()) as { data: unknown }; console.log(data); ``` | `scope` | Returns | |---|---| | `own` | Your team's Spaces, newest first. The default | | `curated` | Our curated Spaces, by name | | `all` | Both, your team's first | ```json { "data": { "spaces": [ { "id": "spc_01jd3v9k2m8q4r6s0t1u2v3w4x", "slug": "baking", "name": "Baking", "curated": false, "mode": "only", "sites": ["example.org", "example.com/blog", "docs.example.net"], "remove_top_sites": 1000, "created_at": "2026-11-18T10:00:00Z", "updated_at": "2026-11-18T10:00:00Z" } ] }, "usage": null, "warnings": [], "request_id": "req_..." } ``` Each entry is a whole Space; the sample is shortened. ## Read a Space By id, by your slug, or a curated one: ```bash curl https://api.millionshort.com/v1/spaces/$SPACE_ID \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" ``` ```python import os import requests r = requests.get( f"https://api.millionshort.com/v1/spaces/{os.environ['SPACE_ID']}", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, timeout=30, ) r.raise_for_status() print(r.json()["data"]) ``` ```ts const res = await fetch(`https://api.millionshort.com/v1/spaces/${process.env.SPACE_ID}`, { headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}` }, }); if (!res.ok) throw new Error(`GET /v1/spaces/… failed: ${res.status}`); const { data } = (await res.json()) as { data: unknown }; console.log(data); ``` ```bash curl https://api.millionshort.com/v1/spaces/curated:home-cooking \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" ``` ```python import os import requests r = requests.get( "https://api.millionshort.com/v1/spaces/curated:home-cooking", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, timeout=30, ) r.raise_for_status() print(r.json()["data"]) ``` ```ts const res = await fetch('https://api.millionshort.com/v1/spaces/curated:home-cooking', { headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}` }, }); if (!res.ok) throw new Error(`GET /v1/spaces/curated:home-cooking failed: ${res.status}`); const { data } = (await res.json()) as { data: unknown }; console.log(data); ``` The answer is the Space, in `data`, as in the answer to a create. `curated:home-cooking` stands for any curated slug; `GET /v1/spaces?scope=curated` lists the real ones. ## Change a Space `PATCH` takes the same fields as a create, all optional. A field you send replaces the stored value; a field you leave out stays as it is. `lens` is one field: a `lens` you send replaces all three of its lists, so send the lists you want to keep. A `PATCH` with no field is a `400 INVALID_PARAM`. ```bash curl -X PATCH https://api.millionshort.com/v1/spaces/$SPACE_ID \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "remove_top_sites": 10000, "exclude_page_types": ["listicles"] }' ``` ```python import os import requests r = requests.patch( f"https://api.millionshort.com/v1/spaces/{os.environ['SPACE_ID']}", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, json={ "remove_top_sites": 10000, "exclude_page_types": [ "listicles" ] }, timeout=30, ) r.raise_for_status() print(r.json()["data"]) ``` ```ts const res = await fetch(`https://api.millionshort.com/v1/spaces/${process.env.SPACE_ID}`, { method: 'PATCH', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ "remove_top_sites": 10000, "exclude_page_types": [ "listicles" ] }), }); if (!res.ok) throw new Error(`PATCH /v1/spaces/… failed: ${res.status}`); const { data } = (await res.json()) as { data: unknown }; console.log(data); ``` The answer is the Space after the change. Sending `slug` renames the Space. Searches that pass the old slug stop finding it, so update them first or refer to the Space by its `id`, which keeps working. ## Delete a Space ```bash curl -X DELETE https://api.millionshort.com/v1/spaces/$SPACE_ID \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" ``` ```python import os import requests r = requests.delete( f"https://api.millionshort.com/v1/spaces/{os.environ['SPACE_ID']}", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, timeout=30, ) r.raise_for_status() print(r.json()["data"]) ``` ```ts const res = await fetch(`https://api.millionshort.com/v1/spaces/${process.env.SPACE_ID}`, { method: 'DELETE', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}` }, }); if (!res.ok) throw new Error(`DELETE /v1/spaces/… failed: ${res.status}`); const { data } = (await res.json()) as { data: unknown }; console.log(data); ``` ```json { "data": { "id": "spc_01jd3v9k2m8q4r6s0t1u2v3w4x", "deleted": true }, "usage": null, "warnings": [], "request_id": "req_..." } ``` A search that still names a deleted Space is answered with `404 SPACE_NOT_FOUND`. ## Import from the search site A Space here is the same object as a Space on the MillionShort search site. `POST /v1/spaces/import` takes the search site's export file as it is, so the Spaces you made by hand there can be used by your agent. ```bash curl https://api.millionshort.com/v1/spaces/import \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "millionshort_spaces": 1, "spaces": [ { "id": "baking", "name": "Baking", "about": "Bread, mostly", "mode": "only", "sites": ["example.org", "example.com/blog"], "remove_top": 1000, "lens": { "boost": ["type:tutorials"], "bury": [], "block": ["type:products"] } } ] }' ``` ```python import os import requests r = requests.post( "https://api.millionshort.com/v1/spaces/import", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, json={ "millionshort_spaces": 1, "spaces": [ { "id": "baking", "name": "Baking", "about": "Bread, mostly", "mode": "only", "sites": [ "example.org", "example.com/blog" ], "remove_top": 1000, "lens": { "boost": [ "type:tutorials" ], "bury": [], "block": [ "type:products" ] } } ] }, timeout=30, ) r.raise_for_status() print(r.json()["data"]) ``` ```ts const res = await fetch('https://api.millionshort.com/v1/spaces/import', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ "millionshort_spaces": 1, "spaces": [ { "id": "baking", "name": "Baking", "about": "Bread, mostly", "mode": "only", "sites": [ "example.org", "example.com/blog" ], "remove_top": 1000, "lens": { "boost": [ "type:tutorials" ], "bury": [], "block": [ "type:products" ] } } ] }), }); if (!res.ok) throw new Error(`POST /v1/spaces/import failed: ${res.status}`); const { data } = (await res.json()) as { data: unknown }; console.log(data); ``` The body is the export file, or `{"spaces": [...]}` with 1 to 100 entries. An entry is a Space as the search site writes it, or a Space as this API returns it. The search site's fields map like this: | Search site | Here | |---|---| | `id` | `slug` | | `name`, `emoji`, `mode`, `sites`, `lens` | The same | | `about` | `description` | | `remove_top` | `remove_top_sites` | ```json { "data": { "imported": [ { "id": "spc_01jd3v9k2m8q4r6s0t1u2v3w4x", "slug": "baking", "name": "Baking", "description": "Bread, mostly", "curated": false, "mode": "only", "sites": ["example.org", "example.com/blog"], "remove_top_sites": 1000, "lens": { "boost": ["type:tutorials"], "bury": [], "block": ["type:products"] }, "created_at": "2026-11-18T10:00:00Z", "updated_at": "2026-11-18T10:00:00Z" } ], "skipped": [] }, "usage": null, "warnings": [], "request_id": "req_..." } ``` - `imported` holds the Spaces that were created, each one whole. - `skipped` names what was not, each with the `index` of the entry in the list you sent, a `reason` and a `message`. The reason is `invalid` for an entry that cannot be read, such as one with no name, or one whose `sites` were sent and none of them can be read, and `limit` for the entries that would take the team past its plan's number of Spaces. An import stops at the limit; what was created before it stays. - An entry whose slug is already taken is not skipped: it gets the slug with `-2`, `-3` and so on. - Inside an entry that is imported, a field we do not know and a list item that cannot be read are left out. ## Using a Space on a search Pass `space` on [`POST /v1/search`](https://millionshort.com/docs/search/parameters): an id, a slug of your team, or `curated:` and a slug. ```bash curl https://api.millionshort.com/v1/search \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "query": "sourdough hydration", "space": "baking" }' ``` ```python import os from millionshort import MillionShort client = MillionShort(api_key=os.environ["MILLIONSHORT_API_KEY"]) r = client.search("sourdough hydration", space="baking") for hit in r.results: print(hit["position"], hit["site"], hit["title"]) print(r.space["sites_applied"], "of", r.space["sites_total"], "sites searched") ``` ```ts import { MillionShort } from 'millionshort'; const client = new MillionShort({ apiKey: process.env.MILLIONSHORT_API_KEY }); const r = await client.search('sourdough hydration', { space: 'baking' }); for (const hit of r.results) { console.log(hit.position, hit.site, hit.title); } console.log(r.space?.sites_applied, 'of', r.space?.sites_total, 'sites searched'); ``` ### The request wins A parameter you send in the request replaces the Space's value for that setting. Everything you do not send comes from the Space. So a Space is a set of defaults, and one search can step outside it without changing it. | Setting of the Space | Replaced when the request sends | |---|---| | `sources` | `sources` | | `sites`, with `mode: only` | `include_domains` or `only_domains` | | `sites`, with `mode: boost`, and the `site:` targets of `lens.boost` | `boost_domains` | | The `site:` targets of `lens.bury` | `bury_domains` | | `exclude_sites`, and the `site:` targets of `lens.block` | `exclude_domains` or `block_domains` | | `remove_top_sites`, `only_top_sites` | `remove_top_sites`, `only_top_sites` or `index_level`. Any one of them replaces both | | `page_types` | `page_types` | | `topics` | `topics` | | `exclude_page_types`, and the `type:` targets of `lens.block` | `exclude_page_types` | | `exclude_topics`, and the `topic:` targets of `lens.block` | `exclude_topics` | | The `type:` targets of `lens.boost` | `boost_page_types` | | The `type:` targets of `lens.bury` | `bury_page_types` | | The `topic:` targets of `lens.boost` | `boost_topics` | | The `topic:` targets of `lens.bury` | `bury_topics` | | `safe_search`, `popularity_buckets`, `traffic_trend`, `popular_in`, `site_tech`, `exclude_risky` | The parameter of the same name | A replacement is whole: a list in the request takes the place of the Space's list, and the two are not merged. When the request keeps a page type or topic that the Space leaves out, or leaves out one the Space keeps, the request's list stands and that slug is dropped from the Space's list for this search. The call is not refused. Everything else on the request (`query`, `num_results`, dates, `language`, `country`, highlights, `include_content`, `explain`) works as on any search. ### `mode: only` applies the first 50 sites A Space can hold up to 200 sites. A search inside a list of sites uses the first 50 of them, in the order of `sites`. A longer list is cut, and the answer says so twice: a `space_sites_cut` warning, and `sites_applied` lower than `sites_total` in `data.space`. Put the sites that matter most first, or split a long list into two Spaces. With `mode: boost` the search is not limited to the sites, so nothing is cut out of the results. A path prefix does not narrow a preference: `example.com/blog` prefers the whole of `example.com`. ### What the answer adds A search with a Space has `data.space`: the Space that was used and what it supplied. ```json { "data": { "results": [ { "title": "Hydration levels for a sourdough starter, measured", "url": "https://example.org/starter-hydration", "site": "example.org", "source": "web", "snippet": "At 100% hydration the starter peaks in four to six hours...", "highlights": ["At 100% hydration the starter peaks in four to six hours..."], "published_date": null, "page_type": "articles", "topic": "food", "popularity": { "rank": null, "bucket": "long-tail" }, "risk": null, "position": 1, "score": 1.0, "extra": {} } ], "summary": { "returned": 10, "removed": { "popularity": 0, "blocked": 0, "duplicates": 1, "risk": 0, "safe_search": 0, "filters": 0 } }, "warnings": [], "space": { "id": "spc_01jd3v9k2m8q4r6s0t1u2v3w4x", "slug": "baking", "name": "Baking", "curated": false, "mode": "only", "sites_total": 3, "sites_applied": 3, "applied": { "include_domains": ["example.org", "example.com/blog", "docs.example.net"], "remove_top_sites": 1000 }, "overridden": [] } }, "usage": { "credits": 1, "cost_usd": 0.001, "breakdown": { "search": 1 } }, "warnings": [], "request_id": "req_..." } ``` | Field | Type | Notes | |---|---|---| | `id`, `slug`, `name`, `curated`, `mode` | | Of the Space that was used | | `sites_total` | integer | How many sites the Space holds | | `sites_applied` | integer | How many of them this search used. Lower than `sites_total` when the list was cut, or when the request replaced it | | `applied` | object | The settings the Space supplied to this search, under the names of the search parameters | | `overridden` | array of strings | The request parameters that replaced a setting of the Space | Read `applied` and `overridden` to see exactly what was searched: together with your own request they are the whole scope. ### Warnings | Warning code | Meaning | |---|---| | `space_sites_cut` | The Space has `mode: only` and lists more sites than one search uses (50; 20 without a key). `sites_total` and `sites_applied` in the warning give the numbers | | `space_setting_not_applied` | Something the Space asks for was left out: a setting that cannot be applied right now (named in `settings`), or a page type, topic or source that no longer exists (named in `values`). The search ran without it | A setting of a Space is never dropped silently. The warnings a search can carry on its own, such as a `filter_not_applied` warning for page types on a source that has none, apply to settings that came from a Space as well. ### How a search inside a list of sites is counted A search inside a list of sites on the `web` source, whether the list comes from a Space with `mode: only` or from `include_domains` in the request, is more work than a plain search. Its price is the same, 1 credit per source. Two limits count it differently: - **Heavy-source searches a minute.** It counts as the number of sites divided by 10, rounded up, where a plain `web` search counts as 1. Up to 10 sites count once, 25 sites three times, 50 sites five times. The count is taken whole or not at all: a search that does not fit is refused with `429 RATE_LIMITED`, uses none of the limit, and `Retry-After` is the wait until all of it fits. - **Capacity.** When the service is busy, it can be refused with `429 CAPACITY` where a plain search would have run. Nothing is charged. Wait `Retry-After` seconds and send it again. [Credits and limits](https://millionshort.com/docs/credits-and-limits#rate-limits) has each plan's numbers. ### Without a key The [playground](https://millionshort.com/docs/authentication#without-a-key) and the no-key mode of the [MCP server](https://millionshort.com/docs/mcp) can list the curated Spaces and search with one, as `curated:` and its slug. Their own bounds stay: one source (the first, when the Space names several), up to five results, and the first 20 sites of a Space with `mode: only`, said in a `space_sites_cut` warning. Making a Space needs a key. ## Curated Spaces Curated Spaces are ours: scopes we have put together for a subject, the same ones the MillionShort search site offers. Every caller can read them and search with them, and nobody but us can change them. - List them with `GET /v1/spaces?scope=curated`. - Use one as `"space": "curated:"`. - Changing or deleting one is refused with `403 SPACE_READ_ONLY`. To change one, read it and create your own Space from its fields: it then belongs to your team and counts towards your limit. ## Errors | Code | HTTP | Meaning | Retry? | |---|---|---|---| | `SPACE_NOT_FOUND` | 404 | No such Space for this caller: it does not exist, or it belongs to another team. The two are not told apart. | No. | | `SPACE_READ_ONLY` | 403 | A curated Space cannot be changed or deleted. | No. Create your own Space from its fields. | Also: `400 INVALID_PARAM` for the cases under [Rules](#rules); `403 QUOTA_EXCEEDED` at the plan's number of Spaces; `401` for a missing or refused key; `429`. A search that names a Space that does not exist is answered with `404 SPACE_NOT_FOUND` and charged nothing. See [Errors](https://millionshort.com/docs/errors). ## In the SDKs Both SDKs carry one method per endpoint, and `space` on `search`: | Endpoint | Python | TypeScript | |---|---|---| | `POST /v1/spaces` | `create_space` | `createSpace` | | `GET /v1/spaces` | `list_spaces` | `listSpaces` | | `GET /v1/spaces/{id}` | `get_space` | `getSpace` | | `PATCH /v1/spaces/{id}` | `update_space` | `updateSpace` | | `DELETE /v1/spaces/{id}` | `delete_space` | `deleteSpace` | | `POST /v1/spaces/import` | `import_spaces` | `importSpaces` | | `POST /v1/search` with `space` | `search(..., space="baking")` | `search(..., { space: 'baking' })` | The [Python](https://millionshort.com/docs/sdks/python#spaces) and [TypeScript](https://millionshort.com/docs/sdks/typescript#spaces) pages have samples. ## Over MCP Two tools of the [MCP server](https://millionshort.com/docs/mcp#spaces) work with Spaces: `list_spaces`, which only reads and lists the curated Spaces without a key, and `create_space`, which needs a key. The `search` tool takes `space`. ## Without a Space A Space saves what a search request can already say. To keep the scope in your own store instead, send it with each search: `include_domains` or `boost_domains` for the sites, `remove_top_sites`, the page-type and topic lists, and the site filters. [Lenses](https://millionshort.com/docs/search/lenses) and [Filters for agents](https://millionshort.com/docs/search/filters) show each one. --- Source: https://millionshort.com/docs/webhooks Section: Build with # Webhooks Register an endpoint once, verify it, and receive signed events from monitors and batches. Webhook endpoints are registered once per team and referred to by id from [monitors](https://millionshort.com/docs/monitor/parameters) and [batches](https://millionshort.com/docs/extract/batch). Events can always be pulled instead; a webhook is a convenience, not a requirement. ## Endpoints | Endpoint | What it does | |---|---| | `POST /v1/webhooks` | Register a URL. Returns the endpoint with `status: "pending"` and its `secret`, shown once | | `POST /v1/webhooks/{id}/verify` | Sends a `webhook.test` event carrying a random `challenge`. The endpoint becomes `active` when its 2xx answer contains `HMAC-SHA256(secret, challenge)` in hex. Repeating the challenge is not enough: the endpoint must hold the secret | | `GET /v1/webhooks`, `GET /v1/webhooks/{id}` | List, or read one. Free | | `POST /v1/webhooks/{id}/test` | Sends a `webhook.test` event to an active endpoint | | `POST /v1/webhooks/{id}/rotate` | Issues a new secret, shown once. For 24 hours deliveries carry both signatures | | `GET /v1/webhooks/{id}/deliveries` | The delivery log | | `DELETE /v1/webhooks/{id}` | Remove it. Its monitors keep running and their events are pulled | ## Register and verify ```bash curl https://api.millionshort.com/v1/webhooks \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "url": "https://hooks.example.com/millionshort", "description": "production" }' ``` ```python import os import requests r = requests.post( "https://api.millionshort.com/v1/webhooks", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, json={ "url": "https://hooks.example.com/millionshort", "description": "production" }, timeout=30, ) r.raise_for_status() print(r.json()["data"]) ``` ```ts const res = await fetch('https://api.millionshort.com/v1/webhooks', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ "url": "https://hooks.example.com/millionshort", "description": "production" }), }); if (!res.ok) throw new Error(`POST /v1/webhooks failed: ${res.status}`); const { data } = (await res.json()) as { data: unknown }; console.log(data); ``` ```bash curl -X POST https://api.millionshort.com/v1/webhooks/$WEBHOOK_ID/verify \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" ``` ```python import os import requests r = requests.post( f"https://api.millionshort.com/v1/webhooks/{os.environ['WEBHOOK_ID']}/verify", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, timeout=30, ) r.raise_for_status() print(r.json()["data"]) ``` ```ts const res = await fetch(`https://api.millionshort.com/v1/webhooks/${process.env.WEBHOOK_ID}/verify`, { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}` }, }); if (!res.ok) throw new Error(`POST /v1/webhooks/…/verify failed: ${res.status}`); const { data } = (await res.json()) as { data: unknown }; console.log(data); ``` Only an `active` endpoint receives events. An endpoint still `pending` 24 hours after registration is deleted. | Field | Type | Notes | |---|---|---| | `id` | string | | | `url` | string | | | `description` | string or null | | | `status` | `pending`, `active` or `disabled` | | | `secret` | string | Starts with `whsec_`. Only in the answers to register and rotate | | `created_at` | date and time | | | `last_success_at` | date and time, or null | | | `consecutive_failures` | integer | | ## What your endpoint receives A `POST` with a JSON body, the event, and three headers: ```text MS-Event-Id: evt_01J... MS-Timestamp: 1763460000 MS-Signature: t=1763460000,v1= ``` The signature is `HMAC-SHA256(secret, "..")`, in hex. The key is the whole secret string, `whsec_` included, as UTF-8 bytes. `t` is the same number as `MS-Timestamp`. Every delivery is signed, the verification challenge included. During a rotation there are two `v1=` values, and either may match. ## Check the signature ```python import hashlib import hmac import time def verify(secret, event_id, timestamp, signature_header, raw_body, tolerance=300): """True when the delivery is ours and recent. raw_body is bytes, exactly as received.""" if abs(time.time() - int(timestamp)) > tolerance: return False signed = event_id.encode() + b"." + str(timestamp).encode() + b"." + raw_body expected = hmac.new(secret.encode(), signed, hashlib.sha256).hexdigest() sent = [part[3:] for part in signature_header.split(",") if part.startswith("v1=")] return any(hmac.compare_digest(expected, candidate) for candidate in sent) ``` ```ts import { createHmac, timingSafeEqual } from 'node:crypto'; /** True when the delivery is ours and recent. rawBody is the bytes exactly as received. */ export function verify( secret: string, eventId: string, timestamp: string, signatureHeader: string, rawBody: Uint8Array, tolerance = 300, ): boolean { if (Math.abs(Date.now() / 1000 - Number(timestamp)) > tolerance) return false; const expected = createHmac('sha256', secret) .update(`${eventId}.${timestamp}.`) .update(rawBody) .digest(); return signatureHeader .split(',') .filter((part) => part.startsWith('v1=')) .map((part) => Buffer.from(part.slice(3), 'hex')) .some((sent) => sent.length === expected.length && timingSafeEqual(sent, expected)); } ``` Your endpoint should: 1. Reject a delivery whose timestamp is more than 300 seconds from now. 2. Compare signatures in constant time, as above. 3. Remember `MS-Event-Id` for 24 hours and drop repeats. A retry keeps the event id and carries a fresh timestamp and signature. 4. Answer with a 2xx status quickly, and do the work afterwards. ## Delivery rules - `https` only. The URL must be a public address. It is checked at registration and again on every delivery. - A redirect counts as a failure. The answer's body is ignored, except when verifying. The timeout is 10 seconds. A payload is at most 256 KB. - **Retries:** six attempts: one at once, then a retry about 1 minute, 10 minutes, 1 hour, 6 hours and 24 hours after each failure, on anything that is not a 2xx. - **Auto-disable:** after 20 failures in a row, or 3 days of failed attempts with no success, the endpoint becomes `disabled`. Its monitors are paused with a `monitor.paused` event, and their events stay available to pull for 30 days. ## The delivery log `GET /v1/webhooks/{id}/deliveries` returns the latest attempts, newest first: | Field | Type | Notes | |---|---|---| | `event_id` | string | | | `event_type` | string | | | `attempt` | integer | | | `status_code` | integer or null | What your endpoint answered | | `duration_ms` | integer | | | `ok` | boolean | | | `at` | date and time | | The log never holds the body of a delivery. ## Limits - 10 endpoints per team, and 20 registrations a day. - `/verify` and `/test`: 5 an hour per endpoint, and 20 an hour per team. ## Event types `monitor.changed`, `monitor.failed`, `monitor.paused`, `extract_batch.completed` and `webhook.test`. The [Monitors](https://millionshort.com/docs/monitor/parameters#events) page describes what each carries. An [Agent](https://millionshort.com/docs/agent) run started with a `webhook_id` delivers `agent.completed` when it ends, with the run's `id`, `status`, `stop_reason` and `credits_used`. See [the webhook event](https://millionshort.com/docs/agent/parameters#the-webhook-event). --- Source: https://millionshort.com/docs/dashboard Section: Account # The dashboard Keys with spending caps, rename and roll, the request log, and free playground runs. The [dashboard](https://millionshort.com/app/) is where a signed-in team makes and manages its keys, sees what its calls did and cost, and tries searches without a key in the browser. This page says how its key settings, its request log and its playground behave. Signing in is covered in [Authentication](https://millionshort.com/docs/authentication). ## Monthly cap per key A key can have a **monthly spending cap**: a whole number of credits, 1 or more. Set it when you make the key, or later with **Edit** on the Keys tab; clear the field to remove it. A changed cap counts from the key's next call. - The cap counts what the key has spent in the current calendar month, UTC. It starts again when the month turns. - A key that has spent its cap is refused with `403` and the code `QUOTA_EXCEEDED`, with `details.limit` set to `key_monthly_cap`. Nothing is charged for a refused call, and the team's other keys keep working. - The cap changes no price. Every key of a team still draws on the same credits. **Calls already in flight.** When a call starts, it sets aside on its key the most it can cost (its worst case). When it answers, what is set aside is let go and what it was charged is added to the key's spending; a call that fails is charged nothing. So: - A call that is already under way when the key reaches its cap **finishes and is charged**, and its worst case was already counted inside the cap: calls running at the same time stay within the cap. (Only a call charged more than its worst case, which is rare, can go past it.) - A call whose worst case is more than the key has left, counting its calls still running, is **refused before it runs**, even if it would have cost less. The refusal's `details` carry `cap_credits`, `spent_credits`, `in_flight_credits` and `needed_credits`. Ask for less (fewer sources or results), raise the cap, or use another key. - The key's spending on the Keys tab is what it was charged; what running calls set aside is not in it. Work that is charged later, as it happens (a batch, a crawl, a monitor's checks), is counted against the team's credits but not against a key's cap. ```bash curl https://api.millionshort.com/v1/search \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "query": "sourdough starter hydration", "sources": ["web", "news"], "remove_top_sites": 1000 }' ``` ```python import os import requests r = requests.post( "https://api.millionshort.com/v1/search", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, json={ "query": "sourdough starter hydration", "sources": [ "web", "news" ], "remove_top_sites": 1000 }, timeout=30, ) r.raise_for_status() for hit in r.json()["data"]["results"]: print(hit["position"], hit["title"], hit["url"]) ``` ```ts const res = await fetch('https://api.millionshort.com/v1/search', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ "query": "sourdough starter hydration", "sources": [ "web", "news" ], "remove_top_sites": 1000 }), }); if (!res.ok) throw new Error(`POST /v1/search failed: ${res.status}`); const { data } = (await res.json()) as { data: { results: { position: number; title: string; url: string }[] }; }; for (const hit of data.results) console.log(hit.position, hit.title, hit.url); ``` The same call as a tool of the MCP server: ```json { "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "search", "arguments": { "query": "sourdough starter hydration", "sources": [ "web", "news" ], "remove_top_sites": 1000 } } } ``` A key with 1 credit left refuses this call: two sources can cost up to 2 credits. ## Rename and roll a key - **Rename** a key with **Edit**. The name is for you; calls do not send it. - **Roll** makes a new key with the same name and cap, and shows it once. The old key keeps working for **24 hours**, then stops, so you can swap it without downtime. The new key starts with what the old one has spent this month: rolling does not start a cap again. For those 24 hours the two keys count apart, so between them they can spend what was left of the cap twice. - Rolling needs room under the team's limit of 10 active keys. A key that is revoked, or already ending after a roll, cannot be rolled. - **Revoke** stops a key at once and cannot be undone. ## The request log The **Logs** tab lists one row for each call that does work: every `/v1` call that is not a read (`GET`), and every search run from the dashboard's playground. Reads and polls are not listed, and neither is a call without a valid key. **What a row keeps:** the time, the request id, the name of the key that made the call, the endpoint, the HTTP status and error code, the time taken, the credits charged, the sources, the Space, the number of results, the top-sites setting, and how many results were left out (from popular sites, as duplicates, or for a risk label). **What a row never keeps:** a key, a token, the answer, or the body of the request as it was sent. - **Rows are kept for 30 days**, then deleted. - **Query text is the team's choice:** kept for **30 days** (the default), for **7 days**, or **not kept**. Query text is what was asked for: a search's `query` and its settings (so a call can be opened again in the playground), the addresses of an extract or a domain lookup, a monitor's name. With "not kept" it is never written, and rows hold only the numbers above. Only the team's owner can change the setting, on the Logs tab. - **Keeping less takes effect at once:** text the new setting would not keep is removed when you change it (for a very large log, within the hour). - An address is kept without its `user:password@`, its query string and its fragment, where a credential or token would be. A webhook's address is kept as its scheme, host and port only, since its path is often its secret. - A call refused before any work (a rate limit, a key at its cap) is listed at most 20 times a minute per team, so a client caught in a retry loop cannot fill the log. - Filter by time, endpoint, key, status, source and Space, or search for a request id or query text. **Export CSV** downloads what the filters match, up to 10,000 rows. ## Free playground runs The **Playground** tab runs a real search as your team, with no key in the browser. It takes the same request as [`POST /v1/search`](https://millionshort.com/docs/search/parameters) and answers the same way. - **The first 25 runs of each UTC day are free, per team.** A free run says `usage.credits: 0`. - After that, a run is charged exactly like the same call with a key. The page says what a run will cost before you run it. - A run that could cost more than 5 credits (many results, or the text of each page) is always charged: the free runs cover ordinary searches. - A run that fails gives its free run back. - The free runs of all teams share a daily ceiling. When it is reached, runs are charged until midnight UTC, and the page says no free runs are left. - Your plan's limits apply to playground runs, and each run is in the request log as the playground's, with no key. This is the dashboard's playground. The playground on the [Agents page](https://millionshort.com/agents) needs no account and has its own limits, listed in [Authentication](https://millionshort.com/docs/authentication). --- Source: https://millionshort.com/docs/authentication Section: Account # Authentication API keys, the trial key for agents, and what works with no key at all. ## API keys Every call to a `/v1` endpoint carries a key in the `Authorization` header: ```bash curl https://api.millionshort.com/v1/sources \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" ``` ```python import os import requests r = requests.get( "https://api.millionshort.com/v1/sources", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, timeout=30, ) r.raise_for_status() print(r.json()["data"]) ``` ```ts const res = await fetch('https://api.millionshort.com/v1/sources', { headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}` }, }); if (!res.ok) throw new Error(`GET /v1/sources failed: ${res.status}`); const { data } = (await res.json()) as { data: unknown }; console.log(data); ``` The same call as a tool of the MCP server: ```json { "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "list_sources", "arguments": {} } } ``` - A key starts with `ms-`. - A key belongs to a team. Every key of a team draws on the same credit balance and the same rate limits. - The full key is shown once, when it is created. After that only its first characters are shown. If you lose a key, revoke it and create another. - A team can hold up to 10 active keys. - Revoking a key stops it at once and cannot be undone. - A key can have a monthly spending cap, and can be rolled: a new key replaces it while the old one keeps working for 24 hours. See [The dashboard](https://millionshort.com/docs/dashboard). Create, name, cap, roll and revoke keys in the [dashboard](https://millionshort.com/app/). The Free plan needs a signed-in account with a verified email address, and no card. Send the key only in the header. Do not put it in a URL, and do not ship it in code that runs in a browser or a mobile app: call the API from your server. A missing key is answered with `401` and the code `AUTH_MISSING_KEY`; a key that is malformed, revoked or expired with `401` and `AUTH_INVALID_KEY`. See [Errors](https://millionshort.com/docs/errors). ## Signing in to the dashboard Keys in the dashboard are made by a signed-in account. There are three ways to sign in to the [dashboard](https://millionshort.com/app/): | Way in | How | |---|---| | Email and password | Sign up with your address and a password of at least 8 characters. We send a confirmation link; the account opens when you open it | | GitHub | Sign in with GitHub. The address your GitHub account has verified is the one we use | | Google | Sign in with Google. The address of your Google account is the one we use | - **One verified address is one account, whichever way you sign in.** If you signed up with an email address and later sign in with GitHub or Google under the same verified address, you are in the same account, with the same keys, credits and plan. - **Forgot your password?** The sign-in page sends a link to set a new one. - **No password yet?** An account opened with GitHub or Google has none. "Forgot your password?" sets one; signing up again does not. - **A new sign-up opens nothing until its address is confirmed.** No account, no dashboard key and no credits exist until the address is proved, by the confirmation link, the link to set a new password, GitHub or Google. - **An account you already had on millionshort.com** keeps its email address and password where the sign-in page says so ("Have a millionshort.com account?"): sign in with them as before, with no confirmation link. - A link we send works once and comes back to the dashboard's sign-in page. Open it in the browser you asked for it in. Opened elsewhere, a confirmation link still confirms your address, and you then sign in there; a link to set a new password cannot set one there, and is used up: ask for a new one. - The sign-in page has no sign-in link by email. If you have no password, or have lost it, "Forgot your password?" sends a link to set a new one, and setting it signs you in. A sign-in that cannot open a free account (the address is not verified, is a disposable address, or already belongs to another account: sign in the way you did when you created it) is answered with `ACCOUNT_NOT_ELIGIBLE`. It is a dashboard answer only and is never returned by a `/v1` call. ## Trial key for agents An agent that cannot sign up can get a key with one call and no account: ```bash curl https://api.millionshort.com/v1/keys/agent \ -H "Content-Type: application/json" \ -d '{ "agent": "my-agent", "purpose": "trying the search API" }' ``` ```python import requests r = requests.post( "https://api.millionshort.com/v1/keys/agent", json={ "agent": "my-agent", "purpose": "trying the search API" }, timeout=30, ) r.raise_for_status() print(r.json()["data"]) ``` ```ts const res = await fetch('https://api.millionshort.com/v1/keys/agent', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ "agent": "my-agent", "purpose": "trying the search API" }), }); if (!res.ok) throw new Error(`POST /v1/keys/agent failed: ${res.status}`); const { data } = (await res.json()) as { data: unknown }; console.log(data); ``` | Field | Type | Notes | |---|---|---| | `agent` | string, up to 60 characters | Required. The agent's name. | | `purpose` | string, up to 200 characters or null | | The response's `data` holds the key: | Field | Type | Notes | |---|---|---| | `api_key` | string | The `ms-...` key, shown exactly once. | | `tier` | `trial` | | | `rate_limit` | string | | | `expires_in_days` | integer | `expires_in_hours` rounded up to whole days. | | `expires_in_hours` | integer | | | `expires_at` | string | When the key stops working. | | `team_id` | string | | A trial key carries 25 credits and stops working after 24 hours; `expires_at` in the response gives the exact time. Trial keys are limited per network address and in total per day; past the limit the call answers `429`. When the trial ends, create a key in the dashboard to keep going. With the SDKs: ```python from millionshort import MillionShort key = MillionShort().create_agent_key("my-agent").api_key client = MillionShort(api_key=key) ``` ```ts import { MillionShort } from 'millionshort'; const { api_key } = await new MillionShort().createAgentKey('my-agent'); const client = new MillionShort({ apiKey: api_key }); ``` ## Without a key Two things work with no key at all. Both are for trying the service, not for building on it. **The playground.** The [Agents page](https://millionshort.com/agents) has a search playground that runs real searches from the browser. It needs no key and asks for none. Limits per visitor: 6 searches a minute and 15 a day (a run that also shows a comparison counts as two), one source per search, up to 5 results, no `explain`. **The MCP server.** The hosted [MCP server](https://millionshort.com/docs/mcp) accepts a connection with no `Authorization` header. A caller with no key gets the `search` and `list_sources` tools; `list_sources` then returns the names of the sources only. Limits per visitor: 10 free searches a day and at most 5 in a minute, one source per search, up to 5 results, no `explain`. Each answer says how many searches are left today. When they are used up, the tool says so and names the [dashboard](https://millionshort.com/app/), where a key is free. Neither of these is an API. The REST endpoints under `/v1` always need a key, except `POST /v1/keys/agent`. ## Which one to use | You are | Use | |---|---| | Building a product or a script | An API key from the dashboard | | An agent trying the API with no human to sign up | A trial key | | Connecting an IDE or a coding agent | The MCP server with your API key | | Connecting a chat assistant that cannot send a key | The MCP server with no key | | Just looking | The playground | --- Source: https://millionshort.com/docs/credits-and-limits Section: Account # Credits and limits What each call costs, and how many calls each plan allows. ## Credits **1 credit = 1 search; a page is half.** One credit is $0.001, so dollars per 1,000 credits are dollars per 1,000 searches: | | Per 1,000 searches | Per 1,000 pages | |---|---|---| | Pay as you go | $1.00 | $0.50 | | Starter, in plan | $0.73 | $0.36 | | Growth, in plan | $0.70 | $0.35 | | Scale, in plan | $0.60 | $0.30 | | Business, in plan | $0.50 | $0.25 | Every metered call is charged in credits, and every response says what it cost in `usage`: `credits`, `cost_usd` and a `breakdown` by line item. | Action | Credits | |---|---| | Search, per source searched (covers the first 10 results of the call) | 1 | | Each further 10 results (or part of 10) | 0.5 | | explain (why a result ranked, with signals) | 0 | | Every filter, and highlights | 0 | | include_content, per call (covers the page text of up to 10 results; each further 10 with text adds 1) | 1 | | Domain info call (up to 25 domains) | 1 | | List sources | 0 | What a typical call costs: | Call | Credits | Dollars | |---|---|---| | Search, one source, 10 results | 1 | $0.0010 | | Search with page text for the 10 results | 2 | $0.0020 | | A page, fetched live (Extract) | 0.5 | $0.0005 | | A page loaded in a browser (rendered) (Extract) | 2 | $0.0020 | | A live page returned as JSON of your shape (Extract) | 3.5 | $0.0035 | | The least an Agent run is charged (Agent: searches and pages at the prices above plus tokens by tier, never more than your max_credits; per-run cap Free 200, Starter 1,000, Growth 2,500, Scale 5,000, Business 10,000, Enterprise by agreement) | 5 | $0.0050 | Never charged: - A call that fails, and a source that did not answer (one exception: a page a browser mode reached and the site says does not exist, 404 or 410, is charged at the mode's price) - Our own refusals: robots.txt, the URL rules, caps and capacity - Every filter, explain and highlights - Listing the sources - An Agent run that fails, and one cancelled before it starts Every filter is free: `remove_top_sites`, `only_top_sites`, the domain lists, page types, topics, dates, `language`, `country`, `popularity_buckets`, `traffic_trend`, `popular_in`, `site_tech`, `exclude_risky` and `safe_search`. Highlights are free too. ### How a search is counted - **Sources.** One credit for each source that answered. A source that did not answer is named in a `source_unavailable` warning and is not charged. - **The first 10 results are included, per call.** The 10 are counted on the one merged list the call returns, not per source. - **Further results.** 0.5 credits for each further 10 results, or part of 10, counted once per call on the results actually returned. - **Page content.** `include_content` adds 1 credit to the call, which covers the page text of up to 10 results. Each further 10 results that come back with text (or part of 10) add 1 more. A call where no result came back with text pays nothing for it. - `usage.breakdown` has `search` for the sources and, when they apply, `additional_results` and `search_content`. | Call | Credits | |---|---| | 1 source, 10 results | 1 | | 1 source, 50 results | 1 + 4 × 0.5 = 3 | | 3 sources, 10 results | 3 | | 3 sources, 25 results returned | 3 + 2 × 0.5 = 4 | | 1 source, 10 results, `include_content`, 8 came back with content | 1 + 1 = 2 | | 1 source, 30 results, `include_content`, 25 came back with content | 1 + 2 × 0.5 + 3 × 1 = 5 | ### Rules 1. **Checked first.** A call is refused with `429 INSUFFICIENT_CREDITS` before any work when the balance does not cover its largest possible cost: every source answers, a full list comes back and, with `include_content`, every result has content. 2. **Charged on success only.** A call that fails or is refused costs nothing. That covers `SEARCH_UNAVAILABLE`, `CAPACITY`, `RATE_LIMITED` and every `400`. 3. **Itemised.** `usage.breakdown` always lists the line items. The same credits pay for searches over the [MCP server](https://millionshort.com/docs/mcp) with your key: a tool call costs what the API call behind it costs. ### Spaces **[Spaces](https://millionshort.com/docs/spaces) are free**: creating, keeping, reading, changing and deleting one costs 0 credits, and a search with a `space` costs what the same search costs without it. ### Map and Crawl Map costs 1 credit for every 10 URLs returned (or part of 10), and a map that fails or finds nothing is free. A crawled page costs 1 credit in `cached` and `live`, 2 in `rendered` and 26 in `unblock`; a URL that fails is free. A crawl holds the price of `max_pages` when it starts, never costs more than that, and hands back what it did not use. [Map pricing](https://millionshort.com/docs/map/pricing) and [Crawl pricing](https://millionshort.com/docs/crawl/pricing) have worked examples. ### Places [Places](https://millionshort.com/docs/places) costs what one source of a search costs: **1 credit per call for up to 10 places, and 0.5 for each further 10 returned** (or part of 10). Every filter, `sort` and `fields` are free, and so is the category list. A call that fails, or whose location is missing or not found, costs nothing. [Places pricing and limits](https://millionshort.com/docs/places/pricing) has worked examples. ### Agent An [Agent](https://millionshort.com/docs/agent) run is **metered**, so it has no one price. It pays for what it did: searches and pages at their list prices, model tokens per 1,000 by tier, and at least 5 credits a run that ends `completed` or `incomplete`: | What the run did | Credits | |---|---| | Each search, per source searched | 1 | | Each search whose results came with their page text | +1 | | Each page read from a stored copy | 0.25 | | Each page fetched live | 0.5 | | Each places lookup | 1 | | `fast`, per 1,000 input tokens | 0.4 | | `fast`, per 1,000 output tokens | 2 | | `balanced`, per 1,000 input tokens | 8 | | `balanced`, per 1,000 output tokens | 40 | | `best`, per 1,000 input tokens | 16 | | `best`, per 1,000 output tokens | 80 | | The least a run that ends `completed` or `incomplete` is charged | 5 | | A run cancelled after it started | the work done, with no minimum | | A run that fails, or is cancelled before it starts | 0 | | Polling, the results, the event stream | 0 | `max_credits` is the most a run may cost. It is held when the run starts, and what is not used is handed back when it ends. It may be at most the plan's per-run cap: | Plan | The most `max_credits` may be, per run | |---|---| | Free | 200 | | Starter | 1,000 | | Growth | 2,500 | | Scale | 5,000 | | Business | 10,000 | | Enterprise | by agreement (10,000 until agreed) | A request with `max_credits` above the plan's cap is refused with `400 INVALID_PARAM`: the message names the cap, `error.details.plan_max_credits` carries it, and nothing is held. Left out, `max_credits` is the lesser of the plan's cap and what the tier needs: 40, 120 and 1,500 for the `lite`, `standard` and `pro` processors, raised to the least the chosen model needs. A run that reaches its cap stops and is charged for the work done. A run that fails is free. [Agent pricing and limits](https://millionshort.com/docs/agent/pricing) has the rules, the limits and measured examples of what runs have cost. ## Plans | Plan | Monthly | Credits a month | Extra credits, per 1,000 | Requests a minute | Heavy-source searches a minute | Searches in flight | |---|---|---|---|---|---|---| | Free | $0 | 1,000 | None: calls stop at the limit | 60 | 20 | 2 | | Starter | $29 | 40,000 | $0.90 | 180 | 60 | 4 | | Growth | $139 | 200,000 | $0.80 | 300 | 120 | 8 | | Scale | $449 | 750,000 | $0.70 | 600 | 240 | 16 | | Business | $1,499 | 3,000,000 | $0.60 | 1,200 | 480 | 32 | | Enterprise | Custom | Custom | Custom | Custom | Custom | Custom | Prepaid credits need no plan and cost $1.00 per 1,000. They never expire: | Pack | Credits | |---|---| | $10 | 10,000 | | $50 | 50,000 | | $250 | 250,000 | When the month's credits and any prepaid credits are used up, calls stop with 429 INSUFFICIENT_CREDITS until the next month starts or you buy prepaid credits. Nothing is billed on account. On a paid plan, prepaid credits cost your plan's rate per 1,000 when that is lower than the list price. Prepaid credits never expire. The Million Short search plans for people (a Free trial of 25 searches, then Standard: $5 a month for 1,000 searches) are a separate product: they are counted in searches on millionshort.com and include no API credits. The API and the MCP server are paid for only by the plans and credits on this page. The [pricing page](https://millionshort.com/pricing#api) has the full comparison. ## Rate limits Each plan has three limits, shown in the table above: - **Requests a minute**: every `/v1` call counts. - **Heavy-source searches a minute**: each heavy source in a search counts once, except [a search inside a list of sites](#a-search-inside-a-list-of-sites). The heavy sources are `web`, `smallweb`, `discussions`, `social`, `hn`. - **Searches in flight**: how many searches a team can have running at the same moment. Every `/v1` response that passed the rate limiter carries three headers: | Header | Meaning | |---|---| | `X-RateLimit-Limit` | Requests allowed per minute | | `X-RateLimit-Remaining` | Requests left in the current window | | `X-RateLimit-Reset` | Unix time at which the window is full again | A call over a limit is answered with `429` and the code `RATE_LIMITED`, and a `Retry-After` header with the number of seconds to wait. The same number is in the body as `error.retry_after_seconds`. `429` with the code `CAPACITY` is different: the service as a whole has no room for the call at that moment, whatever your plan. Nothing is charged. Wait `Retry-After` seconds and send it again. ### A search inside a list of sites A search inside a list of sites on the `web` source is more work than a plain search, and two limits count it that way. The list is `include_domains` in the request or, with [Spaces](https://millionshort.com/docs/spaces), the sites of a Space with `mode: only`. - **Heavy-source searches a minute:** it counts as the number of sites divided by 10, rounded up, where a plain `web` search counts as 1. The count is taken whole or not at all: a search that does not fit is refused with `429 RATE_LIMITED`, uses none of the limit, and `Retry-After` is the wait until all of it fits. - **Capacity:** when the service is busy it can be refused with `429 CAPACITY` where a plain search would have run. Nothing is charged. | Sites in the list | Counts as | |---|---| | 1 to 10 | 1 | | 11 to 20 | 2 | | 21 to 30 | 3 | | 31 to 40 | 4 | | 41 to 50, the most a Space applies | 5 | A request's own `include_domains` holds up to 25 sites, so it counts as 3 at most; only a Space reaches 4 or 5. The price does not change: 1 credit per source. ## Request limits | Limit | Value | |---|---| | `query` | 1 to 400 characters | | `sources` | 1 to 5 per search | | `num_results` | 1 to 50; more is a `400` | | Each domain list | up to 25 entries | | `max_chars_per_result` | 0 to 2,000 | | Domains per `POST /v1/domain` call | up to 25 | | Active API keys per team | up to 10 | | Spaces per team | 10 on Free and a trial key; 100 on Starter, Growth and Scale; 1,000 on Business and Enterprise | | Sites in a Space | up to 200; a search inside the list applies the first 50 | ## Limits without a key | | Trial key | Playground | MCP server with no key | |---|---|---|---| | What it is | A short-lived API key for an agent | The search form on the Agents page | The hosted MCP server with no `Authorization` header | | Allowance | 25 credits, for 24 hours | 6 searches a minute, 15 a day, per visitor | 10 searches a day, at most 5 in a minute, per visitor | | Sources per search | up to 5 | 1 | 1 | | Results per search | up to 50 | up to 5 | up to 5 | | `explain` | Yes | No | No | All free and trial use together also has a daily ceiling. When it is reached, those callers get `CAPACITY` until midnight UTC; paid keys are not affected. [Authentication](https://millionshort.com/docs/authentication) explains each of the three. --- Source: https://millionshort.com/docs/errors Section: Account # Errors One error shape, a short list of codes, and which ones to retry. ## The error shape Every error has the same JSON body, whatever the endpoint: ```json { "error": { "code": "INVALID_PARAM", "message": "num_results must be between 1 and 50.", "retry_after_seconds": null, "details": {} }, "request_id": "req_..." } ``` - `code` is stable and meant for your code to branch on. The list is below. - `message` is for a person. Its wording can change. - `retry_after_seconds` is a number when waiting helps, otherwise `null`. - `request_id` identifies the call. Quote it when you contact us. A call that ends in an error is never charged. ## Codes | Code | HTTP | Meaning | Retry? | |---|---|---|---| | `INVALID_PARAM` | 400 | A field is missing, wrong or unknown. `message` names it. | No. Fix the request. | | `UNSUPPORTED_OPTION` | 400 | The request asks for an option this API version does not offer. | No. Remove the option. | | `AUTH_INVALID_KEY` | 401 | The key is malformed, revoked or expired. | No. Use a valid key. | | `AUTH_MISSING_KEY` | 401 | No `Authorization` header was sent. | No. Send a key. | | `QUOTA_EXCEEDED` | 403 | The team has reached a limit set on its account. | No. Raise the limit or wait for the next period. | | `ACCOUNT_NOT_ELIGIBLE` | 403 | Dashboard sign-up only: this sign-in cannot open a free account (the email is not verified, is a disposable address, or already has an account). Never returned by a `/v1` call. | No. | | `ACCOUNT_SUSPENDED` | 403 | The account is suspended: its keys are refused until it is lifted. Nothing is charged. | No. Contact support. | | `NOT_FOUND` | 404 | No such resource for this team. | No. | | `RATE_LIMITED` | 429 | The plan's requests per minute, heavy-source searches per minute, or searches in flight were exceeded. | Yes, after `Retry-After` seconds. | | `CAPACITY` | 429 | The service has no free capacity for this call right now. Nothing is charged. | Yes, after `Retry-After` seconds. | | `INSUFFICIENT_CREDITS` | 429 | The balance does not cover the call. Nothing is charged. | No. Add credits first. | | `INTERNAL` | 500 | Something failed on our side. Nothing is charged. | Yes, with backoff. Send us the `request_id` if it persists. | | `SEARCH_UNAVAILABLE` | 502 | Search could not be served right now. Nothing is charged. | Yes, after `Retry-After` seconds. | A key with a monthly cap answers `403 QUOTA_EXCEEDED` with `error.details.limit` set to `key_monthly_cap` when it has spent its cap, or when a call could cost more than the key has left (`error.details.needed_credits`). Your other keys keep working. See [The dashboard](https://millionshort.com/docs/dashboard#monthly-cap-per-key). ### Codes of Spaces [Spaces](https://millionshort.com/docs/spaces) add two codes: | Code | HTTP | Meaning | Retry? | |---|---|---|---| | `SPACE_NOT_FOUND` | 404 | No such Space for this caller: it does not exist, or it belongs to another team. The two are not told apart. | No. | | `SPACE_READ_ONLY` | 403 | A curated Space cannot be changed or deleted. | No. Create your own Space from its fields. | Creating more Spaces than the plan allows is a `403 QUOTA_EXCEEDED`, with the plan's number in `error.details.limit`. ## What to retry Retry `RATE_LIMITED`, `CAPACITY` and `SEARCH_UNAVAILABLE` after the number of seconds in the `Retry-After` header, which is also `error.retry_after_seconds` in the body. Retry `INTERNAL` with a growing pause and give up after a few attempts. Do not retry a `400`, a `401`, a `403` or `INSUFFICIENT_CREDITS`: the same request will fail the same way until something changes. A retry loop with nothing but what curl and each language come with. curl retries a `429`, a `500` and a `502` by itself and waits as long as `Retry-After` says. It goes by the status alone and cannot read `error.code`, so it also retries `INSUFFICIENT_CREDITS`, which is a `429` too; the two programs do not: ```bash curl --retry 3 https://api.millionshort.com/v1/search \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{"query": "tide tables", "num_results": 5}' ``` ```python import json import os import time import urllib.error import urllib.request RETRYABLE = {"RATE_LIMITED", "CAPACITY", "SEARCH_UNAVAILABLE", "INTERNAL"} def search(body, attempts=4): request = urllib.request.Request( "https://api.millionshort.com/v1/search", data=json.dumps(body).encode(), headers={ "Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"], "Content-Type": "application/json", }, ) for attempt in range(attempts): try: with urllib.request.urlopen(request, timeout=30) as response: return json.load(response) except urllib.error.HTTPError as failure: problem = json.load(failure)["error"] if problem["code"] not in RETRYABLE or attempt == attempts - 1: raise time.sleep(problem.get("retry_after_seconds") or 2**attempt) print(search({"query": "tide tables", "num_results": 5})["data"]["summary"]) ``` ```ts const RETRYABLE = new Set(['RATE_LIMITED', 'CAPACITY', 'SEARCH_UNAVAILABLE', 'INTERNAL']); type Answer = { data: { summary: unknown } }; type Problem = { code: string; retry_after_seconds?: number | null }; async function search(body: object, attempts = 4) { for (let attempt = 0; ; attempt += 1) { const res = await fetch('https://api.millionshort.com/v1/search', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify(body), }); if (res.ok) return (await res.json()) as Answer; const problem = ((await res.json()) as { error: Problem }).error; if (!RETRYABLE.has(problem.code) || attempt === attempts - 1) { throw new Error(`${res.status} ${problem.code}`); } const seconds = problem.retry_after_seconds || 2 ** attempt; await new Promise((resolve) => setTimeout(resolve, seconds * 1000)); } } console.log((await search({ query: 'tide tables', num_results: 5 })).data.summary); ``` ## Warnings are not errors A call can succeed and still have something to tell you. Those notices arrive in `warnings`, with a `200`: | Warning code | Meaning | |---|---| | `option_not_supported` | A field was accepted but does nothing. `option` names it. | | `source_unavailable` | One source did not answer. `source` names it. It was not charged, and the other sources' results are returned. | | `short_results` | Fewer results came back than were asked for. `requested` and `returned` give the numbers. | | `filter_not_applied` | A filter could not be applied to some sources. `filter` names the field and `sources` the sources; with no `sources` it was applied nowhere right now. | | `language_detected` | `language` was applied to a source that stores no language (`web`), on a language detected from each result's text. `sources` names it. The list can be short. | | `content_partial` | `include_content`: some results have no stored page text, so their `content` is `null`. `with_content` and `returned` give the numbers. Only results with content are charged for it. | | `content_unavailable` | `include_content`: page content is away right now. The results came back without it and it was not charged. | With [Spaces](https://millionshort.com/docs/spaces#warnings), a search with a `space` has two more: | Warning code | Meaning | |---|---| | `space_sites_cut` | The Space searches inside a list and holds more sites than one search uses (50; 20 without a key). `sites_total` and `sites_applied` in the warning give the numbers. | | `space_setting_not_applied` | Something the Space asks for was left out: a setting that cannot be applied right now (named in `settings`), or a page type, topic or source that no longer exists (named in `values`). The search ran without it. | ## In the SDKs Both SDKs raise one class per kind of error, all derived from `MillionShortError`. Each error carries the code, the message, the request id and the suggested wait. The [Python](https://millionshort.com/docs/sdks/python#errors) and [TypeScript](https://millionshort.com/docs/sdks/typescript#errors) pages list the classes. ## Over MCP The [MCP server](https://millionshort.com/docs/mcp) reports a failed search as a tool result marked as an error, with one short sentence the model can act on, such as a bad argument or a limit that was reached. A connection problem is an HTTP status instead: `401` for a key that was refused (a request with no key is served in the no-key mode, where that mode is on), `403` for a browser origin that is not allowed, `405` for `GET`, `413` for a body over 256 KB. --- Source: https://millionshort.com/docs/api-reference/overview Section: Reference # API reference The base address, the shape of every request and response, and where each endpoint's fields are listed. ```text https://api.millionshort.com ``` The API is JSON over HTTPS. Every path starts with `/v1`. This is version 1.0.0. ## Endpoints | Endpoint | What it does | Credits | |---|---|---| | [`POST /v1/search`](https://millionshort.com/docs/search/parameters) | Search one to five sources and get one ranked list | 1 per source, plus 0.5 per 10 results after the first 10 | | [`GET /v1/sources`](https://millionshort.com/docs/api-reference/sources) | The sources, page types and topics a search accepts | Free | | [`POST /v1/domain`](https://millionshort.com/docs/api-reference/domain) | Popularity and risk for up to 25 sites | 1 per call | | [`POST /v1/keys/agent`](https://millionshort.com/docs/api-reference/agent-key) | A short-lived trial key for an agent. Needs no key | Free | The fields of an endpoint are listed on the Parameters page of its own section: [Search](https://millionshort.com/docs/search/parameters), [Extract](https://millionshort.com/docs/extract/parameters), [Monitor](https://millionshort.com/docs/monitor/parameters), [Map](https://millionshort.com/docs/map/parameters), [Crawl](https://millionshort.com/docs/crawl/parameters), [Places](https://millionshort.com/docs/places/parameters), [Agent](https://millionshort.com/docs/agent/parameters). The other endpoints and building blocks, each described with its section: | Endpoint | What it does | |---|---| | [`POST /v1/extract`](https://millionshort.com/docs/extract/parameters) | A page as clean text | | [`POST /v1/extract/batch`](https://millionshort.com/docs/extract/batch) | The same for up to 1,000 pages, as a job | | [`/v1/monitors`](https://millionshort.com/docs/monitor/parameters) | Watch a search or a page and be told what changed | | [`/v1/webhooks`](https://millionshort.com/docs/webhooks) | Where monitors, batches, crawls and agent runs deliver events | | [`/v1/spaces`](https://millionshort.com/docs/spaces) | Saved scopes for search: create, list, read, change, delete and import. Free | | [`space` on `POST /v1/search`](https://millionshort.com/docs/spaces#using-a-space-on-a-search) | Search with a saved scope | | [`POST /v1/map`](https://millionshort.com/docs/map/parameters) | The URLs of a site, from its sitemaps, its links and our index | | [`POST /v1/crawl`](https://millionshort.com/docs/crawl/parameters) | A site's pages as clean text, as a job: start, poll, list and cancel | | [`POST /v1/places`](https://millionshort.com/docs/places/parameters) | Businesses and points of interest by what they are and where, as data | | [`POST /v1/agent`](https://millionshort.com/docs/agent/parameters) | A question in, an answer with a checked quote for every statement out, as a job you start and then poll | [The endpoints](https://millionshort.com/docs/endpoints) has all six at a glance. [openapi.json](https://millionshort.com/docs/openapi.json) is the machine-readable description of the four endpoints in the first table. The others are described field by field on their Parameters pages. ## Authentication Send your key as a bearer token on every call: ```bash curl https://api.millionshort.com/v1/sources \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" ``` ```python import os import requests r = requests.get( "https://api.millionshort.com/v1/sources", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, timeout=30, ) r.raise_for_status() print(r.json()["data"]) ``` ```ts const res = await fetch('https://api.millionshort.com/v1/sources', { headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}` }, }); if (!res.ok) throw new Error(`GET /v1/sources failed: ${res.status}`); const { data } = (await res.json()) as { data: unknown }; console.log(data); ``` The same call as a tool of the MCP server: ```json { "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "list_sources", "arguments": {} } } ``` Keys start with `ms-`. [Authentication](https://millionshort.com/docs/authentication) covers creating and revoking keys, the trial key, and what works with no key. ## Requests - `POST` bodies are JSON, with `Content-Type: application/json`. - **A field the endpoint does not list is refused** with `400 INVALID_PARAM`. A typo in a field name is an error, not a silent default. - A field you leave out takes the default shown in the endpoint's table. - Calls are synchronous: the answer to a search is the response to the request. - A search changes nothing, so sending it again after a failure is always safe. ## Responses Every success has the same four parts: ```json { "data": { "sources": [], "page_types": [], "topics": [] }, "usage": { "credits": 0, "cost_usd": 0, "breakdown": { "sources": 0 } }, "warnings": [], "request_id": "req_..." } ``` | Part | What it is | |---|---| | `data` | The answer. Its shape depends on the endpoint | | `usage` | What the call cost: `credits`, `cost_usd`, and a `breakdown` by line item | | `warnings` | Notices that did not fail the call, each with a `code` and a `message` | | `request_id` | Identifies the call. Quote it when you contact us | The SDKs unwrap `data`: `results` and `summary` sit directly on the object a search returns, with `usage`, `warnings` and the request id beside them. Every failure has one shape too, with a stable `code` to branch on: ```json { "error": { "code": "RATE_LIMITED", "message": "Too many requests. Try again in 12 seconds.", "retry_after_seconds": 12, "details": {} }, "request_id": "req_..." } ``` [Errors](https://millionshort.com/docs/errors) lists every code and says which to retry. A call that ends in an error is never charged. ## Status codes | Status | Meaning | |---|---| | `200` | Success. Read `warnings` as well as `data` | | `400` | The request is wrong: `INVALID_PARAM` or `UNSUPPORTED_OPTION`. Do not retry it unchanged | | `401` | No key, or a key that is malformed, revoked or expired | | `403` | Dashboard sign-up only (`ACCOUNT_NOT_ELIGIBLE`). Not returned by `/v1` calls | | `404` | No such endpoint or resource | | `429` | `RATE_LIMITED` or `CAPACITY`: wait `Retry-After` seconds. `INSUFFICIENT_CREDITS`: add credits | | `500` | Our fault. Retry with a growing pause | | `502` | `SEARCH_UNAVAILABLE`: search could not be served right now. Retry after `Retry-After` seconds | ## Headers Every `/v1` response that passed the rate limiter carries these headers: | Header | Meaning | |---|---| | `X-RateLimit-Limit` | Requests allowed per minute | | `X-RateLimit-Remaining` | Requests left in the current window | | `X-RateLimit-Reset` | Unix time at which the window is full again | | `Retry-After` | On a `429` or a `502`: seconds to wait before sending the call again | [Credits and limits](https://millionshort.com/docs/credits-and-limits) has each plan's numbers. ## Credits One credit is $0.001. Each endpoint's page says what a call costs, every response says what it did cost in `usage`, and a call that fails costs nothing. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the rules and worked examples. ## Clients - [Python SDK](https://millionshort.com/docs/sdks/python) and [TypeScript SDK](https://millionshort.com/docs/sdks/typescript): thin clients, one method per endpoint. Not published to a package registry yet. - [MCP server](https://millionshort.com/docs/mcp): the same endpoints as tools, for any MCP client. - [LangChain](https://millionshort.com/docs/integrations/langchain) and [Vercel AI SDK](https://millionshort.com/docs/integrations/vercel-ai-sdk) tool packages. Not published yet. - Anything that can send an HTTPS request. Call the API from a server. Do not put a key in code that runs in a browser or a mobile app. --- Source: https://millionshort.com/docs/api-reference/sources Section: Reference # Sources The sources you can search, and the page types and topics you can filter by. ```text GET https://api.millionshort.com/v1/sources ``` Returns the source slugs that `sources` accepts in a [search](https://millionshort.com/docs/search/parameters), how fresh each source is, which filters each source applies, and the values that `page_types`, `topics`, `traffic_trend` and `popularity_buckets` accept. The call is free. It needs an [API key](https://millionshort.com/docs/authentication). ## The sources | Slug | What it contains | Heavy | |---|---|---| | `web` | The general web: Billions+ pages on our own independent index. | Yes | | `news` | News articles, refreshed through the day. | | | `smallweb` | Personal sites, blogs and small independent publishers. | Yes | | `discussions` | Forum threads and community conversations in one search. | Yes | | `hn` | Technology links and the comment threads around them. | Yes | | `social` | Recent public posts from open social networks. | Yes | | `communities` | Public chat communities, by name, topic and size. | | | `podcasts` | Podcast shows and episodes. | | | `academic` | Scholarly papers and preprints. | | | `medical` | Biomedical and clinical literature. | | | `law` | Statutes, regulations and court opinions (United States). | | | `finance` | Public-company filings and disclosures. | | | `contracts` | Government contract opportunities and awards. | | One search can cover up to five of these. "Heavy" sources have their own per-minute limit on each plan; see [Credits and limits](https://millionshort.com/docs/credits-and-limits). The table above is a guide. The response of `GET /v1/sources` is the authority: read the list from there if your code depends on it. ## Request ```bash curl https://api.millionshort.com/v1/sources \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" ``` ```python import os import requests r = requests.get( "https://api.millionshort.com/v1/sources", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, timeout=30, ) r.raise_for_status() print(r.json()["data"]) ``` ```ts const res = await fetch('https://api.millionshort.com/v1/sources', { headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}` }, }); if (!res.ok) throw new Error(`GET /v1/sources failed: ${res.status}`); const { data } = (await res.json()) as { data: unknown }; console.log(data); ``` The same call as a tool of the MCP server: ```json { "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "list_sources", "arguments": {} } } ``` ## Response `data` holds these lists: | Field | Type | Notes | |---|---|---| | `sources` | array of objects | | | `page_types` | array of objects | | | `topics` | array of objects | | | `traffic_trends` | array of objects | The values `traffic_trend` accepts. | | `popularity_buckets` | array of `top-100`, `top-1k`, `top-10k`, `top-100k`, `top-1m`, `long-tail` | The values `popularity_buckets` accepts. | A source has a `slug`, a one-line `description`, its `freshness` and the `filters` it applies. A page type, a topic or a traffic trend has a `slug` and a `label`. `freshness`: | Field | Type | Notes | |---|---|---| | `cadence` | `minutes`, `hourly`, `twice_daily`, `daily`, `weekly`, `snapshot` | How often new material arrives. | | `description` | string | | | `captured_from` | string | Snapshot sources: the first day its pages were captured. | | `captured_to` | string | Snapshot sources: the last day its pages were captured. | `filters` is the list of search request fields the source applies. A filter you send to a source that does not list it is not applied to that source's results, and the search response says so in a `filter_not_applied` warning. ```json { "data": { "sources": [ { "slug": "web", "description": "...", "freshness": { "cadence": "snapshot", "description": "...", "captured_from": "2026-01-05", "captured_to": "2026-03-20" }, "filters": ["include_domains", "exclude_domains", "language", "country", "page_types", "topics", "include_content"] }, { "slug": "news", "description": "...", "freshness": { "cadence": "hourly", "description": "New articles arrive every hour." }, "filters": ["include_domains", "exclude_domains", "start_date", "end_date", "language", "country", "page_types", "topics", "include_content"] } ], "page_types": [ { "slug": "articles", "label": "Article" }, { "slug": "documentation", "label": "Documentation" }, { "slug": "tutorials", "label": "Tutorial" } ], "topics": [ { "slug": "programming", "label": "Programming" }, { "slug": "science", "label": "Science" } ], "traffic_trends": [ { "slug": "rising", "label": "Visits to the site are growing" } ], "popularity_buckets": ["top-100", "top-1k", "top-10k", "top-100k", "top-1m", "long-tail"] }, "usage": { "credits": 0, "cost_usd": 0, "breakdown": {} }, "request_id": "req_..." } ``` The lists above are cut short, the `filters` lists too: the real ones also name the site filters and the exclude, boost and bury lists. Pass a page-type or topic slug to a search to keep only matching results: ```bash curl https://api.millionshort.com/v1/search \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "query": "memory safety", "page_types": ["documentation"], "topics": ["programming"] }' ``` ```python import os import requests r = requests.post( "https://api.millionshort.com/v1/search", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, json={ "query": "memory safety", "page_types": [ "documentation" ], "topics": [ "programming" ] }, timeout=30, ) r.raise_for_status() for hit in r.json()["data"]["results"]: print(hit["position"], hit["title"], hit["url"]) ``` ```ts const res = await fetch('https://api.millionshort.com/v1/search', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ "query": "memory safety", "page_types": [ "documentation" ], "topics": [ "programming" ] }), }); if (!res.ok) throw new Error(`POST /v1/search failed: ${res.status}`); const { data } = (await res.json()) as { data: { results: { position: number; title: string; url: string }[] }; }; for (const hit of data.results) console.log(hit.position, hit.title, hit.url); ``` The same call as a tool of the MCP server: ```json { "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "search", "arguments": { "query": "memory safety", "page_types": [ "documentation" ], "topics": [ "programming" ] } } } ``` ## With the SDKs and MCP ```python import os from millionshort import MillionShort client = MillionShort(api_key=os.environ["MILLIONSHORT_API_KEY"]) catalog = client.list_sources() for source in catalog.sources: print(source["slug"], source["description"]) ``` ```ts import { MillionShort } from 'millionshort'; const client = new MillionShort({ apiKey: process.env.MILLIONSHORT_API_KEY }); const catalog = await client.listSources(); for (const source of catalog.sources) { console.log(source.slug, source.description); } ``` Over MCP the same list is the `list_sources` tool. Without a key the tool still answers, with the names of the sources only. --- Source: https://millionshort.com/docs/api-reference/domain Section: Reference # Domain info How popular a site is, and whether it carries a risk label. ```text POST https://api.millionshort.com/v1/domain ``` For up to 25 domains, returns how popular each site is and whether it carries a risk label. These are the same `popularity` and `risk` objects that every search result carries. One call costs 1 credit, however many domains it holds. It needs an [API key](https://millionshort.com/docs/authentication). ## Request | Field | Type | Notes | |---|---|---| | `domains` | array of strings, 1 to 25 items | Required. | ```bash curl https://api.millionshort.com/v1/domain \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "domains": ["example.com", "blog.example.org"] }' ``` ```python import os import requests r = requests.post( "https://api.millionshort.com/v1/domain", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, json={ "domains": [ "example.com", "blog.example.org" ] }, timeout=30, ) r.raise_for_status() print(r.json()["data"]) ``` ```ts const res = await fetch('https://api.millionshort.com/v1/domain', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ "domains": [ "example.com", "blog.example.org" ] }), }); if (!res.ok) throw new Error(`POST /v1/domain failed: ${res.status}`); const { data } = (await res.json()) as { data: unknown }; console.log(data); ``` The same call as a tool of the MCP server: ```json { "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "get_domain_info", "arguments": { "domains": [ "example.com", "blog.example.org" ] } } } ``` ## Response `data.domains` has one entry per domain, in the order sent. | Field | Type | Notes | |---|---|---| | `domain` | string | | | `popularity` | object | | | `risk` | object or null | | `popularity`: | Field | Type | Notes | |---|---|---| | `rank` | integer or null | The site's popularity rank (1 is the most popular), or null when it is outside the top 1,000,000 or unknown. | | `bucket` | `top-100`, `top-1k`, `top-10k`, `top-100k`, `top-1m`, `long-tail`, `unknown` | | `risk` is `null` when the site carries no risk label. Otherwise: | Field | Type | Notes | |---|---|---| | `level` | `labelled`, `demoted`, `blocked` | | | `categories` | array of strings | | ```json { "data": { "domains": [ { "domain": "example.com", "popularity": { "rank": 812, "bucket": "top-1k" }, "risk": null }, { "domain": "blog.example.org", "popularity": { "rank": null, "bucket": "long-tail" }, "risk": null } ] }, "usage": { "credits": 1, "cost_usd": 0.001, "breakdown": { "domain": 1 } }, "request_id": "req_..." } ``` The values are an illustration. ## With the SDKs and MCP ```python import os from millionshort import MillionShort client = MillionShort(api_key=os.environ["MILLIONSHORT_API_KEY"]) info = client.get_domain_info(["example.com", "blog.example.org"]) for entry in info.domains: print(entry["domain"], entry["popularity"]["bucket"], entry["risk"]) ``` ```ts import { MillionShort } from 'millionshort'; const client = new MillionShort({ apiKey: process.env.MILLIONSHORT_API_KEY }); const info = await client.getDomainInfo(['example.com', 'blog.example.org']); for (const entry of info.domains) { console.log(entry.domain, entry.popularity.bucket, entry.risk); } ``` Over MCP this is the `get_domain_info` tool. It needs a key. ## Errors `400 INVALID_PARAM` (no domains, more than 25, or a value that is not a domain name), `401`, `429` and `502 SEARCH_UNAVAILABLE`. See [Errors](https://millionshort.com/docs/errors). --- Source: https://millionshort.com/docs/api-reference/agent-key Section: Reference # Trial key for agents One call, no account, and an agent has a key that works for 24 hours. ```text POST https://api.millionshort.com/v1/keys/agent ``` Returns a short-lived API key with a small credit grant. It is the only `/v1` call that needs no key, and it is meant for an agent that wants to try the API with no person at hand to sign up. For anything lasting, create a key in the [dashboard](https://millionshort.com/app/). ## Request | Field | Type | Notes | |---|---|---| | `agent` | string, up to 60 characters | Required. The agent's name. | | `purpose` | string, up to 200 characters or null | | ```bash curl https://api.millionshort.com/v1/keys/agent \ -H "Content-Type: application/json" \ -d '{ "agent": "my-agent", "purpose": "trying the search API" }' ``` ```python from millionshort import MillionShort key = MillionShort().create_agent_key("my-agent").api_key client = MillionShort(api_key=key) r = client.search("sourdough starter hydration", num_results=3) print(r.results[0]["title"], r.usage.credits) ``` ```ts import { MillionShort } from 'millionshort'; const { api_key } = await new MillionShort().createAgentKey('my-agent'); const client = new MillionShort({ apiKey: api_key }); const r = await client.search('sourdough starter hydration', { numResults: 3 }); console.log(r.results[0]?.title, r.usage?.credits); ``` ## Response `data` holds the key. It is shown once: keep it for the session, and do not write it into a file. | Field | Type | Notes | |---|---|---| | `api_key` | string | The `ms-...` key, shown exactly once. | | `tier` | `trial` | | | `rate_limit` | string | | | `expires_in_days` | integer | `expires_in_hours` rounded up to whole days. | | `expires_in_hours` | integer | | | `expires_at` | string | When the key stops working. | | `team_id` | string | | ## What a trial key can do | | | |---|---| | Credits | 25. They cannot be topped up | | Lifetime | 24 hours. `expires_at` gives the exact time | | Endpoints | Everything a normal key can call: search, sources, domain info | | Sources per search | Up to 5 | | Results per search | Up to 50 | | `explain` | Yes | | Renewal | None. When it ends, create a key in the dashboard | ## Limits Trial keys are limited per network address and in total per day. Past a limit the call answers `429`. All free and trial use together also has a daily ceiling; when it is reached, trial keys get `429 CAPACITY` until midnight UTC, and paid keys are not affected. The exact numbers are not published and can change. An agent that is refused should stop and ask its person for a key. ## Cost Free. Searches made with the key draw on its 25 credits at the usual rates. ## Errors `400 INVALID_PARAM` (no `agent`, or a value that is too long), `404` when trial keys are switched off, and `429` past a limit. See [Errors](https://millionshort.com/docs/errors). ## For the agent reading this 1. Call this endpoint once. Keep the key in memory or in an environment variable for the session. 2. Send it as `Authorization: Bearer ` on every other call. 3. Watch `usage.credits` on each response; you have 25. 4. When you get `401 AUTH_INVALID_KEY` after it worked before, the key has expired. Tell your person; do not ask for another in a loop. The plain-text version of these steps is [auth.md](https://millionshort.com/docs/auth.md). --- Source: https://millionshort.com/docs/changelog Section: Reference # Changelog Changes to the API, the MCP server and the SDKs. Newest first. Dates are the day a change reached the public documentation. ## 2026-11-27: new plan prices; the Free plan has 1,000 credits a month - **Free:** 1,000 credits a month (it was 10,000), still with no card. A Free account moves to 1,000 at its next monthly reset; the credits of the month under way are not taken back. - **Starter** $29 a month for 40,000 credits, more at $0.90 per 1,000. **Growth** $139 a month for 200,000 credits, more at $0.80 per 1,000. **Scale** $449 for 750,000 ($0.70 per 1,000 more) and **Business** $1,499 for 3,000,000 ($0.60 per 1,000 more), by a conversation with us. Every plan keeps its rate limits. - **Pay as you go** is unchanged: $1.00 per 1,000 credits, which never expire. So are the price of every call and the per-run caps of Agent. - The [pricing page](https://millionshort.com/pricing#api) is at `/pricing` now; `/plans` leads there. ## 2026-11-26: the MCP server without a key gives 10 searches a day - The hosted [MCP server](https://millionshort.com/docs/mcp) with no key now gives **10 free searches a day per visitor** (it was 25), still at most 5 in a minute. Each answer says how many are left today; past the 10, the tool says so and names the [dashboard](https://millionshort.com/app/), where a key is free. ## 2026-11-26: Agent is available - **Agent is available, no longer in preview.** [`POST /v1/agent`](https://millionshort.com/docs/agent) can be called on the public API, and `start_agent`, `get_agent` and `get_agent_results` on [the MCP server](https://millionshort.com/docs/mcp#agent), on every plan, the Free plan included. Its pages no longer carry a Preview mark. All six endpoints are now available. - **Per-run caps by plan.** `max_credits` may be at most Free 200, Starter 1,000, Growth 2,500 (3,000 in the preview), Scale 5,000 and Business 10,000. On Enterprise the per-run cap is set by agreement. [Pricing and limits](https://millionshort.com/docs/agent/pricing#by-plan) has the table. - **Over the cap is refused.** A request with `max_credits` above the plan's cap is a `400 INVALID_PARAM` whose message names the cap, with `details.plan_max_credits`; nothing is held. Left out, `max_credits` is the lesser of the plan's cap and what the tier needs. See [Errors](https://millionshort.com/docs/agent/errors#requests-that-are-refused). - **Prices,** unchanged from the preview: metered, with searches and pages at their list prices and model tokens per 1,000 by tier (`model` defaults to `auto`: `fast`, except on the `pro` processor), at least 5 credits a run, and never more than `max_credits`. - **Privacy.** Agent runs send your question and the pages read to our AI model provider (a sub-processor); they are not used for training. The [privacy policy](https://millionshort.com/privacy) says so too. ## 2026-11-20: Extract, Monitor, Map, Crawl and Places are available - **Six endpoints, five available.** [Extract](https://millionshort.com/docs/extract), [Monitor](https://millionshort.com/docs/monitor), [Map](https://millionshort.com/docs/map), [Crawl](https://millionshort.com/docs/crawl) and [Places](https://millionshort.com/docs/places) are documented as endpoints you call like [Search](https://millionshort.com/docs/search), with the same key, credits and errors. So are [Spaces](https://millionshort.com/docs/spaces) and [webhooks](https://millionshort.com/docs/webhooks). Their pages no longer carry a Preview mark. - [Agent](https://millionshort.com/docs/agent) is the one endpoint in preview (below): its contract is written, and it cannot be called on the public API yet. ## 2026-11-20: Agent, in preview - **Agent has a contract.** [`POST /v1/agent`](https://millionshort.com/docs/agent) takes a question and returns an answer in which every statement ends with `[n]` markers, each naming a page and a quote from it. It was "planned"; it is now in preview: the contract is written, and it cannot be called on the public API yet. - **A section of its own:** [overview](https://millionshort.com/docs/agent), [quickstart](https://millionshort.com/docs/agent/quickstart), [parameters](https://millionshort.com/docs/agent/parameters), [guides](https://millionshort.com/docs/agent/guides), [pricing and limits](https://millionshort.com/docs/agent/pricing) and [errors](https://millionshort.com/docs/agent/errors). - **A run is a job.** Start it, then poll `GET /v1/agent/{id}`, read the steps on `GET /v1/agent/{id}/events`, or name a `webhook_id` and receive `agent.completed`. `DELETE /v1/agent/{id}` cancels. - **Citations are checked.** A quote must be one unbroken run of the words of the page it names; one that is not is dropped, and a statement left with no quote is removed and counted in `uncited_removed`. On `standard` and `pro`, `verified` says whether the second pass over the citations was made. If nothing can be supported the run ends `incomplete`, with no answer. The [overview](https://millionshort.com/docs/agent#what-this-does-not-promise) says what this does not promise. - **Data in your shape.** With `schema` the answer comes back as `output`, with `field_citations` per field, and `uncited_fields` names the filled fields that no checked quote supports. - **Where a run looks:** `sources`, `space`, `remove_top_sites`, `include_domains`, `exclude_domains` and `start_date`, applied to every search of the run. Its only tools are our own Search, Extract and Places. - **How much it does:** `processor` is `lite`, `standard` or `pro`. `model` chooses the model that writes; `auto` is the processor's own. [Parameters](https://millionshort.com/docs/agent/parameters#processors) has both tables. - **The price we intend:** metered. Each search and each page at the Search and Extract prices, plus the model's tokens, with a minimum per run and never more than `max_credits`, which is held at the start and handed back unused. A failed run is free. [Pricing and limits](https://millionshort.com/docs/agent/pricing) has every number. - **MCP:** `start_agent`, `get_agent` and `get_agent_results`, in preview, with a key. See [the MCP server](https://millionshort.com/docs/mcp#agent). - **SDKs:** `start_agent`, `get_agent`, `get_agent_results`, `wait_agent`, `stream_agent_events` and `cancel_agent` in Python, and the same in camelCase in TypeScript. ## 2026-11-20: Map and Crawl - **Map and Crawl have a contract.** [`POST /v1/map`](https://millionshort.com/docs/map) lists the URLs of a site in one call. [`POST /v1/crawl`](https://millionshort.com/docs/crawl) returns a site's pages as clean text, as a job you poll, list and cancel. They were "planned"; the contract is now written. - **A section each:** [Map](https://millionshort.com/docs/map) and [Crawl](https://millionshort.com/docs/crawl), with a quickstart, parameters, guides, pricing and limits, and errors. - **Map looks in three places:** the site's sitemaps, the links of the page you name, and our own index, which adds titles and labels and requests no page of the site. `search` finds pages inside a site; `include` and `exclude` are regular expressions on the path. - **A crawled page is an Extract result** with a `depth`, so every page carries its labels, free. `max_pages`, `max_depth`, `include`, `exclude`, `same_domain`, `include_subdomains`, a `sitemap` switch, the modes of Extract, and a `webhook_id` that is told when the crawl ends. - **robots.txt is always honoured.** There is no option to ignore it. One account gets at most 30 pages of one site a minute and 2,000 a day. - **Prices:** Map costs 1 credit for every 10 URLs returned. A crawled page costs 1 credit in `cached` and `live`, 2 in `rendered` and 26 in `unblock`. Failed pages are free, and a crawl hands back what it held and did not use. - **MCP:** `map`, `crawl`, `crawl_status` and `crawl_cancel`, with a key. See [the MCP server](https://millionshort.com/docs/mcp#map-and-crawl). **SDKs:** `map` and the crawl methods, in [Python](https://millionshort.com/docs/sdks/python#map-and-crawl) and [TypeScript](https://millionshort.com/docs/sdks/typescript#map-and-crawl). - Nothing in the live API changed. ## 2026-11-20: Places - **Places has a contract.** [`POST /v1/places`](https://millionshort.com/docs/places) finds businesses and points of interest by what they are and where they are, and returns them as data: name, category, address, coordinates, distance, phone number, website and, where known, opening hours. No map, no tiles. It was "planned"; the contract is now written. - **A section of its own:** [overview](https://millionshort.com/docs/places), [quickstart](https://millionshort.com/docs/places/quickstart), [parameters](https://millionshort.com/docs/places/parameters), [guides](https://millionshort.com/docs/places/guides), [pricing and limits](https://millionshort.com/docs/places/pricing) and [errors](https://millionshort.com/docs/places/errors). - **Where to look** is a place name (`near`), a point (`lat`, `lng`), a box (`bbox`), an IP address's city (`ip`, or `near_me` for the address the call comes from) or a `neighbourhood`; with none of them, `city` and `region`. A name that cannot be found is an error, never a guess. The address a request comes from is used only when `near_me` says so, and no IP address is logged, kept or returned. - **Filters:** `category` and `exclude_category` (ids or names), `brand`, `city`, `region`, `country`, `radius_m`, `has_phone`, `has_website`, `has_hours`, `open_now`. **Shaping:** `sort` (`relevance`, `distance`), `fields`, `limit`. [Parameters](https://millionshort.com/docs/places/parameters) has each one with an example, and says [which filters work where](https://millionshort.com/docs/places/parameters#which-filters-work-where). - **The category list:** [`GET /v1/places/categories`](https://millionshort.com/docs/places/parameters#the-category-list), free. - **What to expect.** Coverage is worldwide and uneven; place names are read best in Canada and the United States. Opening hours are known for few places. There are no ratings, reviews, photos or price levels. The [overview](https://millionshort.com/docs/places#coverage) says so in full. - **Price:** 1 credit per call for up to 10 places, 0.5 for each further 10 returned. A call that fails costs nothing. - **Attribution.** Every answer carries a credit line to show wherever you show the places. See [Attribution](https://millionshort.com/docs/places/parameters#attribution). - **MCP:** a `places` tool and a `list_place_categories` tool that also work with no key. See [the MCP server](https://millionshort.com/docs/mcp#places). - Nothing in the live API changed. ## 2026-11-20: prices - **10,000 free credits a month** on the Free plan, up from 3,000. Still no card. - **Page text on a search is 1 credit a call.** `include_content` adds 1 credit, which covers the page text of up to 10 results; each further 10 results with text add 1 more. It was 0.25 credits per result with text. - **Prices lead with dollars per 1,000.** 1 credit = 1 search; a page is half. [Credits and limits](https://millionshort.com/docs/credits-and-limits) has the dollars per 1,000 searches and pages on each plan, what a typical call costs, and what is never charged. - **Extract:** `unblock` is 10 credits a page (it was 4). A new mode, `stealth`, is 25 credits a page, on request. In `rendered`, `unblock` and `stealth`, a page the site says does not exist (`404`, `410`) is charged at the mode's price and marked `charged: true`; our own refusals stay free. - **When credits run out, calls stop** with `429 INSUFFICIENT_CREDITS` until the next month or until you buy prepaid credits. Nothing is billed on account. The pricing page said otherwise; it is corrected. ## 2026-11-19: the docs are organised by endpoint - **One section per endpoint:** [Search](https://millionshort.com/docs/search), [Extract](https://millionshort.com/docs/extract), [Monitor](https://millionshort.com/docs/monitor), [Map](https://millionshort.com/docs/map), [Places](https://millionshort.com/docs/places) and [Agent](https://millionshort.com/docs/agent). Each has the same parts in the same order: overview, quickstart, parameters, guides, pricing and limits, errors. - **Every page about an endpoint lives under it.** Removing the top sites, the sources, the filters, lenses and Spaces are under Search; labels are under Extract and under Monitor. An endpoint's reference is its Parameters page. - **Map (with Crawl), Places and Agent are planned.** Their pages say what each will do and the request we have in mind. None of them can be called, and no price is set. Agent is what earlier pages called Research. Crawling and mapping a site were listed as not planned; they are planned now. - **22 new pages.** [The endpoints](https://millionshort.com/docs/endpoints), which replaces "What is coming". - **New under Search:** the [overview](https://millionshort.com/docs/search), [quickstart](https://millionshort.com/docs/search/quickstart), [guides](https://millionshort.com/docs/search/guides), [highlights and page text](https://millionshort.com/docs/search/highlights), [pricing and limits](https://millionshort.com/docs/search/pricing), and [errors and warnings](https://millionshort.com/docs/search/errors). - **New under Extract:** the [overview](https://millionshort.com/docs/extract), [quickstart](https://millionshort.com/docs/extract/quickstart), [guides](https://millionshort.com/docs/extract/guides), [labels](https://millionshort.com/docs/extract/labels), [pricing and limits](https://millionshort.com/docs/extract/pricing), and [errors](https://millionshort.com/docs/extract/errors). - **New under Monitor:** the [overview](https://millionshort.com/docs/monitor), [quickstart](https://millionshort.com/docs/monitor/quickstart), [guides](https://millionshort.com/docs/monitor/guides), [labels](https://millionshort.com/docs/monitor/labels), [pricing and limits](https://millionshort.com/docs/monitor/pricing), and [errors](https://millionshort.com/docs/monitor/errors). - **New and planned:** [Map](https://millionshort.com/docs/map) (with Crawl), [Places](https://millionshort.com/docs/places) and [Agent](https://millionshort.com/docs/agent). - **Addresses changed.** A page that moved still answers at its old address, which sends you on, and its Markdown twin is still served there. `llms.txt` and `llms-full.txt` follow the new order. - **Corrected the same day.** In Extract and Monitor, a batch or a monitor that does not exist is `404 JOB_NOT_FOUND`, not `NOT_FOUND`. `interval_minutes` takes 1 to 43,200; the shortest a monitor may use still depends on the plan and the source. The error pages now list every `paused_reason`, `401`, and a `webhook_id` that is not active. - Nothing in the API changed. ## 2026-11-19: the dashboard's keys, request log and playground - **A monthly spending cap per key.** A call sets aside the most it can cost when it starts, so calls already in flight when the cap is reached finish and are charged, and together they stay within the cap; a call that could cost more than the key has left is refused with `403 QUOTA_EXCEEDED` before it runs. See [The dashboard](https://millionshort.com/docs/dashboard#monthly-cap-per-key). - **Rename and roll a key.** After a roll, the old key keeps working for 24 hours. - **The request log:** one row per call that does work, kept 30 days; query text kept 30 days, 7 days or not at all, as the team chooses. It never holds a key or an answer. - **The dashboard's playground:** 25 free runs a day per team, then charged like the same call with a key. ## 2026-11-19: signing in to the dashboard - Three ways in: email and password (a new address is confirmed by a link first), GitHub and Google. The sign-in page has no sign-in link by email. See [Authentication](https://millionshort.com/docs/authentication#signing-in-to-the-dashboard). - One verified address is one account, whichever way you sign in. A new sign-up opens nothing until its address is confirmed. - "Forgot your password?" on the sign-in page sends a link to set a new one. ## 2026-11-19: limits of Extract and Monitor - **The daily limit per site counts a page once while it is unchanged.** A team may still fetch 2,000 pages of one site a day. Fetching the same address again counts only when the page has changed since your last fetch of it, so a monitor's checks of an unchanged page use one fetch a day, not one a check. A page that is different on every fetch counts every time. See [the daily limit per site](https://millionshort.com/docs/extract/parameters#the-daily-limit-per-site). - **Batches wait for our own limits.** A `cached` batch no longer fails pages with `CAPACITY` when stored copies are looked up faster than we allow: it waits. A page waiting for a busy site waits, at no cost to it, until the batch has run for 60 minutes; only after that can it fail as `HOST_BUSY`. See [Extract batch](https://millionshort.com/docs/extract/batch#how-a-batch-runs). - **Monitors:** a scheduled check that was put off is tried again about two minutes later, up to three times, for `query` monitors as for `url` monitors. - A site that gave no answer at all to your last two fetches of it is not asked again for you for five minutes; its URLs answer `TIMEOUT` or `FETCH_FAILED` at once. - `CAPACITY` on `rendered` and `unblock` can be for the moment only, and then carries `retry_after_seconds`. It does not count as one of the day's attempts. ## 2026-11-18: the MCP server without a key - The hosted [MCP server](https://millionshort.com/docs/mcp) answers a connection with no key: `search` and `list_sources`, one source and up to 5 results per search. - **25 free searches a day per visitor**, at most 5 in a minute. The number is the one the MillionShort search site gives a visitor who is not signed in. - Each no-key answer says how many searches are left today (`allowance` in the structured answer, and a line of the text). When they are used up, the tool says so and names the dashboard, where a key is free. ## 2026-11-18: Spaces - [Spaces](https://millionshort.com/docs/spaces): a saved scope for search. Sites to search inside or to prefer, the popularity cut, page types and topics, a lens, site filters, default sources and safe search, under one name. Free. - `space` on `POST /v1/search` searches with a Space: an id, your slug, or `curated:` and the slug of one of our curated Spaces. A parameter of the request replaces the Space's value for that setting, and the answer says what the Space supplied in `data.space`. - `/v1/spaces`: create, list, read, change and delete, and `POST /v1/spaces/import` for Spaces exported from the MillionShort search site. - Error codes `SPACE_NOT_FOUND` and `SPACE_READ_ONLY`; a `space_sites_cut` warning and a `space_setting_not_applied` warning. - SDKs: `create_space`, `list_spaces`, `get_space`, `update_space`, `delete_space` and `import_spaces` in Python, the same in camelCase in TypeScript, and `space` on `search`. MCP: `list_spaces`, `create_space`, and `space` on `search`. - New concept page: [Spaces](https://millionshort.com/docs/search/spaces). ## 2026-11-18: search filters, highlights and page content - **Language on the web source is detected, not assumed.** Each result carries `language`. For `web`, which stores none, it is detected from the result's text; a `language` filter is applied to that, and the response says so (`language_detected`). A German query with `language: "de"` now returns German web pages. - **Dates, language and country:** `start_date`, `end_date`, `time_range`, `language` and `country` are real filters now. Where a source cannot apply one, the response says so in a `filter_not_applied` warning; a filter is never ignored silently. The same now holds for `page_types` and `topics` on sources other than `web` and `news`. - **Boost, bury, block and only** for page types and topics as well as sites: `exclude_page_types`, `boost_page_types`, `bury_page_types`, `exclude_topics`, `boost_topics`, `bury_topics`. `only_domains` and `block_domains` are other names for `include_domains` and `exclude_domains`. - **Site filters:** `popularity_buckets`, `traffic_trend`, `popular_in`, `site_tech` and `exclude_risky`. Each result carries `traffic_trend`, `popular_in` and `site_tech`. - **Highlights:** `max_highlights` returns up to five passages a result, with `highlight_spans` (offsets and a score). Free. - **Page content:** `include_content` returns the text of the page as we hold it, for `web` and `news` results, with the dates it was captured. 0.25 credits per result that has content. - **Freshness:** `GET /v1/sources` says how fresh each source is and which filters it applies. - `signals.link_authority` is always between 0 and 10, or `null`. - A search inside a list of sites (`include_domains`) on `web` counts as the number of sites divided by 10, rounded up, against the heavy-source limit: see [Credits and limits](https://millionshort.com/docs/credits-and-limits#a-search-inside-a-list-of-sites). Its price does not change. ## 2026-11-18: documentation - New concept pages: [Mixture of Experts](https://millionshort.com/docs/search/mixture-of-experts), [Remove the top sites](https://millionshort.com/docs/search/remove-top-sites), [Lenses](https://millionshort.com/docs/search/lenses), [Popularity and risk](https://millionshort.com/docs/search/popularity-and-risk) and [Freshness and dates](https://millionshort.com/docs/search/freshness). - One page for each of the 13 [sources](https://millionshort.com/docs/search/sources): what it is good for, what its results carry, and queries to try. - New reference pages: the [API overview](https://millionshort.com/docs/api-reference/overview) and the [trial key](https://millionshort.com/docs/api-reference/agent-key). - Guides: [RAG](https://millionshort.com/docs/search/guides/rag), [agent tool use](https://millionshort.com/docs/search/guides/agent-tool-use), [long-tail research](https://millionshort.com/docs/search/guides/long-tail-research) and [news monitoring](https://millionshort.com/docs/monitor/guides/news-monitoring). - Integration pages for [LangChain](https://millionshort.com/docs/integrations/langchain) and the [Vercel AI SDK](https://millionshort.com/docs/integrations/vercel-ai-sdk). The packages are not published yet. - The [glossary](https://millionshort.com/docs/glossary) and the [use cases](https://millionshort.com/docs/use-cases), rewritten for this version of the API. - Examples in cURL, Python and TypeScript side by side, each one run against the SDKs before it is published. ## 2026-11-18: Extract, Monitor and webhooks - **Labels on Extract and Monitor:** every extracted page, every page-monitor event and every new result of a search monitor carries `topic`, `page_type`, `source_hint` and `label_confidence`: the same 24 topics and 23 page types as search results, and which of the sources holds pages like it. Free. `topics`, `page_types` and `source_hints` on [Extract](https://millionshort.com/docs/extract/parameters#labels) and [Extract batch](https://millionshort.com/docs/extract/batch) keep only the pages with those labels. - [Extract](https://millionshort.com/docs/extract/parameters): a page as clean text. Modes `cached`, `live`, `rendered` and `unblock`; per-URL errors; charged only for pages that succeed. - [Extract batch](https://millionshort.com/docs/extract/batch): up to 1,000 URLs as a job. - [Monitors](https://millionshort.com/docs/monitor/parameters): watch a search or a page. [Webhooks](https://millionshort.com/docs/webhooks): signed delivery of events. ## API 1.0.0 The first version of the public API. - `POST /v1/search`: search one to five sources, with the popularity cut (`remove_top_sites`, `only_top_sites`), domain lists, page types, topics, `safe_search` and `explain`. - `GET /v1/sources`: the sources, page types and topics. - `POST /v1/domain`: popularity and risk for up to 25 domains. - `POST /v1/keys/agent`: a trial key for an agent. - Error codes `SEARCH_UNAVAILABLE`, `CAPACITY`, `UNSUPPORTED_OPTION` and `ACCOUNT_NOT_ELIGIBLE`. - Credits: 1 credit is $0.001; a search costs 1 credit per source searched. Changed from earlier drafts of the API, for anyone who built against them: - `index_level` became `remove_top_sites`, which takes any number from 0 to 1,000,000. The old field still works. - The options that asked for page content, a generated answer, images and favicons in the response are gone: a search returns snippets. - `start_date`, `end_date`, `time_range`, `country` and `language` are accepted and ignored, with a warning. - `num_results` goes up to 50, not 100. ## MCP server - Hosted server over streamable HTTP with three read-only tools: `search`, `get_domain_info` and `list_sources`. - Works with an API key. A mode with no key, at smaller limits, is part of the server and is switched on separately; the [MCP page](https://millionshort.com/docs/mcp) says whether it is on. ## SDKs - Python and TypeScript clients with `search`, the sources list, domain info and the trial key. The packages are not published yet. - Error classes for `CAPACITY`, `SEARCH_UNAVAILABLE` and `UNSUPPORTED_OPTION`. ## Not in this version Extract, Monitor, Map, Crawl, Places, Spaces and Agent came later (above). See [the endpoints](https://millionshort.com/docs/endpoints). --- Source: https://millionshort.com/docs/glossary Section: Reference # Glossary Plain answers to the questions people ask about search APIs, retrieval for language models, and web data. Each entry opens with a short answer you can quote, then explains the idea, and ends by saying plainly where MillionShort fits and where it does not. ## Web search APIs - [Search API vs SERP API: what's the difference?](https://millionshort.com/docs/glossary/search-api-vs-serp-api): A search API queries an index and returns results made for programs, while a SERP API replays a search engine's results page as a person would see it. - [What is a SERP API?](https://millionshort.com/docs/glossary/what-is-a-serp-api): A SERP API fetches a search engine's results page and returns what it displays, such as rankings, ads and featured snippets, as structured JSON. - [What is a web search API?](https://millionshort.com/docs/glossary/what-is-a-web-search-api): A web search API lets software query an index of the web and get titles, URLs and text passages back as JSON instead of a results page made for people. - [What is agentic search?](https://millionshort.com/docs/glossary/what-is-agentic-search): Agentic search is web search run by an AI agent that chooses its own queries, reads the results and searches again until the task is done. - [What is an answer engine?](https://millionshort.com/docs/glossary/what-is-an-ai-answer-engine): An answer engine replies to a query with one written answer drawn from retrieved sources, where a search engine would return a list of links. - [What is an independent search index?](https://millionshort.com/docs/glossary/what-is-an-independent-search-index): An independent search index is one a provider builds and runs itself, so its results, prices and terms do not depend on another search engine. - [What is long-tail search?](https://millionshort.com/docs/glossary/what-is-long-tail-search): Long-tail search reaches the large part of the web below the most popular sites, usually by removing the top-N most popular sites from the results. - [What is search index freshness?](https://millionshort.com/docs/glossary/what-is-search-api-freshness): Search index freshness is the lag between a page being published or changed and that page, in its current form, being retrievable through a search API. ## RAG and grounding - [RAG vs fine-tuning: which do you need?](https://millionshort.com/docs/glossary/rag-vs-fine-tuning): Use RAG when a model needs current or private facts at answer time, and fine-tuning when it needs a new behavior, style or format. - [What are primary sources in RAG?](https://millionshort.com/docs/glossary/what-are-primary-sources-in-rag): Primary sources in RAG are the original documents where information first appeared, retrieved in place of the summaries and rewrites made from them. - [What is context engineering?](https://millionshort.com/docs/glossary/what-is-context-engineering): Context engineering is deciding what goes into a language model's context window, in what form and in what order, so that scarce tokens carry signal. - [What is LLM grounding?](https://millionshort.com/docs/glossary/what-is-llm-grounding): LLM grounding ties a model's output to verifiable outside information, such as retrieved documents, so that each claim can be traced to a source. - [What is llms.txt?](https://millionshort.com/docs/glossary/what-is-llms-txt): llms.txt is a proposed convention for a markdown file at a site's root that gives AI systems a short, curated map of the site's most useful content. - [What is RAG?](https://millionshort.com/docs/glossary/what-is-rag): RAG (retrieval-augmented generation) fetches relevant documents and hands them to a language model as context, so it answers from evidence. - [What is RAG noise?](https://millionshort.com/docs/glossary/what-is-rag-noise): RAG noise is the irrelevant, repeated or low-quality content that reaches a retrieval pipeline's context window and makes the answers worse. - [What is source diversity in RAG?](https://millionshort.com/docs/glossary/what-is-source-diversity): Source diversity in RAG means drawing evidence from many independent sites, publishers and document types, not several copies of the same popular pages. ## Web data APIs - [Scraping vs crawling: what's the difference?](https://millionshort.com/docs/glossary/scraping-vs-crawling): Scraping extracts content from pages whose URLs you already know, while crawling discovers pages by following links from a starting point. - [What is headless browser scraping?](https://millionshort.com/docs/glossary/what-is-a-headless-browser): Headless browser scraping loads a page in a real browser with no visible window, runs its JavaScript, and then extracts the rendered content. - [What is a web scraping API?](https://millionshort.com/docs/glossary/what-is-a-web-scraping-api): A web scraping API is a hosted service that fetches a webpage for you and returns its content as clean markdown, text or JSON in one HTTP call. - [What is a webset?](https://millionshort.com/docs/glossary/what-is-a-webset): A webset is a list of entities, such as companies, people or papers, built from web search and checked item by item against criteria you wrote. - [What is a website crawler?](https://millionshort.com/docs/glossary/what-is-a-website-crawler): A website crawler is a program that visits a site's pages by starting from a URL, downloading each page and following the links it finds. - [What is document parsing?](https://millionshort.com/docs/glossary/what-is-document-parsing): Document parsing converts files such as PDF, DOCX and XLSX into text or markdown a language model can read, keeping headings and tables intact. - [What is facet filtering?](https://millionshort.com/docs/glossary/what-is-facet-filtering): Facet filtering narrows a set of results by structured attributes such as category, domain or date, usually with a count shown for each value. - [What is HTML to markdown conversion?](https://millionshort.com/docs/glossary/what-is-html-to-markdown): HTML to markdown conversion turns a webpage's markup into plain text that keeps headings, lists, links and tables, and drops tags, scripts and layout. - [What is LLM-ready data?](https://millionshort.com/docs/glossary/what-is-llm-ready-data): LLM-ready data is web or document content cleaned of boilerplate and put in a consistent format, usually markdown or JSON, that a model can use directly. - [What is OCR?](https://millionshort.com/docs/glossary/what-is-ocr): OCR (optical character recognition) recognizes text in images such as scanned pages, photos and screenshots and turns it into machine-readable characters. - [What is robots.txt and how does it affect AI crawlers?](https://millionshort.com/docs/glossary/what-is-robots-txt): Robots.txt is a plain-text file at a site's root that tells crawlers, including AI crawlers, which paths they may visit, and following it is voluntary. - [What is structured data extraction?](https://millionshort.com/docs/glossary/what-is-structured-data-extraction): Structured data extraction pulls specific fields such as prices, names and dates out of webpages and returns them as machine-readable JSON. --- Source: https://millionshort.com/docs/glossary/rag-vs-fine-tuning Section: Reference # RAG vs fine-tuning: which do you need? Use RAG when a model needs current or private facts at answer time, and fine-tuning when it needs a new behavior, style or format. Use RAG when your model needs current or private facts at answer time. Use fine-tuning when it needs new behavior, style or format. RAG retrieves documents into the prompt, so knowledge updates as soon as the documents do and answers can cite sources. Fine-tuning retrains model weights, which changes how the model responds, not what it knows today. ## The one-line rule: knowledge vs behavior [RAG](https://millionshort.com/docs/glossary/what-is-rag) adds **knowledge**: documents fetched at request time and placed in the prompt. Fine-tuning adds **behavior**: additional training that adjusts the model's weights so it responds in a particular style, format or domain register. Most "should we fine-tune?" questions get easier once framed this way. If the failure is "the model does not know X", retrieval fixes it. If the failure is "the model knows X but answers in the wrong shape", tuning might. ## Where each one wins **RAG wins when:** - Facts change faster than you can retrain: news, prices, documentation, inventory. - You need **citations**. RAG can point at its evidence. A fine-tuned model cannot show which training example produced a claim. - Data is private or permissioned. Retrieval can respect access per user. Knowledge trained into weights cannot. - You need updates to take effect immediately, or you need to remove information. Reliably deleting one fact from trained weights is not practical. **Fine-tuning wins when:** - You need a consistent voice, a strict output format or domain-specific phrasing in every response. - You want to teach a skill or a classification pattern that examples in a prompt do not convey reliably. - You are optimizing latency and cost at scale: a tuned smaller model can replace long prompts of instructions and examples. ## Can you combine them? Yes, and mature systems often do: fine-tune for behavior (format, tone, tool-use patterns) and retrieve for facts. What fine-tuning is not is a substitute for retrieval. Facts added by tuning are expensive to refresh, cannot be cited, and may be blended with what the model already learned instead of being recalled exactly. ## Practical consequence Choosing RAG moves the hard work to retrieval quality. Your answers become only as good as the documents you fetch, so [grounding](https://millionshort.com/docs/glossary/what-is-llm-grounding) on clean, verifiable evidence can matter more than the choice of model. For pipelines that use the web as their knowledge source, that means a search API made for programs. The [RAG use case](https://millionshort.com/docs/use-cases/rag) and the [Search for RAG guide](https://millionshort.com/docs/search/guides/rag) show how MillionShort search fits that step: it returns ranked results with snippets and URLs, and your model writes the answer. ## Related terms - [What is RAG noise?](https://millionshort.com/docs/glossary/what-is-rag-noise) - [What is context engineering?](https://millionshort.com/docs/glossary/what-is-context-engineering) --- Source: https://millionshort.com/docs/glossary/scraping-vs-crawling Section: Reference # Scraping vs crawling: what's the difference? Scraping extracts content from pages whose URLs you already know, while crawling discovers pages by following links from a starting point. Scraping and crawling solve different problems: scraping extracts content from specific pages whose URLs you already know, while crawling discovers pages by starting from one URL and following links across a site. Crawlers find the pages and scrapers read them. Most real pipelines combine both: crawl a site to list its URLs, then scrape each page's content. ## Two different jobs The terms get used interchangeably, but they name different operations. **Scraping** is content extraction: given a URL, pull out the text, fields or data you care about. **Crawling** is discovery: given a starting point, find the URLs worth visiting by following links, sitemaps and navigation. A scraper answers "what does this page say?" A crawler answers "what pages exist?" Search engines show the split at the largest scale. A crawler discovers pages across the web, and a separate indexing pipeline extracts and processes the content of each one. ## When you want scraping Use scraping when you already have the URLs: - Extracting an article, product page or documentation page that a user or agent supplied - Enriching a list of known URLs, such as search results or citations to verify - Converting individual pages into markdown or JSON for a prompt or a document store ## When you want crawling Use crawling when the site itself is the unit of work: - Ingesting a whole documentation site or knowledge base for RAG - Mirroring a product catalog or blog where new pages appear over time - Building a corpus when you cannot list the URLs in advance Crawling is asynchronous by nature, since a site might be ten pages or ten thousand, so crawl services typically run as jobs that you submit and then poll. A [website crawler](https://millionshort.com/docs/glossary/what-is-a-website-crawler) also has obligations that a single-page fetch mostly does not: respecting [robots.txt](https://millionshort.com/docs/glossary/what-is-robots-txt), limiting its request rate per host, and deduplicating URLs. ## How they combine in practice Almost every "crawl a site" task is really crawl-then-scrape: the crawler walks the links while an extraction step converts each discovered page into clean content. Managed services often join the two. If you would rather keep them separate, pair a discovery pass with a [web scraping API](https://millionshort.com/docs/glossary/what-is-a-web-scraping-api) of your choice. There is a third way to find pages, which is to search for them. When you want pages about a subject rather than every page of one site, a [web search API](https://millionshort.com/docs/glossary/what-is-a-web-search-api) returns the URLs directly. ## Where MillionShort fits MillionShort does both jobs. A crawl of a site you name is [Crawl](https://millionshort.com/docs/crawl), with [Map](https://millionshort.com/docs/map) for a site's URLs, and reading a page you name is [Extract](https://millionshort.com/docs/extract), which turns one URL you already have into clean text. Search is the third way: a search returns URLs with snippets from our own index, and `include_domains` restricts a search to sites you list, which answers "which pages on these sites match this query?" but does not enumerate a site. --- Source: https://millionshort.com/docs/glossary/search-api-vs-serp-api Section: Reference # Search API vs SERP API: what's the difference? A search API queries an index and returns results made for programs, while a SERP API replays a search engine's results page as a person would see it. A search API queries an index directly and returns clean, ranked results built for machines to consume, while a SERP API scrapes or replays a search engine's human-facing results page, ads and all. For LLM and agent workloads, search APIs deliver leaner output that is ready to use. SERP APIs suit SEO rank tracking and results-page monitoring. ## What does each one actually return? | | Search API | SERP API | |---|---|---| | What is queried | An index the provider queries directly | A search engine's results page, loaded and parsed | | Output | Ranked results as JSON, with a text passage per result | Organic positions, ads, results-page features | | Built for | LLMs, agents, RAG, applications | SEO rank tracking, results-page monitoring | | Text per result | A snippet or passage, with some providers the full page | The short snippet the results page shows | | Position on a consumer search engine | Not available | The whole point | ## When is a SERP API the right choice? When the results page itself is your dataset. If you need to know where a page ranks on a consumer search engine for a keyword in a given city, which competitors are running ads, or which queries trigger a featured snippet, only a [SERP API](https://millionshort.com/docs/glossary/what-is-a-serp-api) can tell you. A search API has no concept of another engine's positions or ad slots. SEO platforms, ad-intelligence tools and marketplace monitors are SERP API territory. ## When is a search API the right choice? When you need information, not rankings. A [web search API](https://millionshort.com/docs/glossary/what-is-a-web-search-api) returns results a program can use immediately: structured JSON, a score, filters you can set per request, and a passage of text from each page. There is no results page to parse and no ad block to strip out. For the request and response shape of one such API, see the MillionShort [search reference](https://millionshort.com/docs/search/parameters). ## Why does the distinction matter for LLMs? Token cost and grounding quality. Piping SERP JSON into a prompt spends context on ads, sitelinks and position metadata that the model ignores, and results-page snippets are a line or two, usually too thin to ground an answer. A search API can return a longer passage per result and nothing else, which makes each agent tool call cheaper to read. How current the results are matters too. See [search index freshness](https://millionshort.com/docs/glossary/what-is-search-api-freshness). ## Where MillionShort fits MillionShort is a search API, not a SERP API. It searches our own independent index and returns one ranked list with a snippet of up to 2,000 characters per result. With `include_content`, `web` and `news` results also carry the text of the page as we hold it. It does not report positions on any other search engine. --- Source: https://millionshort.com/docs/glossary/what-are-primary-sources-in-rag Section: Reference # What are primary sources in RAG? Primary sources in RAG are the original documents where information first appeared, retrieved in place of the summaries and rewrites made from them. Primary sources in RAG are the original documents where information first appeared: research papers, official documentation, standards, filings, datasets and firsthand reports. Retrieving them instead of secondary summaries or aggregator rewrites gives a language model cleaner evidence, fewer copy-of-a-copy errors, and citations that end users can trust and verify. ## Primary vs secondary sources: what's the difference? A primary source is the document that said it first: the peer-reviewed paper, the vendor's own changelog, the court filing, the standards document, the earnings report, the maintainer's post announcing the change. A secondary source describes, summarizes or reacts to a primary one: news coverage of the paper, a listicle about the release, a forum thread paraphrasing the documentation. Secondary sources are not worthless. They add interpretation and make hard material accessible. The problem is degree. On the open web one primary document often spawns many secondary rewrites, each a lossy copy competing to outrank the original. ## Why do primary sources matter for RAG quality? - **Accuracy.** Every rewrite is a chance to drop a caveat, garble a number or flatten nuance. Grounding on the original removes the telephone game. - **Citations users trust.** "According to the regulator's filing" carries more weight, and survives scrutiny better, than "according to a blog post about the filing". For [grounded systems](https://millionshort.com/docs/glossary/what-is-llm-grounding), citation quality is product quality. - **Less redundancy.** Secondary accounts of the same story are near-duplicates of each other, so retrieving three adds little beyond retrieving one. Separate primary documents are usually distinct, which helps [source diversity](https://millionshort.com/docs/glossary/what-is-source-diversity). - **Detail.** Summaries leave out the tables, parameters and edge cases that agents often need. ## Why is retrieving them hard? Search rankings lean on popularity signals, and secondary coverage is often written to win those signals. The original paper can sit below a dozen articles about the paper, so a naive top-10 retrieval fills the context window with [noise](https://millionshort.com/docs/glossary/what-is-rag-noise) before it reaches the source. Practical fixes include boosting authoritative domains, removing duplicate rewrites, searching collections that hold primary material directly, and filtering the most popular, most heavily optimized sites out of the results, which is the approach behind [long-tail search](https://millionshort.com/docs/glossary/what-is-long-tail-search). ## Where MillionShort fits Several MillionShort controls are aimed at this problem: - [`remove_top_sites`](https://millionshort.com/docs/search/remove-top-sites) removes results from the N most popular sites, so less-visited originals can rank. - [Lenses](https://millionshort.com/docs/search/lenses): `boost_domains` moves sites you trust up, `bury_domains` moves others down, and `include_domains` restricts the search to a list. - [Sources](https://millionshort.com/docs/search/sources) such as `academic`, `medical`, `law` (United States), `finance` and `contracts` search specialist material directly, next to `web` in the same call. None of these labels a result as primary or secondary. That judgment stays with you or your model. Results come as snippets; `include_content` adds the page text we hold to `web` and `news` results, not to the specialist sources. [Primary-source research](https://millionshort.com/docs/use-cases/primary-source-research) walks through the use case. ## Related terms - [What is RAG?](https://millionshort.com/docs/glossary/what-is-rag) - [What is RAG noise?](https://millionshort.com/docs/glossary/what-is-rag-noise) --- Source: https://millionshort.com/docs/glossary/what-is-a-headless-browser Section: Reference # What is headless browser scraping? Headless browser scraping loads a page in a real browser with no visible window, runs its JavaScript, and then extracts the rendered content. Headless browser scraping uses a real web browser running without a visible window, controlled by a program through a browser automation library, to load a page, execute its JavaScript, and then extract the fully rendered content. It is needed for sites that build their pages in the browser, where a plain HTTP request returns an empty shell. ## Why a plain HTTP request sometimes isn't enough A simple scraper sends an HTTP GET and parses the HTML that comes back. That works for pages rendered on the server. But many modern sites are single-page applications: they send a nearly empty HTML document plus a bundle of JavaScript, and the content only exists after that JavaScript runs. Fetch such a page without a browser and you get an empty container element and a loading indicator. A headless browser closes that gap. It is a full browser engine that runs without drawing to a screen, driven by an automation protocol. It executes scripts, makes the page's own API calls, waits for content to appear, and can click, scroll and fill in forms. Everything a person's browser does, it does under program control. ## The trade-offs Rendering is powerful but expensive, which is why it is not the default everywhere: - **Speed.** A rendered fetch often takes seconds where a plain request takes a fraction of a second. - **Cost.** Each browser instance uses real CPU and memory, and many of them need orchestration. - **Fragility.** Timing problems, such as content that loads after your extraction runs, are a constant source of flaky results. - **Access.** Some sites detect automated browsers and refuse them. A site's terms and its [robots.txt](https://millionshort.com/docs/glossary/what-is-robots-txt) still apply to a browser that a program drives. The usual engineering answer is selective rendering: try the cheap static fetch first, and fall back to a browser only when the page needs it. ## Headless browsers in AI data pipelines For LLM workloads, rendering is a means and not the end. The rendered page still has to be cleaned and converted before a model can use it, as covered in [what a web scraping API does](https://millionshort.com/docs/glossary/what-is-a-web-scraping-api) and [HTML to markdown conversion](https://millionshort.com/docs/glossary/what-is-html-to-markdown). Managed extraction services bundle the whole chain, so that rendering becomes an option on a request instead of infrastructure you run. Many questions do not need a browser at all. If what you need is to find pages and read a passage from each, a [web search API](https://millionshort.com/docs/glossary/what-is-a-web-search-api) answers from an index that was built ahead of time. ## Where MillionShort fits MillionShort does not offer a headless browser or browser automation. A search returns results with text snippets, and your code never loads a page. When you need one page's text, [Extract](https://millionshort.com/docs/extract/parameters) turns a URL into clean text; its `rendered` mode loads the page in a browser first, so content built by scripts appears. --- Source: https://millionshort.com/docs/glossary/what-is-a-serp-api Section: Reference # What is a SERP API? A SERP API fetches a search engine's results page and returns what it displays, such as rankings, ads and featured snippets, as structured JSON. A SERP API is a service that programmatically fetches search engine results pages (SERPs) and returns them as structured JSON. It captures what a search engine displays: organic rankings, ads, featured snippets and related questions. SERP APIs are built mainly for SEO tracking rather than for feeding content to LLMs. ## How does a SERP API work? A SERP API submits your query to a search engine, loads the results page as a searcher in a given place and on a given device would see it, and parses that page into JSON fields: organic positions, paid ads, featured snippets, related-question boxes, local results, shopping carousels. Many also cover video sites, marketplaces and app stores. The output is a machine-readable replica of the results page, position numbers included. That is the raw material SEO teams work with. ## What are SERP APIs used for? - **Rank tracking.** Where a site appears for a keyword, by location and device. - **Competitor and ad monitoring.** Who is bidding on what, and how listings are worded. - **Results-page feature research.** Which queries trigger snippets, video packs or AI summaries. - **Marketplace monitoring.** Prices and placements on shopping sites. For all of these the results page itself is the dataset, and a SERP API is the right tool. ## Why does this matter for LLMs and agents? A results page is designed for people, so SERP output carries plenty that a model does not need, such as ads, position metadata and layout features, while leaving out what it usually does need: enough of the text behind each link to answer from. To ground an LLM you would still have to fetch and clean the result URLs yourself, which adds latency, fetching infrastructure and tokens. That is why LLM and agent stacks usually reach for a [web search API](https://millionshort.com/docs/glossary/what-is-a-web-search-api) instead. It queries an index directly and returns a passage of text with each result. Unsure which one your project needs? [Search API vs SERP API](https://millionshort.com/docs/glossary/search-api-vs-serp-api) compares them point by point. ## Where MillionShort fits MillionShort is not a SERP API. It cannot tell you where a page ranks on another search engine, and it shows no ads or results-page features. It is a search API on our own independent index: one call to [`POST /v1/search`](https://millionshort.com/docs/search/parameters) returns a ranked list with a snippet per result. --- Source: https://millionshort.com/docs/glossary/what-is-a-web-scraping-api Section: Reference # What is a web scraping API? A web scraping API is a hosted service that fetches a webpage for you and returns its content as clean markdown, text or JSON in one HTTP call. A web scraping API is a hosted service that fetches webpages and returns their content in a usable format, typically clean markdown, text or structured JSON, through a single HTTP call. It handles the hard parts of scraping for you, such as JavaScript rendering, retries and content cleanup, so you write no browser or parsing code. ## What a web scraping API actually does When you call a web scraping API, you send it a URL and it sends back the page's content. Behind that one call, the service fetches the page, rendering JavaScript when needed, strips away navigation and boilerplate, and converts what remains into the format you asked for. The alternative is to run your own browsers and maintain your own parsers for each site, which is a well-known drain on engineering time. That is why scraping APIs exist as a category. ## Scraping API vs building your own scraper A scraper you build starts simple: an HTTP request and an HTML parser. It stops being simple the first time a site needs JavaScript to render, changes its markup, or limits your request rate. A scraping API spreads those problems across all its customers: - **Rendering.** A managed [headless browser](https://millionshort.com/docs/glossary/what-is-a-headless-browser) executes JavaScript when a page needs it. - **Reliability.** Retries, timeouts and failed fetches are the provider's problem. - **Cleanup.** Main-content detection removes ads, menus and footers before you see the page. - **Consistency.** Every site comes back in the same shape, so your code has one path. Using a service does not change what you are allowed to fetch. A site's terms and its [robots.txt](https://millionshort.com/docs/glossary/what-is-robots-txt) apply whoever sends the request. ## What changed with LLMs Earlier scraping APIs were built for price monitoring and data teams, and returned raw HTML or fields picked out with CSS selectors. AI workloads changed the usual output: agents and RAG pipelines want [LLM-ready data](https://millionshort.com/docs/glossary/what-is-llm-ready-data), which means markdown for prose and JSON when you need specific fields. Many current services return markdown by default and offer [structured data extraction](https://millionshort.com/docs/glossary/what-is-structured-data-extraction) against a schema. ## Scraping one page vs many A scraping API works on URLs you already know. When you want every page on a site, such as documentation, a knowledge base or a product catalog, you need crawling, which discovers pages by following links. The two are often confused. [Scraping vs crawling](https://millionshort.com/docs/glossary/scraping-vs-crawling) covers the difference and when each applies. ## Where MillionShort fits MillionShort search is not a scraping API. A search finds pages in our own index and returns a snippet of up to 2,000 characters from each. It does not fetch an arbitrary URL. With `include_content`, `web` and `news` results also carry the text of the page as we hold it, with no request to the site. For many agent questions that is enough, and no page fetch is needed. When you need the page itself, [Extract](https://millionshort.com/docs/extract/parameters) is the scraping side: it turns a URL into clean text, honours robots.txt and charges only for pages that succeed. --- Source: https://millionshort.com/docs/glossary/what-is-a-web-search-api Section: Reference # What is a web search API? A web search API lets software query an index of the web and get titles, URLs and text passages back as JSON instead of a results page made for people. A web search API is a programmatic interface that lets software query an index of the web and get structured results, such as titles, URLs, snippets and sometimes full page content, as JSON instead of a human-facing results page. Developers use them to give LLMs, agents and applications access to current web information. ## How does a web search API work? You send an HTTP request containing a query, plus options such as the number of results or a list of domains to include or exclude. The service searches its index and returns ranked results as JSON. Each result typically carries a title, a URL, a score and a snippet, ready to parse or to place in a prompt. Some providers return the full page text, and some add a short generated answer next to the results. ## Why do web search APIs matter for LLMs and agents? A language model is frozen at its training cutoff, and a web search API is the standard way around that. At query time your application retrieves pages and grounds the model's answer in them. This is the pattern behind [retrieval-augmented generation](https://millionshort.com/docs/glossary/what-is-rag). For autonomous agents the search API becomes a tool the model calls repeatedly in a loop (see [agentic search](https://millionshort.com/docs/glossary/what-is-agentic-search)), which raises the bar on output: agents need structured results that are cheap in tokens, not HTML built for human eyes. ## What should you look for when choosing one? - **Output format.** JSON with a usable passage of text per result saves you a fetch for many questions. - **Freshness.** How quickly new pages become retrievable. See [search index freshness](https://millionshort.com/docs/glossary/what-is-search-api-freshness). - **Filtering.** Which controls exist for scoping retrieval: domains, page types, topics, dates, language, country. Providers differ, so check the ones you need. - **Ranking control.** Whether you can steer results away from the same heavily optimized, popular domains. - **Cost transparency.** Metered pricing per call that you can budget against. - **Who runs the index.** Whether the provider builds and runs its own. See [independent search index](https://millionshort.com/docs/glossary/what-is-an-independent-search-index). One common confusion: a web search API is not a SERP API, which replays a search engine's human-facing results page for SEO tooling. The difference has [its own entry](https://millionshort.com/docs/glossary/search-api-vs-serp-api). ## Where MillionShort fits MillionShort is a web search API on our own independent index. One call to [`POST /v1/search`](https://millionshort.com/docs/search/parameters) searches 1 to 5 of 13 [sources](https://millionshort.com/docs/search/sources) and returns one merged, ranked list. Each result has a snippet of up to 2,000 characters, a popularity signal and a risk signal. You can remove the most popular sites with [`remove_top_sites`](https://millionshort.com/docs/search/remove-top-sites) and set domain rules with [lenses](https://millionshort.com/docs/search/lenses). What it does not do: it writes no generated answer. It does not fetch a page at request time: with `include_content`, `web` and `news` results carry the page text as we hold it. Web pages carry no date, so a date filter is not applied to `web`. Retrieval is keyword-based. The [quickstart](https://millionshort.com/docs/quickstart) shows a first call. --- Source: https://millionshort.com/docs/glossary/what-is-a-webset Section: Reference # What is a webset? A webset is a list of entities, such as companies, people or papers, built from web search and checked item by item against criteria you wrote. A webset is a verified, enriched list of entities, such as companies, people, papers or products, built programmatically from web search. Instead of returning links, a websets service evaluates each candidate against your written criteria, keeps only the matches it could verify, adds data columns generated by a language model, and can refresh the finished list on a schedule. ## Where does the term come from? "Websets" is the name Exa gave to its query-to-dataset product, and the word is now also used loosely for the general idea: building a verified list of entities from the web. Other tools that do something similar use their own names. ## How is a webset different from search results? A search API answers "which pages match this query?" You get ranked links and snippets, and turning them into a dataset is your job. A webset answers "which entities satisfy these criteria?" The system searches, resolves pages into entities, evaluates every candidate against each criterion you wrote, removes duplicates, and stores the survivors as structured rows. The output is a table you can filter and sort, not a page of links you still have to read. ## What does a webset contain? A few working parts recur: - **Items.** The verified entities, each with its source URL and the result of the check against each criterion. - **Enrichments.** Columns generated by a language model for every item, such as "number of employees" or "lead product". - **Monitors.** Scheduled jobs that add newly found entities or refresh existing ones, so the list stays true after the week it was built. The structured attributes also serve as facets. See [facet filtering](https://millionshort.com/docs/glossary/what-is-facet-filtering) for how a finished set gets queried. ## Why do websets matter for AI teams? They collapse a research workflow (search, open tabs, judge, copy into a spreadsheet, repeat) into one asynchronous job with a record of why each row is there. The checks and the enrichments are made by a language model, so they can be wrong, and the record is what lets you audit them. Quality also depends on discovery: a list built only from the most popular, most heavily optimized sites misses the regional firms and primary sources that make a list valuable. That is the gap [long-tail search](https://millionshort.com/docs/glossary/what-is-long-tail-search) addresses. ## Where MillionShort fits MillionShort does not offer websets, collections, list building or enrichment. It is the search step underneath such a workflow. `POST /v1/search` returns pages, not entities, and an agent of your own has to do the verifying and the tabulating. What it does offer for discovery: `remove_top_sites` to reach past the most popular sites, 13 [sources](https://millionshort.com/docs/search/sources) to search beyond the web, and a hosted [MCP server](https://millionshort.com/docs/mcp) so that an agent can run the searches itself. [Research agents](https://millionshort.com/docs/use-cases/research-agents) describes that pattern. --- Source: https://millionshort.com/docs/glossary/what-is-a-website-crawler Section: Reference # What is a website crawler? A website crawler is a program that visits a site's pages by starting from a URL, downloading each page and following the links it finds. A website crawler is a program that systematically visits a site's pages by starting from a URL, downloading each page, and following the links it finds to discover more pages. Crawlers feed search engine indexes and site audits, and increasingly AI pipelines that need a whole site's content converted into a form a language model can read. ## How a crawler works Every crawler runs the same loop. It begins with one or more seed URLs, fetches each page, parses out the links, adds new URLs to a queue (the "frontier"), and repeats until it reaches a stopping condition: a page limit, a depth limit or an empty frontier. Along the way it deduplicates URLs, stays within the domain or path it was scoped to, and stores what it fetched. The classic example is a search engine's crawler, which revisits the web again and again to keep an index current. But crawlers are just as common at small scale: an SEO tool auditing one site, an archiver mirroring a blog, or an AI pipeline ingesting a documentation site. ## The rules well-behaved crawlers follow Crawling uses someone else's servers, so good conduct is part of the definition: - **robots.txt.** The Robots Exclusion Protocol tells crawlers which paths a site does or does not want visited. See [what robots.txt is and how it affects AI crawlers](https://millionshort.com/docs/glossary/what-is-robots-txt). - **Rate limiting.** Polite crawlers space out their requests to each host. - **Identification.** A crawler declares itself with a recognizable user-agent string. - **Scope discipline.** Depth limits, path filters and page caps keep a crawl from wandering across the whole web. ## Crawlers and LLM pipelines Crawling has found a second use with AI. RAG systems need whole knowledge bases and documentation sites ingested, not single pages, and agents ask for "everything on this site" as a routine operation. That changed what the output should look like: each page needs the same cleanup a scraper applies, because the reader is a model and not an indexer. The crawl discovers and extraction converts. The [scraping vs crawling](https://millionshort.com/docs/glossary/scraping-vs-crawling) entry explains that division of labor. Because the size of a crawl is unknown in advance, crawl services typically run asynchronously: submit a job, poll or receive a webhook, then page through the results. ## Where MillionShort fits MillionShort crawls a site you name with [Crawl](https://millionshort.com/docs/crawl): a job that follows the site's sitemap and links within robots.txt and returns its pages as clean text. [Map](https://millionshort.com/docs/map) lists the URLs of a site in one call. Search is the result of that kind of work, made searchable: a search API on our own independent index. If your goal is "find the pages on these sites about this subject", a search with `include_domains` does that in one call and returns a snippet per page. If your goal is "give me every page of this site", use Crawl. For one URL at a time, use [Extract](https://millionshort.com/docs/extract/parameters). --- Source: https://millionshort.com/docs/glossary/what-is-agentic-search Section: Reference # What is agentic search? Agentic search is web search run by an AI agent that chooses its own queries, reads the results and searches again until the task is done. Agentic search is web search performed by an AI agent rather than a person: the agent decides what to query, runs searches through an API, evaluates the results, and iterates, reformulating queries or reading more of a source, until it has what it needs to complete a task. It turns search from a single lookup into a research loop. ## How is agentic search different from a person searching? A person runs one query, scans a results page and clicks. An agent runs a loop: plan what information the task needs, issue a query through a search tool, read the structured results, judge whether they answer the question, then refine with a narrower query, different phrasing or a domain filter, and repeat. A single task can trigger several searches, sometimes dozens. The agent never sees a results page. It consumes JSON, which is why agentic search is usually built on [web search APIs](https://millionshort.com/docs/glossary/what-is-a-web-search-api) rather than on browser automation. ## What does an agent need from a search API? The loop changes the requirements: - **Structured results with usable text.** Every extra fetch-and-clean step is another tool call, more latency and another thing that can fail. - **Token efficiency.** Results land in a finite context window, and the loop multiplies whatever each call costs. - **Filters the model can reason with.** Domain include and exclude lists, source choices and result counts let the agent narrow on purpose instead of asking again blindly. - **Predictable, metered cost.** Ten calls per task make the price per call a design constraint. - **Freshness.** Agents are often deployed because the answer changes over time. See [search index freshness](https://millionshort.com/docs/glossary/what-is-search-api-freshness). ## Why does agentic search matter? Because an agent's ceiling is its retrieval. The model can only reason over what search returns, so a search layer that surfaces the same heavily optimized, popular domains on every query caps answer quality, and a noisy result set wastes loop iterations. Deep-research agents and [answer engines](https://millionshort.com/docs/glossary/what-is-an-ai-answer-engine) are the clearest examples: their output is only as good as their queries and sources. ## Where MillionShort fits MillionShort is made for this loop. An agent can call [`POST /v1/search`](https://millionshort.com/docs/search/parameters) directly, or connect to the hosted [MCP server](https://millionshort.com/docs/mcp), which has `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints. One call can search up to 5 of 13 sources and returns one ranked list. `remove_top_sites` and domain rules let the agent change what it sees between iterations, and each result carries popularity and risk signals it can weigh. Every response states what the call cost. The limits are worth knowing before you design the loop. Retrieval is keyword-based, so an agent does better with the words a page would use than with a long question. Web pages carry no date, so a date filter works on the dated sources and is not applied to `web`. Page text (`include_content`) is our stored copy of `web` and `news` pages, not a live fetch. [Agent tool use](https://millionshort.com/docs/search/guides/agent-tool-use) covers the practical side, and [research agents](https://millionshort.com/docs/use-cases/research-agents) the use case. --- Source: https://millionshort.com/docs/glossary/what-is-an-ai-answer-engine Section: Reference # What is an answer engine? An answer engine replies to a query with one written answer drawn from retrieved sources, where a search engine would return a list of links. An answer engine is a system that responds to a query with a direct, synthesized answer instead of a list of links. AI answer engines, such as chat assistants with web access and the AI summaries on search results pages, combine large language models with web retrieval, so the answer is generated from retrieved sources and usually cites them. ## How does an answer engine work? Most answer engines run a pipeline in four stages: 1. **Query understanding.** The user's question is interpreted and often rewritten into one or more search queries. 2. **Retrieval.** Those queries run against a web index and return candidate pages. 3. **Generation.** A language model reads the retrieved content and composes a direct answer from it. 4. **Citation.** The answer links back to the sources it drew from, so claims can be checked. The retrieval step is what separates an answer engine from a bare chatbot. Without it, the model can only answer from its training data, which stops at a cutoff date. ## How is that different from a search engine? A search engine's product is a ranked list. The user does the reading, judging and synthesizing. An answer engine does that work itself and returns a conclusion. That changes what ranking means: instead of competing for the first position, sources compete to be retrieved and cited inside the answer. It also means fewer readers click through to the sites underneath. ## Why does this matter for LLM and agent builders? Two reasons. First, you can build one. An answer engine is essentially a [RAG](https://millionshort.com/docs/glossary/what-is-rag) pipeline pointed at the web, and its answer quality is capped by its retrieval quality: poor sources in, confident and poor answers out. Grounding on varied, [primary sources](https://millionshort.com/docs/glossary/what-are-primary-sources-in-rag) is one of the most effective improvements available. Second, agents increasingly act as their own answer engines, running retrieval loops on their own. That pattern is covered under [agentic search](https://millionshort.com/docs/glossary/what-is-agentic-search). Answer quality also depends on how current the index is. [Search index freshness](https://millionshort.com/docs/glossary/what-is-search-api-freshness) explains why. For the retrieval layer itself, start with [what a web search API is](https://millionshort.com/docs/glossary/what-is-a-web-search-api). ## Where MillionShort fits A MillionShort search is not an answer engine. It does not generate an answer: it returns ranked results with snippets, and your model writes the answer from them. In the four stages above it is the retrieval step. [Agent](https://millionshort.com/docs/agent) is the endpoint that returns a written answer, with a checked quote for every statement; see [the endpoints](https://millionshort.com/docs/endpoints). If you are building an answer engine, [Search for RAG](https://millionshort.com/docs/search/guides/rag) shows how to pass results to a model with their URLs kept for citation. --- Source: https://millionshort.com/docs/glossary/what-is-an-independent-search-index Section: Reference # What is an independent search index? An independent search index is one a provider builds and runs itself, so its results, prices and terms do not depend on another search engine. An independent search index is a searchable database of web pages that a provider builds and maintains itself instead of passing on a large search engine's results. Independence removes dependence on another company's pricing, terms and shutdown risk, which the retirement of Microsoft's Bing Search APIs in August 2025 showed to be real, and it allows ranking choices the large engines do not offer. ## What counts as independent? An independent provider builds and runs its own index and its own ranking, instead of passing on another engine's results. In practice the market is a spectrum. Some providers do all of it themselves. Some take results under licence from one or more large engines and add their own ranking or filtering. Some simply pass a large engine's API through, which is the thinnest and most fragile position. ## Why did independence start to matter? For years many search APIs passed on the same large engine's results. When Microsoft retired its Bing Search APIs, products built on that supply had to migrate on Microsoft's timeline. That turned index independence from an architectural footnote into a buying question: who controls the index my product depends on, and what happens if they change the price or close the door? ## What are the honest trade-offs? Independence is not automatically better. An independent index is usually smaller than the largest consumer engines' indexes, may revisit pages less often, and its ranking has had less tuning on real traffic. For some queries a large engine's result set is simply stronger. The reasonable question is not only "independent or not?" but also "what does this provider let me do that the large engines do not?" ## Why does it matter for LLMs and agents? Retrieval monoculture. If every RAG pipeline and agent retrieves from the same engine, everyone grounds on the same heavily optimized, popular part of the web, and answers converge on the same sources. Independent and differently ranked indexes widen what models can cite, which is the point of [long-tail search](https://millionshort.com/docs/glossary/what-is-long-tail-search) and of [source diversity](https://millionshort.com/docs/glossary/what-is-source-diversity). How an index is built also decides how current its results are. See [search index freshness](https://millionshort.com/docs/glossary/what-is-search-api-freshness). ## Where MillionShort fits MillionShort runs on our own independent index. That is what makes controls such as [`remove_top_sites`](https://millionshort.com/docs/search/remove-top-sites) possible: removing the N most popular sites and letting the rest of the web fill the list is something only the owner of an index can offer. The trade-offs above apply to us too. The web source is refreshed periodically, not continuously, and web results carry no date. For recent material, add the `news`, `social` or `hn` source to the same call. [Freshness](https://millionshort.com/docs/search/freshness) says more. --- Source: https://millionshort.com/docs/glossary/what-is-context-engineering Section: Reference # What is context engineering? Context engineering is deciding what goes into a language model's context window, in what form and in what order, so that scarce tokens carry signal. Context engineering is the practice of deciding what information goes into a language model's context window, in what form and in what order: retrieved documents, tool results, instructions and history. Because context is finite and every token costs money and attention, the discipline focuses on selecting high-signal content and cutting noise. ## How is context engineering different from prompt engineering? Prompt engineering is about wording: phrasing instructions so the model behaves. Context engineering is about curation: assembling everything else in the window. Which documents get retrieved, how they are trimmed, which tool outputs are kept, how much conversation history survives, and what gets summarized instead of quoted. As models improved, clever phrasing mattered less and the quality of the supplied material mattered more. In agentic and [RAG](https://millionshort.com/docs/glossary/what-is-rag) systems, much of the engineering effort now goes into assembling context. ## Why does it matter? Three constraints make the context window a scarce resource: - **It is finite.** Even large windows fill quickly once you add system instructions, tool definitions, history and retrieved pages. - **Attention degrades.** Models tend to use a small, relevant context better than a large, padded one, and a key passage buried under filler is easier to miss. - **Tokens are money and latency.** Every token is paid for on every call, so junk context is a recurring cost. The upshot: adding more context is not free and is often not even helpful. The job is to maximize signal per token. ## What are the core techniques? - **Selection.** Retrieve fewer, better documents. Rerank. Remove near-copies before they reach the prompt. - **Compression.** Strip boilerplate, summarize long documents, and keep quotes only where the wording matters. - **Ordering.** Put critical evidence where it is least likely to be overlooked, commonly near the start or the end of the window, and group related material. - **Budgeting.** Give each component (instructions, history, retrieval, tool output) an explicit token allowance and enforce it. - **Isolation.** In agent systems, keep the context of a sub-task in a sub-agent and pass back conclusions, not transcripts. ## Where do most context budgets leak? Retrieval. A single noisy web fetch can put thousands of tokens of navigation, filler and duplicated rewrites into the window. This failure mode is called [RAG noise](https://millionshort.com/docs/glossary/what-is-rag-noise). That is why context engineering starts at the retrieval layer, before any trimming: cleaner, deduplicated sources shrink the problem at its origin. ## Where MillionShort fits MillionShort search gives you a few direct levers on the retrieval budget. `max_chars_per_result` sets the longest snippet (up to 2,000 characters, 800 by default), and `num_results` sets the length of the one merged list. Duplicates across sources are removed before the list is returned. `remove_top_sites` and domain rules change which sites can appear at all. See [low-noise RAG](https://millionshort.com/docs/use-cases/low-noise-rag) for how these combine. ## Related terms - [What is LLM grounding?](https://millionshort.com/docs/glossary/what-is-llm-grounding) - [What is source diversity in RAG?](https://millionshort.com/docs/glossary/what-is-source-diversity) --- Source: https://millionshort.com/docs/glossary/what-is-document-parsing Section: Reference # What is document parsing? Document parsing converts files such as PDF, DOCX and XLSX into text or markdown a language model can read, keeping headings and tables intact. Document parsing converts structured or binary document formats, such as PDF, DOCX, XLSX, PPTX and CSV, into machine-usable text or markdown, preserving structure like headings and tables. LLM pipelines depend on it because models consume plain text, not binary files: parsing turns a report or spreadsheet into content a context window can read. ## Why LLM pipelines need document parsing A lot of the web's substantive content does not live in HTML. Research papers, financial filings, government reports, product specification sheets and datasets are published as PDFs, word-processor documents, spreadsheets and slide decks. To a text-only pipeline those files are opaque: a PDF mostly describes where glyphs sit on a page, and an XLSX file is a zipped bundle of XML. Document parsing is the decoding step in between. A parser opens the file format, extracts the text, and rebuilds the document's logical structure (heading levels, paragraphs, lists and tables) as markdown or plain text. Keeping structure is what separates a good parser from a raw text dump: a financial table flattened into one stream of words loses the row and column relationships a model needs to answer questions about it. Structured, compact output is the document-side counterpart of [LLM-ready data](https://millionshort.com/docs/glossary/what-is-llm-ready-data) for webpages. ## Document parsing vs web scraping The two are often bundled but do different jobs. Web scraping is about fetching: retrieving a page over HTTP, rendering JavaScript if needed, and isolating the main content (see [what a web scraping API does](https://millionshort.com/docs/glossary/what-is-a-web-scraping-api)). Document parsing is about decoding a format: taking a file that the fetch already returned and translating its internal format into text. For HTML pages the decoding step is [HTML to markdown conversion](https://millionshort.com/docs/glossary/what-is-html-to-markdown). For a PDF or DOCX it is a parser for that format. A pipeline that fetches URLs but cannot parse documents silently drops every PDF link it meets, and in research-heavy work those are often the primary sources. ## Document parsing vs OCR Document parsing reads the digital structure of a file. A PDF exported from software carries an embedded text layer, and a DOCX carries its text as XML, so a parser can read the characters directly. Reading order and tables in a PDF can still come out wrong, because the format records positions, not structure. [OCR (optical character recognition)](https://millionshort.com/docs/glossary/what-is-ocr) solves a different problem: recognizing text in images, such as scanned pages, photos and screenshots, where no text layer exists. A scanned PDF looks like a PDF but is really a stack of pictures. Parsing alone gets nothing out of it, and it needs OCR. ## Where MillionShort fits MillionShort does not offer document parsing. You cannot send it a PDF or a spreadsheet to convert, and search results are snippets, not parsed documents. What is related: several of the 13 [sources](https://millionshort.com/docs/search/sources), such as `academic`, `medical`, `law` (United States), `finance` and `contracts`, search material that is commonly published as documents, and return a snippet and a URL for each result like any other source. [Extract](https://millionshort.com/docs/extract/parameters) turns a URL into clean text; its page says which kinds of page it reads. --- Source: https://millionshort.com/docs/glossary/what-is-facet-filtering Section: Reference # What is facet filtering? Facet filtering narrows a set of results by structured attributes such as category, domain or date, usually with a count shown for each value. Facet filtering narrows a result set by structured attributes, called facets, such as category, size, domain or date, usually paired with counts per value so you can see the shape of the data before drilling in. The sidebar of an online shop is the classic example. Data APIs expose the same idea as filter expressions over stored attributes. ## How does facet filtering work? Each record carries a set of structured attributes, its facets, which are computed and stored when the record is written, not worked out at query time. Filtering is then a matter of simple conditions on those attributes: equality, ranges, membership of a set, combined with AND. Because the values are stored in advance, two things stay cheap: applying the filter, and counting how many matching records have each facet value. Those counts, sometimes called a facet summary, are what turn filtering into navigation. You can see how the filtered set divides, by top-level domain or by category for example, before you narrow further. ## Facet filtering vs full-text search Full-text search ranks records by relevance to a free-text query. Facet filtering partitions records by exact structured values. They work together and do not compete: search produces the candidate set, and facets slice it. The difference matters when designing an API. A relevance score cannot express "only companies with at least 500 employees", and a facet filter cannot tell you which page answers a question most directly. ## Why does it matter for AI and web-data APIs? Agents and pipelines increasingly work with datasets built from the web (see [what a webset is](https://millionshort.com/docs/glossary/what-is-a-webset)), and a list of several thousand rows is only useful if it can be queried. Facet filtering gives an agent a cheap, deterministic way to slice a dataset instead of running discovery again, and the counts let it inspect the distribution before choosing a slice. A deterministic filter over stored values is also more dependable than asking a model to filter prose, where it may skip or invent rows. ## How do APIs expose facet filtering? Typically as filter parameters or a filter expression over named facets, plus a sort parameter, with counts per value in the response. In a search API the facets are usually attributes of the page or the site: its domain, its type, its topic, its language, its date. ## Where MillionShort fits MillionShort has filters on structured attributes, and no facet counts. On a search request you can filter by `page_types` and `topics` (the slugs come from `GET /v1/sources`), by site with `include_domains` and `exclude_domains`, by popularity with `remove_top_sites`, `only_top_sites` and `popularity_buckets`, by date, language and country on the sources that carry them, and by `safe_search`. Every result then carries the attributes themselves: `source`, `page_type`, `topic`, `popularity` and `risk`, so your code can group or filter the list further. The filters are described under [lenses](https://millionshort.com/docs/search/lenses) and in the [search reference](https://millionshort.com/docs/search/parameters). What it does not have: counts per facet value or a filter expression language. Web pages carry no date, so a date filter is not applied to `web`. `summary.removed` counts results that were removed and why, which is a different thing from a facet summary. MillionShort does not offer stored datasets or collections to filter either. --- Source: https://millionshort.com/docs/glossary/what-is-html-to-markdown Section: Reference # What is HTML to markdown conversion? HTML to markdown conversion turns a webpage's markup into plain text that keeps headings, lists, links and tables, and drops tags, scripts and layout. HTML to markdown conversion transforms a webpage's markup into markdown, a lightweight plain-text format that keeps headings, lists, links, tables and code blocks while discarding tags, scripts, styles and layout. It is a standard way to prepare web content for language models, because markdown keeps the document's structure at a much lower token cost than HTML. ## Why convert HTML at all HTML describes how a page renders, not just what it says. Tags, attributes, inline styles, scripts and layout scaffolding can outweigh the visible text many times over. A language model given raw HTML spends much of its context window on markup and page furniture. A model given markdown gets the same document in a form that is far smaller and easier to reason over. Markdown became the target format for a practical reason: it is common in the text that models learn from, such as READMEs, forums and documentation, so models handle its conventions well: `#` headings, `-` lists, link syntax, fenced code blocks. It sits in a useful middle that plain text misses. Structure survives and noise does not. ## What good conversion involves Translating tags to syntax one by one is not enough. A useful converter does two separate jobs: - **Content selection.** Identify the main content and drop navigation, ads, cookie banners, sidebars and footers. This "readability" step matters more than the syntax translation. Converting boilerplate to markdown just gives you tidy boilerplate. - **Faithful translation.** Map headings to `#` levels, keep link targets, keep tables as markdown tables, and fence code blocks with their language. Losing structure here hurts everything that comes after. Hard cases include pages rendered by JavaScript (there is nothing to convert until a [browser runs the page](https://millionshort.com/docs/glossary/what-is-a-headless-browser)), complex nested tables, and pages where the boundary of the main content is unclear. ## Where it fits in AI pipelines HTML to markdown is a routine preprocessing step in web-connected AI systems. RAG pipelines convert pages to markdown before chunking and indexing them, agents that browse convert each page before reading it, and dataset builders convert whole corpora. It is the most common concrete form of [LLM-ready data](https://millionshort.com/docs/glossary/what-is-llm-ready-data), and when you need fields instead of prose, its sibling is [structured data extraction](https://millionshort.com/docs/glossary/what-is-structured-data-extraction). You can run the conversion yourself with open-source libraries, or use a hosted service that does it for a URL you send. ## Where MillionShort fits MillionShort search does not return HTML or markdown. Each result carries a `snippet`: a plain-text passage of up to 2,000 characters (800 by default), already free of markup, which you can place in a prompt as it is. With `include_content`, `web` and `news` results also carry the text of the page as we hold it, as plain text. For a URL you send, [Extract](https://millionshort.com/docs/extract/parameters) is the hosted converter: it fetches the page and returns its main content as Markdown or plain text. --- Source: https://millionshort.com/docs/glossary/what-is-llm-grounding Section: Reference # What is LLM grounding? LLM grounding ties a model's output to verifiable outside information, such as retrieved documents, so that each claim can be traced to a source. LLM grounding means anchoring a language model's output to verifiable external information, such as retrieved documents, web results or a knowledge base, instead of letting it answer from memory alone. A grounded response can cite where each claim came from, which reduces hallucinations and lets users verify the model's work. ## Why do LLMs need grounding? A language model's default mode is recall: it produces a plausible continuation of your prompt based on patterns in its training data. Plausible is not the same as true. When the model lacks the relevant fact, because it is recent, private or obscure, it can produce a confident, fluent, wrong answer. Grounding changes the model's job from remembering to reading. You put trusted evidence in the context window and instruct the model to answer only from it. The model becomes a reasoning and writing layer over sources you control, not an oracle you have to trust blindly. ## Grounding vs RAG: what's the difference? The two terms overlap but are not identical. [RAG](https://millionshort.com/docs/glossary/what-is-rag) is a mechanism: retrieve documents, add them to the prompt, generate. Grounding is the goal: every claim in the output traceable to evidence. RAG is the most common way to ground an LLM, but grounding also covers tool results, database lookups and documents a user supplies. And a RAG pipeline can still produce ungrounded output, if the model ignores its context or the retrieved pages are wrong. ## What makes grounding actually work? Three things, in practice: - **Evidence quality.** Grounding on a content farm just passes the content farm's errors on in a confident voice. [Primary sources](https://millionshort.com/docs/glossary/what-are-primary-sources-in-rag), the documents that said it first, are the strongest anchor. - **Citations.** Grounded systems attach source URLs to claims so that a person, or a later agent, can check them. If you cannot trace a claim, it is not grounded. - **Instruction discipline.** The prompt must tell the model to prefer the supplied context over its own memory, and to say so when the evidence does not answer the question. For systems that answer from the web, the evidence usually comes from a [web search API](https://millionshort.com/docs/glossary/what-is-a-web-search-api). ## Where MillionShort fits MillionShort supplies the evidence, not the answer. A search returns ranked results, each with its `url`, `site` and a snippet, so your model can quote and cite. Two signals help you decide what to trust: `popularity` says where a site sits among the most popular sites, and `risk` is set when a site carries a risk label. It does not check claims or write the grounded answer for you. [Search for RAG](https://millionshort.com/docs/search/guides/rag) shows the pattern, and [popularity and risk](https://millionshort.com/docs/search/popularity-and-risk) explains the signals. ## Related terms - [What is RAG noise?](https://millionshort.com/docs/glossary/what-is-rag-noise) - [What is source diversity in RAG?](https://millionshort.com/docs/glossary/what-is-source-diversity) --- Source: https://millionshort.com/docs/glossary/what-is-llm-ready-data Section: Reference # What is LLM-ready data? LLM-ready data is web or document content cleaned of boilerplate and put in a consistent format, usually markdown or JSON, that a model can use directly. LLM-ready data is web or document content that has been cleaned, structured and formatted so a large language model can consume it directly, usually markdown or JSON with navigation, ads, scripts and boilerplate removed. Because only the meaningful text remains, it uses fewer tokens, introduces less noise, and gives RAG and agent pipelines better material to answer from. ## Why raw HTML isn't enough for language models Much of a typical webpage is not content. Navigation menus, cookie banners, ad slots, tracking scripts, sidebars and footer links often account for more of the HTML than the article does. Feed that raw markup to a language model and you pay for it twice: once in tokens, and again in quality, because the model has to find the signal inside the clutter. LLM-ready data is the opposite. It is the same page reduced to what a human reader would call "the article", with its headings, paragraphs, lists, tables and code blocks, expressed in a format the model handles well. ## What makes data LLM-ready In practice, LLM-ready data has four properties: - **Boilerplate removed.** Navigation, ads, consent banners and repeated page furniture are stripped so that tokens go to substance. - **Structure preserved.** Headings, lists, tables and links survive the conversion, because models use document structure to reason about content. - **A model-friendly format.** Markdown is the usual choice for prose, and JSON is used when you need specific fields. See [what HTML to markdown conversion is](https://millionshort.com/docs/glossary/what-is-html-to-markdown). - **Predictable shape.** Every page comes back in the same format, so pipelines do not need parsing logic for each site. ## Where LLM-ready data is used Retrieval-augmented generation is the largest consumer: [RAG](https://millionshort.com/docs/glossary/what-is-rag) pipelines index and retrieve cleaned text, and noisy input degrades answers (see [RAG noise](https://millionshort.com/docs/glossary/what-is-rag-noise)). Agents are the second: an agent browsing the web uses up its context window quickly on raw HTML, so tools that return clean text let it read more pages per task. Fine-tuning and evaluation datasets built from web content need the same cleanup for the same reasons. ## How teams produce it Some teams run their own pipeline of fetch, render, strip and convert, using open-source readability libraries. Others use an extraction service that does this as a managed step. When the target is specific fields and not prose, that is [structured data extraction](https://millionshort.com/docs/glossary/what-is-structured-data-extraction), a closely related technique. ## Where MillionShort fits MillionShort search results are LLM-ready in the narrow sense that matters for a search call. The response is JSON with the same fields for every result and every source, and each `snippet` is a plain-text passage of up to 2,000 characters with no markup. An agent can read a result list without any cleanup step. With `include_content`, `web` and `news` results also carry the cleaned text of the page as we hold it, as plain text and not as markdown. A search does not fetch a URL you name; [Extract](https://millionshort.com/docs/extract/parameters) does, and returns the page as Markdown or plain text. --- Source: https://millionshort.com/docs/glossary/what-is-llms-txt Section: Reference # What is llms.txt? llms.txt is a proposed convention for a markdown file at a site's root that gives AI systems a short, curated map of the site's most useful content. llms.txt is a proposed web standard: a markdown file at a site's root that gives AI systems a curated map of its most important content. It contains an H1 title, a short blockquote summary, and sections of annotated links. A companion file that many sites publish, llms-full.txt, puts the full page content in one file. ## Why does llms.txt exist? Websites are built for browsers: navigation, JavaScript, ads and layout that a person takes in at a glance but a language model pays for in tokens. When an AI assistant or agent wants to understand a site, reading the HTML page by page is slow and noisy, and it can fill the context window before reaching the substance. llms.txt was proposed by Jeremy Howard of Answer.AI in September 2024. It borrows the spirit of [robots.txt](https://millionshort.com/docs/glossary/what-is-robots-txt) but turns the purpose around: instead of telling crawlers what to avoid, it hands language models a concise, curated guide to what matters. ## What's in the file? The format is deliberately simple markdown, in a fixed order: 1. **An H1** with the name of the site or project. This is the only required element. 2. **A blockquote** straight after it, with a short summary of what the site is. 3. Optionally, a few paragraphs of context. 4. **Link sections under H2 headings** (for example "Docs" or "Guides"), each a bulleted list of markdown links: a name, a URL and a short description of what is behind the link. 5. An optional section titled **"Optional"**, whose links can be skipped when a shorter context is needed. Because it is plain markdown at a predictable address (`/llms.txt`), any model or agent can fetch and read it with no special tooling. ## What is llms-full.txt? A heavier companion that has become a common convention: **llms-full.txt** puts the complete text of the documentation into one large file. It grew up alongside the proposal and is not one of its required parts. The index file suits agents that navigate selectively. The full file suits loading everything at once. This documentation publishes both, and each page is also available as markdown. ## Does it matter for RAG and answer engines? It is a proposal, not a ratified standard, and nothing obliges an AI system to read it, so do not treat it as a way to influence how models rank or describe you. Its practical value today is with tools you point at it: coding assistants and agents that are given the address get a compact, accurate entry point, and for site owners it is cheap to publish. For retrieval pipelines, a site's llms.txt is [context engineering](https://millionshort.com/docs/glossary/what-is-context-engineering) done at the source. ## Related terms - [What is RAG?](https://millionshort.com/docs/glossary/what-is-rag) - [What is a web search API?](https://millionshort.com/docs/glossary/what-is-a-web-search-api) --- Source: https://millionshort.com/docs/glossary/what-is-long-tail-search Section: Reference # What is long-tail search? Long-tail search reaches the large part of the web below the most popular sites, usually by removing the top-N most popular sites from the results. Long-tail search means searching the vast majority of the web that sits below the most popular, heavily optimized sites: the personal blogs, forums, academic pages and niche publications that mainstream rankings rarely surface. In practice it works by filtering out results from the top-N most popular sites so that less-visited primary sources can rank. ## Where does the term come from? Attention on the web is very uneven. A short "head" of very popular sites receives most visits, followed by a long, thin "tail" of sites that each get little attention but together hold a great deal of first-hand knowledge. Long-tail search is search that deliberately reaches into that tail instead of stopping at the head. ## Why do mainstream rankings bury the tail? Popularity compounds. Large sites earn links and clicks, which strengthen the signals that put them on top, which earns more links. Add professional SEO, with content farms, affiliate roundups and aggregators that summarize one another, and the first page for many queries becomes a rotation of the same familiar sites. The engineer's own write-up, the maintainer's forum answer and the lab's original paper are still out there. They just cannot outrank the sites optimized to sit above them. ## Why does long-tail search matter for LLMs and agents? Retrieval quality. A RAG pipeline or agent grounded only on the head of the web inherits the head's failure modes: thin listicle content, near-duplicate sources that create false confidence, and secondary summaries where a primary source exists. Reaching into the tail improves [source diversity](https://millionshort.com/docs/glossary/what-is-source-diversity) and can surface the document that said it first. It also counters the retrieval monoculture described under [independent search index](https://millionshort.com/docs/glossary/what-is-an-independent-search-index): differently ranked retrieval gives models something different to cite. The tail is not automatically better. It also holds abandoned and low-quality pages, so long-tail results still need judging. ## How is long-tail search implemented? The direct mechanism is a popularity filter at query time: order sites by popularity, drop every result whose site is inside the top 100, 1,000, 10,000, 100,000 or 1,000,000, and let the tail fill the vacated positions. In MillionShort this is the `remove_top_sites` field of a search request. It takes any number from 0 to 1,000,000: ```bash curl https://api.millionshort.com/v1/search \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "query": "sourdough starter hydration", "remove_top_sites": 10000 }' ``` ```python import os import requests r = requests.post( "https://api.millionshort.com/v1/search", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, json={ "query": "sourdough starter hydration", "remove_top_sites": 10000 }, timeout=30, ) r.raise_for_status() for hit in r.json()["data"]["results"]: print(hit["position"], hit["title"], hit["url"]) ``` ```ts const res = await fetch('https://api.millionshort.com/v1/search', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ "query": "sourdough starter hydration", "remove_top_sites": 10000 }), }); if (!res.ok) throw new Error(`POST /v1/search failed: ${res.status}`); const { data } = (await res.json()) as { data: { results: { position: number; title: string; url: string }[] }; }; for (const hit of data.results) console.log(hit.position, hit.title, hit.url); ``` The same call as a tool of the MCP server: ```json { "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "search", "arguments": { "query": "sourdough starter hydration", "remove_top_sites": 10000 } } } ``` Each result carries a `popularity` signal, so you can see where its site sits and that the filter worked. `only_top_sites` does the reverse. [Remove top sites](https://millionshort.com/docs/search/remove-top-sites) explains the control, and [Long-tail research](https://millionshort.com/docs/search/guides/long-tail-research) shows how to use it in practice. --- Source: https://millionshort.com/docs/glossary/what-is-ocr Section: Reference # What is OCR? OCR (optical character recognition) recognizes text in images such as scanned pages, photos and screenshots and turns it into machine-readable characters. OCR (optical character recognition) is the technology that recognizes text in images, such as scanned pages, photos and screenshots, and converts it into machine-readable characters. It differs from document parsing: a PDF created by software carries an embedded text layer that a parser reads directly, while a scanned document is just a picture of text and needs OCR to become readable. ## How OCR works OCR takes pixels as input and produces characters as output. A classic pipeline cleans up the image (straightening it, removing noise, converting it to black and white), divides it into lines and character regions, and classifies each region against known letter shapes. Modern OCR systems replace those hand-built stages with neural networks, and increasingly with vision-language models that read a page image from start to finish. These cope much better with varied fonts, layouts and photo conditions. Output quality still depends heavily on the input: clean, high-resolution scans of printed text do well, while low-resolution photos, handwriting and dense multi-column layouts remain the harder cases. ## OCR vs document parsing The distinction comes down to whether the text exists digitally in the file: - **Digital documents** carry their text as data. A PDF exported from a word processor has an embedded text layer, and a DOCX stores its text as XML. [Document parsing](https://millionshort.com/docs/glossary/what-is-document-parsing) reads that directly, so the characters come out fast and exact. - **Scanned or photographed documents** are images. A scanned PDF is a container of page pictures with no text layer, so a parser finds nothing to read. Recovering the text requires OCR, with the accuracy trade-offs that brings. A quick test: if you can select and copy text in a PDF viewer, the file has a text layer and a parser can read it. If you cannot, it is a scan and needs OCR. Some scans carry a text layer that earlier OCR added, and that layer is only as accurate as the OCR that made it. ## When LLM pipelines need OCR, and when they don't Documents created digitally do not need OCR, so a pipeline with solid document parsing handles them. OCR earns its place when your material includes older archives, scanned contracts and invoices, faxes or photographed pages. It also introduces a failure mode that parsing does not have: recognition errors, such as "rn" read as "m" or digits confused in a table, which silently corrupt later retrieval and [structured data extraction](https://millionshort.com/docs/glossary/what-is-structured-data-extraction). Text that came from OCR usually deserves a confidence check before it enters an index. ## Where MillionShort fits MillionShort does not offer OCR. You cannot send it an image or a scanned file, and it does not search images. It is a text search API: results are snippets of text from pages and documents in our own index. If your pipeline needs OCR, it is a separate step with a separate tool, and MillionShort has nothing to add to it beyond finding the URLs. --- Source: https://millionshort.com/docs/glossary/what-is-rag Section: Reference # What is RAG? RAG (retrieval-augmented generation) fetches relevant documents and hands them to a language model as context, so it answers from evidence. RAG (retrieval-augmented generation) is a technique where an AI system fetches relevant documents from a search index, a database or the web, then passes them to a large language model as context for its answer. Instead of relying on training data alone, the model answers from retrieved evidence, which reduces hallucinations and keeps responses current. ## How does retrieval-augmented generation work? A RAG pipeline runs four steps on every request: 1. **Query.** The user's question, or an agent's sub-task, is turned into one or more search queries. 2. **Retrieve.** Those queries run against a knowledge source: a vector database, a keyword index, internal documents or a [web search API](https://millionshort.com/docs/glossary/what-is-a-web-search-api). 3. **Augment.** The top results are cleaned, trimmed and inserted into the model's prompt next to the original question. 4. **Generate.** The model writes its answer from that evidence and, ideally, cites which document supported each claim. The model's weights never change. All of the new knowledge lives in the prompt, which is why a RAG system can be updated without retraining: change the documents and the answers change with them. ## What problem does RAG solve? Language models have two structural gaps. Their training data has a cutoff date, so they know nothing about later events. And they have no access to your private data, such as tickets, contracts and internal wikis. Without retrieval, a model asked about either will guess, and guesses are where many hallucinations come from. RAG closes both gaps at answer time. It also makes answers auditable: because the evidence is in the prompt, the system can point to the passage behind a claim. That is the core idea of [LLM grounding](https://millionshort.com/docs/glossary/what-is-llm-grounding). RAG reduces hallucination and does not end it. A model can still misread or ignore what it was given. ## What does a RAG pipeline retrieve from? Many production systems mix sources: a store of internal documents, and a search API for the web when a question concerns the outside world. Retrieval quality is the ceiling on answer quality. A pipeline fed duplicate, heavily optimized pages inherits their errors, a failure mode known as [RAG noise](https://millionshort.com/docs/glossary/what-is-rag-noise). ## Where MillionShort fits MillionShort is the retrieve step for the web. One call to [`POST /v1/search`](https://millionshort.com/docs/search/parameters) returns ranked results with snippets of up to 2,000 characters and their URLs, from 1 to 5 of 13 sources, and your model does the generating. It does not write the answer. When a question needs more than a snippet, `include_content: true` adds the page text we hold to `web` and `news` results. That is our stored copy. For a page as it is now, [Extract](https://millionshort.com/docs/extract/parameters) fetches the URL and returns clean text. The [Search for RAG guide](https://millionshort.com/docs/search/guides/rag) has working code, and the [RAG use case](https://millionshort.com/docs/use-cases/rag) describes the fit. ## Related terms - [RAG vs fine-tuning: which do you need?](https://millionshort.com/docs/glossary/rag-vs-fine-tuning) - [What is LLM grounding?](https://millionshort.com/docs/glossary/what-is-llm-grounding) - [What is source diversity in RAG?](https://millionshort.com/docs/glossary/what-is-source-diversity) --- Source: https://millionshort.com/docs/glossary/what-is-rag-noise Section: Reference # What is RAG noise? RAG noise is the irrelevant, repeated or low-quality content that reaches a retrieval pipeline's context window and makes the answers worse. RAG noise is irrelevant, redundant or low-quality content that ends up in a retrieval pipeline's context window: filler written to rank, content-farm rewrites, duplicated aggregator pages and boilerplate. Noise wastes tokens, dilutes the signal the model needs, and degrades answer accuracy, because language models weigh whatever context they are given. ## Where does RAG noise come from? Noise enters a pipeline at three points: - **The corpus.** If retrieval runs over the open web, the corpus itself is noisy. Popular queries return pages written to rank, not to inform: listicles padded to a word count, affiliate roundups, and near-identical rewrites of one source article across many sites. - **The retriever.** Similarity search returns the closest chunks, which are not always the most useful ones. Ten chunks that paraphrase the same paragraph each score well but together add one document's worth of information at ten documents' cost. - **The extraction step.** Raw HTML brings navigation menus, cookie banners, "related posts" widgets and footers along with the article. Without clean extraction, a large part of the context window can be page furniture. ## Why does noise hurt LLM answers? Language models treat everything in the context window as potentially relevant. Noise hurts in three ways that compound. It **crowds out signal**: a finite context filled with filler has less room for the passage that mattered. It **misleads the model**: models can latch onto distractor passages, and an error repeated across several retrieved copies starts to look like consensus. And it **inflates cost and latency**, since every junk token is paid for on every call. Deciding what deserves those tokens is the core problem of [context engineering](https://millionshort.com/docs/glossary/what-is-context-engineering). ## How do you recognize it? Symptoms of a noisy pipeline: answers that hedge across contradictory retrieved copies, citations that point at aggregators instead of the original document, token bills that grow faster than answer quality, and evaluation scores that improve when you retrieve fewer documents. The countermeasures are deduplication, [source diversity](https://millionshort.com/docs/glossary/what-is-source-diversity), a preference for [primary sources](https://millionshort.com/docs/glossary/what-are-primary-sources-in-rag), and filtering the most heavily optimized sites out at retrieval time. ## Where MillionShort fits MillionShort works on the first of those three points, the corpus your pipeline sees. `remove_top_sites` removes results from the N most popular sites, `exclude_domains` and `bury_domains` deal with sites you already know are noise, and `page_types` narrows results to kinds of page such as tutorials or documentation. Results from several sources are merged and duplicates are removed, and `summary.removed` counts what was taken out and why. Results are plain-text snippets, so there is no page furniture to strip. It does not judge whether a passage is relevant to your question beyond ranking, and it does not rerank by meaning: retrieval is keyword-based. The [low-noise RAG use case](https://millionshort.com/docs/use-cases/low-noise-rag) puts the pieces together. ## Related terms - [What is RAG?](https://millionshort.com/docs/glossary/what-is-rag) - [What is LLM grounding?](https://millionshort.com/docs/glossary/what-is-llm-grounding) --- Source: https://millionshort.com/docs/glossary/what-is-robots-txt Section: Reference # What is robots.txt and how does it affect AI crawlers? Robots.txt is a plain-text file at a site's root that tells crawlers, including AI crawlers, which paths they may visit, and following it is voluntary. Robots.txt is a plain-text file at a website's root that tells automated crawlers which paths they may or may not visit, using the Robots Exclusion Protocol (RFC 9309). It affects AI crawlers because well-behaved bots check it before fetching pages. Compliance is voluntary, though, so it signals intent and does not enforce access control. ## How the Robots Exclusion Protocol works Since 1994, sites have published their crawling preferences at one well-known location: `/robots.txt` at the root of the host. The format, standardized in 2022 as RFC 9309, is a list of rule groups. Each group names a `User-agent` (a specific bot, or `*` for all) and gives it `Disallow` and `Allow` rules for URL paths. `Sitemap` lines and a `Crawl-delay` hint are common additions. They are not part of the RFC, and not every crawler honors `Crawl-delay`. Two properties define the protocol. First, it is advisory: nothing technical prevents a crawler from ignoring it. Reputable operators comply, but robots.txt is a "no trespassing" sign, not a lock, and anything truly private needs authentication. Second, it governs crawling, not indexing or use. A disallowed URL can still appear in an index if other pages link to it, and what may be done with fetched content is a separate question of policy and law. ## What changed with AI crawlers For decades the main audience was search engine crawlers. AI added new kinds of automated visitor: collectors of training data, retrieval bots that fetch pages to answer a user's question, and agents that browse on a user's behalf. Publishers responded by addressing them by name. Operators of AI crawlers publish the user-agent names their bots use, and some offer a separate name that controls use for AI training apart from search crawling. This lets a site welcome search crawlers while opting out of AI training, or the reverse. The rules a [website crawler](https://millionshort.com/docs/glossary/what-is-a-website-crawler) must read before fetching have become, in effect, where a site states its AI policy. Whether a given bot honors them is up to its operator, so check each operator's own documentation for the current names and behavior. A related proposal, [llms.txt](https://millionshort.com/docs/glossary/what-is-llms-txt), does the opposite job: it tells language models what on a site is worth reading. ## What it means for services that fetch pages A service that fetches pages for you inherits the compliance question, and a well-behaved one honors the file instead of working around it. When you evaluate a scraping or extraction service, ask how it identifies itself, whether it reads robots.txt, and what it returns when a page is disallowed. A clear, machine-readable refusal is more useful to a pipeline than content a publisher asked crawlers not to take. ## Where MillionShort fits MillionShort is a search API on our own independent index. A search call reads the index and returns snippets. It does not fetch the result pages at the time of your request. [Extract](https://millionshort.com/docs/extract/parameters), which fetches a URL you name and returns clean text, identifies itself to sites as `MillionShortBot` and honours robots.txt in every mode, with no option to ignore it. --- Source: https://millionshort.com/docs/glossary/what-is-search-api-freshness Section: Reference # What is search index freshness? Search index freshness is the lag between a page being published or changed and that page, in its current form, being retrievable through a search API. Search index freshness is how quickly new or updated web content becomes retrievable through a search API: the lag between something being published and appearing in results. Fresh indexes revisit fast-changing pages frequently or fetch pages live at query time. For LLMs with fixed training cutoffs, freshness determines whether retrieved answers reflect current reality. ## How do search APIs keep results fresh? Three broad strategies, often combined: - **Scheduled recrawling** revisits pages at a rate matched to how often they change, so the index stays a rolling approximation of the web. - **Feed and sitemap ingestion** shortens discovery by reading newly published URLs from sources that announce them. - **Live fetching** skips the index for the last step: after retrieval picks candidate URLs, the service fetches the current page at query time, trading extra latency for current content. The two layers move separately. An index can discover a page quickly and still serve an old snippet for it, or the reverse. ## How do you evaluate a provider's freshness? Providers rarely publish their schedules, so test. Query for events from the last 24 hours and check whether results exist and whether their published dates are filled in. Check whether date controls exist, and remember that a "past day" filter is only as good as the index behind it. Then compare the text returned against the page as it is now, to catch stale copies. ## Why does freshness matter for LLMs and agents? A language model's weights stop at its training cutoff, and retrieval is how it learns anything newer. If the retrieval layer is itself stale, you get the worst case: an answer that cites sources and sounds current but reflects last month's web. Stale retrieval can be worse than none, because a model that has been handed sources tends to drop its hedging. Freshness matters most for [answer engines](https://millionshort.com/docs/glossary/what-is-an-ai-answer-engine) and [agentic search](https://millionshort.com/docs/glossary/what-is-agentic-search) loops, which often exist because the answer changes over time. How an index is built, and who controls what gets revisited, is part of the same buying question. See [independent search index](https://millionshort.com/docs/glossary/what-is-an-independent-search-index). ## Where MillionShort fits MillionShort is plain about this. The `web` source is a large index that is refreshed periodically, not continuously. A page that changed recently may show its earlier text, a page published in recent months may not be there yet, and web results carry no date: `published_date` is `null`. For recent material, add a source that is kept current, such as `news`, `social` or `hn`, to the same call. Results from those sources carry a `published_date` when the source knows it. `start_date`, `end_date` and `time_range` filter those sources by date. They are not applied to `web`, whose pages carry no date, and the response says so in a warning. `GET /v1/sources` says how fresh each source is. [Freshness](https://millionshort.com/docs/search/freshness) has the detail. --- Source: https://millionshort.com/docs/glossary/what-is-source-diversity Section: Reference # What is source diversity in RAG? Source diversity in RAG means drawing evidence from many independent sites, publishers and document types, not several copies of the same popular pages. Source diversity in RAG means retrieving evidence from a wide range of independent origins: different domains, publishers, viewpoints and document types, rather than several near-identical pages from the same few popular sites. Diverse retrieval reduces duplicated context, exposes the model to dissenting or niche information, and produces answers that reflect more of the web than its most popular part. ## Why does source diversity matter for RAG? Information in a context window is only as valuable as it is new. When a retriever returns eight pages that all rewrite the same wire story, the model receives one source's worth of information at eight sources' token cost. Worse, it gets a false sense of consensus, because an error repeated across copies reads as corroboration. Diversity is the remedy: independent origins can confirm, contradict or extend one another, which lets a grounded system weigh evidence instead of counting echoes. Diversity also protects against a subtler failure: systematic blind spots. Web ranking concentrates attention on a small set of large, heavily optimized domains. A retriever that only samples that head inherits its perspective, which is mainstream and commercial, and misses the forums, personal blogs, academic pages and niche documentation where firsthand expertise often lives. ## What does diversity look like in practice? Useful axes to vary: - **Domain independence.** Cap results per domain. Two chunks from each of ten sites usually tell you more than twenty from two. - **Publisher type.** Mix official documentation, [primary sources](https://millionshort.com/docs/glossary/what-are-primary-sources-in-rag), community discussion and analysis instead of one genre. - **Popularity tier.** Deliberately sample beyond the most-visited sites, where content is heavily duplicated and optimized to rank. - **Recency spread.** Pair current coverage with the original, older document it derives from. A quick diagnostic: count the unique domains in your top results, and measure how similar the retrieved chunks are to each other. Few domains and high similarity mean you are paying for [noise](https://millionshort.com/docs/glossary/what-is-rag-noise), not evidence. ## How do you retrieve diversely? Remove duplicates aggressively, enforce limits per domain, and query beyond the popular head of the web. Popularity signals are part of what causes the problem, so one direct alternative is to filter the top-N most popular sites out of the results, as [long-tail search](https://millionshort.com/docs/glossary/what-is-long-tail-search) does, so that the tail of the web can surface at all. ## Where MillionShort fits MillionShort gives you two of those axes as request fields. Popularity tier: [`remove_top_sites`](https://millionshort.com/docs/search/remove-top-sites) removes the N most popular sites, and every result carries a `popularity` signal you can check. Publisher type: one call can search up to 5 of 13 [sources](https://millionshort.com/docs/search/sources), for example `web`, `discussions` and `academic` together, and returns one merged list with duplicates removed. Each result names its `site` and `source`, so the unique-domain count above is one line of code. There is no per-domain cap field. If you need one, apply it to the list yourself, or use `bury_domains` for sites that dominate. ## Related terms - [What is RAG?](https://millionshort.com/docs/glossary/what-is-rag) - [What is LLM grounding?](https://millionshort.com/docs/glossary/what-is-llm-grounding) --- Source: https://millionshort.com/docs/glossary/what-is-structured-data-extraction Section: Reference # What is structured data extraction? Structured data extraction pulls specific fields such as prices, names and dates out of webpages and returns them as machine-readable JSON. Structured data extraction is the process of pulling specific fields, such as prices, names, dates and specifications, out of unstructured webpages and returning them as machine-readable JSON. Traditionally done with brittle CSS selectors written for each site, it is now commonly done by describing the fields you want in a JSON schema or a plain-language prompt and letting a model locate them on the page. ## From pages to fields Most web content is written for people: an article, a product page, a filing. Structured data extraction turns that prose and layout into rows and fields a program can use. The product page becomes an object with a name, a price and availability. The job posting becomes title, company, location and salary. The output is typically JSON, ready for a database, a spreadsheet or another API call. It complements full-content extraction and does not replace it. When a model needs to read a page, you want clean markdown. When a pipeline needs specific values from many pages, you want fields. For the prose side, see [HTML to markdown conversion](https://millionshort.com/docs/glossary/what-is-html-to-markdown). ## The old way: selectors The traditional approach maps each field to a CSS selector or an XPath expression: "the price lives at `.product-price span`". It is fast and deterministic, but every site needs its own set of selectors, and a redesign breaks them without warning. For teams that maintain parsers for many sites, that upkeep is a large share of the cost of scraping. ## The new way: schema-guided extraction Extraction with a language model turns the problem around. Instead of telling the system where the data lives, you describe what you want, and a model finds it in the page content, whatever the markup. Two forms are common: - **A JSON schema** that defines the fields, types and structure you expect. The extractor returns JSON that conforms to it, which you can validate. - **A plain-language prompt**, such as "extract the author, the publication date and the key claims", for quicker and looser extraction. Schema-guided extraction trades determinism for generality: one schema can cover many sites. The trade is real. A model can return a value that fits the schema and is still wrong, or fill a field the page never stated, so check extracted values against the source when they matter. ## Where it shows up Price and competitor monitoring, lead enrichment, research agents that tabulate findings across sources, and filling knowledge bases with [LLM-ready data](https://millionshort.com/docs/glossary/what-is-llm-ready-data) are the common cases. It fits anywhere the question is "what are the values?" and not "what does it say?" ## Where MillionShort fits [Extract](https://millionshort.com/docs/extract/parameters#json-of-your-shape) returns a page you name as JSON of your shape: send `json` with a `schema` and an optional `prompt`, for up to three URLs a call, on Starter and up. A [crawl](https://millionshort.com/docs/crawl/parameters#request) takes the same `json` for every page of a site. It costs 3 credits a page on top of the fetch. What a search does return is structured in a fixed way: every result is a JSON object with the same fields, including `title`, `url`, `site`, `source`, `snippet`, `page_type`, `topic`, `popularity` and `risk`, plus an `extra` object for details that a source supplies. Those are attributes of the result, not values extracted to your schema. To get fields of your own from a result's page, pass its URL to Extract with `json`. --- Source: https://millionshort.com/docs/use-cases Section: Reference # Use cases What people build on MillionShort search, with a working request for each. Each page describes a problem, shows the request that addresses it, and says what the API does not do for that job. The [guides](https://millionshort.com/docs/search/guides/rag) go further, step by step. - [Search for RAG pipelines](https://millionshort.com/docs/use-cases/rag): Retrieval decides what your model can say. MillionShort gives a RAG pipeline ranked passages from the web and specialist sources, with controls over which sites are allowed in. - [Low-noise RAG](https://millionshort.com/docs/use-cases/low-noise-rag): Much of what search hands a model is filler. MillionShort lets you cut the popular, repetitive layer out of retrieval and see what was removed. - [Search for research agents](https://millionshort.com/docs/use-cases/research-agents): A research agent searches many times and reads what it finds. MillionShort gives it one tool for the web and specialist sources, with levers it can pull between steps. - [Research from primary sources](https://millionshort.com/docs/use-cases/primary-source-research): The document that said it first is rarely at the top of a result list. Removing the most popular sites takes away the coverage that sits on top of it. --- Source: https://millionshort.com/docs/use-cases/rag Section: Reference # Search for RAG pipelines Retrieval decides what your model can say. MillionShort gives a RAG pipeline ranked passages from the web and specialist sources, with controls over which sites are allowed in. A [RAG](https://millionshort.com/docs/glossary/what-is-rag) pipeline answers a question in two steps: it retrieves text, then a model writes from that text. The model can only be as good as what was retrieved. When the retrieval step is web search, three things usually go wrong. ## The problem - **The passages are too short.** A one-line snippet tells the model a page exists, not what it says. - **The same sites answer everything.** General search favors the most popular sites, so every answer cites the same handful of them, whatever the question. - **Nothing says how far to trust a source.** A result list gives a title and a link. Your pipeline has to guess the rest. ## How MillionShort addresses it - **Longer snippets.** `max_chars_per_result` sets the snippet length, up to 2,000 characters (the default is 800). That is usually enough for a model to quote and cite. - **The right source for the question.** One call searches 1 to 5 of the [13 sources](https://millionshort.com/docs/search/sources) and returns one merged, ranked list. A medical question can search `medical` and `academic`; a question about a library can search `web`, `discussions` and `hn`. Every source costs the same. - **Control over the site pool.** [`remove_top_sites`](https://millionshort.com/docs/search/remove-top-sites) removes results from the N most popular sites. The [lenses](https://millionshort.com/docs/search/lenses) do the rest: `include_domains` keeps only sites you name, `exclude_domains` blocks them, `boost_domains` and `bury_domains` change the order without filtering. - **Kinds of page.** `page_types` and `topics` keep only matching results, for example documentation and tutorials. The slugs come from `GET /v1/sources`. - **Signals on every result.** Each result carries [`popularity` and `risk`](https://millionshort.com/docs/search/popularity-and-risk) for its site, so your code can down-weight a source before the model sees it. `exclude_risky: true` drops every result whose site carries a risk label. - **A reason for each result.** `explain: true` adds `why` and `signals` to each result, at no cost. It is useful when you are tuning retrieval and want to know why a passage was chosen. ## A retrieval call This asks two sources for eight passages of up to 1,500 characters, keeps documentation and tutorials among the `web` results (the page-type filter acts on `web` and `news`, so the response names `discussions` in a `filter_not_applied` warning), drops results from sites with a risk label, and blocks one site: ```bash curl https://api.millionshort.com/v1/search \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "query": "rate limiting with a token bucket", "sources": ["web", "discussions"], "num_results": 8, "max_chars_per_result": 1500, "page_types": ["documentation", "tutorials"], "exclude_domains": ["example.com"], "exclude_risky": true }' ``` ```python import os from millionshort import MillionShort client = MillionShort(api_key=os.environ["MILLIONSHORT_API_KEY"]) r = client.search( "rate limiting with a token bucket", sources=["web", "discussions"], num_results=8, max_chars_per_result=1500, page_types=["documentation", "tutorials"], exclude_domains=["example.com"], exclude_risky=True, ) context = [] for hit in r.results: context.append(f'[{hit["position"]}] {hit["title"]} ({hit["url"]})\n{hit["snippet"]}') prompt = "Answer from these sources and cite them by number.\n\n" + "\n\n".join(context) print(r.usage.credits, "credits") ``` ```ts const res = await fetch('https://api.millionshort.com/v1/search', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ "query": "rate limiting with a token bucket", "sources": [ "web", "discussions" ], "num_results": 8, "max_chars_per_result": 1500, "page_types": [ "documentation", "tutorials" ], "exclude_domains": [ "example.com" ], "exclude_risky": true }), }); if (!res.ok) throw new Error(`POST /v1/search failed: ${res.status}`); const { data } = (await res.json()) as { data: { results: { position: number; title: string; url: string }[] }; }; for (const hit of data.results) console.log(hit.position, hit.title, hit.url); ``` The same call as a tool of the MCP server: ```json { "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "search", "arguments": { "query": "rate limiting with a token bucket", "sources": [ "web", "discussions" ], "num_results": 8, "max_chars_per_result": 1500, "page_types": [ "documentation", "tutorials" ], "exclude_domains": [ "example.com" ], "exclude_risky": true } } } ``` The call searches two sources, so it costs 2 credits. The Python SDK is not published to a package registry yet; until it is, send the same request with any HTTP client. ## What it does not do - **No live fetch in a search.** A snippet goes up to 2,000 characters. When that is not enough, `include_content: true` adds the text of the page as we hold it to `web` and `news` results, for 1 credit a call (up to 10 results). It is our stored copy, as old as the day we captured it. Fetching a page as it is now is what [Extract](https://millionshort.com/docs/extract/parameters) is for, as a separate call. - **No generated answers from a search.** A search returns results; your model writes the answer. For an answer written by us, [Agent](https://millionshort.com/docs/agent) is a separate, metered call: a written answer with a checked quote for every statement. - **Keyword retrieval.** Queries that contain the words you expect on the page work well. A question phrased as a long sentence works better when your pipeline first turns it into a search query. - **The web source is not continuously refreshed.** It is refreshed periodically and web results carry no date. For recent events, search `news`, `social` or `hn`. The date filters work on those sources; they are not applied to `web`, and the response says so. See [Freshness](https://millionshort.com/docs/search/freshness). ## Read next - [RAG with MillionShort](https://millionshort.com/docs/search/guides/rag), the step-by-step guide. - [Low-noise RAG](https://millionshort.com/docs/use-cases/low-noise-rag), when the problem is the quality of what comes back. - Glossary: [What is RAG?](https://millionshort.com/docs/glossary/what-is-rag) and [What is RAG noise?](https://millionshort.com/docs/glossary/what-is-rag-noise) - The [Search reference](https://millionshort.com/docs/search/parameters) lists every field. --- Source: https://millionshort.com/docs/use-cases/low-noise-rag Section: Reference # Low-noise RAG Much of what search hands a model is filler. MillionShort lets you cut the popular, repetitive layer out of retrieval and see what was removed. [RAG noise](https://millionshort.com/docs/glossary/what-is-rag-noise) is retrieved text that looks relevant and adds nothing: ten pages that restate the same source, listicles written to rank, pages that mention your keywords in passing. A model given noisy context writes a bland answer or a wrong one, and it spends tokens doing it. ## The problem Most of the noise comes from one place. General search rewards popularity, and the most popular sites are often the ones that summarize, aggregate and repeat. Re-ranking the list afterwards does not help much, because the pages you wanted were never in it. The fix is to change which sites can answer. ## How MillionShort addresses it - **Remove the popular layer.** [`remove_top_sites: N`](https://millionshort.com/docs/search/remove-top-sites) removes every result whose site is among the N most popular, from 0 to 1,000,000. What remains is the [long tail](https://millionshort.com/docs/glossary/what-is-long-tail-search): specialist sites, personal sites, forums and small publishers. Check `popularity` on what comes back to see the cut at work; the count in `summary.removed.popularity` stays 0 on some sources, `web` among them. - **Block and bury.** `exclude_domains` blocks up to 25 sites outright. `bury_domains` moves sites down without removing them, and `boost_domains` moves trusted ones up. See [Lenses](https://millionshort.com/docs/search/lenses). - **Keep the kinds of page you want.** `page_types` and `topics` filter by what a page is and what it is about. `exclude_page_types` and `exclude_topics` remove the kinds you never want, such as listicles. - **Screen on signals.** Every result has a [`popularity` bucket and a `risk` label](https://millionshort.com/docs/search/popularity-and-risk). `risk` is null for a site with no label. Results from sites with the most serious labels are removed before you see them and counted in `summary.removed.risk`. `exclude_risky: true` drops every result whose site carries any label. - **Search where noise is low.** The `smallweb` source is small independent sites only. `academic`, `medical` and `law` are specialist sources. You can search up to 5 of the [13 sources](https://millionshort.com/docs/search/sources) in one call. - **Check the result.** `explain: true` is free and adds `why` to each result, so you can see whether a rule you set did what you meant. ## A low-noise call The web and the small web without the 100,000 most popular sites, articles only among the `web` results (the page-type filter acts on `web` and `news`, so the response names `smallweb` in a `filter_not_applied` warning), with no site that carries a risk label and one site buried: ```bash curl https://api.millionshort.com/v1/search \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "query": "sourdough starter hydration", "sources": ["web", "smallweb"], "remove_top_sites": 100000, "page_types": ["articles"], "bury_domains": ["example.com"], "exclude_risky": true, "max_chars_per_result": 1200, "explain": true }' ``` ```python import os from millionshort import MillionShort client = MillionShort(api_key=os.environ["MILLIONSHORT_API_KEY"]) r = client.search( "sourdough starter hydration", sources=["web", "smallweb"], remove_top_sites=100000, page_types=["articles"], bury_domains=["example.com"], exclude_risky=True, max_chars_per_result=1200, explain=True, ) seen = set() for hit in r.results: if hit["site"] in seen: continue seen.add(hit["site"]) print(hit["site"], hit["popularity"]["bucket"], hit.get("why", [])) print(r.summary["removed"]) ``` ```ts const res = await fetch('https://api.millionshort.com/v1/search', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ "query": "sourdough starter hydration", "sources": [ "web", "smallweb" ], "remove_top_sites": 100000, "page_types": [ "articles" ], "bury_domains": [ "example.com" ], "exclude_risky": true, "max_chars_per_result": 1200, "explain": true }), }); if (!res.ok) throw new Error(`POST /v1/search failed: ${res.status}`); const { data } = (await res.json()) as { data: { results: { position: number; title: string; url: string }[] }; }; for (const hit of data.results) console.log(hit.position, hit.title, hit.url); ``` The same call as a tool of the MCP server: ```json { "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "search", "arguments": { "query": "sourdough starter hydration", "sources": [ "web", "smallweb" ], "remove_top_sites": 100000, "page_types": [ "articles" ], "bury_domains": [ "example.com" ], "exclude_risky": true, "max_chars_per_result": 1200, "explain": true } } } ``` The loop keeps one passage per site, and `exclude_risky` leaves out any site that carries a risk label, which are two cheap ways to raise [source diversity](https://millionshort.com/docs/glossary/what-is-source-diversity). The Python SDK is not published to a package registry yet; the `curl` request works today. ## Choosing N There is no single right value. Start at 10,000 and compare the list with the unfiltered one for a dozen of your own queries. Raise N when the same aggregators still appear, lower it when good reference sites disappear. For questions where the popular answer is the right one, leave it at 0, or use `only_top_sites` to do the reverse. ## What it does not do - **It does not judge pages.** `remove_top_sites` works on how popular a site is, not on how good a page is. Small sites can be wrong too, so keep your own checks. - **No live fetch in a search.** Snippets go up to 2,000 characters, and `include_content: true` adds the page text we hold to `web` and `news` results. Fetching a page as it is now is what [Extract](https://millionshort.com/docs/extract/parameters) is for, as a separate call. - **No generated answers from a search.** Your model writes; for an answer written by us, [Agent](https://millionshort.com/docs/agent) is a separate, metered call. - **Keyword retrieval, periodic refresh.** Retrieval matches words, and the web source is refreshed periodically, not continuously, with no dates on web results. ## Read next - [RAG with MillionShort](https://millionshort.com/docs/search/guides/rag) and [Long-tail research](https://millionshort.com/docs/search/guides/long-tail-research), the guides. - [Remove the top sites](https://millionshort.com/docs/search/remove-top-sites), the concept in full. - Glossary: [What is RAG noise?](https://millionshort.com/docs/glossary/what-is-rag-noise) and [What is long-tail search?](https://millionshort.com/docs/glossary/what-is-long-tail-search) --- Source: https://millionshort.com/docs/use-cases/research-agents Section: Reference # Search for research agents A research agent searches many times and reads what it finds. MillionShort gives it one tool for the web and specialist sources, with levers it can pull between steps. A research agent takes a question, plans searches, reads the results, and searches again until it can write. This is often called [agentic search](https://millionshort.com/docs/glossary/what-is-agentic-search). Its output is only as wide as the pool it searched. ## The problem - **Every step returns the same sites.** If each search is answered by the same popular sites, ten steps of research add up to one view repeated ten times. - **Different questions live in different places.** A paper, a court opinion, a forum thread and a podcast episode are not found by the same web search. - **The agent cannot tell sources apart.** Without a signal about the site, it treats every link the same. - **Tool sprawl.** One tool per kind of content means more for the model to choose between, and more to go wrong. ## How MillionShort addresses it - **One tool, 13 sources.** The agent names up to 5 in `sources`, such as `web`, `news`, `discussions`, `academic` and `law`, and gets one merged list. [The sources](https://millionshort.com/docs/search/sources) lists them all. We call this the [Mixture of Experts](https://millionshort.com/docs/search/mixture-of-experts). - **A lever for the second search.** When the first pass returns the usual sites, the agent can repeat it with [`remove_top_sites`](https://millionshort.com/docs/search/remove-top-sites) set and see what sits below them. `only_top_sites` does the reverse when it wants the mainstream view. - **Domain rules it can write itself.** `include_domains` to stay inside sites it trusts, `exclude_domains` to drop ones it has already read, `boost_domains` and `bury_domains` to lean without filtering. See [Lenses](https://millionshort.com/docs/search/lenses). - **Signals it can reason about.** Each result has `popularity {rank, bucket}` and `risk`. `POST /v1/domain` returns both for up to 25 domains for 1 credit, so the agent can check a site it found elsewhere. - **Reasons.** `explain: true` adds `why` and `signals` to each result and is free. - **A known cost per step.** Every response states `usage.credits` and `cost_usd`, so the agent, or the code around it, can keep a budget. ## Two steps of a research loop A first pass over the web and the research literature: ```bash curl https://api.millionshort.com/v1/search \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "query": "transformer interpretability", "sources": ["web", "academic"], "num_results": 10 }' ``` ```python import os import requests r = requests.post( "https://api.millionshort.com/v1/search", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, json={ "query": "transformer interpretability", "sources": [ "web", "academic" ], "num_results": 10 }, timeout=30, ) r.raise_for_status() for hit in r.json()["data"]["results"]: print(hit["position"], hit["title"], hit["url"]) ``` ```ts const res = await fetch('https://api.millionshort.com/v1/search', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ "query": "transformer interpretability", "sources": [ "web", "academic" ], "num_results": 10 }), }); if (!res.ok) throw new Error(`POST /v1/search failed: ${res.status}`); const { data } = (await res.json()) as { data: { results: { position: number; title: string; url: string }[] }; }; for (const hit of data.results) console.log(hit.position, hit.title, hit.url); ``` The same call as a tool of the MCP server: ```json { "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "search", "arguments": { "query": "transformer interpretability", "sources": [ "web", "academic" ], "num_results": 10 } } } ``` Then a second pass below the most popular sites and in the places people discuss the topic: ```bash curl https://api.millionshort.com/v1/search \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "query": "transformer interpretability", "sources": ["web", "hn", "discussions"], "remove_top_sites": 10000, "num_results": 10, "max_chars_per_result": 1500, "explain": true }' ``` ```python import os import requests r = requests.post( "https://api.millionshort.com/v1/search", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, json={ "query": "transformer interpretability", "sources": [ "web", "hn", "discussions" ], "remove_top_sites": 10000, "num_results": 10, "max_chars_per_result": 1500, "explain": True }, timeout=30, ) r.raise_for_status() for hit in r.json()["data"]["results"]: print(hit["position"], hit["title"], hit["url"]) ``` ```ts const res = await fetch('https://api.millionshort.com/v1/search', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ "query": "transformer interpretability", "sources": [ "web", "hn", "discussions" ], "remove_top_sites": 10000, "num_results": 10, "max_chars_per_result": 1500, "explain": true }), }); if (!res.ok) throw new Error(`POST /v1/search failed: ${res.status}`); const { data } = (await res.json()) as { data: { results: { position: number; title: string; url: string }[] }; }; for (const hit of data.results) console.log(hit.position, hit.title, hit.url); ``` The same call as a tool of the MCP server: ```json { "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "search", "arguments": { "query": "transformer interpretability", "sources": [ "web", "hn", "discussions" ], "remove_top_sites": 10000, "num_results": 10, "max_chars_per_result": 1500, "explain": true } } } ``` The first call costs 2 credits and the second 3. ## Over MCP An agent that speaks MCP needs no code. The [hosted MCP server](https://millionshort.com/docs/mcp) at `https://mcp.millionshort.com/mcp` has `search`, `get_domain_info`, `list_sources` and the tools of the other endpoints ([the MCP page](https://millionshort.com/docs/mcp#tools) lists them). The same fields are the tool's arguments. If you write the loop yourself, the [agent tool use guide](https://millionshort.com/docs/search/guides/agent-tool-use) shows how to describe the search tool to a model. Tool packages for LangChain and the Vercel AI SDK exist, as do Python and TypeScript SDKs, but none is published to a package registry yet. ## What it does not do - **A search does not write the report.** MillionShort returns results and your agent's model does the reading and writing. To have us write it, [Agent](https://millionshort.com/docs/agent) returns a written answer with a checked quote for every statement, as a separate, metered call. - **No live fetch in a search.** Snippets go up to 2,000 characters, and `include_content: true` adds the page text we hold to `web` and `news` results. That text is as old as the day we captured it. To read a page as it is now, the agent calls [Extract](https://millionshort.com/docs/extract/parameters). - **No find-similar, and keyword retrieval.** The agent should search with the words it expects on the page, not a description of the idea. - **No date filter on web pages.** `start_date`, `end_date` and `time_range` work on the dated sources, such as `news`, `hn` and `academic`. Web pages carry no date. The `web` source stores no language: a `language` filter is applied to the language detected from each result's text. A source that cannot apply a filter is named in a `filter_not_applied` warning, so the agent can tell. - **The web source is not continuously refreshed.** It is refreshed periodically and web results carry no date. For what happened this week, search `news`, `social` or `hn`. ## Read next - [Agent tool use](https://millionshort.com/docs/search/guides/agent-tool-use) and [Long-tail research](https://millionshort.com/docs/search/guides/long-tail-research), the guides. - [Research from primary sources](https://millionshort.com/docs/use-cases/primary-source-research), a related use case. - Glossary: [What is agentic search?](https://millionshort.com/docs/glossary/what-is-agentic-search) and [What is long-tail search?](https://millionshort.com/docs/glossary/what-is-long-tail-search) --- Source: https://millionshort.com/docs/use-cases/primary-source-research Section: Reference # Research from primary sources The document that said it first is rarely at the top of a result list. Removing the most popular sites takes away the coverage that sits on top of it. Primary-source research is any work where the output must cite the origin: the filing, the opinion, the paper, the dataset, the standard. Analysts, journalists, policy teams and due-diligence teams all need it, and so does a model that is asked to cite. The glossary has more on [primary sources in RAG](https://millionshort.com/docs/glossary/what-are-primary-sources-in-rag). ## The problem Search for anything newsworthy and the top results are coverage: articles that summarize articles that summarize a press release about the document. Each step drops detail and adds interpretation. The original often sits on a site that will never outrank the sites that write about it: a regulator's subdomain, a university server, a standards body, the personal site of the person who did the work. Re-ranking does not fix this when the original was not in the list to begin with. ## How MillionShort addresses it - **Remove the coverage layer.** [`remove_top_sites`](https://millionshort.com/docs/search/remove-top-sites) removes results from the N most popular sites. With the large publishers and aggregators gone, what is left is the layer under them. This is [long-tail search](https://millionshort.com/docs/glossary/what-is-long-tail-search). - **Search where originals are kept.** Several of the [13 sources](https://millionshort.com/docs/search/sources) hold primary material by nature: `law` (United States), `academic`, `medical`, `finance` and `contracts`. One call searches up to 5 and returns one ranked list, and each source costs the same as `web`. - **Stay inside sites you trust.** `include_domains` limits a search to up to 25 sites you name, such as an agency or a publisher you already rely on. `exclude_domains` blocks a site that keeps restating the story. See [Lenses](https://millionshort.com/docs/search/lenses). - **Filter by kind.** `page_types` and `topics` keep only matching results; the slugs come from `GET /v1/sources`. - **Check the site.** Each result has [`popularity` and `risk`](https://millionshort.com/docs/search/popularity-and-risk). A long-tail site is not automatically an original, so these help you decide what to open. `POST /v1/domain` returns both for up to 25 domains for 1 credit. - **See why.** `explain: true` adds `why` and `signals` to each result, free. ## Two searches The web without its 1,000 most popular sites, alongside the law source: ```bash curl https://api.millionshort.com/v1/search \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "query": "heat pump subsidies eligibility rule", "sources": ["web", "law"], "remove_top_sites": 1000, "num_results": 20, "max_chars_per_result": 1200 }' ``` ```python import os import requests r = requests.post( "https://api.millionshort.com/v1/search", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, json={ "query": "heat pump subsidies eligibility rule", "sources": [ "web", "law" ], "remove_top_sites": 1000, "num_results": 20, "max_chars_per_result": 1200 }, timeout=30, ) r.raise_for_status() for hit in r.json()["data"]["results"]: print(hit["position"], hit["title"], hit["url"]) ``` ```ts const res = await fetch('https://api.millionshort.com/v1/search', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ "query": "heat pump subsidies eligibility rule", "sources": [ "web", "law" ], "remove_top_sites": 1000, "num_results": 20, "max_chars_per_result": 1200 }), }); if (!res.ok) throw new Error(`POST /v1/search failed: ${res.status}`); const { data } = (await res.json()) as { data: { results: { position: number; title: string; url: string }[] }; }; for (const hit of data.results) console.log(hit.position, hit.title, hit.url); ``` The same call as a tool of the MCP server: ```json { "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "search", "arguments": { "query": "heat pump subsidies eligibility rule", "sources": [ "web", "law" ], "remove_top_sites": 1000, "num_results": 20, "max_chars_per_result": 1200 } } } ``` The same question limited to sites you name: ```bash curl https://api.millionshort.com/v1/search \ -H "Authorization: Bearer $MILLIONSHORT_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "query": "heat pump subsidies eligibility rule", "include_domains": ["example.gov", "example.org"], "explain": true }' ``` ```python import os import requests r = requests.post( "https://api.millionshort.com/v1/search", headers={"Authorization": "Bearer " + os.environ["MILLIONSHORT_API_KEY"]}, json={ "query": "heat pump subsidies eligibility rule", "include_domains": [ "example.gov", "example.org" ], "explain": True }, timeout=30, ) r.raise_for_status() for hit in r.json()["data"]["results"]: print(hit["position"], hit["title"], hit["url"]) ``` ```ts const res = await fetch('https://api.millionshort.com/v1/search', { method: 'POST', headers: { Authorization: `Bearer ${process.env.MILLIONSHORT_API_KEY}`, 'Content-Type': 'application/json', }, body: JSON.stringify({ "query": "heat pump subsidies eligibility rule", "include_domains": [ "example.gov", "example.org" ], "explain": true }), }); if (!res.ok) throw new Error(`POST /v1/search failed: ${res.status}`); const { data } = (await res.json()) as { data: { results: { position: number; title: string; url: string }[] }; }; for (const hit of data.results) console.log(hit.position, hit.title, hit.url); ``` The same call as a tool of the MCP server: ```json { "jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": { "name": "search", "arguments": { "query": "heat pump subsidies eligibility rule", "include_domains": [ "example.gov", "example.org" ], "explain": true } } } ``` The first call searches two sources for twenty results and costs 2.5 credits. The second costs 1. In the first response, each result's `popularity.bucket` shows where its site stands. (The count in `summary.removed.popularity` stays 0 on some sources, `web` among them, even when the cut worked.) ## Working method 1. Search once without the filter to see the coverage and learn the terms the story uses. 2. Search again with `remove_top_sites` at 1,000, then 10,000, and add the specialist source that fits. 3. Open the candidates and confirm each one is the original, not a copy. The API does not know which page said it first. 4. Cite the URL of the original, and keep the `request_id` if you need to show how you found it. ## What it does not do - **It does not identify primary sources.** It removes popular sites and searches specialist sources. Deciding that a page is the origin is your job, or your model's. - **No live fetch of a document in a search.** A snippet goes up to 2,000 characters, and `include_content: true` adds the page text we hold to `web` and `news` results. That text is our copy from the day we captured the page, so read the page as it is now before you quote it: that is what [Extract](https://millionshort.com/docs/extract/parameters) is for. - **No generated answers from a search.** For an answer written by us, [Agent](https://millionshort.com/docs/agent) is a separate, metered call: a written answer with a checked quote for every statement. - **No date filter on web pages, and the web source is not continuously refreshed.** It is refreshed periodically and web results carry no date. Results from `news`, `social` and `hn` are fresh and dated. `start_date`, `end_date` and `time_range` work on them, and on `law`, `academic`, `medical`, `finance` and `contracts`, among others. - **Law is United States only.** ## Read next - [Long-tail research](https://millionshort.com/docs/search/guides/long-tail-research), the guide. - [Search for research agents](https://millionshort.com/docs/use-cases/research-agents), when an agent does the searching. - Glossary: [What are primary sources in RAG?](https://millionshort.com/docs/glossary/what-are-primary-sources-in-rag) and [What is long-tail search?](https://millionshort.com/docs/glossary/what-is-long-tail-search)