开发者钱包服务

CLAWD Wallet是一个为开发者提供的轻量级自主钱包服务,支持x402支付、TAP身份验证、推荐注册和域名管理等功能。

  • by csmoove530
  • TypeScript
  • 本地部署
  • 更新于
在 GitHub 查看 csmoove530/unified-clawd-wallet-mcp

使用说明

CLAWD 钱包

Claude的 L重量轻 **A.**自主的 Wallet for D开发者

一个统一的MCP服务器,为Claude Code和其他MCP客户提供x402支付、TAP身份验证、推荐入职和域名注册。

快速入门(5分钟)

1.安装

git clone https://github.com/csmoove530/unified-clawd-wallet-mcp.git
cd unified-clawd-wallet-mcp
npm install && npm run build

2.初始化您的钱包

创建一个新钱包(键入操作系统钥匙链,配置为 ~/.clawd/config.json):

# Option A: use the CLI (after npm link, see below)
clawd init

# Option B: run init via npm (no global install)
npm run init

要使用 clawd 命令从任何目录,从项目运行一次: npm link.
初始化是 幂等:正在运行 clawd init 除非你通过,否则什么都不做 --force (覆盖现有钱包)。

3.添加到克劳德代码

增添 ~/.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"
      }
    }
  }
}

使用真实路径 dist/mcp-server/index.js。参见 广州网络 下面是广州的设置。

4.重新启动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
  }
}

兑换推荐码(新用户)

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"

克劳德将:

  1. 呼叫 clawd_domain_purchase → 获取付款详细信息
  2. 呼叫 x402_payment_request → 执行USDC付款
  3. 呼叫 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."
}

全部27个工具

钱包工具(5)

工具 说明 示例
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"

支出控制(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"

广州网络工具(6)

看 广州网络 用于设置和使用。

工具 说明 示例
canton_configure 创建新参与方或设置现有参与方ID "Configure Canton: create a new party with display name test-wallet"
canton_check_balance 检查广州币(CC)余额 "Check my Canton balance"
canton_list_holdings 列出所有CIP-56代币持有量(UTXO) "List my Canton holdings"
canton_get_party_info 获取参与方ID、验证器URL、网络 "Show my Canton party info"
canton_transfer 将CC发送给另一方(需要收件人+金额) "Transfer 10 CC to <recipient-party-id>"
canton_transaction_history 查看发送/接收历史记录 "Show my Canton transactions"

常见工作流

新用户引导

1. "Redeem referral code CLAWD2024"     → Get $15 USDC
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

域名+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

广州网络

Canton Network工具允许您创建各方、检查余额、列出代币持有情况、转移Canton Coin(CC)和查看交易历史。

设置

  • 本地(Splice LocalNet): 看 CANTON_LOCALNET.md 用于Docker设置、MCP环境配置和故障排除。
  • DevNet(或其他非本地): 无需额外设置。从MCP配置中省略Canton env变量;默认情况下,服务器使用公共DevNet端点。

Canton env变量(仅适用于LocalNet或自定义部署):

CANTON_USE_LOCALNET=true                                    # Use local Splice; omit for DevNet
CANTON_VALIDATOR_URL=http://127.0.0.1:2903/api/validator    # LocalNet default
CANTON_LEDGER_API_URL=http://127.0.0.1:2975                 # LocalNet default

用法

1.创建一个聚会(首先需要)

You: "Configure Canton: create a new party with display name test-wallet"

退货:

{
  "success": true,
  "partyId": "test-wallet::12205301d046...",
  "network": "localnet",
  "validatorUrl": "<validator API base, e.g. http://127.0.0.1:2903/api/validator (local) or https://canton-devnet.digitalasset.com/api/v1 (DevNet)>",
  "ledgerApiUrl": "<ledger API URL, e.g. http://127.0.0.1:2975 (local) or https://canton-devnet.digitalasset.com/ledger/v1 (DevNet)>"
}

2.检查余额

You: "Check my Canton balance"

3.列出所持股份

You: "List my Canton holdings"

4.转让

You: "Transfer 10 CC to <recipient-party-id>"

需要 接收者 (完整的政党ID)和 数量.

5.交易历史

You: "Show my Canton transactions"

错误

错误 原因 修复
Canton not configured 还没有聚会 快跑 canton_configure 随着 displayName 创建一个聚会,或与 partyId 使用现有
The requested resource could not be found 验证程序URL错误 当地: 看 CANTON_LOCALNET.md. 其他: 集 CANTON_VALIDATOR_URL 在MCP环境中。
Unexpected token '<', "<!DOCTYPE "... 点击HTML而不是API 验证程序URL必须是API基础,而不是UI端口(例如2000)。
fetch failed / ECONNREFUSED Canton未运行或URL错误 当地: 启动Splice LocalNet。 其他: 检查验证器和分类账URL
Invalid recipient party ID format 错误的参与者ID 使用完整的参与者ID(例如。 name::1220...).
Insufficient balance for transfer CC不足 请检查余额 canton_check_balance.
No Canton signing key 没有用于传输的私钥 创建派对 canton_configure (无partyId)因此密钥被存储,或配置为 partyId + privateKey.

错误参考

钱包错误

错误 原因 修复
Configuration not found 钱包未初始化 运行 clawd init 或 npm run init (请参阅快速入门)
No wallet found in keychain 钱包未初始化或钥匙链被拒绝 运行 clawd init 或 npm run init;检查操作系统密钥链权限
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服务器:

# 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

后端(铁路部署):

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": ["/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"
      }
    }
  }
}

