CRA AGENT

io.github.giupy997由 GitHub 账号 giupy997 发布v0.0.11更新于 Nov 3, 2026

Lets an agent pay for x402 APIs in USDC on Arc, under a spending policy it cannot change.

概览

AI 生成的概览

让 AI 代理在 Arc 上以 USDC 查找、询价并支付 x402 API,支出受环境变量中固定的策略约束。

可以做什么
  • 搜索并询价 Arc 上可购买的 API,返回方法、URL、参数、价格、卖家以及策略是否允许支付
  • 支付某个 URL 并取回响应与签名收据,可选通过闪电网络以比特币支付,并可为单次调用设上限
  • 查询钱包与 Circle Gateway 余额,并把钱包中的 USDC 转入 Gateway
  • 查看每次尝试的账本,把已结算支付与链上转账对应,并验证其他代理的收据
  • 显示当前生效的支出限额,并在测试网上处理 ERC-8183 托管任务
适用场景
适合希望代理自行用 Arc 上的 USDC 购买 API 调用或数据,同时需要硬性支出限额、收据和审计记录的场景;也适合在付费前先确认某个端点价格。
运行要求
通过 npx 从 npm 包 @cra-agent/mcp 在本地运行。需要 CRA_KEY_FILE 指向一个权限为 chmod 600、存放代理私钥的文件,并设置 CRA_NETWORK 为 arc 或 arcTestnet。CRA_POLICY 设定支出限额,CRA_RPC_URL 与 DATABASE_URL 可选。钱包需有 USDC,首次支付前还需一次性存入 Circle Gateway。
安装前请注意
它持有私钥并在主网上花费真实 USDC,钱包只应放入愿意花掉的金额,且不要把私钥写进提示词。支付不可撤销且流向第三方卖家;策略限额从环境变量读取,模型无法自行提高。可选的闪电网络支付使用另一个钱包文件,账本也可存入 Postgres。

安装

在 SourceWeft 中

  1. 打开 控制台中的 CRA AGENT,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

@cra-agent/mcp

An MCP server that lets an AI agent pay for an API call. The agent calls one tool, the rail reads the x402 price, checks a spending policy, pays in USDC on Arc through Circle Gateway with no gas for the buyer, and keeps the receipt.

The model never sees the key, and it cannot raise its own limit: both are read from the environment before the conversation starts.

Install

bash
npm i -g @cra-agent/mcp

Set it up in one command

bash
cra-agent init --client claude-desktop

Creates the agent's key in ~/.cra-agent/agent.key (readable only by you, never overwritten), checks the limits, writes the entry into the client's config file with a copy of the old one, and prints the address to fund. --client is claude-desktop, cursor, claude-code or terminal; --policy, --network, --key-file and --dry-run do what they say. CRA Factory writes the command for you from four questions.

Or by hand, from any MCP client

json
{ "mcpServers": { "cra-agent": {    "command": "cra-agent-mcp",    "env": {      "CRA_NETWORK": "arc",      "CRA_KEY_FILE": "/path/to/agent.key",      "CRA_POLICY": "daily=5,per_seller=0.5,per_payment=0.05"    }} } }

CRA_KEY_FILE points at a file holding the private key, chmod 600. Never put a key in a prompt.

Tools

ToolWhat it does
arc_searchFinds what can be bought on Arc from a few words ("bitcoin price", "web search"): CRA AGENT's own data, the CRA market, and the endpoints Circle's x402 catalogue lists as payable on Arc (Exa, Goldsky, BlockRun and others). Each result: the method and the URL with example parameters, where each parameter goes (query, path or JSON body), the price, the seller, who listed it, and whether your policy allows paying it now. Free.
arc_quoteReads the price of a URL and says whether the policy would allow it. Pays nothing. For a POST, pass the body the payment will carry: some sellers check it before they name a price.
arc_payPays for the URL and returns the response with a receipt. With lightning: true it pays in bitcoin over Lightning when the seller's 402 offers it (x402 exact on lnbtc), from the wallet in CRA_NWC_PAY_FILE, under the same limits in dollars. Limits are checked on what the 402 asks at pay time, before anything is signed. maxUsdc adds a ceiling for that one call: pass the price arc_search listed, and a seller who raised it since is refused even inside your limits.
arc_balanceWallet and Circle Gateway balances.
arc_depositMoves wallet USDC into the Gateway balance. Needed once before the first payment.
arc_ledgerEvery attempt: quoted, rejected, signed, settled, failed.
arc_proofMatches settled payments to the on-chain transfer that carried them.
arc_verify_receiptChecks a signed receipt from another agent: who signed it, and whether the payment fitted the limits it states.
arc_policyShows the limits in force.
arc_job_*ERC-8183 escrow jobs. Testnet only until the contract is deployed on Arc mainnet.

An agent that pays for its own thinking

cra-agent think "<task>" runs a small autonomous agent whose brain is a pay-per-call LLM on Arc: BlockRun's chat completions, found in the bazaar, Claude Haiku 4.5 by default. Every thought is a paid call, and so is every tool the brain asks for: it searches the bazaar for free, then buys what it needs at the listed price. There is no API key anywhere, only the agent's wallet. The session budget (--budget, default $0.10) and the spending policy cover thinking and tools alike, a thought is capped with --ceiling (default $0.01), and the brain can only buy a URL that one of its searches returned. It prints each step with its cost and ends with the bill: so much for thinking, so much for tools. A short task costs a few cents: the run on cra-agent.tech/think that found when Arc mainnet went live and who validates it cost $0.023648, four thoughts and one web search from Exa.

