Claude · Cursor · Copilot · Windsurf · 任意支持 x402 的 Agent
全部通过 x402 协议在 Base 主网以 USDC 结算 · 每笔可在 BaseScan 查验
// 1. 获取挑战(402 Payment Required 头)
const challengeResp = await fetch('autotasker.highkingflower.com/api/x402/hotlist?board=weiboHot&limit=3');
const paymentRequired = challengeResp.headers.get('Payment-Required');
const challenge = JSON.parse(atob(paymentRequired));
// 2. 构建支付 payload(你的钱包地址填入 from)
const payload = {
...challenge,
authorization: {
from: 'YOUR_WALLET_ADDRESS', // ← 换成你的 Base 钱包地址
validFrom: Math.floor(Date.now()/1000) - 300,
validUntil: Math.floor(Date.now()/1000) + 3600,
}
};
// 3. 用你的私钥签名(需要 viem 或 ethers)
// const signature = await signer.signTypedData(...)
// 4. 带着签名再调一次
const paidResp = await fetch('autotasker.highkingflower.com/api/x402/hotlist?board=weiboHot&limit=3', {
headers: { 'PAYMENT-SIGNATURE': btoa(JSON.stringify(payload)) }
});
const data = await paidResp.json();
将以下 JSON 添加到你的 MCP config:
{
"name": "chinese-trending-data",
"url": "https://autotasker.highkingflower.com/mcp",
"description": "Real-time Chinese social media trending data via x402 USDC payment on Base mainnet",
"tools": [
{
"name": "get_hotlist",
"description": "Get trending posts from Weibo/Zhihu/Douban/Bilibili/Tieba",
"price": "$0.05"
},
{
"name": "search_chinese_social",
"description": "Search across Chinese social platforms",
"price": "$0.05"
},
{
"name": "export_full_dataset",
"description": "Export complete dataset",
"price": "$0.50"
}
]
}
金库 0xb9A9E6d9…94773C BaseScan 查看链上数据 对账 /api/x402/reconcile