
X402 Api
io.github.fernsugi由 GitHub 帳號 fernsugi 發布v1.0.5更新於 Oct 24, 2026
Eight paid DeFi tools: prices, gas, swaps, token security, holders, yields, funding and wallets
概覽
本機 MCP 伺服器,讓助理使用八個按次付費的加密與 DeFi 資料工具,透過 x402 協定在 Base 上以 USDC 付款。
- 可以做什麼
- 取得加密貨幣價格與多鏈 Gas 價格,無需參數;依代幣對與數量取得單一 DEX 兌換報價,以及 Hyperliquid 與 dYdX v4 的每小時資金費率(可指定資產或全部資產)。執行代幣安全掃描,辨識貔貅盤等風險標記,抽樣前列持幣地址與供應占比,並依鏈與最低 TVL 篩選 DeFi 收益池。查詢錢包已觀測的餘額與交易筆數。預設僅檢查付款要求並回傳 402 詳情,不會實際付款。
- 適用情境
- 適合助理需要快速取得加密行情、Gas、DEX 報價、代幣風險、持幣分布、收益、資金費率或錢包資料,且你願意為每次呼叫支付少量 USDC 的情境。檢查模式可在啟用付款前安全查看每次呼叫的費用。
- 執行需求
- 透過 npx 或全域 npm 安裝後在本機執行(需要 Node.js)。可選的自動付款需要 viem 套件、一個在 Base 上存有 USDC 的錢包,以及環境變數 X402_WALLET_PRIVATE_KEY。可選設定:X402_API_BASE_URL、X402_MAX_PER_CALL_USDC(預設 0.01)、X402_EXPECTED_PAY_TO 與 X402_REFERRAL_SOURCE。需要能連線至 x402 API 的網路。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 X402 Api,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
@x402-api/mcp-server
[x402-api MCP server]MCP server that gives Claude, ChatGPT, and any MCP-compatible AI agent access to pay-per-call crypto/DeFi data via the x402 protocol.
8 tools. No API keys. AI agents pay USDC micropayments on Base, per request.
Find this service: Official MCP Registry · Glama · Agent discovery manifest · OpenAPI.
Tools
Quick Start
Option A: Inspect mode (no payment needed)
Just run it — any 402 responses will return human-readable payment instructions:
Claude will tell you what's needed when a tool requires payment.
Option B: Auto-pay mode (fully autonomous)
Install optional payment deps and set your wallet key:
The MCP server signs Base USDC EIP-3009 authorizations only when the API advertises that settlement mode. The default payment cap is 0.01 USDC per call. Fund the wallet with USDC on Base; the API operator sponsors gas in direct settlement mode.
Claude Desktop Integration
Add to your claude_desktop_config.json:
Without auto-pay (inspect mode)
With auto-pay
Config file location:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json - Linux:
~/.config/Claude/claude_desktop_config.json
Environment Variables
How x402 Payments Work
This API uses the x402 protocol — HTTP 402 Payment Required:
- Agent calls tool → MCP server makes API request
- Server returns 402 with payment details (amount, USDC address, Base network)
- Auto-pay mode: this client signs an EIP-3009 authorization and retries; the API settles it on Base
- Inspect mode: MCP returns 402 details without signing or paying
Payment details:
- Token: USDC on Base mainnet
- Address:
0x60264c480b67adb557efEd22Cf0e7ceA792DefB7 - Chain: Base (chain ID 8453)
- Amount: 0.001–0.008 USDC per call (< 1 cent USD)
Tool Reference
get_crypto_prices
No parameters. Returns current prices for BTC, ETH, SOL + top 24h movers.
get_gas_prices
No parameters. Returns gas prices for Ethereum, Base, Polygon, Arbitrum — slow/standard/fast tiers.
get_dex_quotes
Get one ParaSwap aggregate route. No independent comparison between DEX venues.
scan_token
Token security scan — detects rug-pull flags, honeypot patterns, mint authority, etc.
track_whales
Top-holder sample from GoPlus. Gini and recent transfer history unavailable.
scan_yields
Top DeFi yield opportunities across Aave, Compound, Morpho, Lido, Pendle, etc.
get_funding_rates
Hourly perpetual funding from Hyperliquid and dYdX v4. Spreads are indicative.
profile_wallet
Observed priced wallet balances and available transaction counts. DeFi positions, PnL and risk score unavailable.
Development
To test without a payment wallet, simply run and see the 402 responses:
Links
License
MIT
Three runnable workflows
Runnable Node examples start in inspect mode. Each demo has inputs, recorded provider output, coverage limits, a spending cap, and an agent prompt.
Optional X402_REFERRAL_SOURCE labels requests for first-party aggregate attribution (default mcp). It is a hint, not verified caller identity. The API journals no raw payer wallets, IP addresses, or signatures. X402_EXPECTED_PAY_TO pins the payment recipient to the official wallet by default. Tools advertise that auto-pay can spend money and repeated calls can incur another charge.
Cursor / other local MCP clients
Use the same mcpServers configuration shown above. For Cursor, put it in .cursor/mcp.json in your project. Inspect mode needs no wallet. Set X402_MAX_PER_CALL_USDC before enabling auto-pay; repeated calls spend again. Keep wallet credentials in local environment settings, outside Git.
Registry publication
The Publish MCP Registry GitHub workflow validates the matching npm version, then publishes server.json using GitHub OIDC. It runs on a published GitHub release or a manual dispatch from main. No npm token, GitHub PAT, or wallet key is stored in CI. Actions and official publisher source are pinned to verified commits. npm publication still happens separately before creating the release.
來源:README.md,提交 44bdf37
工具
0版本歷史
3- v1.0.5最新Sep 30, 2026
- v1.0.4Sep 29, 2026
- v1.0.2Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分

