USDD 백서

bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 12쪽 중 7쪽

arnSa`) use §6.7 — it is not here. **Endpoint.** <mark style="color:blue;">`GET /api/v1/smart-allocator/detail-overview`</mark> — Base URL & auth see §1. **Request parameters.** None. **Request example.** ```bash curl "https://openapi.usdd.io/api/v1/smart-allocator/detail-overview" ``` **Response fields — top level.** <table><thead><tr><th width="152.625">Field</th><th width="104.9453125">Type</th><th width="115.42578125">Existence</th><th width="114.84375">Unit</th><th>Description</th></tr></thead><tbody><tr><td>apy</td><td>number</td><td>always</td><td>percent</td><td>Smart Allocator blended APY — a <strong>percentage</strong> (<code>3.4268</code> = 3.4268%)</td></tr><tr><td>debt</td><td>number</td><td>always</td><td>USDD</td><td>Total debt managed by Smart Allocator</td></tr><tr><td>platformSummaryInfos[]</td><td>array</td><td>always</td><td>—</td><td>Positions per (platform × chain × asset)</td></tr><tr><td>vaultInfos[]</td><td>array</td><td>always</td><td>—</td><td>Smart Allocator Vaults per chain</td></tr></tbody></table> **Response fields — `platformSummaryInfos[]`.** <table><thead><tr><th width="150.203125">Field</th><th width="116.4296875">Type</th><th width="115.0625">Existence</th><th width="115.46875">Unit</th><th>Description</th></tr></thead><tbody><tr><td>platform</td><td>string</td><td>always</td><td>text</td><td>DeFi platform, e.g. <code>Aave</code>, <code>Morpho</code>, <code>JustLend</code>, <code>Spark</code>, <code>Venus</code>, <code>ListaDAO</code></td></tr><tr><td>chain</td><td>string</td><td>always</td><td>enum</td><td>Chain, e.g. <code>eth</code>, <code>tron</code>, <code>bsc</code>, <code>plasma</code></td></tr><tr><td>gemSymbol</td><td>string</td><td>always</td><td>text</td><td>Asset symbol, e.g. <code>USDT</code>, <code>USDC</code>, <code>USDS</code>, <code>USDT0</code></td></tr><tr><td>holdingAmount</td><td>number</td><td>always</td><td>USD</td><td>Current holding</td></tr><tr><td>apyHoldingAmount</td><td>number</td><td>always</td><td>USD</td><td>APY-weighted holding amount used in the blended APY calculation</td></tr><tr><td>apy</td><td>number</td><td>always</td><td>decimal</td><td>Position APY</td></tr><tr><td>actualEarnings</td><td>number</td><td>always</td><td>USD</td><td>Cumulative actual earnings</td></tr><tr><td>operatorAddress</td><td>string</td><td>always</td><td>address</td><td>Operator address</td></tr><tr><td>strategy</td><td>string</td><td>always</td><td>text</td><td>Strategy type, e.g. <code>Investment</code></td></tr><tr><td>tag</td><td>string | null</td><td>nullable</td><td>text</td><td>Risk-curator tag, e.g. <code>Gauntlet</code>, <code>Steakhouse</code>; may be empty or <code>null</code></td></tr></tbody></table> **Response fields — `vaultInfos[]`.** <table><thead><tr><th width="152.9140625">Field</th><th width="110.06640625">Type</th><th width="114.51953125">Existence</th><th width="115.28515625">Unit</th><th>Description</th></tr></thead><tbody><tr><td>chain</td><td>string</td><td>always</td><td>enum</td><td>Chain</td></tr><tr><td>vaultType</td><td>string</td><td>always</td><td>text</td><td>SA Vault identifier, e.g. <code>SA001-A</code></td></tr><tr><td>contractAddress</td><td>string</td><td>always</td><td>address</td><td>Vault contract address</td></tr><tr><td>debt</td><td>number</td><td>always</td><td>USDD</td><td>Current Vault debt</td></tr></tbody></table> **Response example (truncated).** ```json { "code": 0, "message": "SUCCESS", "data": { "apy": 3.4268, "debt": 837933499.00, "platformSummaryInfos": [ { "platform": "Aave", "chain": "eth", "gemSymbol": "USDT", "holdingAmount": 43488409.16, "apyHoldingAmount": 119040213.57, "apy": 2.737286, "actualEarnings": 3550427.88, "operatorAddress": "0xD00e0079B8CAB524F3fa20EA879a7736E512a5Fc", "strategy": "Investment", "tag": "" } ], "vaultInfos": [ { "chain": "tron", "vaultType": "SA001-A", "contractAddress": "TYyC3kxzMYC1sGKpui79VAzwn992jCA6fN", "debt": 589698996.00 } ] } } ``` **Errors.** See §3. Note `apy` here is a percentage, unlike every other APY field in this document. *** ### 7. Quick Reference for AI Agents <a href="#id-28" id="id-28"></a> <table><thead><tr><th width="292.359375">To query</th><th width="104.08984375">Call</th><th>Key fields</th></tr></thead><tbody><tr><td>Total / circulating supply (single number)</td><td>§6.1 / §6.2</td><td>bare numeric value</td></tr><tr><td>Earn APY per chain</td><td>§6.3</td><td><code>tronApy</code> / <code>ethApy</code> / <code>bscApy</code></td></tr><tr><td>USDD or sUSDD supply by chain</td><td>§6.4 / §6.5</td><td><code>totalSupply</code>, <code>tron</code>, <code>eth</code>, <code>bsc</code></td></tr><tr><td>Protocol size, real-time</td><td>§6.6</td><td><code>totalSupply</code>, <code>tvl</code></td></tr><tr><td>Protocol size with 24h change</td><td>§6.7</td><td><code>*DailyChange</code></td></tr><tr><td>Cumulative Vault investment profits</td><td>§6.7</td><td><code>earnSa</code></td></tr><tr><td>APY history curve</td><td>§6.8</td><td><code>items[].items[]</code></td></tr><tr><td>USDD supply history</td><td>§6.9</td><td><code>usdd[3]</code>, <code>susdd[3]</code></td></tr><tr><td>Collateral value history</td><td>§6.10</td><td><code>collateralValue[3]</code></td></tr><tr><td>Vault list and configuration</td><td>§6.11</td><td><code>items[]</code></td></tr><tr><td>Vault real-time state per chain</td><td>§6.12</td><td><code>items[].collateralRatio</code>, <code>mintedUSDD</code></td></tr><tr><td>Single-chain history (debt / supply / apy)</td><td>§6.13</td><td><code>items[]</code></td></tr><tr><td>Smart Allocator allocations and earnings</td><td>§6.14</td><td><code>platformSummaryInfos[]</code></td></tr></tbody></table> Rules for automated consumption: * Branch on the `code` field, not the HTTP status — business errors return HTTP 200 (§3). * Always check `code == 0` before reading `data` (except §6.1 / §6.2, bare numbers). * Treat APY as a decimal, except `smart-allocator/detail-overview.apy`, which is a percentage. * Null-check `nullable` fields: `apy`, `estimatedAnnualEarnings`, `psmFee`, `tag`, `time`. * An empty or zero result is success, not an error (§2.5). * In history arrays of length 3, element order is fixed: `[tron, eth, bsc]`. * Use a high-precision decimal type for APY fields, which may carry 29 digits. # MCP Server ### What It Is The USDD MCP Server is a [Model Context Protocol](https://modelcontextprotocol.io/) implementation that allows AI agents to interact with the **USDD decentralized stablecoin protocol** across **TRON, Ethereum, and BNB Smart Chain**. The server enables both core protocol operations — Vault/CDP, PSM, and Savings — and general-purpose chain utilities such as token balance queries and allowance management. **GitHub**: <https://github.com/decentralized-usd/mcp-server-usdd> ### Key Capabilities **USDD Protocol** * **Vault / CDP**: Full vault lifecycle management — open vaults, deposit collateral, mint USDD, repay debt, withdraw, and close. Includes real-time oracle and liquidation configuration per collateral type. * **Vault Risk Monitoring**: AI-guided risk assessment with collateral ratio checks, liquidation threshold warnings, and vault health summaries. * **PSM (Peg Stability Module)**: Real-time fee and enablement status for each PSM. Swap supported stablecoins into USDD or redeem USDD back to the underlying gem. * **USDD Savings**: Inspect current savings rate, sUSDD metrics, and wallet share positions. Deposit and withdraw USDD through the savings module. * **Token Approvals**: Check allowances and approve token spending for USDD protocol interactions. **General Chain** * **Balances**: Native (TRX / ETH / BNB) and ERC20 / TRC20 token balances across TRON, Ethereum, and BNB Smart Chain (plus internal testnets). * **Allowances & Approvals**: Read token allowance for any spender, compare against a required amount, and approve token spending for USDD protocol interactions. * **Protocol Discovery**: Configured contract addresses, collateral types (ilks), PSM joins, and debt ceilings per network. * **Networks**: Supported network list with chain keys (`tron`, `eth`, `bsc` + internal testnets); per-family default network selection with aliases (`mainnet`, `nile`). * **Wallet**: Signing-address resolution per network, dual signing modes (browser / agent), and wallet management — connect browser wallet, list / switch / import wallets. * **Token Transfers**: Two-step preview → confirm flow for safe asset transfers across TRX, TRC20, ETH / BNB native, and ERC20. The AI must present transfer details and wait for explicit user confirmation; pending previews expire after 10 minutes. **Protocol Analytics** * **Protocol & Chain Metrics**: Aggregated USDD protocol metrics and per-chain metrics (collateral breakdown, USDD supply, utilization) from mainnet data feeds. * **Collateral Prices**: Latest highest-price data per collateral type from the website API. * **Treasury**: Latest USDD treasury report summary and JST buyback & burn statistics. * **Smart Allocator**: Investment overview (debt, invested amount, earnings, APY), asset breakdown by protocol / network / asset, proof-of-reserve platform details, and debt overview grouped by network vault. ### Supported Networks <table><thead><tr><th width="193.8828125">Network</th><th width="185.46875">Key</th><th>Notes</th></tr></thead><tbody><tr><td>TRON</td><td><code>tron</code></td><td>TRON-native vault and PSM support</td></tr><tr><td>Ethereum</td><td><code>eth</code></td><td>Vault, PSM, USDD Savings</td></tr><tr><td>BNB Smart Chain</td><td><code>bsc</code></td><td>Mirrors ETH deployment structure</td></tr><tr><td>TRON Nile</td><td><code>tron_nile</code></td><td>Internal testnet deployment</td></tr><tr><td>Ethereum Sepolia</td><td><code>eth_sepolia</code></td><td>Internal testnet deployment</td></tr><tr><td>BSC Testnet</td><td><code>bsc_testnet</code></td><td>Internal testnet deployment</td></tr></tbody></table> ### Prerequisites * Node.js 20+ * Optional but recommended: * `TRONGRID_API_KEY` for more reliable TRON access * dedicated `ETH_RPC_URL` * dedicated `BSC_RPC_URL` ### Developer #### Installation ``` git clone https://github.com/decentralized-usd/mcp-server-usdd cd mcp-server-usdd npm install ``` #### Usage ``` npm start npm run start:http npm run dev ``` ### Configuration #### Wallet Modes <table><thead><tr><th width="198.09765625">Mode</th><th>When to use</th><th>Key storage</th></tr></thead><tbody><tr><td><strong>Browser</strong> (TronLink-compatible)</td><td>Sign in a browser extension (TronLink)</td><td>Wallet extension</td></tr><tr><td><strong>Agent</strong></td><td>Automation / CI / headless; required for EVM signing</td><td>Encrypted local file under <code>~/.agent-wallet/</code>, never exported</td></tr></tbody></table> Private keys are **never** returned by any MCP tool. **CLI (agent-wallet)** The server uses [@bankofai/agent-wallet](https://github.com/BofAI/agent-wallet) for encrypted local wallet storage. On first startup it will automatically initialize \~/.agent-wallet/ and create a default wallet if none exists. ```bash # Import an existing private key or mnemonic npx agent-wallet add # Generate a new wallet npx agent-wallet generate # List all wallets npx agent-wallet list # Switch active wallet npx agent-wallet activate <wallet-id> ``` **Wallet management MCP tools(runtime)** <table data-header-hidden><thead><tr><th width="225.05078125">Tool</th><th>Description</th></tr></thead><tbody><tr><td><code>get_wallet_address</code></td><td>Shows current address (auto-generates wallet if needed)</td></tr><tr><td><code>connect_browser_wallet</code></td><td>Connect TronLink / browser wallet for signing</td></tr><tr><td><code>set_wallet_mode</code></td><td>Switch between browser and agent signing</td></tr><tr><td><code>get_wallet_mode</code></td><td>Show current signing mode and addresses</td></tr><tr><td><code>list_wallets</code></td><td>List wallets with per-family active status (<code>tron</code> and <code>evm</code>)</td></tr><tr><td><code>set_active_wallet</code></td><td>Switch active wallet by ID, optionally scoped by <code>walletType</code> (<code>tron</code>/<code>evm</code>)</td></tr></tbody></table> #### Environment Variables ```bash # Strongly recommended — avoids TronGrid 429 rate limiting on mainnet export TRONGRID_API_KEY="your_trongrid_api_key" ``` #### Client Configuration **Claude Desktop** Add the following config to: `~/Library/Application Support/Claude/claude_desktop_config.json` ```json { "mcpServers": { "mcp-server-usdd": { "type": "stdio", "command": "npx", "args": ["-y", "@usdd/mcp-server-usdd"], "env": { "TRONGRID_API_KEY": "your_trongrid_api_key" } } } } ``` **Claude Code** Create `.mcp.json` in the project root directory: ```json { "mcpServers": { "mcp-server-usdd": { "type": "stdio", "command": "npx", "args": ["-y", "@usdd/mcp-server-usdd"], "env": { "TRONGRID_API_KEY": "your_trongrid_api_key" } } } } ``` **Cursor** Add to .cursor/mcp.json: ```json { "mcpServers": { "mcp-server-usdd": { "type": "stdio", "command": "npx", "args": ["-y", "@usdd/mcp-server-usdd"], "env": { "TRONGRID_API_KEY": "your_trongrid_api_key" } } } } ``` ### Tools #### Side-Effect & Risk Classification <a href="#side-effect-26-risk-classification" id="side-effect-26-risk-classification"></a> All tools are classified by side-effect level. Hosts MUST surface `remote-write` and `destructive` operations to the user before execution. <table><thead><tr><th width="164.97265625">Level</th><th>Definition</th><th>Tools</th></tr></thead><tbody><tr><td><code>safe</code></td><td>Pure local read, no network</td><td><p><code>get_supported_networks</code>, </p><p><code>get_network</code>, </p><p><code>get_wallet_mode</code>, </p><p><code>get_wallet_address</code>, </p><p><code>list_wallets</code></p></td></tr><tr><td><code>network-read</code></td><td>Read-only on-chain or HTTP query</td><td><p><code>get_protocol_overview</code>, </p><p><code>get_supported_ilks</code>, </p><p><code>get_native_balance</code>, </p><p><code>get_token_balance</code>, </p><p><code>check_allowance</code>, </p><p><code>get_oracle_status</code>, </p><p><code>get_user_vaults</code>, </p><p><code>get_vault_summary</code>, </p><p><code>analyze_vault_risk</code>, </p><p><code>get_psm_status</code>, </p><p><code>get_savings_status</code>, </p><p><code>get_protocol_metrics</code>, </p><p><code>get_chain_metrics</code>, </p><p><code>get_collateral_prices</code>, </p><p><code>get_psm_metrics</code>, </p><p><code>get_treasury_summary</code>, <code>get_jst_buyback_stats</code>, </p><p><code>get_smart_allocator_overview</code>, </p><p><code>get_assets_breakdown</code>, </p><p><code>get_proof_of_reserve</code>, </p><p><code>get_debt_overview</code></p></td></tr><tr><td><code>local-write</code></td><td>Modifies local config / wallet store</td><td><p><code>set_network</code>, </p><p><code>set_wallet_mode</code>, </p><p><code>set_active_wallet</code>, </p><p><code>import_wallet</code>, </p><p><code>connect_browser_wallet</code></p></td></tr><tr><td><code>remote-write</code></td><td>Broadcasts a tx, costs gas, HITL required</td><td><p><code>approve_token</code>, </p><p><code>open_vault</code>, </p><p><code>deposit_and_mint</code>,</p><p> <code>mint_usdd</code>,</p><p> <code>repay_usdd</code>, </p><p><code>withdraw_collateral</code>, </p><p><code>psm_swap_to_usdd</code>, </p><p><code>psm_swap_from_usdd</code>, </p><p><code>deposit_savings</code>, </p><p><code>withdraw_savings</code>, </p><p><code>prepare_token_transfer</code>, </p><p><code>confirm_token_transfer</code>, </p><p><code>close_vault</code></p></td></tr></tbody></table> **Safe to retry**: `safe`, `network-read`, and all `prepare_*` previews.\ **NOT safe to retry**: every `remote-write` tool — a duplicate call may broadcast a second tx. #### Wallet & Network <a href="#id-8.1-wallet-26-network" id="id-8.1-wallet-26-network"></a> <table><thead><tr><th width="215.08984375">Tool</th><th width="229.9375">Description</th><th width="94.6875">Write?</th><th>Input schema</th></tr></thead><tbody><tr><td><code>get_supported_networks</code></td><td>List supported networks</td><td>No</td><td>—</td></tr><tr><td><code>set_network</code></td><td>Set the default network for a family (<code>tron</code>/<code>eth</code>/<code>bsc</code>); accepts <code>mainnet</code> / <code>nile</code> aliases</td><td>Yes</td><td><strong>Required</strong>: <code>network: string</code> (key or alias) · <strong>Optional</strong>: <code>family: "tron" \| "eth" \| "bsc"</code></td></tr><tr><td><code>get_network</code></td><td>Show per-family default networks</td><td>No</td><td>—</td></tr><tr><td><code>get_wallet_mode</code></td><td>Show current signing mode and addresses</td><td>No</td><td><strong>Optional</strong>: <code>network</code></td></tr><tr><td><code>set_wallet_mode</code></td><td>Switch signing mode: <code>agent</code> / <code>browser</code></td><td>Yes</td><td><strong>Required</strong>: <code>mode: "browser" \| "agent"</code> · <strong>Optional</strong>: <code>network</code></td></tr><tr><td><code>connect_browser_wallet</code></td><td>Connect a browser wallet and activate browser mode</td><td>Yes</td><td><strong>Optional</strong>: <code>network</code>, <code>address: string</code></td></tr><tr><td><code>get_wallet_address</code></td><td>Show the current address for the target network</td><td>No</td><td><strong>Optional</strong>: <code>network</code></td></tr><tr><td><code>list_wallets</code></td><td>List wallets with <code>tron</code> and <code>evm</code> active pointers</td><td>No</td><td>—</td></tr><tr><td><code>set_active_wallet</code></td><td>Switch active wallet by ID (optional <code>walletType: tron/evm</code>)</td><td>Yes</td><td><strong>Required</strong>: <code>walletId: string</code> · <strong>Optional</strong>: <code>walletType: "tron" \| "evm"</code></td></tr><tr><td><code>import_wallet</code></td><td>Import a private key / mnemonic into the encrypted keystore</td><td>Yes</td><td><strong>Required</strong>: <code>walletType: "tron" \| "evm"</code>, <code>secretType: "private_key" \| "mnemonic"</code>, <code>secret: string</code> · <strong>Optional</strong>: <code>index: int ≥ 0</code> (mnemonic derivation index, default <code>0</code>)</td></tr></tbody></table> #### Common <a href="#id-16" id="id-16"></a> <table><thead><tr><th width="204.52734375">Tool</th><th width="230.18359375">Description</th><th width="95.30078125">Write?</th><th>Input schema</th></tr></thead><tbody><tr><td><code>get_protocol_overview</code></td><td>Protocol addresses, ilks, PSMs, debt ceilings</td><td>No</td><td><strong>Optional</strong>: <code>network</code></td></tr><tr><td><code>get_supported_ilks</code></td><td>Configured collateral types and PSM joins</td><td>No</td><td><strong>Optional</strong>: <code>network</code></td></tr><tr><td><code>get_native_balance</code></td><td>Read TRX / ETH / BNB balance</td><td>No</td><td><strong>Optional</strong>: <code>owner: string</code> (defaults to active wallet), <code>network</code></td></tr><tr><td><code>get_token_balance</code></td><td>Read ERC20 / TRC20 balance</td><td>No</td><td><strong>Required</strong>: <code>token: string</code> (contract) · <strong>Optional</strong>: <code>owner: string</code>, <code>decimals: int > 0</code>, <code>network</code></td></tr><tr><td><code>check_allowance</code></td><td>Read allowance, optionally compare against an <code>amount</code></td><td>No</td><td><strong>Required</strong>: <code>token: string</code>, <code>spender: string</code> · <strong>Optional</strong>: <code>owner: string</code>, <code>amount: string</code> (human-readable), <code>decimals: int > 0</code>, <code>network</code></td></tr><tr><td><code>approve_token</code></td><td>Approve a token allowance</td><td>Yes</td><td><strong>Required</strong>: <code>token: string</code>, <code>spender: string</code>, <code>amount: string</code> (human-readable or <code>"max
프로젝트로 돌아가기