The full upstream README, mirrored here for reference. Install config, tool schemas, adoption signals, and an original overview live on the Agentfetch MCP listing page.
Web intelligence for AI agents — an MCP server that fetches URLs with token estimation, smart caching, and intelligent routing built in.
AgentFetch sits between your agent and the open web. Instead of integrating Jina, FireCrawl, pypdf, and your own caching layer separately, agents call one MCP tool and AgentFetch handles routing, caching, token budgeting, and clean Markdown extraction automatically.
This repository contains the open-source MCP server. For the hosted API + dashboard + billing, see www.agentfetch.dev.
| Tool | What it's for |
|---|---|
fetch_url | Fetch a URL → clean Markdown + metadata + token count + cache info |
estimate_tokens | Get a token count before fetching, so agents don't blow context windows on huge pages |
fetch_multiple | Fetch up to 20 URLs concurrently |
search_and_fetch | Web search + fetch top N results in one round-trip |
Under the hood, AgentFetch routes URLs to the cheapest effective fetcher:
Cache is Redis with a 6-hour TTL; you can bring your own or run without caching.
Get a free Jina Reader key at jina.ai (1M tokens/mo free tier). FireCrawl is optional but recommended for JS-heavy pages.
Edit your MCP config (~/Library/Application Support/Claude/claude_desktop_config.json on macOS, or run claude mcp add in Claude Code):
Restart Claude. The four tools (fetch_url, estimate_tokens, fetch_multiple, search_and_fetch) appear automatically.
The server speaks MCP over stdio (the standard transport for desktop integrations).
| Feature | AgentFetch | Generic web_fetch |
|---|---|---|
| Token estimation before fetching | ✓ | ✗ |
| Smart cache (6h TTL) | ✓ | ✗ |
| Auto-routing by URL type | ✓ | ✗ |
| JS-rendered page handling | ✓ (via FireCrawl) | partial |
| PDF extraction | ✓ | ✗ |
| Truncation to fit context budget | ✓ | manual |
| Env var | Required | Default | Notes |
|---|---|---|---|
JINA_API_KEY | Recommended | — | Free tier covers ~1M tokens/mo. Without it, only Trafilatura works (still useful for ~70% of pages). |
FIRECRAWL_API_KEY | Optional | — | Needed for JS-heavy domains (Twitter, LinkedIn, Notion). 500 free credits on signup. |
REDIS_URL | Optional | — | Without Redis, fetches run uncached. |
CACHE_TTL_SECONDS | Optional | 21600 (6h) | Cache TTL for fetch results. |
If you'd rather not manage your own keys, Redis, or the routing yourself, the hosted version at www.agentfetch.dev gives you:
The hosted API is a drop-in REST equivalent — same response shapes, same routing logic. You can run the OSS MCP locally and the hosted API in parallel, or migrate between them at any time.
MIT — see LICENSE.
The MCP server in this repo is open source. The hosted product, billing, and ops infrastructure live in a separate (private) repo.
PRs welcome. If you're adding a new fetcher (e.g., Bright Data, ScrapingBee, etc.), please match the FetchResult interface in agentfetch/core/fetchers/__init__.py and add the cost to the routing logic.