使用说明
CLAWD 钱包
Claude的 L重量轻 **A.**自主的 Wallet for D开发者
一个统一的MCP服务器,为Claude Code和其他MCP客户提供x402支付、Coinbase Onramp资金、TAP身份验证、推荐入职和域名注册。
快速入门(5分钟)
1.安装
git clone https://github.com/Tylerc8138/x402-MCP-Wallet.git
cd x402-MCP-Wallet
npm install && npm run build
2.添加到克劳德代码
增添 ~/.claude.json:
{
"mcpServers": {
"clawd-wallet": {
"command": "node",
"args": ["/path/to/unified-clawd-wallet-mcp/dist/mcp-server/index.js"],
"env": {
"CLAWD_BACKEND_URL": "https://clawd-domain-backend-production.up.railway.app",
"CLAWD_TAP_MOCK_MODE": "true"
}
}
}
}
3.重新启动Claude代码并尝试
You: "Check my wallet balance"
Claude: [calls x402_check_balance]
{
"success": true,
"balance": {
"address": "0x742d35Cc6634C0532925a3b844Bc9e7595f...",
"amount": "25.50",
"currency": "USDC",
"decimals": 6
}
}
您现在有一个可用的CLAWD钱包。
你能做什么?
检查您的余额
You: "What's my USDC balance?"
退货:
{
"success": true,
"balance": {
"address": "0x742d35Cc6634C0532925a3b844Bc9e7595f...",
"amount": "25.50",
"currency": "USDC",
"decimals": 6
}
}
为您的钱包充值(Coinbase Onramp)
You: "Add $50 to my wallet"
退货:
{
"success": true,
"walletAddress": "0x742d35Cc6634C0532925a3b844Bc9e7595f...",
"expectedAmount": 50,
"currency": "USDC",
"message": "Secure payment window opened. Complete purchase to add $50 USDC to your wallet on base.",
"estimatedArrival": "1-5 minutes after payment confirmation"
}
浏览器窗口打开Coinbase Pay,您可以在其中使用借记卡/信用卡购买USDC。
兑换推荐码(新用户)
You: "Redeem referral code CLAWD2024"
退货:
{
"success": true,
"code": "CLAWD2024",
"amount": 15,
"currency": "USDC",
"txHash": "0x1234...abcd",
"recipientAddress": "0x742d35Cc6634C0532925a3b844Bc9e7595f...",
"explorerUrl": "https://basescan.org/tx/0x1234...abcd",
"message": "Successfully redeemed $15 USDC! Check your balance with x402_check_balance."
}
搜索域名
You: "Search for domains with 'myproject'"
退货:
{
"query": "myproject",
"results": [
{ "domain": "myproject.dev", "available": true, "first_year_price_usdc": "14.99" },
{ "domain": "myproject.xyz", "available": true, "first_year_price_usdc": "4.99" },
{ "domain": "myproject.com", "available": false }
]
}
购买域名
You: "Buy myproject.xyz for John Doe, john@example.com"
克劳德将:
- 呼叫
clawd_domain_purchase→ 获取付款详细信息 - 呼叫
x402_payment_request→ 执行USDC付款 - 呼叫
clawd_domain_confirm→ 注册域名
退货:
{
"success": true,
"domain": "myproject.xyz",
"status": "registered",
"expires": "2027-02-01",
"nameservers": ["ns1.porkbun.com", "ns2.porkbun.com"]
}
验证您的身份(TAP)
You: "Verify my identity for premium merchants"
退货:
{
"success": true,
"status": "verified",
"agentId": "agent_abc123",
"identityLevel": "kyc",
"reputationScore": 50.0,
"message": "Identity verified at KYC level. Premium merchants will now accept your payments."
}
全部22个工具
钱包工具(6)
| 工具 | 说明 | 示例 |
|---|---|---|
x402_payment_request |
支付支持x402的服务 | "Pay $0.01 to https://api.example.com/data" |
x402_check_balance |
检查Base上的USDC余额 | "What's my balance?" |
x402_get_address |
获取资金钱包地址 | "What's my wallet address?" |
x402_transaction_history |
查看最近的付款 | "Show my last 5 transactions" |
x402_discover_services |
查找x402服务 | "Find AI services I can pay for" |
x402_fund_wallet |
通过Coinbase Onramp添加美元 | "Add $50 to my wallet" |
安全工具(2)
| 工具 | 说明 | 示例 |
|---|---|---|
x402_get_spending_controls |
查看当前支出限额 | "Show my spending limits" |
x402_update_spending_controls |
更新支出限额 | "Set my daily limit to $100" |
推荐工具(1)
| 工具 | 说明 | 示例 |
|---|---|---|
x402_redeem_referral |
兑换免费USDC代码 | "Redeem referral code CLAWD2024" |
TAP身份识别工具(4)
| 工具 | 说明 | 示例 |
|---|---|---|
tap_register_agent |
在TAP注册表中注册 | "Register my agent as 'My AI Assistant'" |
tap_verify_identity |
完成KYC/KYB验证 | "Verify my identity at KYC level" |
tap_get_status |
检查验证状态 | "What's my TAP status?" |
tap_revoke |
删除TAP凭据 | "Remove my TAP verification" |
域工具(9)
| 工具 | 说明 | 示例 |
|---|---|---|
clawd_domain_search |
搜索可用域名 | "Search for domains with 'myapp'" |
clawd_domain_purchase |
开始域名购买 | "Buy myapp.dev for John Doe" |
clawd_domain_confirm |
付款后确认 | (付款后自动) |
clawd_domain_list |
列出您的域名 | "Show my domains" |
clawd_dns_list |
列出DNS记录 | "Show DNS records for myapp.dev" |
clawd_dns_create |
创建DNS记录 | "Point myapp.dev to 192.0.2.1" |
clawd_dns_delete |
删除DNS记录 | "Delete the A record for myapp.dev" |
clawd_domain_nameservers |
更新名称服务器 | "Use Cloudflare nameservers for myapp.dev" |
clawd_domain_auth_code |
获取传输认证码 | "Get auth code to transfer myapp.dev" |
常见工作流
新用户引导
1. "Add $50 to my wallet" → Fund via Coinbase (card/bank)
2. "Check my balance" → Verify funds arrived
3. "Verify my identity" → Enable premium services
4. "Search for domains with 'myproject'" → Find a domain
5. "Buy myproject.xyz" → Purchase with USDC
替代方案:推荐码入职
1. "Redeem referral code CLAWD2024" → Get $15 USDC free
2. "Check my balance" → Verify funds arrived
3. "Verify my identity" → Enable premium services
域名+DNS设置
1. "Search for coolapp domains" → Find available options
2. "Buy coolapp.dev for Jane Doe" → Purchase domain
3. "Point coolapp.dev to 192.0.2.1" → Create A record
4. "Add www.coolapp.dev as alias" → Create CNAME record
5. "Show DNS for coolapp.dev" → Verify configuration
使用x402服务
1. "Find AI image services" → Discover services
2. "Generate an image of a sunset" → Pays automatically via x402
3. "Show my recent transactions" → Review payments
错误参考
钱包错误
| 错误 | 原因 | 修复 |
|---|---|---|
Configuration not found |
钱包未初始化 | 首次使用会自动创建钱包 |
No wallet found in keychain |
钥匙链访问失败 | 检查操作系统钥匙链权限 |
Insufficient balance |
USDC不足 | 资金钱包或兑换推荐码 |
Transaction failed |
网络或燃气问题 | 重试;检查基础网络状态 |
推荐错误
| 错误 | 原因 | 修复 |
|---|---|---|
Invalid referral code |
代码不存在 | 检查代码拼写(不区分大小写) |
Code has already been redeemed |
代码已用完 | 请求新代码 |
Code has expired |
过期日期 | 请求新代码 |
This wallet has already redeemed |
每个钱包兑换一次 | 不能再次兑换 |
Treasury has insufficient balance |
金库空 | 联系支持 |
TAP错误
| 错误 | 原因 | 修复 |
|---|---|---|
Not registered |
无TAP代理 | 致电 tap_register_agent 首先 |
Already verified |
已验证 | 使用 tap_get_status 检查液位 |
Verification failed |
KYC/KYB被拒绝 | 联系TAP注册支持 |
定义域错误
| 错误 | 原因 | 修复 |
|---|---|---|
Domain not available |
已注册 | 尝试其他TLD或名称 |
Invalid domain format |
名称中的错误字符 | 仅使用a-z、0-9、连字符 |
Payment verification failed |
tx_hash无效 | 检查在Base上完成的事务 |
Not authorized |
钱包不拥有域名 | 使用购买域名的钱包 |
Backend connection failed |
后端无法访问 | 检查 CLAWD_BACKEND_URL |
配置
环境变量
MCP服务器:
# Coinbase Onramp (get from https://portal.cdp.coinbase.com/)
CDP_PROJECT_ID=your_project_id
CDP_API_KEY_NAME=organizations/your_org_id/apiKeys/your_key_id
CDP_API_KEY_PRIVATE_KEY="-----BEGIN PRIVATE KEY-----
your_pkcs8_private_key_here
-----END PRIVATE KEY-----"
# Required for domain features
CLAWD_BACKEND_URL=https://clawd-domain-backend-production.up.railway.app
# TAP configuration
CLAWD_TAP_REGISTRY=https://tap-registry.visa.com/v1 # Production
CLAWD_TAP_MOCK_MODE=true # Demo mode (no real registry)
# Referral system (operators only)
CLAWD_TREASURY_PRIVATE_KEY=0x... # Treasury wallet for payouts
注: CDP门户的私钥为
EC PRIVATE KEY格式。将其转换为PKCS8:openssl pkcs8 -topk8 -nocrypt -in your_key.pem
后端(铁路部署):
PORKBUN_API_KEY=pk1_... # From porkbun.com/account/api
PORKBUN_SECRET=sk1_... # From porkbun.com/account/api
TREASURY_ADDRESS=0x... # Your wallet to receive domain payments
PUBLIC_URL=https://... # Your Railway deployment URL
DATABASE_URL=sqlite:////tmp/clawd_domains.db # Railway uses /tmp
ENVIRONMENT=production
完整MCP配置
{
"mcpServers": {
"clawd-wallet": {
"command": "node",
"args": ["/Users/you/clawd-wallet/dist/mcp-server/index.js"],
"env": {
"CDP_PROJECT_ID": "your_project_id",
"CDP_API_KEY_NAME": "organizations/your_org_id/apiKeys/your_key_id",
"CDP_API_KEY_PRIVATE_KEY": "-----BEGIN PRIVATE KEY-----\nYOUR_KEY_HERE\n-----END PRIVATE KEY-----",
"CLAWD_BACKEND_URL": "https://clawd-domain-backend-production.up.railway.app",
"CLAWD_TAP_MOCK_MODE": "true"
}
}
}
}
建筑
┌─────────────────────────────────────────────────────────────┐
│ Claude Code / MCP Client │
└─────────────────────────┬───────────────────────────────────┘
│ MCP Protocol (stdio)
▼
┌─────────────────────────────────────────────────────────────┐
│ CLAWD Wallet MCP Server (22 tools) │
│ ├─ Wallet: balance, payments, history, funding │
│ ├─ Referral: code redemption │
│ ├─ TAP: identity verification │
│ └─ Domains: search, purchase, DNS │
└──────────┬──────────────────────┬───────────────────────────┘
│ │
│ USDC on Base │ HTTPS
▼ ▼
┌──────────────────┐ ┌────────────────────┐ ┌────────────────────┐
│ Base Network │ │ Domain Backend │ │ Coinbase CDP │
│ (x402 services) │ │ (Railway/FastAPI) │ │ (Onramp API) │
└──────────────────┘ └─────────┬──────────┘ └────────────────────┘
│
▼
┌────────────────────┐
│ Porkbun API │
└────────────────────┘
安全
- 私钥:存储在操作系统密钥链中(macOS密钥链、Windows凭据管理器、Linux libsecret)
- 支出限额:10美元/笔,50美元/天(可配置)
- TAP凭据:存储在
~/.clawd/tap/具有0600权限 - 付款审批:所有付款都需要克劳德代码中明确的用户批准
- 代码中没有秘密:所有凭据都通过环境变量或密钥链
发展
# Build
npm run build
# Watch mode
npm run dev
# Run MCP server directly
node dist/mcp-server/index.js
# Run backend locally
cd backend
python -m venv venv && source venv/bin/activate
pip install -r requirements.txt
uvicorn src.main:app --port 8402 --reload
将后端部署到铁路
cd backend
railway login
railway init
railway up
# Set environment variables in Railway dashboard:
# PORKBUN_API_KEY, PORKBUN_SECRET, TREASURY_ADDRESS, PUBLIC_URL, DATABASE_URL
故障排除
启动MCP服务器时“找不到命令”
# Rebuild the project
npm run build
# Check the path in your MCP config matches your actual install location
ls /path/to/clawd-wallet/dist/mcp-server/index.js
工具未出现在Claude代码中
- 完全重新启动Claude代码(而不仅仅是重新加载)
- 检查中的MCP配置语法
~/.claude.json - 手动测试服务器:
node dist/mcp-server/index.js
域名购买停留在“待定”状态
- 检查付款交易完成时间 BaseScan
- 验证
tx_hash格式:0x+64个十六进制字符 - 检查后端日志中是否存在Porkbun API错误
转介时“财政部未配置”
推荐赎回需要资金钱包。对于操作员:
export CLAWD_TREASURY_PRIVATE_KEY=0x...
API 参考
看 docs/API.md文件 获取完整的工具输入/输出模式。
许可证
阿帕奇-2.0