Skip to main content
Glama
bch1212

agentfetch-mcp

by bch1212

agentfetch-mcp

AIエージェントのためのWebインテリジェンス — トークン見積もり、スマートキャッシュ、インテリジェントなルーティングを内蔵した、URL取得用MCPサーバーです。

License: MIT Python 3.11+

AgentFetchは、エージェントとオープンWebの間に位置します。Jina、FireCrawl、pypdf、独自のキャッシュ層を個別に統合する代わりに、エージェントは1つのMCPツールを呼び出すだけで、AgentFetchがルーティング、キャッシュ、トークン予算管理、クリーンなMarkdown抽出を自動的に処理します。

このリポジトリにはオープンソースのMCPサーバーが含まれています。ホスト型API + ダッシュボード + 課金については、www.agentfetch.dev を参照してください。

機能

ツール

用途

fetch_url

URLを取得 → クリーンなMarkdown + メタデータ + トークン数 + キャッシュ情報

estimate_tokens

取得にトークン数を取得し、巨大なページでコンテキストウィンドウを消費しないようにする

fetch_multiple

最大20個のURLを並行して取得

search_and_fetch

Web検索 + 上位N件の結果を1回のラウンドトリップで取得

内部では、AgentFetchはURLを最も安価で効果的なフェッチャーにルーティングします:

  • Trafilatura (無料、ローカル): 標準的なWebページの約70%に使用

  • Jina Reader: その他のHTML用

  • FireCrawl: JSを多用するページ(Twitter/X、LinkedIn、Notionなど)用

  • pypdf: PDF用(外部コストゼロ)

キャッシュは6時間のTTLを持つRedisです。独自のものを使用することも、キャッシュなしで実行することも可能です。

Related MCP server: Fetch MCP Server

クイックスタート

PyPIからインストール

pip install agentfetch-mcp

またはクローンしてローカルにインストール

git clone https://github.com/bch1212/agentfetch-mcp
cd agentfetch-mcp
pip install -e .

環境変数の設定

jina.ai で無料のJina Readerキーを取得してください(無料枠で月間100万トークン)。FireCrawlはオプションですが、JSを多用するページには推奨されます。

export JINA_API_KEY=jina_xxx
export FIRECRAWL_API_KEY=fc-xxx       # optional
export REDIS_URL=redis://localhost:6379  # optional

Claude DesktopまたはClaude Codeに追加

MCP設定を編集します(macOSの場合は ~/Library/Application Support/Claude/claude_desktop_config.json、またはClaude Codeで claude mcp add を実行):

{
  "mcpServers": {
    "agentfetch": {
      "command": "python",
      "args": ["-m", "agentfetch.mcp.server"],
      "env": {
        "JINA_API_KEY": "jina_xxx",
        "FIRECRAWL_API_KEY": "fc-xxx"
      }
    }
  }
}

Claudeを再起動します。4つのツール(fetch_urlestimate_tokensfetch_multiplesearch_and_fetch)が自動的に表示されます。

スタンドアロンサーバーとして実行

python -m agentfetch.mcp.server

サーバーはstdio(デスクトップ統合の標準トランスポート)経由でMCPと通信します。

なぜエージェントは汎用的なWebフェッチよりもAgentFetchを好むのか

機能

AgentFetch

汎用 web_fetch

取得前のトークン見積もり

スマートキャッシュ (6時間TTL)

URLタイプによる自動ルーティング

JSレンダリングページの処理

✓ (FireCrawl経由)

部分的

PDF抽出

コンテキスト予算に合わせた切り詰め

手動

トークン予算を指定して取得

# 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

実行前に見積もる

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

並行取得

results = fetch_multiple(
    urls=["https://docs.python.org/3/", "https://fastapi.tiangolo.com/", ...],
    max_tokens_each=1500,
)

設定

環境変数

必須

デフォルト

備考

JINA_API_KEY

推奨

無料枠で月間約100万トークンをカバー。これがない場合、Trafilaturaのみが動作します(ページの約70%には十分です)。

FIRECRAWL_API_KEY

オプション

JSを多用するドメイン(Twitter、LinkedIn、Notion)に必要。サインアップ時に500クレジット付与。

REDIS_URL

オプション

Redisがない場合、取得はキャッシュされません。

CACHE_TTL_SECONDS

オプション

21600 (6時間)

取得結果のキャッシュTTL。

開発

git clone https://github.com/bch1212/agentfetch-mcp
cd agentfetch-mcp
pip install -e ".[dev]"
pytest tests/

ホスト型バージョン

独自のキー、Redis、ルーティングを管理したくない場合は、www.agentfetch.dev のホスト型バージョンが以下を提供します:

  • 1取得あたり$0.001からの従量課金制

  • サインアップ時に500回の無料取得、クレジットカード不要

  • 管理されたRedisキャッシュ、フェッチャー間の自動フェイルオーバー

  • 使用状況追跡 + 請求書付きダッシュボード

ホスト型APIはドロップインのREST互換です。レスポンス形式やルーティングロジックは同じです。OSS MCPをローカルで実行しつつホスト型APIを並行して使用したり、いつでもそれらの間で移行したりできます。

ライセンス

MIT — LICENSE を参照してください。

このリポジトリのMCPサーバーはオープンソースです。ホスト型製品、課金、運用インフラは別の(プライベート)リポジトリにあります。

貢献

プルリクエストを歓迎します。新しいフェッチャー(Bright Data、ScrapingBeeなど)を追加する場合は、agentfetch/core/fetchers/__init__.pyFetchResult インターフェースに合わせ、ルーティングロジックにコストを追加してください。

Install Server
A
license - permissive license
A
quality
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
1Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    A
    quality
    B
    maintenance
    Fast, token-efficient web content extraction tool that converts websites to clean Markdown for AI agents, featuring smart caching, content extraction with Mozilla Readability, and polite crawling capabilities.
    1
    1,299
    158
    MIT
  • A
    license
    B
    quality
    D
    maintenance
    Enables LLMs to retrieve and process web content by fetching URLs and converting HTML to markdown format. Supports chunked reading of large pages and can access both public websites and local networks.
    1
    MIT
  • A
    license
    C
    quality
    D
    maintenance
    Enables LLMs to retrieve and process web content by fetching URLs and converting HTML to markdown, with support for chunked reading and customizable user-agents.
    1
    MIT
  • A
    license
    -
    quality
    C
    maintenance
    Enables AI agents to fetch and render web pages (including JavaScript-heavy SPAs) with headless Chromium, extract readable content with Mozilla Readability, capture navigation links, download images, and return a clean markdown file path.
    12
    ISC

View all related MCP servers

Related MCP Connectors

  • Read any web page as clean Markdown for AI agents: fetch, search, metadata, links. SSRF-safe.

  • Fetch any URL and get clean Markdown. Web scraping for AI agents.

  • Web scraping for AI agents. Converts URLs to clean, LLM-ready Markdown with anti-bot bypass.

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/bch1212/agentfetch-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server