
Fresh402
io.github.kirillradchenko96v1.1.1更新于 Oct 8, 2026
Detect webpage and API changes. Free baseline; $0.005 USDC per check via x402 on Base.
概览
让助手注册网页或 API 端点,并在进行昂贵的抓取或推理前低成本检查其是否发生变化。
- 功能
- Fresh402 是一个远程新鲜度判定服务。免费的 fresh402_register 工具为某个 URL 创建或取回持久基线并返回 watch_id;付费的 fresh402_check 工具报告该资源是否发生实质变化,可选返回确定性的差异摘要。它支持 HTML 选择器范围限定、忽略选择器、规范化 JSON 与通配 JSON Pointer 忽略路径、ETag 与 Last-Modified 重新验证,以及有界的快照历史。REST 接口涵盖注册、检查、历史、差异和统计。
- 适用场景
- 适合助手需要反复监控页面或 API 响应,并希望在花费浏览器会话、爬虫、API 调用或 LLM 上下文之前先做一次低成本判断的场景。最适合能够处理 x402 支付、并希望获得降噪变更检测而非完整内容抓取的代理。
- 运行要求
- 远程 Streamable HTTP 端点 API 密钥。检查工具每次调用在 Base 主网上通过 x402 支付协议花费 0.005 USDC,因此付费检查需要兼容 x402 的客户端和已充值的 USDC 钱包。需要能访问该端点及被监控目标。
安装
在 SourceWeft 中
- 打开 控制台中的 Fresh402,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Web executable,通过 Streamable HTTP。 远程服务在工作区中配置后即可从网页运行时运行。
其他 MCP 客户端
把它添加到你客户端的 mcpServers 配置中。
{
"mcpServers": {
"fresh402": {
"type": "http",
"url": "https://fresh402.kirilllabs.workers.dev/mcp"
}
}
}README
Fresh402
A low-cost freshness oracle for AI agents, powered by x402.
Fresh402 lets an AI agent register a web resource once, then cheaply check whether it has materially changed before spending money on a browser session, scraper, API call, or LLM context.
- Free baseline registration
- $0.005 USDC per freshness check
- REST API
- MCP support
- x402 payments on Base mainnet
- Persistent watch IDs
- HTML, JSON, and text monitoring
- Noise filtering and deterministic diffs
Why Fresh402?
AI agents often need to answer a simple question:
Has this resource changed since the last time I looked at it?
Fetching, rendering, parsing, and sending an entire page through an LLM can cost much more than answering that question.
Fresh402 acts as a cheap first step:
- Register a resource for free.
- Receive a persistent
watch_id. - Ask Fresh402 whether it changed.
- Only perform expensive downstream work when necessary.
Live API
Production:
Health and service metadata:
Pricing
Quick start
1. Register a baseline
Registration is free.
Example response:
Registering the same resource again returns the existing baseline without refetching it.
That prevents the free registration endpoint from being used as a free repeated freshness check.
2. Check the resource
Without payment, Fresh402 returns an x402 payment requirement.
The current price is $0.005 USDC on Base mainnet (eip155:8453).
An x402-compatible client can satisfy the payment requirement and retry the request automatically.
REST API
POST /v1/register
Create or retrieve a persistent baseline for free.
Example with HTML scoping:
For JSON resources:
Wildcard * JSON Pointer segments are supported.
POST /v1/check
Paid freshness check.
Supported inputs include:
watch_idurlprevious_hashselectorignore_selectorsignore_json_pathsmax_age_secondsinclude_diff
max_age_seconds lets agents reuse sufficiently fresh shared Fresh402 state instead of forcing another upstream fetch.
GET /v1/history
Retrieve stored snapshot history using a watch_id or URL.
GET /v1/diff
Retrieve change information for a watched resource.
GET /v1/stats
Retrieve public service usage statistics.
MCP
Fresh402 exposes a Streamable HTTP MCP endpoint:
Available tools:
fresh402_register
Free.
Creates or retrieves a persistent baseline and returns a watch_id.
fresh402_check
Costs $0.005 USDC.
Checks whether a registered or caller-supplied resource changed.
The tool exposes x402 payment metadata so compatible agents can discover and pay for the operation programmatically.
Change detection
Fresh402 is designed to reduce false positives from irrelevant page noise.
HTML selector scoping
Monitor only part of a page:
HTML noise filtering
Remove volatile elements before fingerprinting:
Canonical JSON
JSON is canonicalized before hashing, so object key ordering does not cause false changes.
JSON Pointer ignores
Known volatile JSON fields can be removed before fingerprinting.
Conditional HTTP revalidation
Fresh402 can use upstream ETag and Last-Modified metadata when available.
Deterministic diff
When comparable previous content exists, include_diff: true can return a compact deterministic change summary.
Persistent watches
Fresh402 v1.1 introduced persistent agent watches.
A registered resource receives a stable identifier:
Fresh402 stores watch state and bounded snapshot history in Cloudflare D1.
Repeated free registration does not refresh an existing watch. A paid check is required to fetch fresh upstream state.
Architecture
Fresh402 currently uses:
- Cloudflare Workers
- Cloudflare D1
- Coinbase / CDP x402 infrastructure
- Base mainnet
- USDC
- Model Context Protocol (MCP)
- TypeScript
The goal is to keep freshness checks cheap enough that agents can use Fresh402 before more expensive browsing, scraping, or reasoning work.
Security
Fresh402 validates outbound targets and includes protections intended to reduce SSRF risk.
Payment credentials and deployment secrets are supplied through runtime environment configuration and are not stored in this repository.
Resource limits
- New free registrations (REST and MCP combined) are limited to 10 attempts per target hostname and 60 attempts overall per 60 seconds, in each Cloudflare location. Paths, queries, ports and selector/ignore-rule variants share the hostname limit. Failed upstream attempts also consume quota. Existing watches are returned without a fetch or quota charge; paid checks do not use these limits.
- REST returns
429 registration_rate_limitedwithRetry-After: 60when a limit is reached. Missing or unavailable rate limit bindings return503 registration_unavailablefor new registrations. MCP reports these through the existing tool-error path. - Every incoming POST body is capped at 65,536 bytes before JSON parsing, payment handling, MCP dispatch or cloning (
413 request_too_large). Reading an incoming body has a 10-second deadline (408 request_timeout). - Upstream response bodies are streamed with a 5,000,000-byte limit (
413 content_too_large), including whenContent-Lengthis absent or misleading. A single 10-second deadline covers redirects, headers and body reading (504 upstream_timeout). Unused and rejected streams are cancelled. - Concurrent creation of the same watch saves only one baseline and one initial snapshot. A losing free registration returns the stored baseline; overlapping initial requests can still perform separate upstream fetches, subject to the registration limits.
The two rate limit bindings and their thresholds are declared in wrangler.jsonc; keep their namespace IDs unique within the Cloudflare account. These Cloudflare limits are local to each location and eventually consistent. They mitigate bursts but are not a strict worldwide quota or a storage/billing cap. Legitimate users sharing a target hostname also share its allowance. The global_fetch_strictly_public compatibility flag remains enabled to protect against private addresses reached through DNS.
Local verification
Use Node.js 24, then run:
Tests use a local Workers runtime, isolated D1 data and mocked upstream requests. They do not require payment credentials or access production. GitHub Actions runs these same checks on pull requests and pushes to main; the workflow has no deployment step.
Current release
v1.1.1
Highlights:
- Persistent
watch_id - Free baseline registration
- Anti-free-refresh behavior
- HTML selector scoping
- HTML ignore selectors
- Canonical JSON monitoring
- Wildcard JSON Pointer ignore paths
- Shared freshness caching
- Caller-supplied
previous_hash - Deterministic inline diff
- ETag / Last-Modified revalidation
- Bounded snapshot retention
- REST and MCP support
Status
Fresh402 is live and usable today.
The project is still early and the API may evolve as real agent usage patterns become clearer.
Author
Built and maintained by Kirill Radchenko.
Issues, integrations, feedback, and AI-agent use cases are welcome.
来源:README.md,提交 3378225
工具
0版本历史
1- v1.1.1最新Oct 8, 2026

