Machine Utility Foundry (Safe x402 Wallet & Trust Oracles)

السجل الرسمي المالية والمدفوعات

Auto-paying x402 MCP wallet bridge, honeypot & wash-trade oracle, route failover & ICP guardrails.

التثبيت

أضف هذا إلى إعدادات MCP في عميلك (Claude Desktop: claude_desktop_config.json، وCursor: ‏.cursor/mcp.json، ويستخدم VS Code وغيره الصيغة نفسها «mcpServers»).

Remote (streamable-http)
Claude Code
claude mcp add --transport http machine-utility-foundry-safe-x402-wallet 'https://machine-utility-foundry.meritoriousmatrix00.workers.dev/mcp'
إعداد JSON (Claude Desktop وCursor وVS Code)
{
    "mcpServers": {
        "machine-utility-foundry-safe-x402-wallet": {
            "type": "http",
            "url": "https://machine-utility-foundry.meritoriousmatrix00.workers.dev/mcp"
        }
    }
}
NPM package foundry-x402
Claude Code
claude mcp add machine-utility-foundry-safe-x402-wallet -e 'EVM_PRIVATE_KEY=<your evm_private_key>' -e 'MAX_PAYMENT_USD=0.05' -e 'SESSION_BUDGET_USD=1.00' -e 'FOUNDRY_WAL_PATH=<FOUNDRY_WAL_PATH>' -e 'FOUNDRY_BASE_URL=https://machine-utility-foundry.meritoriousmatrix00.workers.dev' -- npx -y foundry-x402@0.4.5 mcp
إعداد JSON (Claude Desktop وCursor وVS Code)
{
    "mcpServers": {
        "machine-utility-foundry-safe-x402-wallet": {
            "command": "npx",
            "args": [
                "-y",
                "foundry-x402@0.4.5",
                "mcp"
            ],
            "env": {
                "EVM_PRIVATE_KEY": "<your evm_private_key>",
                "MAX_PAYMENT_USD": "0.05",
                "SESSION_BUDGET_USD": "1.00",
                "FOUNDRY_WAL_PATH": "<FOUNDRY_WAL_PATH>",
                "FOUNDRY_BASE_URL": "https://machine-utility-foundry.meritoriousmatrix00.workers.dev"
            }
        }
    }
}

متغيرات البيئة

  • EVM_PRIVATE_KEY سري Optional isolated Base Mainnet USDC micro-wallet private key (0x...) from `npx -y foundry-x402 new-wallet` for automatic EIP-3009 payment.
  • MAX_PAYMENT_USD Maximum USD allowed on any single paid x402 call.
  • SESSION_BUDGET_USD Maximum cumulative USD spend allowed per MCP session.
  • FOUNDRY_WAL_PATH Optional path for the pre-send fsync JSONL payment WAL (default resolves via LOCALAPPDATA, XDG_STATE_HOME, or ~/.foundry-x402/wal.jsonl; set to 'off' or 'none' to disable).
  • FOUNDRY_BASE_URL Optional Machine Utility Foundry origin URL override.

التوثيق

مأخوذ من ملف README للمشروع على GitHub ويُحدَّث أسبوعيًا. تفتح الروابط على GitHub.

المحتويات
  1. Machine Utility Foundry (foundry-x402)
  2. 1. Quick Start: Claude Desktop / Cursor / Windsurf (Zero-ETH Gasless Auto-Pay)
  3. 2. Quick Start: TypeScript / Node / Cloudflare Workers SDK (v0.4.4)
  4. 3. For x402 API Providers: Copy-Paste Docs Snippets
  5. 4. Core x402 Trust & Routing Oracles (Primary Wedge)
  6. 5. Operations & Verification

Machine Utility Foundry (foundry-x402)

Safe Auto-Paying x402 Wallet & Counterparty Trust Oracle for Claude Desktop, Cursor, and Autonomous AI Agents (Worker v1.2.2 / foundry-x402@0.4.4).

Autonomous agents and desktop AI clients face three blockers when consuming x402 paid APIs on Base Mainnet (eip155:8453 USDC):

  1. Desktop MCP clients cannot sign EIP-3009 payments natively.
  2. External x402 catalogs contain wash-traded bots, price bait-and-switch endpoints, and post-payment 402 honeypots.
  3. Network drops or client crashes after signing can cause accidental double-payments on retries or fallback routes.

foundry-x402@0.4.4 solves all three: a local spend-capped Base USDC wallet bridge with pre-send fsync WAL & Base L2 reconciliation + pre-settlement Ed25519 trust screening + automatic on-chain slashing backed by Internet Computer (ICP) and Cloudflare Edge KV.


1. Quick Start: Claude Desktop / Cursor / Windsurf (Zero-ETH Gasless Auto-Pay)

