webfetch
webfetch
面向 AI 智能体和人类的“许可优先”图像层。
一个 MCP 服务器、一个 CLI 和一个 HTTP 服务器,可联合 25 个图像提供商,按许可优先对结果进行排名,并默认拒绝 UNKNOWN(未知)结果。任何支持 MCP 的智能体(Claude Code、Cursor、Cline、Continue、Roo Code、Codex)只需一行配置即可连接。着陆页、定价和托管服务请访问 getwebfetch.com。
安装
平台 | 一行命令 | |
npm |
| |
Homebrew |
| |
Docker |
| |
curl | bash |
|
curl | bash 安装程序还会幂等地将 webfetch 写入 Claude Code 的 ~/.claude/settings.json 中。随时重新运行即可更新。
Related MCP server: visual-image-search-mcp
30 秒上手
CLI:
webfetch search "drake portrait" --limit 5
webfetch artist "Taylor Swift" --kind portrait --min-width 1200
webfetch download <url> --out ./portrait.jpg
printf "drake portrait\nradiohead album\n" | webfetch batch --jsonl --continue-on-errorMCP(在任何支持 MCP 的智能体内部使用):
search_images({ query: "drake portrait", limit: 5 })
search_artist_images({ artist: "Taylor Swift", kind: "portrait" })
download_image({ url: "..." })TypeScript 库:
import { searchArtistImages, pickBest, downloadImage } from "webfetch-core";
const { candidates } = await searchArtistImages("Drake", "portrait");
const best = pickBest(candidates, { minWidth: 1200 });
if (best) {
const { cachedPath, sha256 } = await downloadImage(best.url);
console.log(best.attributionLine, "->", cachedPath);
}解决的问题
手动获取图像有四种失败模式:
你不知道许可协议,因此无法安全地发布结果。
无法脚本化 —— 每增加一个新网站都需要耗费一下午时间。
Google 图像搜索 API 已停用;爬虫技术脆弱且处于服务条款的灰色地带。
没有共享缓存 —— 你会重复下载同一个文件数十次。
webfetch 通过联合具有稳定条款和结构化许可元数据的直接来源 API,按许可优先对候选结果进行排名,并将结果作为单个 MCP 工具公开,从而解决了上述所有四个问题。
提供商
提供商 | 覆盖范围 | 默认许可 | 认证 | 可选 |
wikimedia | 人像、活动、Logo、历史 | CC_BY_SA (元数据) | — | 否 |
openverse | 任何 CC 许可内容 | CC_BY (元数据) | — | 否 |
unsplash | 高质量摄影 |
|
| 否 |
pexels | 图库摄影 |
|
| 否 |
pixabay | 图库照片 + 插图 |
|
| 否 |
itunes | 专辑封面、艺术家肖像 | EDITORIAL_LICENSED | — | 否 |
musicbrainz-caa | 规范专辑封面 | EDITORIAL_LICENSED | — | 否 |
spotify | 艺术家 + 专辑图片 | EDITORIAL_LICENSED |
| 否 |
youtube-thumb | 视频缩略图 | EDITORIAL_LICENSED | — | 是 |
brave | 通用网页图像搜索 | UNKNOWN (+启发式) |
| 否 |
bing | 通用网页图像搜索 | UNKNOWN (+启发式) |
| 是 |
serpapi | Google 图片 + 反向搜索 | UNKNOWN (+启发式) |
| 是 |
browser | 无头浏览器回退 vs images.google.com | UNKNOWN | — | 是 |
managed-browser | Bright Data 托管浏览器回退 | UNKNOWN |
| 是 |
flickr | CC / 公有领域摄影 | CC_BY (元数据) |
| 否 |
internet-archive | 公有领域 / CC 存档媒体 | PUBLIC_DOMAIN | — | 否 |
smithsonian | 开放获取博物馆媒体 | CC0 |
| 否 |
nasa | NASA 影像 | PUBLIC_DOMAIN | — | 否 |
met-museum | 大都会博物馆开放获取 | CC0 | — | 否 |
europeana | 欧洲文化遗产 | CC_BY (元数据) |
| 否 |
library-of-congress | 美国历史档案 | PUBLIC_DOMAIN | — | 否 |
wellcome-collection | 医学/历史影像 | CC_BY (元数据) | — | 否 |
rawpixel | CC0 图库切片 | CC0 |
| 否 |
burst | Shopify Burst 图库照片 | CC0 | — | 否 |
europeana-archival | Europeana 文本/手稿记录 | CC_BY (元数据) |
| 是 |
请参阅 docs/PROVIDERS.md 了解注意事项和速率限制,参阅 docs/PROVIDER_TUNING.md 了解针对不同用例的选择。
本地和云端模式
CLI 优先采用本地模式:默认情况下 webfetch search、artist、album、download、probe、license 和 batch 会在进程内调用 webfetch-core 并使用你环境中的提供商 API 密钥。传递 --cloud 或设置 WEBFETCH_MODE=cloud 即可使用 WEBFETCH_API_KEY 或 webfetch config set apiKey wf_live_... 调用 https://api.getwebfetch.com/v1/*。
当你需要直接调用提供商并使用本地缓存时,请使用本地模式。当你需要托管认证、共享提供商密钥池、托管浏览器回退、使用统计或团队控制时,请使用云端模式。
为什么选择“许可优先”
我们默认拒绝的唯一结果是无法证明其合法性的图像。对于需要无需人工审核即可发布的工作流而言,一张许可不明但质量稍好的照片毫无价值。相关性很容易判断,但来源证明则不然。
排序逻辑为:许可标签 -> 元数据置信度 -> 分辨率 -> 提供商优先级。UNKNOWN 默认被拒绝(根据伯尔尼公约:除非另有证明,否则大多数网络内容均为版权所有)。请参阅 docs/LICENSE_POLICY.md。
迁移:CC0 图库提供商
旧版 webfetch 将 Unsplash、Pexels 和 Pixabay 视为 CC0。当前版本明确公开了它们的平台条款:
旧标签 | 新标签 | 检查内容 |
|
| Unsplash 条款;非知识共享 (Creative Commons) |
|
| Pexels 条款;非知识共享 |
|
| Pixabay 条款;非知识共享 |
大多数调用者应保持 licensePolicy: "safe-only",因为它仍然允许开放、平台许可、编辑和新闻稿类别,同时拒绝 UNKNOWN。仅需要知识共享或公有领域资产的工作流应使用 licensePolicy: "open-only" 并更新类型守卫以分别处理这三个平台标签。
webfetch 与替代方案对比
功能 | webfetch | 原生 Google 图片 | 仅 Unsplash | Bing CSE |
可通过 API 脚本化 | 是 | 否 (已停用) | 是 | 是 |
每个结果的许可元数据 | 是 | 否 | 是 (单一许可) | 部分 |
覆盖编辑类音乐艺术 | 是 | 部分 | 否 | 部分 |
覆盖 CC / 公有领域 | 是 | 否 | 否 | 否 |
默认安全 (拒绝 UNKNOWN) | 是 | 不适用 | 不适用 | 否 |
共享内容寻址缓存 | 是 | 否 | 否 | 否 |
内置归属权行 | 是 | 否 | 否 | 否 |
所有 IDE 共享一行 MCP 配置 | 是 | 否 | 否 | 否 |
默认情况下无单次查询成本 | 是 | 不适用 | 是 | 否 |
架构
+------------------+
| webfetch-core |
| (ranker, cache, |
| license coerce)|
+---------+--------+
|
+----------------+-----------+-----------+----------------+
| | | |
+-------v------+ +------v-------+ +-------v------+ +------v-------+
| webfetch | | webfetch-mcp | | webfetch- | | browser |
| CLI | | (stdio) | | server (HTTP)| | extensions |
+-------+------+ +------+-------+ +-------+------+ +------+-------+
| | | |
| | | |
+----------------+-----------+-----------+----------------+
|
+---------------------v---------------------+
| provider adapters |
| wikimedia openverse unsplash pexels |
| pixabay itunes mb-caa spotify |
| youtube brave bing serpapi |
| flickr nasa met europeana |
| loc wellcome rawpixel burst |
| browser + managed-browser + archival opt-in|
+-------------------------------------------+所有界面共享 ~/.webfetch/cache/,并以 SHA-256 为键,因此从 CLI 下载的内容可立即供 MCP 服务器使用,反之亦然。
安全默认设置
licensePolicy: "safe-only"— 允许开放、平台许可和编辑/新闻类别;拒绝UNKNOWN。safeSearch: "strict"。可选提供商(
youtube-thumb、bing、serpapi、browser、managed-browser、europeana-archival)默认关闭。每次下载上限 20 MB,内容类型守卫,主机黑名单。
在通用页面探测时遵守
robots.txt。
路线图
webfetch watch— 用于重复查询/增量刷新的守护进程模式。自带提供商插件 API。
getwebfetch.com 托管层 — 提供商密钥池、托管浏览器回退、团队使用仪表板。
贡献
欢迎提交 Issue 和 PR。运行 bun install && bun test 即可开始。请参阅 docs/ 获取各领域的参考文档。
许可
MIT。
Available Tools
7 toolsdownload_imageA
Download an image URL (typically from a prior search_images result) to the local disk cache. Streams with a 20MB hard cap, content-type guard, SHA-256 hash, and returns the cached file path. Host blocklist enforced.
Inputs: url (required), maxBytes, cacheDir.
fetch_with_licenseA
Given an arbitrary URL (image or webpage), determine its license via host heuristics + page metadata (, dc.rights, og tags). Set probe: true to also download the bytes. Use when an agent already has a URL and needs a go/no-go decision before shipping.
Inputs: url (required), probe.
find_similarA
Reverse-image-search: given a public image URL, find visually similar images. Requires SERPAPI_KEY env var and providers: ['serpapi']. Returns candidates with heuristic licenses — treat results as leads, not shippable.
Inputs: url (required), providers.
probe_pageA
Given a webpage URL, return every on the page with inferred dimensions and a heuristic license per image. Respects robots.txt by default. Use to triage a candidate source page before picking.
Inputs: url (required), respectRobots.
search_album_coverA
Find canonical album artwork. Uses MusicBrainz Cover Art Archive + iTunes + Spotify. Results are EDITORIAL_LICENSED — safe for album identification UI per platform ToS; always show attribution.
Inputs: artist (required), album (required), providers, safeSearch, +5 more.
search_artist_imagesA
Specialized image search for a musical artist. kind selects provider set + query expansion: 'portrait' (Wikimedia + Unsplash + Spotify), 'album' (MusicBrainz CAA + iTunes + Spotify), 'logo' (Wikimedia), 'performing' (Wikimedia + Pexels). Prefer this over search_images when building artist/band content.
Inputs: artist (required), kind, providers, safeSearch, +5 more.
search_imagesA
Federated image search across license-aware providers (Wikimedia Commons, Openverse, Unsplash, Pexels, Pixabay, iTunes, MusicBrainz CAA, Spotify, Brave). Returns concise ranked candidates with license + attribution. Does NOT auto-download — call download_image after. Default safe-only policy includes open, platform-license, editorial/press tags and rejects UNKNOWN. Use open-only for CC/public-domain only. For large batches, prefer CLI: webfetch batch --jsonl --continue-on-error.
Inputs: query (required), providers, safeSearch, licensePolicy, +4 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 7 tools
Each tool has a clearly distinct purpose: downloading, license checking, reverse image search, page probing, and three specialized search tools (general, album art, artist). No ambiguity between them.
All tool names follow a consistent verb_noun pattern with underscores (e.g., download_image, search_images). No mixing of conventions.
Seven tools cover the domain of image fetching and license checking without being excessive. Each tool earns its place, and the count is appropriate for the server's purpose.
The set covers core workflows (search, download, license check, find similar, probe page). Minor gaps exist like a generic URL fetcher for non-image content, but the server's focus on images makes this acceptable.
Maintenance
Related MCP Connectors
Knowledge commons for AI agents: cited, licensed, queryable claims over MCP.
Free web search for AI agents. No API key required. Hosted MCP in active development.
The world's public data, one API. License-cleared public data sources for agents, via MCP and REST.
Multi-engine search for AI agents. Trust scoring, local corpus, MCP-native. Self-hostable, BYOK.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceMCP server for searching and retrieving Creative-Commons-licensed images and audio from Openverse. Enables AI agents to query open media content.195 npm1MIT
- AlicenseAqualityDmaintenanceAn MCP server that searches the web for images, creates a numbered contact sheet for visual selection, and downloads the chosen images with provenance metadata. Works without an API key.320 npmMIT
- AlicenseAqualityDmaintenanceLicense-aware game development resource discovery MCP server. Helps AI coding agents find reusable game assets with commercial-use filtering, license classification, and attribution generation.91MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to search and browse photos, users, collections, and topics, and retrieve photo details, random selections, download tracking URLs, and usage statistics via MCP tools.74 npmMIT