← 返回
开发者工具 中文

Configure X402

Configure x402 micropayments for agent-to-agent commerce via Uniswap. Set up your agent to pay per MCP request in USDC on Base (~200ms settlement) or accept x402 payments as a service provider. Use when the user wants to enable pay-per-use API access or monetize their agent's services.
通过 Uniswap 为代理间商务配置 x402 小额支付。设置代理在 Base 链上按 MCP 请求支付 USDC(结算约 200ms),或作为服务提供商接收 x402 付款。适用于启用按次计费 API 访问或将代理服务变现。
wpank wpank 来源
开发者工具 clawhub v0.1.0 1 版本 100000 Key: 无需
★ 0
Stars
📥 1,042
下载
💾 11
安装
1
版本
#latest

概述

Configure x402

Overview

Configures the x402 HTTP-native payment protocol for agent-to-agent micropayments settled on Base. x402 uses the HTTP 402 "Payment Required" status code to enable pay-per-request billing — agents pay fractions of a cent per API call in USDC, with ~200ms settlement, no API keys, no accounts, and no subscriptions.

This skill supports two modes:

  • Pay mode: Configure your agent to pay for MCP tool calls and external API access via x402
  • Accept mode: Configure your agent as an x402 service provider that accepts micropayments for its services
  • Both: Enable bidirectional x402 payments

x402 has processed 100M+ agent-to-agent transactions across 80+ ecosystem projects (Feb 2026). It eliminates API key onboarding friction and creates revenue streams from every agent interaction.

When to Use

Activate when the user says:

  • "Set up x402 payments for my agent"
  • "Enable pay-per-swap via x402"
  • "Configure my agent to accept x402 payments"
  • "Set up micropayments on Base"
  • "Enable x402 for my MCP server"
  • "Monetize my agent's API"
  • "Configure pay-per-request billing"
  • "Set up agent-to-agent payments"

Parameters

ParameterRequiredDefaultDescription
-------------------------------------------------------------------------------------------------------------------------------------------------
modeNobothPayment mode: "pay" (pay for services), "accept" (accept payments), or "both"
walletAddressYes--USDC wallet address on Base for sending/receiving payments
chainNobaseSettlement chain (Base recommended for ~200ms settlement)
pricePerCallNosee pricingPrice per MCP tool call in USDC (for accept mode). Defaults to recommended pricing below.
supportedToolsNoallWhich MCP tools to gate behind x402 payments (for accept mode). "all" or comma-separated list.
maxSpendPerHourNo$1.00Maximum x402 spend per hour (for pay mode). Safety limit to prevent runaway costs.
facilitatorNoautox402 facilitator to use. "auto" selects the best available facilitator on Base.

Recommended Pricing (Accept Mode)

Tool CategoryPrice per CallExamples
-------------------------------------------------------------------------------------
Price quotes$0.001get_token_price, get_quote
Pool analytics$0.003get_pool_info, get_pool_volume_history
Route optimization$0.005get_pools_by_token_pair, search_tokens
Simulation$0.01simulate_transaction
Execution$0.05execute_swap, add_liquidity

Workflow

  1. Parse configuration from the user's request. Determine the payment mode, wallet address, chain, pricing, and tool scope. Validate the wallet address format.
  1. Validate wallet: Verify the wallet address exists on the target chain and has a USDC balance (for pay mode) or can receive USDC (for accept mode). Check that the chain supports x402 settlement.
  1. Write x402 configuration: Generate the x402 configuration file at .uniswap/x402-config.json with:
    • Payment mode (pay/accept/both)
    • Wallet address and chain
    • Facilitator endpoint
    • Per-tool pricing (accept mode)
    • Spending limits (pay mode)
    • Supported tools list

For accept mode, also generate the .well-known/x402-manifest.json that advertises the agent's x402-enabled endpoints to other agents.

  1. Verify setup: Confirm the configuration is valid by checking:
    • Wallet connectivity on the settlement chain
    • Facilitator availability
    • USDC token approval for the facilitator contract (if pay mode)
    • Configuration file is properly formatted

Output Format

x402 Configuration Complete

  Mode:         Both (pay + accept)
  Chain:        Base (8453)
  Wallet:       0x1234...abcd
  Facilitator:  Auto-selected (Coinbase x402)

  Pay Mode:
    Max Spend:  $1.00/hour
    USDC Balance: $50.00 (sufficient)

  Accept Mode:
    Pricing:
      Price quotes:       $0.001/call
      Pool analytics:     $0.003/call
      Route optimization: $0.005/call
      Simulation:         $0.010/call
      Execution:          $0.050/call
    Tools Gated:  All (17 tools)

  Config Files:
    .uniswap/x402-config.json
    .well-known/x402-manifest.json

  Status: Ready for x402 payments

Important Notes

  • x402 settles on Base by default (~200ms). Ethereum mainnet settlement is possible but slower and more expensive.
  • USDC is the only supported payment token for x402. The wallet must hold USDC on the settlement chain.
  • The maxSpendPerHour safety limit prevents runaway costs in pay mode. Adjust based on expected usage.
  • x402 uses the HTTP 402 "Payment Required" status code. When a client hits an x402-gated endpoint without payment, it receives a 402 response with payment instructions.
  • Facilitators handle the payment settlement. The "auto" option selects the best available facilitator on the target chain.
  • For accept mode, the .well-known/x402-manifest.json file makes your agent discoverable on Coinbase Bazaar (12,365+ services).
  • x402 payments are per-request. There are no subscriptions, API keys, or accounts. Each request includes a micropayment.
  • All x402 transactions are logged for treasury management and can be tracked via the manage-treasury skill.
  • This skill does not execute any on-chain transactions. It only generates configuration files. The actual x402 payment flow happens at runtime when the MCP server processes requests.

Error Handling

ErrorUser-Facing MessageSuggested Action
---------------------------------------------------------------------------------------------------------------------------------------------------
Invalid wallet"Invalid wallet address format."Provide a valid Ethereum address (0x...)
No USDC balance"Wallet has no USDC on [chain]. x402 payments require USDC."Fund the wallet with USDC on Base
Chain not supported"[chain] does not support x402 settlement."Use Base (recommended) or Ethereum
Facilitator unavailable"No x402 facilitator available on [chain]."Try Base (most facilitators available)
Config write failed"Could not write x402 configuration: [reason]."Check file permissions
Wallet not configured"No agent wallet found. Set up a wallet first."Use setup-agent-wallet skill first
Invalid pricing"Price per call must be positive and in USDC."Provide valid pricing values

版本历史

共 1 个版本

  • v0.1.0 当前
    2026-03-29 03:33 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

ai-agent

self-improving agent

pskoett
捕获经验教训、错误及修正内容,以实现持续改进。适用于以下场景:(1)命令或操作意外失败;(2)用户纠正Claude(如“不,那不对……”“实际上……”);(3)用户请求的功能不存在;(4)外部API或工具出现故障;(5)Claude发现自身
★ 4,083 📥 812,934
ai-agent

Self-Improving + Proactive Agent

ivangdavila
自我反思+自我批评+自我学习+自组织记忆。智能体评估自身工作、发现错误并持续改进。
★ 1,381 📥 320,773
dev-programming

Code Review

wpank
涵盖安全、性能、可维护性、正确性和测试的系统化代码审查模式,包含严重等级、结构化反馈指南、审查流程及需避免的反模式。适用于审查 PR、建立审查标准或提升审查质量。
★ 32 📥 17,298