Generate an isolated Base Mainnet USDC micro-wallet in memory (never written to disk), fund it with $1–$3 Base USDC (0 ETH gas required — EIP-3009 settlement is gas-sponsored), and paste the printed mcpServers JSON into your client config:

npx -y foundry-x402 new-wallet

Gives your AI assistant:

  • safe_x402_request — Safely call & pay any external https:// x402 API with pre-settlement honeypot screening, split-horizon bait-and-switch defense, per-call/session USD caps, automatic pre-send fsync WAL (FOUNDRY_WAL_PATH), and post-payment slashing.
  • foundry_wallet_status — Live Base USDC balance, remaining session budget, and unresolved WAL count ($0 free local check).
  • All Foundry Discovery & Failover Oracles — Automatic $0 zero-charge empty checks and seamless micro-USDC settlement when verified routes exist.

2. Quick Start: TypeScript / Node / Cloudflare Workers SDK (v0.4.4)

npm install foundry-x402
import {
  FileWriteAheadPaymentStore,
  X402OutcomeUnknownError,
  createBaseUsdcPaymentAdapter,
  createSafeX402Fetch,
  fetchWithSafeFailover,
  reconcileBaseUsdcAuthorization,
} from "foundry-x402";

const safeFetch = createSafeX402Fetch({
  paymentAdapter: createBaseUsdcPaymentAdapter(process.env.EVM_PRIVATE_KEY!),
  maxAcceptableUsd: 0.05,
  maxDynamicPriceMultiplierByEndpoint: { "api.example.com": 2 },
  attemptStore: new FileWriteAheadPaymentStore("./.foundry-x402/wal.jsonl"),
});

try {
  // 1-call parallel-quarantined failover across live-verified x402 providers:
  const { response, selectedUrl } = await fetchWithSafeFailover({
    safeFetch,
    need: "weather forecast",
    maxPriceUsd: 0.01,
  });
  console.log(selectedUrl, response.status);
} catch (err) {
  if (err instanceof X402OutcomeUnknownError) {
    const { authorizer, nonce, validBefore } = err.attempt;
    if (authorizer && nonce && validBefore) {
      // Gasless Base L2 block-pinned USDC.authorizationState check before any retry
      const recon = await reconcileBaseUsdcAuthorization({ authorizer, nonce, validBefore });
      console.log(recon.status, recon.safeToRetry);
    }
  }
  throw err;
}
v0.4.4 Crash-Safe & L2 Guarantees
  • OUTCOME_UNKNOWN Fail-Closed Failover & In-Process Dedup: fetchWithSafeFailover throws X402OutcomeUnknownError and halts before calling fallback providers whenever a post-sign request drops or returns HTTP non-2xx (even if PAYMENT-RESPONSE is present). createSafeX402Fetch enables InMemoryPaymentAttemptStore by default so accidental duplicate retries in the same process are blocked automatically.
  • Base L2 Block-Pinned Reconciliation: reconcileBaseUsdcAuthorization pins eth_getBlockByNumber("latest") and USDC.authorizationState to the same RPC block (with a 6s sequencer buffer) before returning CONFIRMED_NOT_SETTLED (safeToRetry: true).
  • Pre-Send fsync WAL: FileWriteAheadPaymentStore (enabled automatically in npx -y foundry-x402 mcp via FOUNDRY_WAL_PATH resolving LOCALAPPDATA / XDG_STATE_HOME / ~/.foundry-x402/wal.jsonl; 'off' or 'none' disables) persists SIGNED_IN_FLIGHT across process crashes/restarts before outbound socket I/O.
  • Per-Endpoint Dynamic Price Tolerance: maxDynamicPriceMultiplierByEndpoint overrides maxDynamicPriceMultiplier (default 5) per exact normalized URL or lowercase hostname, always capped by maxAcceptableUsd.

See packages/x402-safe-fetch/README.md for @x402/core zero-extra-roundtrip adapter options and InMemoryPaymentAttemptStore usage.


3. For x402 API Providers: Copy-Paste Docs Snippets

Give Claude/Cursor users and autonomous TypeScript agents a spend-capped, honeypot-screened client for your x402 API (requires a funded Base Mainnet eip155:8453 USDC micro-wallet; 0 ETH gas needed via EIP-3009):

Claude Desktop / Cursor Wallet Setup (fund $1–$3 Base USDC & paste printed JSON into MCP config):

npx -y foundry-x402 new-wallet

TypeScript / Node Safe Client:

import {
  FileWriteAheadPaymentStore,
  createBaseUsdcPaymentAdapter,
  createSafeX402Fetch,
} from "foundry-x402";

