openapi: 3.1.0
info:
  title: Wallet Portfolio History MCP
  version: 0.1.0
servers:
  - url: https://wallet-portfolio-history-mcp.mtree.workers.dev
paths:
  /tools/portfolio_totals:
    post:
      summary: portfolio_totals
      description: Hosted wallet portfolio totals for EVM agents: native balance, curated token totals, freshness, provenance, and risk flags before routing funds.
      x-x402-price-usd: 0.20
      responses:
        '200': { description: Paid wallet dataset response }
        '402': { description: x402 payment required }
  /tools/token_balances:
    post:
      summary: token_balances
      description: Curated ERC20 token balances across high-volume EVM chains with D1-backed historical wallet snapshots and source coverage.
      x-x402-price-usd: 0.15
      responses:
        '200': { description: Paid wallet dataset response }
        '402': { description: x402 payment required }
  /tools/defi_balances:
    post:
      summary: defi_balances
      description: Hosted DeFi balance and protocol-position snapshot for wallet diligence: Aave/Compound receipt-token reads, Aerodrome/Lido coverage, protocol interaction hints, D1 history, freshness, and provenance.
      x-x402-price-usd: 0.20
      responses:
        '200': { description: Paid wallet dataset response }
        '402': { description: x402 payment required }
  /tools/transaction_history:
    post:
      summary: transaction_history
      description: Recent wallet transaction history for Base addresses from hosted snapshots plus Blockscout provenance, designed for agent pre-action context.
      x-x402-price-usd: 0.25
      responses:
        '200': { description: Paid wallet dataset response }
        '402': { description: x402 payment required }
  /tools/account_identity:
    post:
      summary: account_identity
      description: Derived account identity for EVM agents: curated labels, activity tags, top counterparties, protocol interactions, and holding context from hosted D1 wallet snapshots.
      x-x402-price-usd: 0.15
      responses:
        '200': { description: Paid wallet dataset response }
        '402': { description: x402 payment required }
  /tools/portfolio_change_digest:
    post:
      summary: portfolio_change_digest
      description: Hosted portfolio change digest for agents: compare current wallet state against prior D1 snapshots, flag token balance deltas, new transactions, DeFi position changes, and transaction-velocity alerts before autopay or routing funds.
      x-x402-price-usd: 0.20
      responses:
        '200': { description: Paid wallet dataset response }
        '402': { description: x402 payment required }
  /tools/counterparty_risk_graph:
    post:
      summary: counterparty_risk_graph
      description: Hosted wallet counterparty risk graph for agents: rank recent counterparties, protocol touchpoints, transaction edges, concentration, failed-call signals, labels, and a 0-100 counterparty risk score from D1 wallet history.
      x-x402-price-usd: 0.25
      responses:
        '200': { description: Paid wallet dataset response }
        '402': { description: x402 payment required }
  /tools/wallet_activity_risk:
    post:
      summary: wallet_activity_risk
      description: Hosted wallet activity-risk score for agents before autopay or signing: transaction velocity, failed calls, counterparty concentration, protocol touchpoints, balance context, alerts, and recommended agent policy from refreshed D1 wallet history.
      x-x402-price-usd: 0.20
      responses:
        '200': { description: Paid wallet dataset response }
        '402': { description: x402 payment required }
  /tools/wallet_risk_scorer:
    post:
      summary: wallet_risk_scorer
      description: Hosted wallet risk scorer for agents: exact buyer-vocabulary wallet risk score using transaction patterns, counterparty exposure, failed-call signals, protocol touchpoints, balance context, 0-100 activity risk, alerts, and recommended autopay/signing policy from refreshed D1 wallet history.
      x-x402-price-usd: 0.20
      responses:
        '200': { description: Paid wallet dataset response }
        '402': { description: x402 payment required }
  /tools/transaction_patterns:
    post:
      summary: transaction_patterns
      description: Hosted wallet transaction-pattern analysis for agents: method mix, cadence, inbound/outbound flow, failed status pattern, top counterparties, protocol touches, burst risk score, and autopay policy from refreshed D1 wallet history.
      x-x402-price-usd: 0.20
      responses:
        '200': { description: Paid wallet dataset response }
        '402': { description: x402 payment required }
  /tools/wallet_autopay_risk:
    post:
      summary: wallet_autopay_risk
      description: Hosted wallet autopay risk report for agent-commerce spend controls: 0-100 wallet risk score, transaction-pattern burst risk, counterparty exposure, failed-call signals, protocol touchpoints, spend-limit guidance, and recommended autopay policy from refreshed D1 wallet history.
      x-x402-price-usd: 0.20
      responses:
        '200': { description: Paid wallet dataset response }
        '402': { description: x402 payment required }
  /tools/wallet_spend_limit_policy:
    post:
      summary: wallet_spend_limit_policy
      description: Hosted wallet spend-limit policy for autonomous agents: per-call and per-counterparty caps, autopay spend controls, wallet risk score, transaction-pattern burst signals, counterparty exposure, and fresh D1 provenance before an agent pays.
      x-x402-price-usd: 0.25
      responses:
        '200': { description: Paid wallet dataset response }
        '402': { description: x402 payment required }
  /tools/wallet_allowance_policy:
    post:
      summary: wallet_allowance_policy
      description: Hosted wallet allowance policy for autonomous agents: token allowance risk, approval exposure, curated spender watchlist, revoke/cap guidance, and autopay spend-control policy from fresh D1 wallet snapshots plus live allowance reads.
      x-x402-price-usd: 0.25
      responses:
        '200': { description: Paid wallet dataset response }
        '402': { description: x402 payment required }
  /tools/token_approval_risk:
    post:
      summary: token_approval_risk
      description: Hosted token approval risk for autonomous agents: token-by-token spender approval exposure, allowance-to-balance ratios, risky/unlimited approval flags, revoke-or-cap actions, and agent spend-control policy from fresh D1 wallet snapshots plus live allowance reads.
      x-x402-price-usd: 0.25
      responses:
        '200': { description: Paid wallet dataset response }
        '402': { description: x402 payment required }
  /tools/approval_risk:
    post:
      summary: approval_risk
      description: Hosted approval risk check for Base and EVM agents before signing token approvals or swaps: dangerous spender approvals, unlimited allowance exposure, approval-to-balance ratios, revoke-or-cap actions, and agent spend-control policy from fresh D1 wallet snapshots plus live allowance reads.
      x-x402-price-usd: 0.20
      responses:
        '200': { description: Paid wallet dataset response }
        '402': { description: x402 payment required }
  /tools/agent_spend_controls:
    post:
      summary: agent_spend_controls
      description: Hosted agent spend controls for autonomous wallets: approval-risk gate, per-call and per-counterparty limits, wallet risk score, transaction-pattern burst signals, risky spender approvals, and autopay spend policy from fresh D1 wallet snapshots plus live allowance reads.
      x-x402-price-usd: 0.25
      responses:
        '200': { description: Paid wallet dataset response }
        '402': { description: x402 payment required }
  /dataset/health:
    get:
      responses:
        '200': { description: Dataset health }
