Local web retrieval with ranked, source-grounded evidence.
Project description
TinySearch
Spend tokens on answers, not webpages.
TinySearch searches, crawls, and reranks the web locally, then gives your agent only the evidence worth putting in its context.
Documentation · Quick start · Python · Discord
TinySearch is a self-hosted web-research tool for AI agents. It searches the web, reads the best pages, removes low-value content, and returns compact evidence with source URLs.
Your model receives the useful passages instead of paying to process entire webpages.
TinySearch is part of TinySuite, a suite of focused tools designed to make agentic operations cheaper by minimizing token usage through smart retrieval, selection, and context-management techniques.
Choose a tier
| Tier | Use it when | Entry point | Search backend |
|---|---|---|---|
| 1. Python library | You are building with TinySuite or Python | pip install tinysuite-search |
DDGS |
| 2. One-command MCP | An MCP client should launch TinySearch for you | uvx --from "tinysuite-search[server]" tinysearch |
DDGS |
| 3. Docker + SearXNG | You want the full self-hosted stack and HTTP MCP | docker compose ... up -d |
Bundled SearXNG |
Tiers 1 and 2 need no search service. Tier 3 adds a dedicated SearXNG service, persistent model storage, and a network MCP endpoint. See the installation guide for the Docker setup.
The expensive part of agent research is context
A search result is not yet useful evidence. Agents often have to open several pages, ingest navigation and boilerplate, and spend paid input tokens deciding which passages matter.
TinySearch moves that work in front of the model:
flowchart LR
A[Question] --> B[Search and crawl]
B --> C[Local hybrid reranking]
C --> D[Compact evidence<br/>with source URLs]
D --> E[Your agent]
That lowers cost in three ways:
- Smaller model context. Only the best-ranked evidence chunks are returned, within a controlled evidence budget.
- No metered search API required by default. TinySearch can search through DDGS without a paid search provider.
- Local retrieval by default. ONNX embeddings and hybrid reranking run on your machine instead of creating embedding API charges.
Search broadly. Read locally. Pay the model only for the evidence that matters.
Actual savings depend on the pages, evidence limits, client model, and provider pricing. TinySearch reduces the web content sent to the model; it does not control what the client does with that evidence afterward.
Quick start
With uv installed, add TinySearch to any MCP
client:
{
"mcpServers": {
"tinysearch": {
"command": "uvx",
"args": [
"--from",
"tinysuite-search[server]",
"tinysearch"
]
}
}
}
The client launches TinySearch over stdio when it needs it. No repository clone, hosted account, or paid search key is required.
On first launch, TinySearch installs Chromium and downloads the local embedding model before it starts accepting requests — a one-time delay of a minute or two. To avoid that delay on the first real query, pre-warm both ahead of time:
uvx --from "tinysuite-search[server]" tinysearch setup
Prefer Docker, a remote MCP endpoint, or a source checkout? Follow the installation guide.
Three focused tools
| Tool | Use it when |
|---|---|
research(query) |
The agent needs to discover and compare relevant sources |
scrape_url(url, query) |
You already know which page should be inspected |
get_current_datetime() |
Research depends on the current date or time |
TinySearch deliberately stays focused. It is a retrieval layer, not another agent, chat interface, hosted search product, or permanent web index.
See the complete MCP tool reference for parameters and response contracts.
What your agent gets
TinySearch does not spend another model call writing the final answer. It gives your existing agent ranked, source-grounded evidence to reason over.
An abridged structured result looks like this:
{
"schema_version": "1",
"operation": "research",
"status": "ok",
"query": "How does asyncio cancellation work?",
"sources": [
{
"title": "Coroutines and Tasks",
"url": "https://docs.python.org/3/library/asyncio-task.html",
"chunks": [
{
"text": "Tasks can be cancelled...",
"tokens": 146,
"rank": 1,
"scores": {
"rrf": 0.91,
"dense": 0.88,
"bm25": 0.79
}
}
]
}
],
"stats": {
"search_results": 10,
"sources_crawled": 4,
"chunks_considered": 86,
"chunks_selected": 8
}
}
MCP tools return the same evidence as a grounded prompt by default, ready for
the client model to use. Pass output_format: "json" when you want the
structured result directly.
How it works
- Search the web with DDGS or your own SearXNG instance.
- Hybrid-rank the search results to choose which pages are worth reading.
- Crawl those pages in parallel and extract readable content.
- Chunk, deduplicate, and hybrid-rank the combined evidence pool.
- Return the best passages with their titles, URLs, ranks, and scores.
Dense and lexical ranking happen before the evidence reaches your model. The model gets a small, relevant research packet rather than a pile of raw pages.
Python library
TinySearch also works as a regular Python package:
pip install tinysuite-search
import asyncio
from tinysearch import research, to_prompt
async def main():
evidence = await research("How does asyncio cancellation work?")
print(evidence["sources"])
print(to_prompt(evidence))
asyncio.run(main())
The Python API returns a stable, JSON-serializable evidence schema. Rendering that evidence into an LLM prompt is explicit, so applications can store, inspect, transform, or budget the result first.
Search backends
TinySearch selects a web-search backend from config, so you can start with no search service and add one later without changing code.
"ddgs"(native default): queries theddgspackage's automatic backend selection in-process. No SearXNG deployment required."searxng"(Docker default): queries a self-hosted SearXNG instance. Falls back toddgson backend failure unlesssearch_backend_fallbackis set tofalse."duckduckgo": skips SearXNG and queriesddgsin DuckDuckGo-only mode."auto": tries SearXNG, then falls back toddgson any backend failure.
Set the BRAVE_SEARCH_API_KEY environment variable to add Brave's official
Web Search API as a keyed fallback for the ddgs and duckduckgo backends.
Brave is only consulted when the primary call errors or returns no results.
Full key reference, SearXNG JSON-output setup, and Compose details live in the configuration reference.
Why TinySearch
- Built around token efficiency. Page selection and passage selection happen before content enters model context.
- Source-grounded by construction. Every evidence group stays attached to its originating URL.
- Useful without paid infrastructure. DDGS search and local ONNX embeddings are the defaults.
- Bring your own stack when needed. SearXNG and OpenAI-compatible embedding providers remain optional.
- Works where agents already work. Use MCP over stdio, Streamable HTTP, Python, FastAPI, or Docker.
- Self-hosted and inspectable. No TinySearch account, analytics service, or hosted scraped-data cache.
Part of TinySuite
TinySuite is a product suite built around one idea: agents should spend tokens on useful work, not operational overhead.
Each tool focuses on a different part of the agent workflow and uses targeted techniques to reduce unnecessary context before it reaches the model. TinySearch handles the web-research layer by turning pages into a small, ranked, source-grounded evidence packet.
Documentation
The README is the product overview. Detailed setup and operational material lives in the TinySuite documentation:
The repository also contains an annotated example configuration at
configs/tinysearch_config.json.
When not to use TinySearch
TinySearch is intentionally lightweight. Use a commercial search API, persistent crawler, or full search index when you need:
- guaranteed search coverage or an SLA
- large-scale or scheduled indexing
- long-term page storage and change history
- enterprise observability and access controls
Development
git clone https://github.com/TinySuiteHQ/TinySearch
cd TinySearch
python -m venv .venv
source .venv/bin/activate
pip install -e ".[server]"
python -m unittest discover tests
TinySearch supports Python 3.12 and newer. CI tests Python 3.12, 3.13, and 3.14 across Linux, macOS, and Windows.
Entrypoints
tinysearch.researchandtinysearch.scrape_url: structured Python APItinysearch.to_prompt: pure structured-evidence prompt renderertinysearch mcp: stdio MCP server (also the no-argument default)tinysearch serve: Streamable HTTP MCP servertinysearch.servers.fastapi_server:app: optional FastAPI application
Community
Questions, ideas, and bug reports are welcome:
Privacy and license
TinySearch reads public pages and returns selected excerpts to the calling client. Search, crawling, local embeddings, and reranking can run without sending page content to an embedding provider. If you choose an OpenAI-compatible embedding backend, that provider receives the text sent for vectorization.
TinySearch is available under the MIT License. Downloaded model weights remain subject to their respective model-card licenses. See NOTICE for third-party distribution details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tinysuite_search-0.4.1.tar.gz.
File metadata
- Download URL: tinysuite_search-0.4.1.tar.gz
- Upload date:
- Size: 79.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7a2378c56e63a03fef723cbfe68786004a441466cc07e6a3cfc5f97ece3aed1e
|
|
| MD5 |
4dbfc57565412ed2ae0c8f98993b825a
|
|
| BLAKE2b-256 |
77f586096bad7bdf720b98f5c80ef59fa482e81aa260af5c6c251b732c1baafe
|
Provenance
The following attestation bundles were made for tinysuite_search-0.4.1.tar.gz:
Publisher:
pypi-publish.yml on TinySuiteHQ/TinySearch
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tinysuite_search-0.4.1.tar.gz -
Subject digest:
7a2378c56e63a03fef723cbfe68786004a441466cc07e6a3cfc5f97ece3aed1e - Sigstore transparency entry: 2275452157
- Sigstore integration time:
-
Permalink:
TinySuiteHQ/TinySearch@639a27817b86bd568c4e81b38b01160dcce04177 -
Branch / Tag:
refs/tags/v0.4.1 - Owner: https://github.com/TinySuiteHQ
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@639a27817b86bd568c4e81b38b01160dcce04177 -
Trigger Event:
release
-
Statement type:
File details
Details for the file tinysuite_search-0.4.1-py3-none-any.whl.
File metadata
- Download URL: tinysuite_search-0.4.1-py3-none-any.whl
- Upload date:
- Size: 63.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8876ab29d1c560f0dc8f3a754f732c1686e6c19520a6c6423c8717864ede0b9a
|
|
| MD5 |
44def7c0913eafc2270953e012395868
|
|
| BLAKE2b-256 |
d810573dd3f41136987d5d8dedb0f3f86d9711ec3392e70866a704f290d19468
|
Provenance
The following attestation bundles were made for tinysuite_search-0.4.1-py3-none-any.whl:
Publisher:
pypi-publish.yml on TinySuiteHQ/TinySearch
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
tinysuite_search-0.4.1-py3-none-any.whl -
Subject digest:
8876ab29d1c560f0dc8f3a754f732c1686e6c19520a6c6423c8717864ede0b9a - Sigstore transparency entry: 2275452338
- Sigstore integration time:
-
Permalink:
TinySuiteHQ/TinySearch@639a27817b86bd568c4e81b38b01160dcce04177 -
Branch / Tag:
refs/tags/v0.4.1 - Owner: https://github.com/TinySuiteHQ
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@639a27817b86bd568c4e81b38b01160dcce04177 -
Trigger Event:
release
-
Statement type: