Polygon x402 AI Data Agent
⚡ x402-cleanweb-agent
将任何杂乱的网页、YouTube 视频或 PDF 论文转换为 Polygon 上纯净、可直接用于 LLM 的 Markdown。
零注册。零订阅。为自主 AI 智能体打造的真正机器对机器 HTTP 402 微支付。
💡 为什么选择 x402-cleanweb-agent?
传统的网页抓取和数据提取 API 强制要求昂贵的每月 49 美元订阅和复杂的 API 密钥管理。
x402-cleanweb-agent 为自主 AI 智能体、抓取器和开发者解决了这一问题:
❌ 无月费订阅:按查询量付费(每次调用 0.005 ~ 0.05 USDC)。
❌ 无需注册或 API 密钥:原生 HTTP 402 Payment Required 机器对机器协议。
🤖 支持零人工 AI 智能体:拥有加密钱包的 AI 智能体可以全天候自主购买数据。
⚡ 亚秒级速度:去除广告、跟踪脚本和杂乱内容,返回纯净、结构化的 Markdown。
🪙 超低 Gas 费:由 Polygon PoS 提供支持(网络 Gas 费 < $0.005)。
📊 Token 节省引擎:计算原始与清理后 token 的减少量(平均节省 60~85%)以及预估的 LLM 提示词成本节省($)。
Related MCP server: ToolSnap MCP
🚀 在线演示与服务端点
🌐 Web3 DApp 界面:https://x402-cleanweb-agent.onrender.com
📚 Swagger API 文档:https://x402-cleanweb-agent.onrender.com/docs
📂 GitHub 仓库:https://github.com/nohosa001-pixel/x402-cleanweb-agent
服务 | 端点 | 价格 | 输出与描述 |
🌐 清理网页 |
| 0.01 USDC | 广告/噪音去除 + 可直接用于 AI 的 Markdown + Token 节省分析 |
🎬 YouTube 转录 |
| 0.02 USDC | 完整视频带时间戳的转录文本,格式化为 Markdown |
📑 PDF 论文与报告 |
| 0.05 USDC | 将 arXiv 论文和财报转换为结构化 Markdown |
📝 纯文本 |
| 0.005 USDC | 超轻量级原始文本提取,适用于快速向量索引 |
🤖 零人工自主 AI 智能体集成(Python SDK)
拥有 Polygon 钱包(私钥)的 AI 智能体可以在零人工干预的情况下自主处理支付和数据提取:
from autonomous_agent_client import AutonomousX402Agent
# 1. Initialize Autonomous Agent with Polygon Wallet
agent = AutonomousX402Agent(private_key="0xYOUR_AGENT_PRIVATE_KEY")
# 2. Autonomous Clean Web Extraction (0.01 USDC)
result = agent.clean_web("https://example.com/article")
print("AI-Ready Markdown:\n", result["markdown_content"])
print("Token Savings:", result["token_analytics"]["token_savings_percentage"])
# 3. Autonomous YouTube Transcript Extraction (0.02 USDC)
yt_result = agent.clean_youtube("https://www.youtube.com/watch?v=dQw4w9WgXcQ")
print("YouTube Transcripts:\n", yt_result["markdown_transcript"])
# 4. Autonomous PDF Paper Extraction (0.05 USDC)
pdf_result = agent.clean_pdf("https://arxiv.org/pdf/2301.00001.pdf")
print("PDF Paper Markdown:\n", pdf_result["markdown_content"])🛠️ 工作原理(M2M 架构)
sequenceDiagram
autonumber
actor Agent as Autonomous AI Agent
participant Server as x402 Gateway (FastAPI)
participant Polygon as Polygon Mainnet (Bor RPC)
participant Scraper as AI Data Cleaning Engine
Agent->>Server: GET /api/v1/clean-web?url=https://example.com
Note over Server: Check X-Payment-Tx header
Server-->>Agent: 402 Payment Required (Chain ID: 137, Recipient, Amount)
Agent->>Polygon: Send USDC Transfer (e.g. 0.01 USDC)
Polygon-->>Agent: Return Tx Hash (0xabc...123)
Agent->>Server: GET /api/v1/clean-web?url=... with Header [X-Payment-Tx: 0xabc...123]
Server->>Polygon: Verify Receipt, Event Logs, Recipient & Nonce
Polygon-->>Server: Tx Confirmed (Status: 1)
Server->>Scraper: Sanitize and Structure to Clean Markdown
Scraper-->>Server: Return Clean Markdown + Token Analytics
Server-->>Agent: 200 OK (Clean Markdown & Analytics JSON)⚡ 直接使用 cURL 快速开始
# Step 1: Query without payment to inspect 402 payment requirements
curl -i -X GET "https://x402-cleanweb-agent.onrender.com/api/v1/clean-web?url=https://example.com"
# Step 2: After sending USDC on Polygon, query with transaction hash
curl -X GET "https://x402-cleanweb-agent.onrender.com/api/v1/clean-web?url=https://example.com" \
-H "X-Payment-Tx: 0x<YOUR_POLYGON_TX_HASH>"示例响应
{
"status": "success",
"service": "clean-web",
"source_url": "https://example.com",
"title": "Example Domain",
"markdown_content": "# Example Domain\n\nThis domain is for use in illustrative examples...",
"token_analytics": {
"raw_html_estimated_tokens": 1250,
"clean_markdown_estimated_tokens": 280,
"tokens_saved": 970,
"token_savings_percentage": "77.6%",
"estimated_llm_cost_saved_usd": "$0.0029"
},
"processing_time_seconds": 0.38
}🔌 模型上下文协议(MCP)设置
选项 1:一键自动安装程序(推荐)
自动配置 Claude Desktop 和 Cursor,无需编辑 JSON 文件:
# Windows
install_mcp.bat
# macOS / Linux
python install_mcp.py选项 2:通过 uvx 运行(无需安装)
直接添加到您的 claude_desktop_config.json 或 Cursor 中:
{
"mcpServers": {
"polygon-x402-cleanweb": {
"command": "uvx",
"args": ["--from", "git+https://github.com/nohosa001-pixel/x402-cleanweb-agent", "x402-agent"]
}
}
}选项 3:手动本地配置
{
"mcpServers": {
"polygon-x402-cleanweb": {
"command": "python",
"args": ["-u", "/absolute/path/to/x402-micro-agent/mcp_server.py"],
"env": {
"PYTHONUNBUFFERED": "1",
"POLYGON_RPC_URL": "https://polygon-bor-rpc.publicnode.com",
"SERVER_WALLET_ADDRESS": "0x255F9991233f86B29dB847c8d5b8CB9915e80dCf",
"USDC_CONTRACT_ADDRESS": "0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359"
}
}
}
}公开的 MCP 工具
get_payment_info():获取定价层级和接收方地址。fetch_clean_markdown(url, payment_tx_hash):清理网页抓取器(0.01 USDC)。fetch_youtube_transcript(url, language, payment_tx_hash):YouTube 转录提取器(0.02 USDC)。fetch_pdf_markdown(url, payment_tx_hash):PDF 研究论文转换器(0.05 USDC)。fetch_plain_text(url, payment_tx_hash):轻量级文本抓取器(0.005 USDC)。
🛠️ 本地开发与运行
# 1. Clone repository
git clone https://github.com/nohosa001-pixel/x402-cleanweb-agent.git
cd x402-cleanweb-agent
# 2. Setup virtual environment
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
# 3. Install dependencies
pip install -r requirements.txt
# 4. Start local server
python main.py
# Server running at: http://localhost:8000📜 链上合约与网络详情
网络:Polygon 主网(链 ID:
137)代币合约(USDC):
0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359接收方金库:
0x255F9991233f86B29dB847c8d5b8CB9915e80dCf
🤝 贡献与许可证
欢迎贡献和提出建议!
请随时在 GitHub 上提交 issue 或 pull request:https://github.com/nohosa001-pixel/x402-cleanweb-agent/issues
根据 MIT 许可证 分发。
Maintenance
Related MCP Servers
- AlicenseAqualityBmaintenancePay-per-use clean web reader for AI agents. URL in, markdown plus metadata out, in milliseconds. Settled per-call in USDC over x402 — no signup, no API keys.21852MIT
- AlicenseAqualityAmaintenanceContext-efficient MCP server for AI agents. fetch_extract reduces token usage by a median 98.1% (53,820 → 2,001 tokens) vs raw HTML — saves ~$0.156/call at Sonnet pricing. Pay $0.02 USDC on Base via x402. First call free per wallet. 10 always-free utility tools included.331MIT
- AlicenseNot gradedqualityBmaintenanceMCP server providing 17 keyless, pay-per-use web-data tools with signed-provenance receipts, enabling AI agents to autonomously fetch, extract, and verify web content on Base mainnet.44MIT

nanoparse-mcpofficial
AlicenseAqualityBmaintenanceMCP server that enables AI agents to fetch web content as clean, structured Markdown via NanoParse's hosted API, using x402 micropayments in USDC on Base.1253MIT
Related MCP Connectors
Pay-per-call web scraping for AI agents via x402 on Base USDC. Six tools, no signup.
Web intelligence for AI agents: fetch, render, extract, research. x402 micropayments, no API keys.
Scrape, crawl, map and extract the web. Pay per call in USDC, no account or API key.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/nohosa001-pixel/x402-cleanweb-agent'
If you have feedback or need assistance with the MCP directory API, please join our Discord server