
Agentfetch
- 2 repo stars
- Updated June 6, 2026
- bch1212/agentfetch-mcp
Agentfetch is an MCP server that performs token-budgeted web and PDF fetches with automatic routing across Jina, FireCrawl, Trafilatura, and PDF backends.
About
Agentfetch MCP is a token-budgeted web retrieval server for AI coding agents. developers doing competitor scans, pricing page dumps, or doc archaeology can let the server pick among Jina Reader, FireCrawl for JavaScript-heavy sites, Trafilatura, and PDF pipelines instead of maintaining four integrations by hand. Environment variables document optional API keys—Jina’s free tier is called out at roughly one million tokens per month and FireCrawl at five hundred free credits—plus optional Redis for cache hits on repeat URLs. It sits on the research shelf because the primary win is disciplined ingestion before validation or implementation, though the same tools help during build when agents need live references. Register it in Claude Code or Cursor via the PyPI stdio package when context limits and fetch quality tradeoffs matter more than a single hard-coded curl script. It is not a full browser automation farm for shipped E2E tests; it optimizes read-only fetch for reasoning.
- Token-budgeted web fetch designed for AI agent sessions
- Auto-routes across Jina Reader, FireCrawl, Trafilatura, and PDF handling
- Optional JINA_API_KEY and FIRECRAWL_API_KEY with documented free tiers
- Optional REDIS_URL for response caching
- PyPI agentfetch-mcp v1.0.1 with stdio transport
Agentfetch by the numbers
- Data as of Jul 10, 2026 (Skillselion catalog sync)
claude mcp add --env JINA_API_KEY=YOUR_JINA_API_KEY --env FIRECRAWL_API_KEY=YOUR_FIRECRAWL_API_KEY --env REDIS_URL=YOUR_REDIS_URL agentfetch-mcp -- uvx agentfetch-mcpAdd your badge
Show developers this MCP server is listed on Skillselion. Paste this into your README.
| repo stars | ★ 2 |
|---|---|
| Package | agentfetch-mcp |
| Transport | STDIO |
| Auth | Required |
| Last updated | June 6, 2026 |
| Repository | bch1212/agentfetch-mcp ↗ |
What it does
Fetch web pages and PDFs into your agent context with automatic routing and token budgets so research does not blow the context window.
Who is it for?
Best when you research competitors and docs daily inside Claude Code and want one MCP fetch layer with optional Redis cache.
Skip if: Skip if you only need gov contract NAICS feeds or Stripe agent checkout with no web reading.
What you get
After you add agentfetch-mcp and optional API keys, your agent gets routed, budget-aware page text without you wiring each fetch provider yourself.
- Clean extracted text from URLs and PDFs within agent token budgets
- Automatic provider routing without per-site fetch scripts
By the numbers
- Version 1.0.1; PyPI identifier agentfetch-mcp; stdio transport
- Documented optional tiers: Jina ~1M tokens/mo; FireCrawl 500 free credits
- Env vars: JINA_API_KEY, FIRECRAWL_API_KEY, REDIS_URL
README.md
agentfetch-mcp
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.
What it does
| 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:
- Trafilatura (free, local) for ~70% of standard web pages
- Jina Reader for the rest of HTML
- FireCrawl for JS-heavy pages (Twitter/X, LinkedIn, Notion, etc.)
- pypdf for PDFs (zero external cost)
Cache is Redis with a 6-hour TTL; you can bring your own or run without caching.
Quick start
Install from PyPI
pip install agentfetch-mcp
Or clone and install locally
git clone https://github.com/bch1212/agentfetch-mcp
cd agentfetch-mcp
pip install -e .
Set environment variables
Get a free Jina Reader key at jina.ai (1M tokens/mo free tier). FireCrawl is optional but recommended for JS-heavy pages.
export JINA_API_KEY=jina_xxx
export FIRECRAWL_API_KEY=fc-xxx # optional
export REDIS_URL=redis://localhost:6379 # optional
Add to Claude Desktop or Claude Code
Edit your MCP config (~/Library/Application Support/Claude/claude_desktop_config.json on macOS, or run claude mcp add in Claude Code):
{
"mcpServers": {
"agentfetch": {
"command": "python",
"args": ["-m", "agentfetch.mcp.server"],
"env": {
"JINA_API_KEY": "jina_xxx",
"FIRECRAWL_API_KEY": "fc-xxx"
}
}
}
}
Restart Claude. The four tools (fetch_url, estimate_tokens, fetch_multiple, search_and_fetch) appear automatically.
Run as a standalone server
python -m agentfetch.mcp.server
The server speaks MCP over stdio (the standard transport for desktop integrations).
Why agents prefer AgentFetch over generic web fetch
| 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 |
Examples
Fetching with a token budget
# Inside any MCP-aware agent (Claude Desktop, Claude Code, etc.)
result = fetch_url(
url="https://news.ycombinator.com",
max_tokens=2000, # cap response size
use_cache=True, # serve from cache if <6h old
)
# result.markdown → clean Markdown, ≤2000 tokens
# result.metadata → title, author, word_count, language
# result.cache.hit → True if served from cache
# result.fetch_info → which fetcher ran, cost, duration
Estimating before committing
estimate = estimate_tokens(url="https://very-long-article.com")
if estimate.estimated_tokens and estimate.estimated_tokens < 5000:
result = fetch_url(url="https://very-long-article.com")
else:
# too big — skip or summarize via search_and_fetch with max_tokens_each
pass
Parallel fetching
results = fetch_multiple(
urls=["https://docs.python.org/3/", "https://fastapi.tiangolo.com/", ...],
max_tokens_each=1500,
)
Configuration
| 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. |
Development
git clone https://github.com/bch1212/agentfetch-mcp
cd agentfetch-mcp
pip install -e ".[dev]"
pytest tests/
Hosted version
If you'd rather not manage your own keys, Redis, or the routing yourself, the hosted version at www.agentfetch.dev gives you:
- Pay-per-call pricing from $0.001/fetch
- 500 free fetches on signup, no credit card
- Managed Redis cache, automatic failover between fetchers
- Dashboard with usage tracking + invoices
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.
License
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.
Contributing
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.
Recommended MCP Servers
How it compares
Budgeted multi-provider fetch MCP, not a single-site browser skill or penetration-testing crawler.
FAQ
Who is Agentfetch for?
Developers and agent users who need reliable, token-conscious web and PDF text during research and reference lookups from the IDE.
When should I use Agentfetch?
Use it during idea research—or anytime you need live URLs in context—when JS rendering, PDFs, or provider choice would otherwise block quick validation.
How do I add Agentfetch to my agent?
Install agentfetch-mcp from PyPI, configure stdio in your MCP client, and set JINA_API_KEY and optional FIRECRAWL_API_KEY and REDIS_URL.