It also knows a few free public APIs, called without paying and shown as such: DexScreener's pairs, boosted tokens and new token profiles, digested to what answers questions (pairs by 24-hour volume). --tools <file> keeps it to a list of URL prefixes: anything else is never shown to it, so never bought.

With --record and a DATABASE_URL, the run is kept in Postgres as it happens, step by step, which is how the page shows it live and replays it after. --questions <file> picks the question when none is given, which is how our server runs it on a timer: the file combines templates (What is the price of {coin} right now?) with lists (@coin = bitcoin (BTC) | ether (ETH)), and a recorded run never repeats one of the last hundred questions.

The same agent can be hired by anyone, over x402 upto: GET https://api.cra-agent.tech/v1/upto/think?task=… asks you to sign for up to $0.10 and charges what the run spent plus $0.005. arc_pay and cra-agent pay pay routes like this one: your policy is checked against the ceiling, since all of it could be taken, and your ledger keeps what was. The default policy allows $0.05 a payment, so give this one more with per_payment=0.10.

Fund the agent from Base or Solana

Paying on Arc takes USDC in Circle Gateway on Arc, and most agents hold theirs on Base or Solana. One command brings it over and deposits it:

bash
cra-agent fund 5 --from base                                    # from this agent's own wallet on Base, same key and addresscra-agent fund 5 --from solana --solana-key-file ~/sol.json     # from a Solana wallet: our hex seed or solana-keygen's JSONcra-agent fund 5 --from base --dry-run                          # everything checked, nothing signed

It asks Eco for a route, and checks the quote before signing anything, from the transaction's own calldata: a CCTP burn of exactly that amount to Arc's domain, minting to this agent, a fee under the cap (--max-fee, default 0.5% or $0.01), the refund to the same wallet. From Base, the vault the USDC goes into must be the one Eco's Portal derives for that intent. It then waits for the USDC on Arc, usually seconds, and deposits it into Gateway, leaving $0.01 in the wallet for Arc's gas (--keep, or --no-deposit to keep it all in the wallet). From Base the wallet needs a little ETH for two transactions, about a cent; from Solana, a little SOL. The model has no tool for this: moving money between chains is the owner's call, from a terminal.

The same thing from a terminal

bash
cra-agent find bitcoin price    # what is for sale on Arc; needs no key (in a browser: cra-agent.tech/bazaar)cra-agent balancecra-agent quote https://api.cra-agent.tech/v1/paid/rpc/healthcra-agent quote https://api.exa.ai/search --body '{"query":"x402 on Arc"}'           # the price of a POST, with its bodycra-agent fund 5 --from base   # USDC from Base to this agent on Arc, into Gatewaycra-agent deposit 1cra-agent withdraw 1            # Gateway balance back to the wallet; how a seller collectscra-agent pay   https://api.cra-agent.tech/v1/paid/rpc/healthcra-agent pay   https://api.exa.ai/search 0.007 --body '{"query":"x402 on Arc"}'   # a POST, refused above the listed pricecra-agent think "What is x402, in two sentences?" --budget 0.10              # an agent that pays for its own thinkingcra-agent proofcra-agent verify receipt.json      # needs no key and no networkcra-agent pq-key ~/.cra-agent/pq.key           # a post-quantum key for receipts; prints only its public halfcra-agent verify receipt.json --require-pq --on-arc   # the second signature too, and Arc's own verdict on it

Every receipt carries the limits the payment passed under and is signed with the agent's key, so someone who was not there can check it. The signature proves the agent issued the statement and nobody changed it; the settlement on chain is the independent half.

Environment

VariableMeaning
CRA_NETWORKarc (mainnet) or arcTestnet. Default arcTestnet.
CRA_KEY_FILE / CRA_PRIVATE_KEYThe agent's key. Prefer the file.
CRA_POLICYdaily=5,per_seller=0.5,per_payment=0.05,rate=120/60s,allow=a.com|b.com,deny=c.com
CRA_RPC_URLOptional, one or several separated by commas, in priority order. Tried before the public Arc endpoints.
CRA_RPC_STRICT1 to never fall back to a public endpoint.
CRA_BASE_RPC_URL / SOLANA_RPC_URLOptional, for fund: the Base and Solana endpoints. Public ones by default.
DATABASE_URLOptional Postgres for the ledger. Without it the ledger lives in memory.
CRA_PQ_KEY_FILEOptional, the file cra-agent pq-key made. Every receipt is then signed a second time with SLH-DSA-SHA2-128s, the post-quantum scheme Arc verifies on chain. It covers the receipt, not the payment, and adds about a second to each one.

Two things worth knowing. A payment is settled only after the seller's handler succeeds, so a failing endpoint costs nothing: https://api.cra-agent.tech/v1/paid/selftest/fail always answers 500 so you can check. And identity=required pays only sellers with an ERC-8004 identity on Arc: the address that gets paid must own an agent in the registry, or be the wallet an agent declared for payments. It proves an identity exists, not that the seller is honest; registering costs only gas.

Part of CRA AGENT

Payments for AI agents on Arc, Circle's USDC-native L1. Site: cra-agent.tech · Source: github.com/giupy997/arcagentx402 · MIT

来源:packages/mcp/README.md,提交 47ab8f9

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

6
  1. v0.0.11最新Sep 23, 2026
  2. v0.0.9Sep 23, 2026
  3. v0.0.6Sep 22, 2026
  4. v0.0.4Sep 21, 2026
  5. v0.0.3Sep 20, 2026
  6. v0.0.2Sep 19, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分