xenarch — CLI for Xenarch's x402 MCP server
Xenarch is a non-custodial x402 MCP server. Claude, Cursor and any MCP client pay for HTTP 402–gated content with USDC micropayments on Base L2. Direct agent-to-publisher settlement on-chain. 0% Xenarch fee. The agent wallet only ever holds USDC — no ETH, no gas coin needed.
This package is the xenarch command-line tool. Use it from a terminal to manage an agent wallet, pay x402-gated URLs by hand, and (for publishers) register sites and check stats against the Xenarch API.
What it does
Agent commands:
xenarch wallet — create / inspect / export the local agent wallet
xenarch check <url> — probe a URL for an x402 challenge without paying
xenarch pay <url> — pay an x402-gated URL with USDC on Base L2 and fetch the content
xenarch history — list past payments made from this wallet
Publisher commands:
xenarch login / xenarch register — authenticate with the Xenarch API
xenarch site-add / xenarch sites — register and list publisher sites
xenarch stats — view per-site payment stats
xenarch payout — manage payout settings
Global flags: --json for machine-readable output, --api-base to override the API URL, --rpc-url to override the Base RPC endpoint.
Install
npm install -g xenarch
Requires Node.js 18 or later.
Quick start
xenarch wallet create
xenarch check https://example.com/premium-article
xenarch pay https://example.com/premium-article
xenarch history --json
Set XENARCH_PRIVATE_KEY to use an existing wallet instead of the local one, and XENARCH_MAX_PAYMENT_USD to cap per-call spend (default unbounded).
Agent control plane (optional)
If you've created an xa_live_* token from the Xenarch dashboard at https://dash.xenarch.dev/agent/settings, set it as the XENARCH_API_TOKEN env var. Every xenarch pay will:
- Preflight with the platform — server-enforced caps (per-tx, daily, monthly), scope rules (allow/deny domain patterns), and a fleet-wide kill switch. Refused payments stop before any USDC is signed.
- Settle on chain via a third-party x402 facilitator (PayAI, xpay, Heurist, etc.) — same as before.
- Report the receipt back to the dashboard so you see spend, hit counters, and refusal audits in one place.
export XENARCH_API_TOKEN=xa_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xenarch pay https://example.com/premium-article
Without the env var, the CLI works exactly as before — receipt reporting + control-plane enforcement are opt-in. Network failures during receipt POST queue offline at ~/.xenarch/receipts-queue.jsonl and retry on next invocation.
What refusals look like
When the control plane refuses a payment, the CLI prints the reason and exits with code 1. No USDC is signed and no transaction is sent.
$ xenarch pay https://api.openai.com/v1/chat
Refused by Xenarch control plane: daily cap exceeded ($1.00 spent of $1.00). Resets in 18h 22m.
Edit cap at https://dash.xenarch.dev/agent/caps
$ xenarch pay https://api.openai.com/v1/audio/speech
Refused by Xenarch control plane: per-transaction cap exceeded (max $0.50).
Raise the cap at https://dash.xenarch.dev/agent/caps
$ xenarch pay https://api.scammer.com/x
Refused by Xenarch control plane: scope rule '*.scammer.com' ("phish") matched this URL.
Edit rules at https://dash.xenarch.dev/agent/scope
$ xenarch pay https://example.com/anything
Refused by Xenarch control plane: agent is paused.
Toggle the kill switch off at https://dash.xenarch.dev/agent/scope
If the platform itself is unreachable (control plane down, network error), the CLI fails closed: refuses to pay rather than risk bypassing a cap or kill switch you configured. Brief platform outages briefly stall payments; the fail-closed default protects budgets over throughput.
Links
Learn more: https://xenarch.com