Repository avatar
AI Tools
v1.3.0
active

cerberus-x402-mcp

io.github.Boxxji/cerberus-x402-mcp

Pay-per-call Web3 & AI security MCP server settled in Base & Arbitrum USDC via x402.

Documentation

Cerberus x402 MCP Server & SDK

CI PayAI x402 Settlement License: MIT MCP Protocol x402 Protocol

Zero-bloat Model Context Protocol (MCP) JSON-RPC 2.0 stdio server and TypeScript x402 client SDK (v1.1.0) for the live Cerberus Web3 & AI supply-chain security edge API:

Live Edge API: https://x402-cerberus-worker.boxxon.workers.dev/
x402 Discovery Manifest: https://x402-cerberus-worker.boxxon.workers.dev/.well-known/x402.json
OpenAPI 3.1.0 Schema: https://x402-cerberus-worker.boxxon.workers.dev/openapi.json
AI Crawler Index (llms.txt): https://x402-cerberus-worker.boxxon.workers.dev/llms.txt
Health & PayAI Settlement Status: https://x402-cerberus-worker.boxxon.workers.dev/health

No API keys, no accounts, no monthly subscriptions — AI agents and developers pay per request in Base (8453) or Arbitrum (42161) USDC using HTTP 402 + EIP-3009 TransferWithAuthorization, signed locally via viem and settled live on-chain via PayAI Facilitator (https://facilitator.payai.network).


3-Line Quick Start (Pay $0.05 USDC on Base via PayAI)

import { scanRepo } from "@boxxji/cerberus-x402-mcp";

const report = await scanRepo({ repoUrl: "Boxxji/cerberus-x402-mcp" }, { preferredNetwork: "base", payerPrivateKey: process.env.X402_PAYER_PRIVATE_KEY });
console.log(JSON.stringify(report, null, 2));

See ready-to-run integration files in examples/:


Pricing & Endpoints

MCP ToolHTTP EndpointPrice (USDC)Description
cerberus_list_endpointsGET /health & /.well-known/x402.jsonFREELive health, PayAI settlement status, schema, pricing, and payout discovery
cerberus_token_riskPOST /v1/onchain/token-risk$0.03Read-only EVM bytecode, EIP-1967 proxy slot, opcode (SELFDESTRUCT/DELEGATECALL), and 4-byte selector risk scan
cerberus_scan_repoPOST /v1/cerberus/scan-repo$0.057-layer anti-honeypot, prompt-injection, suspicious binary, postinstall hook, obfuscation, drainer, and DLP secret scan
cerberus_sbom_auditPOST /v1/sbom/audit$0.10CycloneDX 1.5 JSON SBOM generator + typosquatting, unpinned versions, lifecycle hooks, and license risk audit (package.json, requirements.txt, Cargo.toml)
cerberus_audit_solidityPOST /v1/cerberus/audit-solidity$0.1510-detector Solidity contest auditor (ERC-4626 inflation, oracle staleness, unchecked ERC-20, reentrancy, signature replay, tx.origin, delegatecall, precision loss, unprotected init/selfdestruct, fee-on-transfer) + Foundry Test.sol scaffold

Quick Start: Claude Desktop / Cursor / Windsurf / Antigravity

Drop examples/claude-desktop-config.json into your MCP client configuration:

{
  "mcpServers": {
    "cerberus-x402": {
      "command": "npx",
      "args": ["-y", "@boxxji/cerberus-x402-mcp"],
      "env": {
        "CERBERUS_X402_BASE_URL": "https://x402-cerberus-worker.boxxon.workers.dev",
        "X402_NETWORK": "base",
        "X402_PAYER_PRIVATE_KEY": ""
      }
    }
  }
}
  • Read-only / Quote Mode (no key required): Leave X402_PAYER_PRIVATE_KEY empty or omitted to run cerberus_list_endpoints for free and inspect structured HTTP 402 payment quotes on paid tools without spending funds.
  • Autonomous x402 Settlement Mode: Supply your own funded Base or Arbitrum USDC wallet private key via X402_PAYER_PRIVATE_KEY locally on your machine. Private keys are never transmitted, logged, or hardcoded — they only sign EIP-3009 typed data locally via viem/accounts.

CLI Usage

# Verify live worker health (facilitatorConfigured: true), /, /llms.txt, /openapi.json, /.well-known/x402.json
npx -y @boxxji/cerberus-x402-mcp --verify-live

# Print live Base (8453) & Arbitrum (42161) EIP-3009 USDC payment requirements for any endpoint
npx -y @boxxji/cerberus-x402-mcp --quote scan-repo
npx -y @boxxji/cerberus-x402-mcp --quote audit-solidity

# Discover live endpoints and pricing (free)
npx -y @boxxji/cerberus-x402-mcp --discover

# Run as an MCP JSON-RPC 2.0 stdio server
npx -y @boxxji/cerberus-x402-mcp

How the x402 EIP-3009 + PayAI On-Chain Flow Works

Agent / SDK                      Cerberus Edge Worker (Cloudflare)          PayAI Facilitator
    │                                          │                                    │
    ├── POST /v1/cerberus/scan-repo ──────────►│                                    │
    │                                          │                                    │
    │◄── HTTP 402 Payment Required ────────────┤                                    │
    │    (accepts: Base 8453 & Arbitrum 42161, │                                    │
    │     payTo: 0x51E2...C5A1, amount: 50000) │                                    │
    │                                          │                                    │
    ├─ 1. Verify payTo === Wallet 1 :: SI_Gemini                                    │
    ├─ 2. Verify canonical Base/Arbitrum USDC asset                                 │
    ├─ 3. Sign EIP-3009 TransferWithAuthorization locally via viem (gasless)        │
    │                                          │                                    │
    ├── POST /v1/cerberus/scan-repo ──────────►├── POST /settle (EIP-3009 USDC) ───►│
    │    Header: X-PAYMENT: <base64 payload>   │◄── On-chain txHash receipt ────────┤
    │                                          │                                    │
    │◄── HTTP 200 OK + Audit JSON ─────────────┤                                    │
    │    Header: X-PAYMENT-RESPONSE            │                                    │

TypeScript SDK Examples

npm install @boxxji/cerberus-x402-mcp
import {
  CerberusX402Client,
  discover,
  getQuote,
  verifyLive,
} from "@boxxji/cerberus-x402-mcp";

// 1. Free live verification & quote inspection
const liveStatus = await verifyLive();
console.log(liveStatus.ok, liveStatus.facilitatorConfigured);

const quote = await getQuote("scan-repo");
console.log(quote.priceUsd, quote.eip3009Requirements);

// 2. Call paid endpoints with automatic HTTP 402 -> EIP-3009 USDC signing -> retry
const client = new CerberusX402Client({
  preferredNetwork: "base", // or "arbitrum"
  payerPrivateKey: process.env.X402_PAYER_PRIVATE_KEY, // optional; returns 402 quote if omitted
});

const repoReport = await client.scanRepo({ repoUrl: "Boxxji/cerberus-x402-mcp" });
const tokenReport = await client.checkTokenRisk({
  chain: "base",
  address: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
});
const sbomReport = await client.auditSbom({
  format: "package.json",
  content: JSON.stringify({ name: "demo", dependencies: { viem: "^2.23.0" } }),
});
const solidityReport = await client.auditSolidity({
  filename: "Vault.sol",
  source: "pragma solidity ^0.8.24; contract Vault { }",
});

console.log({ repoReport, tokenReport, sbomReport, solidityReport });

curl Examples

# Free health, OpenAPI 3.1.0, llms.txt, and x402 discovery
curl -sS https://x402-cerberus-worker.boxxon.workers.dev/health | jq '{status, facilitatorConfigured, facilitatorUrl}'
curl -sS https://x402-cerberus-worker.boxxon.workers.dev/.well-known/x402.json | jq '.endpoints[] | {id, path, pricing}'
curl -sS https://x402-cerberus-worker.boxxon.workers.dev/openapi.json | jq '.openapi, (.paths | keys)'
curl -sS https://x402-cerberus-worker.boxxon.workers.dev/llms.txt | head -n 20

# Inspect HTTP 402 payment challenge for a paid endpoint
curl -i -sS -X POST https://x402-cerberus-worker.boxxon.workers.dev/v1/onchain/token-risk \
  -H "Content-Type: application/json" \
  -d '{"chain":"base","address":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"}'

Security & Payout Pinning (Wallet 1 :: SI_Gemini)

Before signing any EIP-3009 authorization, signEip3009Payment() strictly verifies:

  1. Pinned Payout Address: challenge.payTo MUST match Wallet 1 :: SI_Gemini (0x51E24000948150400166b40d486dB7b3C5b2C5A1) — preventing MITM or redirected payment challenges.
  2. Canonical USDC Contracts Only:
    • Base (8453): 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913
    • Arbitrum (42161): 0xaf88d065e77c8cC2239327C5EDb3A432268e5831
  3. Local-Only Keys: Private keys are supplied exclusively by the caller via X402_PAYER_PRIVATE_KEY or runtime option and never leave the caller's process.

Verified Public Receiving Addresses (Wallet 1 :: SI_Gemini)

  • EVM (Base 8453 & Arbitrum 42161 USDC): 0x51E24000948150400166b40d486dB7b3C5b2C5A1 (Basescan | Arbiscan)
  • Solana: H8ckc19KdGFoCAXh1cGjQL4bGP75DdAvnRQMBpGypRQx (Solscan)

Development

npm install
npm run typecheck
npm run build
npm test
npm pack --dry-run

License

MIT

No installation packages available.