Skip to content

New: deep research, balance and auto-reload tools in the keyless MCP server. Install in one line

Use case · Coding agents

Ground coding agents in current docs and real code

ContextFetch searches docs, Stack Overflow, GitHub and the open web, then hands your agent each page as Markdown, pruned to the part that answers its question.

Coding agentmy-service

Add a timeout to the async API calls in worker.py

contextfetch_search2,473 ms↓ 57% tokens

{ "query": "python asyncio timeout", "numResults": 5 }

The asyncio Timeout Trap: Why wait_for() Doesn't Stop Tasks Instantly and How to Fix It

runebook.dev/en/docs/python/library/asyncio-task/timeouts

2026-10-12score 1.00

GitHub - aio-libs-abandoned/async-timeout: asyncio-compatible timeout class · GitHub

github.com/aio-libs-abandoned/async-timeout

2026-05-21score 1.00
prunedContext · runebook.dev5,322 → 2,305 tokens
async def main_problem():    try:        # Timeout is 1 second        await asyncio.wait_for(long_running_operation(), timeout=1.0)    except asyncio.TimeoutError:        print("Timeout occurred! ")         # The task might still be running for a while!
Recorded keyless call to api.contextfetch.dev/v1/search on 17 Oct 2026. The prompt is an example; the query, results, tokens and timings are the real response.

Recall

Search where code answers live

Each query goes to every source at once: web metasearch, Hacker News, Wikipedia and our own index. When the question looks technical, Stack Overflow and GitHub search join in.

The candidates are fused into one list, the best pages are fetched, and a cross-encoder ranks what is left.

candidates per source · "python asyncio timeout"
  • searxng217
  • stackoverflow10
  • github10
  • hn7
  • local5
  • wikipedia0

From the response's contextfetch.sources field, recorded 17 Oct 2026.

Pruned context

Give agents the passage, not the page

A cross-encoder scores every chunk of every page against the query and keeps the ones that answer it. Your agent reads less, and you pay for fewer input tokens.

The Reader does the same for one URL: append ?q= and it returns the page as pruned Markdown, with the savings in its headers.

terminal

$ curl -si "…/r/https://docs.python.org/3/library/asyncio-task.html?q=timeouts"

HTTP/2 200

content-type: text/markdown; charset=utf-8

x-raw-tokens: 11188

x-output-tokens: 173

x-token-savings: 98.5

x-credits-remaining: 13

↓ 98.5% tokens · 11,188 → 173

MCP

Search current docs from your coding tools

One line adds the ContextFetch MCP server to Claude Code. Cursor, Windsurf and any other MCP client take the same npx command. No key for the first 25 calls a day.

terminal

$ claude mcp add contextfetch -- npx -y @contextfetch/mcp

6 tools:

  • ✓ contextfetch_search
  • ✓ contextfetch_extract_url
  • ✓ contextfetch_find_similar
  • ✓ contextfetch_deep_research
  • ✓ contextfetch_balance
  • ✓ contextfetch_auto_reload

How it works

One call from question to context

What happened inside the recorded "python asyncio timeout" search, from the response's own timings. Stages overlap, so they add up to more than the total.

  1. 01

    Recall

    All sources are queried in parallel and fused with weighted rank fusion.

    1,233 ms

  2. 02

    Fetch

    The best candidates are fetched in parallel and converted to Markdown, tables kept.

    1,093 ms

  3. 03

    Rerank and prune

    One batched cross-encoder call ranks pages and picks highlights and pruned chunks.

    1,018 ms

  4. 04

    Repeat from cache

    The same query within 15 minutes is answered from cache. It is still billed as one search.

    153 ms p50, production

Code

Keep your Exa client, change the base URL

exa_py and exa-js work against ContextFetch after one argument changes. Or call the HTTP API directly, with no key for the first calls.

  • Filter to docs and repos with includeDomains
  • Ask for highlights or pruned context per result
  • Up to 25 results per search, one credit

Search docs

# pip install exa-pyfrom exa_py import Exa exa = Exa(api_key="YOUR_API_KEY", base_url="https://api.contextfetch.dev") res = exa.search(    "python asyncio timeout",    num_results=5,    include_domains=["docs.python.org", "stackoverflow.com", "github.com"],    contents={"highlights": True},)for r in res.results:    print(r.url, r.highlights[0][:200])

Pricing

ContextFetch Search

$1.00per 1,000 searches

Markdown, highlights and pruned context are in the same credit. 25 searches a day are free with no key. One-time payment. Credits never expire. Full Markdown and pruning included.

Common questions

Which sources does ContextFetch search for code questions?

Every search queries its sources in parallel under a time budget: a SearXNG metasearch instance, Wikipedia, Hacker News and our own index of pages found by earlier searches. Stack Overflow and GitHub search join when the query looks technical, and arXiv when it looks academic. The best candidates are fetched, converted to Markdown and reranked by a cross-encoder.

How does ContextFetch reduce token cost for coding agents?

Ask for pruned_context and each result carries only the chunks that score against your query, in their original order. In the recorded "python asyncio timeout" search on this page that was 5,322 → 2,305 tokens; the Reader call on one Python docs page went from 11,188 to 173 tokens. Across our benchmark: on average 69% fewer tokens than the full page (median 79%) in a benchmark on 29 synthetic docs; not yet measured on live pages.

How fast is it inside an agent loop?

On the production API, called from a client in Florida, a cold search with 10 results and page text had a p50 of 3,141 ms over 5 queries, and the same query repeated within the 15-minute cache window 153 ms, network included. The method and raw JSON are on the benchmarks page.

How do I add ContextFetch to Claude Code, Cursor or Windsurf?

Run claude mcp add contextfetch -- npx -y @contextfetch/mcp for Claude Code, or add the same npx command to the mcpServers config of any MCP client. It works with no key for 25 calls a day; set CONTEXTFETCH_API_KEY to use paid credits.

Is result quality measured against other search APIs?

Not yet. ContextFetch publishes only what it measured: its own latency, token pruning on a synthetic corpus, and competitors' list prices. Our benchmark script compares providers only when you run it with your own API keys.

How much does ContextFetch cost for coding agents?

$1.00 per 1,000 searches on the $15 pack, less on bigger packs, with up to 25 results, Markdown, highlights and pruned context in the same credit. Credits are a one-time purchase and never expire.

Read more

Related use cases

Turn every docs page into context your agent can use

Start with no key: 25 free searches a day.