Skip to main content
Glama

cardzero-mcp

npm version License: MIT

CardZero 的 MCP 服务器 —— 一个为 Base 链上的 AI 智能体提供的智能合约钱包,以 USDC 计价。

赋予你的 AI 智能体以下能力:

  • 创建钱包并查询 USDC 余额

  • 发送直接 USDC 支付(收取 2% 平台费)

  • 支付 x402 保护的 HTTP 资源(HTTP 402 付费墙)

  • 运行 ERC-8183 托管任务 (escrow Jobs) 以进行 A2A 服务交付(收取 2% 平台费 + 5% 评估费)

  • 在链上查询支付/任务状态

CardZero 是底层的 API 层;此 MCP 封装了 REST 端点,因此任何支持 MCP 的客户端(Claude Desktop、Claude Code、Cursor、VS Code 等)都可以通过 stdio 调用它们。

前提条件

CardZero API 密钥 和 钱包 ID,在 CardZero 控制面板 认领钱包后获取。

Related MCP server: x402tools MCP Server

配置

Claude Desktop

编辑 ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "cardzero": {
      "command": "npx",
      "args": ["-y", "cardzero-mcp"],
      "env": {
        "CARDZERO_API_KEY": "czapi_...",
        "CARDZERO_WALLET_ID": "wallet_..."
      }
    }
  }
}

Claude Code

claude mcp add cardzero -- npx -y cardzero-mcp

或者添加到项目中的 .mcp.json:

{
  "mcpServers": {
    "cardzero": {
      "command": "npx",
      "args": ["-y", "cardzero-mcp"],
      "env": {
        "CARDZERO_API_KEY": "czapi_...",
        "CARDZERO_WALLET_ID": "wallet_..."
      }
    }
  }
}

Cursor

设置 → MCP 服务器 → 添加新服务器:

  • 名称: cardzero

  • 命令: npx -y cardzero-mcp

  • 环境变量: CARDZERO_API_KEY, CARDZERO_WALLET_ID

VS Code

添加到 .vscode/settings.json:

{
  "mcp": {
    "servers": {
      "cardzero": {
        "command": "npx",
        "args": ["-y", "cardzero-mcp"],
        "env": {
          "CARDZERO_API_KEY": "czapi_...",
          "CARDZERO_WALLET_ID": "wallet_..."
        }
      }
    }
  }
}

环境变量

变量

必需

描述

CARDZERO_API_KEY

是(用于工具调用)

来自 CardZero 控制面板的智能体 API 密钥 (czapi_...)

CARDZERO_WALLET_ID

是(用于钱包范围工具)

来自 CardZero 控制面板的钱包 ID (wallet_...)

CARDZERO_API_URL

否

API 基础 URL — 默认为 https://api.cardzero.ai/v1

即使没有这些变量,服务器也会启动并响应 tools/list — 单个工具调用随后会返回一个清晰的 config_missing 错误。

可用工具 (10)

直接支付

工具

描述

create_wallet

创建一个新的 CardZero 钱包。返回地址 + 人类所有者的一次性认领密钥。无需身份验证。

get_balance

查询钱包当前的 USDC 余额。

send_payment

向任何以太坊地址发送 USDC。从你的钱包中扣除 2% 的费用。

list_payments

查看最近的支付历史。

get_payment

通过 ID 查询特定支付。无需身份验证。

x402

工具

描述

pay_x402

支付 x402 保护的 HTTP 资源。返回一个用于重试请求的支付标头。

ERC-8183 任务(托管 / A2A 服务交付)

工具

描述

create_job

创建一个任务,托管 USDC 直到提供者交付且评估者批准。

fund_job

将预算锁定到托管中。状态:open → funded。

submit_job

提供者提交交付成果。状态:funded → submitted → 自动评估。

get_job

读取当前状态(状态、交易、评估结果)。无需身份验证 — 任务状态是公开的。

工作原理

此 MCP 服务器是一个调用 CardZero REST API 的轻量级客户端。它在你的机器上本地运行,并通过 stdio 与你的 AI 助手通信。本地不存储任何数据。

AI Assistant (Claude / Cursor / VS Code)
  ⇅ stdio (JSON-RPC)
cardzero-mcp (local Node process)
  ⇅ HTTPS
api.cardzero.ai → Base mainnet (USDC + ERC-4337 + ERC-8004 + ERC-8183)

开发

git clone https://github.com/mrocker/cardzero-mcp.git
cd cardzero-mcp
npm install
npm run dev   # tsx-watch the source
npm run build # compile to ./dist

资源

许可证

MIT

Available Tools

10 tools
create_jobA

Create a Job that escrows USDC payment until a Provider delivers and an Evaluator approves. Use this for A2A service delivery (vs send_payment for direct transfers). Confirm budget + provider with user first. Provider must have a CardZero wallet (Sprint 9 MVP requirement).

Inputs: providerAddress (required), budgetUsdc (required), expiredAt (required), title (required), +3 more.

create_walletA

Create a new CardZero wallet. Returns a wallet address and one-time claim key for the human owner. No authentication required.

Inputs: name.

fund_jobA

Fund a Job created via create_job. Locks the budget USDC into escrow. Requires that the Job is in 'open' state. Two on-chain operations: USDC.approve(jobs) + Jobs.fund. Status: open → funded.

Inputs: jobId (required).

get_balanceA

Check the current USDC balance of your CardZero wallet.

Inputs: no named parameters.

get_jobA

Get the current state of a Job (status, budget, transactions, evaluation outcome). No authentication required — Job state is public.

Inputs: jobId (required).

get_paymentA

Check the status of a specific payment by its ID. No authentication required.

Inputs: paymentId (required).

list_paymentsB

View recent payment history for your CardZero wallet.

Inputs: limit, offset.

pay_x402A

Pay for an x402-protected HTTP resource (HTTP 402 Payment Required). Use after receiving a 402 response. Returns a paymentHeader to include in the retry request as X-PAYMENT header.

Inputs: url (required), maxAmount (required), recipient (required), network, +2 more.

send_paymentA

Send a USDC payment to any Ethereum address. A 2% service fee is deducted automatically from your wallet. Confirm amount and recipient with the user before calling.

Inputs: to (required), amount (required), memo, idempotencyKey.

submit_jobA

Submit a deliverable for a Job (Provider side). Posts the deliverable hash on-chain; Evaluator then auto-approves or rejects. Status: funded → submitted.

Inputs: jobId (required), contentHash (required), contentURI.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.9/5.0

    Scored across 10 tools

    Disambiguation4/5

    Tools have distinct purposes overall, but send_payment and pay_x402 both involve sending payments, potentially causing slight confusion. Descriptions help differentiate them.

    Naming Consistency5/5

    All tools follow a consistent verb_noun pattern with underscores, e.g., create_job, get_balance, send_payment. No mixing of styles.

    Tool Count5/5

    10 tools cover the core wallet and job escrow functionality without being excessive or insufficient for the stated purpose.

    Completeness4/5

    Core workflows are covered, but missing tools like list_jobs or cancel_job could hinder full lifecycle management. Minor gap.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      Provides AI agents with 10 pay-per-call utility tools (QR generation, DNS lookup, OCR, etc.) using USDC on Base via the x402 protocol, with agent's private key never leaving the agent.
      11
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI agents to check their wallet address and USDC balance, preview the cost of an x402 call, and pay for API requests in USDC on Base without an account or API key. Spend caps, allow-lists and blocked contracts are enforced in code before anything is signed, so a prompt injection cannot bypass them.
      1
      MIT