const safeFetch = createSafeX402Fetch({
  paymentAdapter: createBaseUsdcPaymentAdapter(process.env.EVM_PRIVATE_KEY!),
  maxAcceptableUsd: 0.10, // Set >= your endpoint's max USD price (e.g. 1.00 for $1 endpoints)
  paidProbeThresholdUsd: 0.01, // Optional: skip the $0.005 Foundry Oracle fee on sub-cent ($0.001) micro-calls
  attemptStore: new FileWriteAheadPaymentStore("./.foundry-x402/wal.jsonl"), // Optional: persist duplicate-pay guard across restarts
});

4. Core x402 Trust & Routing Oracles (Primary Wedge)

All oracle verdicts include offline-verifiable Ed25519 signatures (/.well-known/jwks.json) and IC Mainnet ledger proofs:

  • POST /v1/x402/route-plan ($0.015 — $0.00 if 0 matches) — Parallel-quarantined x402 failover planner: live-probes top wash-filtered candidates in parallel and returns signed primary + fallback execution tickets with locked paymentTerms.
  • GET|POST /v1/x402/recommend ($0.005 — $0.00 if 0 matches) — Neutral (ZERO_SELF_PREFERENCE), wash-filtered x402 API recommender with organic 30-day payer counts.
  • POST /v1/oracle/x402-counterparty ($0.005) — Live 402 header, official Base USDC asset, SSRF/DNS-rebinding-safe liveness, bait-and-switch, and historical reputation score (0–100).
Free Public Discovery & On-Chain Slashing Endpoints ($0.00)
  • GET /v1/x402/recommend-preview?need={task} — Free match count, masked host hint, and price range preview before paying.
  • GET /v1/oracle/reputation-stats — Live 2-hour autonomous Bazaar crawl stats, wash-trade counts, & IC Mainnet anchor receipt.
  • POST /v1/oracle/delivery-feedback — Free EIP-191 payer-signed & Base Mainnet eth_getTransactionReceipt-verified post-payment slashing endpoint.
  • llms.txt · GET /llms.txt — LLM-readable endpoint, SDK v0.4.4, and provider snippet index.
  • GET /v1/verify/:receiptId · GET /.well-known/jwks.json · GET /.well-known/x402 · GET /.well-known/mcp.json · GET /openapi.json · POST /mcp
Secondary Deterministic Guardrails & Attestation Utilities
  • POST /v1/state/budget-guard ($0.005) — Payer-isolated ICP shared multi-agent budget cap & atomic nonce replay guard.
  • POST /v1/guard/evm-preflight ($0.01) — Fail-closed Base Mainnet eth_call simulator & unlimited approve / Permit2 / counterfeit USDC guard.
  • POST /v1/attest/artifact ($0.005) & POST /v1/attest/bundle ($0.015) — Deterministic JSON Schema / Policy / BigInt Ledger audit anchored on IC Mainnet.
  • POST /v1/diff/breaking-openapi ($0.01) — Deterministic $ref & allOf OpenAPI 3.x breaking-change auditor (up to 2 MB).

5. Operations & Verification

npm.cmd run typecheck        # Sync Apify modules & typecheck Worker + SDK
npm.cmd test                 # Run full unit & Red-Team regression suite
npm.cmd run deploy           # Build SDK & deploy Cloudflare Worker + Cron + KV
npm.cmd run pulse            # Live OpenAPI, full 8-tool MCP, 402 & external Base USDC audit
npm.cmd run bazaar:bootstrap # $0.07 E2E settlement check across all 8 routes
npm.cmd run canary:run       # Execute isolated micro-USDC mystery-shopper sweep

الأسئلة الشائعة

ما هو Machine Utility Foundry (Safe x402 Wallet & Trust Oracles)؟

Auto-paying x402 MCP wallet bridge, honeypot & wash-trade oracle, route failover & ICP guardrails.

كيف أثبّت Machine Utility Foundry (Safe x402 Wallet & Trust Oracles)؟

يعمل كخادم بعيد. في Claude Code: claude mcp add --transport http machine-utility-foundry-safe-x402-wallet 'https://machine-utility-foundry.meritoriousmatrix00.workers.dev/mcp'. وفي العملاء الآخرين، الصق إعداد JSON من هذه الصفحة في إعدادات MCP الخاصة بهم.

هل يحتاج Machine Utility Foundry (Safe x402 Wallet & Trust Oracles) إلى مفتاح API؟

نعم. يتطلب EVM_PRIVATE_KEY، وتضبطها في إعداداته.

هل Machine Utility Foundry (Safe x402 Wallet & Trust Oracles) مفتوح المصدر؟

شيفرته علنية على GitHub، لكن المستودع لا يعلن ترخيصًا قياسيًا.

من يصون Machine Utility Foundry (Safe x402 Wallet & Trust Oracles)؟

ينشره sapphire-japan. يدرجه AI.tn لكنه لا يصونه ولا يوصي به.

من سجل MCP الرسمي. الإدراج ليس توصية: راجع شيفرة الخادم وصلاحياته قبل منحه الوصول إلى بياناتك.