openapi: 3.1.0
info:
  title: DeFi Position Health MCP (x402)
  version: 0.1.0
  description: |
    Pay-per-call EVM DeFi position-health service. Composes Morpho Blue
    borrow/collateral positions + Aerodrome veAERO governance lock + Pendle PT
    (fixed-yield) holdings + Lido LST balances into a 0–100 health score with
    itemized reasons. Companion to wallet-portfolio-risk-mcp (Aave/Compound/UniV3).
    Settle USDC on Base via x402.
servers:
  - url: https://defi-position-health-mcp.mtree.workers.dev
x-pricing:
  - path: /v1/wallet/defi_position_health
    method: POST
    price: $0.30
    amount: "0.30"
    asset: USDC
    network: base
  - path: /v1/wallet/defi_protocol_breakdown
    method: POST
    price: $0.10
    amount: "0.10"
    asset: USDC
    network: base
paths:
  /healthz:
    get:
      summary: Service health
      responses:
        "200":
          description: OK
  /v1/wallet/defi_position_health:
    post:
      summary: Composite EVM DeFi position health (4 sources fused)
      description: |
        $0.30 USDC on Base via x402. Composes Morpho Blue borrow/collateral
        positions + Aerodrome AERO + veAERO governance + Pendle PT holdings +
        Lido LST balances into a 0–100 health score. Multichain — defaults to
        ethereum + base; opt-in arbitrum/optimism/polygon via the `chains` field.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [address]
              properties:
                address:
                  type: string
                  description: EVM address (0x… 20 bytes)
                chains:
                  type: array
                  items: { type: string, enum: [ethereum, base, arbitrum, optimism, polygon] }
                  description: Chains to scan. Default ['ethereum','base']
      responses:
        "402":
          description: Payment required (x402 envelope returned)
        "200":
          description: Composite DeFi position-health view
  /v1/wallet/defi_protocol_breakdown:
    post:
      summary: Per-protocol DeFi position breakdown (Morpho/Aerodrome/Pendle/Lido)
      description: |
        $0.10 USDC on Base via x402. Single-chain Morpho Blue + Aerodrome +
        Pendle + Lido position list — no aggregate score, just per-protocol
        position payloads.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [address]
              properties:
                address:
                  type: string
                  description: EVM address (0x… 20 bytes)
                chain:
                  type: string
                  enum: [ethereum, base, arbitrum, optimism, polygon]
                  default: ethereum
      responses:
        "402":
          description: Payment required (x402 envelope returned)
        "200":
          description: Per-protocol DeFi breakdown payload