有关Canton环境变量,请参阅 广州网络.


建筑

┌─────────────────────────────────────────────────────────────┐
│  Claude Code / MCP Client                                   │
└─────────────────────────┬───────────────────────────────────┘
                          │ MCP Protocol (stdio)
                          ▼
┌─────────────────────────────────────────────────────────────┐
│  CLAWD Wallet MCP Server (27 tools)                         │
│  ├─ Wallet: balance, payments, history                      │
│  ├─ Referral: code redemption                               │
│  ├─ TAP: identity verification                              │
│  ├─ Domains: search, purchase, DNS                          │
│  └─ Canton: balance, holdings, transfers                    │
└──────────┬──────────────────────┬──────────────┬────────────┘
           │                      │              │
           │ USDC on Base         │ HTTPS        │ Canton Ledger API
           ▼                      ▼              ▼
┌──────────────────┐    ┌────────────────┐    ┌────────────────┐
│  Base Network    │    │ Domain Backend │    │  Canton DevNet │
│  (x402 services) │    │ (Railway)      │    │  (CIP-56)      │
└──────────────────┘    └───────┬────────┘    └────────────────┘
                                │
                                ▼
                        ┌────────────────────┐
                        │  Porkbun API       │
                        └────────────────────┘

安全

  • 私钥:存储在操作系统密钥链中(macOS密钥链、Windows凭据管理器、Linux libsecret)
  • 支出限额:10美元/笔,50美元/天(可配置)
  • TAP凭据:存储在 ~/.clawd/tap/ 具有0600权限
  • 付款审批:所有付款都需要克劳德代码中明确的用户批准
  • 代码中没有秘密:所有凭据都通过环境变量或密钥链

发展

# Build
npm run build

# Initialize wallet (creates key in keychain + ~/.clawd/config.json)
npm run init
# Or, after npm link: clawd init
# Use clawd init --force to overwrite an existing wallet

# 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

代码更改后

每当您修改TypeScript源文件时,都必须在更改生效之前重新生成:

npm run build

然后 重新启动MCP客户端 (例如Claude Code),因此它会获取新的服务器二进制文件。

提示: 使用 npm run dev (观察模式)在开发过程中保存后自动重建。您仍然需要重新启动MCP客户端以加载新的二进制文件。


将后端部署到铁路

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代码中

  1. 完全重新启动Claude代码(而不仅仅是重新加载)
  2. 检查中的MCP配置语法 ~/.claude.json
  3. 手动测试服务器: node dist/mcp-server/index.js

域名购买停留在“待定”状态

  1. 检查付款交易完成时间 BaseScan
  2. 验证 tx_hash 格式: 0x +64个十六进制字符
  3. 检查后端日志中是否存在Porkbun API错误

转介时“财政部未配置”

推荐赎回需要资金钱包。对于操作员:

export CLAWD_TREASURY_PRIVATE_KEY=0x...

API 参考

看 docs/API.md文件 获取完整的工具输入/输出模式。


许可证

阿帕奇-2.0