USDD 백서

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

mmarizes collateral breakdown and USDD supply on TRON. * “What are the latest collateral prices?” → AI calls `get_collateral_prices` and lists each collateral type with its current highest price. **Treasury & Smart Allocator** * “Show me the USDD treasury summary” → AI calls `get_treasury_summary` and reports reserve breakdown, collateral ratio, and recent changes. * “How much JST has been bought back and burned?” → AI calls `get_jst_buyback_stats` and summarizes cumulative JST buyback volume and burn totals. * “What is the Smart Allocator overview?” → AI calls `get_smart_allocator_overview` and reports total debt allocated, current invested amount, accumulated earnings, and APY. * “Break down Smart Allocator investments by protocol” → AI calls `get_assets_breakdown` with `dimension=protocol` and lists each DeFi protocol with its allocated amount. * “Show me the Smart Allocator proof of reserve” → AI calls `get_proof_of_reserve` and details each platform investment with amounts and verification status. * “What does the Smart Allocator debt look like by network?” → AI calls `get_debt_overview` and summarizes debt positions grouped by TRON/ETH/BSC vaults. ### Architecture ``` mcp-server-usdd/ ├── src/ │ ├── core/ │ │ ├── chains.ts │ │ ├── abis.ts │ │ ├── tools.ts │ │ ├── prompts.ts │ │ ├── resources.ts │ │ ├── browser-signer.ts │ │ └── services/ │ │ ├── clients.ts │ │ ├── contracts.ts │ │ ├── protocol.ts │ │ ├── vault.ts │ │ ├── psm.ts │ │ ├── savings.ts │ │ ├── tokens.ts │ │ ├── transfer.ts ← token/native transfer (prepare + confirm) │ │ ├── treasury.ts ← treasury report and JST buyback stats │ │ ├── smart-allocator.ts ← Smart Allocator analytics │ │ ├── website-metrics.ts ← protocol metrics, chain metrics, collateral prices │ │ ├── wallet.ts │ │ └── utils.ts │ ├── index.ts │ └── server/ │ ├── server.ts │ └── http-server.ts └── build/ ``` <br> # USDD Skills > AI Agent skills for the USDD stablecoin protocol. This package teaches agents how to query public analytics, inspect wallet-aware protocol state, and safely route Vault, PSM, and Earn writes through the official USDD MCP server. This page describes the published USDD Skills package and its companion MCP server: * Package: `@usdd/usdd-skills` * Version: `1.0.0` * License: MIT * Repository: [decentralized-usd/usdd-skills](https://github.com/decentralized-usd/usdd-skills) * Runtime: Node.js `>=20.0.0` * Local analytics MCP: `scripts/mcp_server.mjs` * CLI: `scripts/usdd_api.mjs` * Write-capable MCP dependency: `@usdd/mcp-server-usdd` * Official MCP repository: [decentralized-usd/mcp-server-usdd](https://github.com/decentralized-usd/mcp-server-usdd) USDD Skills is a **Skills + MCP/CLI hybrid package**. It ships 4 Agent Skills, a local read-only analytics MCP server, CLI access to the same analytics layer, and install helpers for common MCP clients. *** ### Overview <a href="#id-2" id="id-2"></a> #### What it is <a href="#id-3" id="id-3"></a> USDD Skills provides structured instructions for agents using USDD across two MCP servers: * **Analytics MCP** from this package: 14 read-only tools backed by public `openapi.usdd.io` endpoints. * **Official MCP** from `@usdd/mcp-server-usdd`: wallet/network state, protocol reads, Vault/PSM/Savings writes, token transfers, treasury, and Smart Allocator tools. The local analytics MCP never signs transactions and does not hold private keys. All write-capable workflows are delegated to the official MCP. #### Who it is for <a href="#id-4" id="id-4"></a> * Web3 users who want agent-assisted Vault, PSM, or Earn workflows. * Analysts who need public USDD supply, APY, collateral, and Smart Allocator data. * Agent and tooling builders integrating USDD into Claude Desktop, Claude Code, Cursor, Codex, project-level MCP configs, or compatible MCP hosts. #### When not to use it <a href="#id-5" id="id-5"></a> * Do not use it for unattended trading, liquidation bots, or automated transaction execution. Write skills require a fresh chat confirmation after prechecks. * Do not use public analytics output as an oracle or settlement source. Analytics data is informational. * Do not use this package to store or pass private keys. Wallet handling belongs to the official MCP and wallet tooling. * Do not guess protocol addresses from docs or local tables. The skills require Chainlog-backed official MCP resolution. *** ### Which Mode to Use <a href="#id-6" id="id-6"></a> <table><thead><tr><th width="266.4453125">You want to…</th><th width="222.984375">Use</th><th>Reason</th></tr></thead><tbody><tr><td>Compare Earn APY, supply, sUSDD supply, collateral history, public overview, Smart Allocator detail</td><td>Local Analytics MCP</td><td>Public, read-only, no wallet required</td></tr><tr><td>Run the same public analytics in a terminal or CI</td><td>CLI <code>scripts/usdd_api.mjs</code></td><td>Scriptable JSON output, no agent required</td></tr><tr><td>Read wallet balance, allowance, wallet address, Vault ownership, PSM status, Savings status</td><td>Official MCP</td><td>Requires live chain, wallet-aware, or current protocol state</td></tr><tr><td>Open/manage Vaults, swap through PSM, deposit/withdraw Savings</td><td>Official MCP via Skill workflow</td><td>Holds wallet context and performs writes</td></tr><tr><td>Transfer tokens</td><td>Official MCP token-transfer flow</td><td>Uses <code>prepare_token_transfer</code> -> user confirmation -> <code>confirm_token_transfer</code></td></tr></tbody></table> Rule of thumb: * Public dashboard analytics -> local analytics MCP or CLI. * Wallet, current chain state, addresses, allowances, and all writes -> official MCP. *** ### Architecture <a href="#id-7" id="id-7"></a> Two MCP servers are intentionally non-overlapping. | Server | Package/source | Role | Writes? | | ---------------- | -------------------------------------- | ----------------------------------------------------------------------------------------- | ------- | | `usdd-analytics` | This package, `scripts/mcp_server.mjs` | 14 read-only tools over public USDD API | No | | `usdd-full` | `@usdd/mcp-server-usdd` | Wallet/network state, on-chain reads, Vault/PSM/Savings writes, treasury, Smart Allocator | Yes | Agents must call the MCP tools. Skill workflows explicitly say not to fetch upstream API URLs directly. *** ### Requirements <a href="#id-8" id="id-8"></a> | Requirement | Actual package behavior | | --------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Node.js | Required `>=20.0.0`; setup rejects older Node versions | | Package version | `@usdd/usdd-skills` version `1.0.0` | | Official MCP | `@usdd/mcp-server-usdd` is installed by setup unless skipped | | Local analytics dependencies | `@modelcontextprotocol/sdk`, `dotenv` | | Public analytics auth | No API key required for the wrapped public analytics endpoints | | RPC env keys | Optional keys are passed only to `usdd-full`: `TRONGRID_API_KEY`, `TRON_FULL_NODE`, `TRON_NILE_FULL_NODE`, `ETH_RPC_URL`, `ETH_SEPOLIA_RPC_URL`, `BSC_RPC_URL`, `BSC_TESTNET_RPC_URL` | | Supported official MCP networks | `tron`, `eth`, `bsc`, `tron_nile`, `eth_sepolia`, `bsc_testnet` | | Local analytics chain args | `tron`, `eth`, `bsc` for chain-scoped analytics tools | | Local analytics history intervals | `WEEKLY`, `MONTHLY`, `BIANNUAL`, `ANNUAL` | The local analytics MCP does not use a `NETWORK` value. Network selection for official MCP tools is passed in tool arguments as `network`. *** ### Installation <a href="#id-9" id="id-9"></a> #### Recommended setup <a href="#id-10" id="id-10"></a> The CLI exposes: ```bash usdd-skills setup [options] usdd-skills mcp-server usdd-skills list-tools ``` Recommended GitHub package setup: ```bash npx --yes \ --package=git+https://github.com/decentralized-usd/usdd-skills.git \ usdd-skills setup --yes ``` Current setup behavior: * Checks Node.js v20+. * Installs global `usdd-skills` and `@usdd/mcp-server-usdd`, unless `--skip-global-install` or `--dry-run` is used. * Writes MCP config for selected clients with timestamped backups. * Creates a skills symlink at `~/.agents/skills/usdd-skills`. * Registers: * `usdd-analytics` -> `usdd-skills mcp-server` * `usdd-full` -> `mcp-server-usdd` Supported setup clients: ```bash usdd-skills setup --client project,claude-desktop,cursor,codex --yes ``` The special values are: * `auto`: detect project plus existing Claude Desktop, Cursor, and Codex config locations. * `all`: configure `project`, `claude-desktop`, `cursor`, and `codex`. #### Dry run <a href="#id-11" id="id-11"></a> Use dry run to inspect planned config writes without changing files: ```bash usdd-skills setup --client all --dry-run --yes ``` #### Local checkout setup <a href="#id-12" id="id-12"></a> ```bash git clone https://github.com/decentralized-usd/usdd-skills.git cd usdd-skills bash install.sh ``` Actual `install.sh` behavior: * Checks Node.js v20+. * Runs `npm install`. * Installs global `@usdd/mcp-server-usdd`. * Creates `.env` from `.env.example` if missing. * Runs `node bin/usdd-skills.mjs setup --local-source --skip-global-install --yes`. For project config with local source, setup writes a portable `.mcp.json` using `node` plus a relative `./scripts/mcp_server.mjs` path. User-level client configs use the current Node executable plus an absolute analytics script path. #### Verify <a href="#id-13" id="id-13"></a> ```bash usdd-skills list-tools node scripts/usdd_api.mjs total-supply npm test ``` Expected: * `usdd-skills list-tools` prints the 14 analytics MCP tools. * CLI commands print JSON on stdout. * Tests run with `node --test scripts/*.test.mjs`. #### Upgrade <a href="#id-14" id="id-14"></a> ```bash usdd-skills setup --client codex --yes ``` For a local checkout, update the checkout first, then rerun `bash install.sh`. #### Uninstall <a href="#id-15" id="id-15"></a> The included `uninstall.sh` is intentionally narrow: ```bash bash uninstall.sh ``` It must be run from the `@usdd/usdd-skills` project root. It removes local `node_modules` and `.env`, then prints that full removal requires deleting the directory. To remove a user-level install, remove the skills symlink and uninstall the global packages: ```bash rm ~/.agents/skills/usdd-skills npm uninstall -g @usdd/usdd-skills @usdd/mcp-server-usdd ``` Also remove `usdd-analytics` and `usdd-full` from any MCP client configs that were configured. *** ### Client Configuration <a href="#id-16" id="id-16"></a> Both MCP servers use stdio transport. After editing client config, fully restart the client. #### Project-local `.mcp.json` <a href="#id-17" id="id-17"></a> The portable template is: ```json { "mcpServers": { "usdd-analytics": { "type": "stdio", "command": "node", "args": ["./scripts/mcp_server.mjs"], "env": {} }, "usdd-full": { "type": "stdio", "command": "mcp-server-usdd", "args": [], "env": {} } } } ``` Generated local `.mcp.json` files should not be committed. #### Claude Desktop <a href="#id-18" id="id-18"></a> Config path on macOS: ``` ~/Library/Application Support/Claude/claude_desktop_config.json ``` Minimal config shape: ```json { "mcpServers": { "usdd-analytics": { "command": "usdd-skills", "args": ["mcp-server"] }, "usdd-full": { "command": "mcp-server-usdd", "env": { "TRONGRID_API_KEY": "your_key_optional", "TRON_FULL_NODE": "your_tron_url_optional", "TRON_NILE_FULL_NODE": "your_nile_url_optional", "ETH_RPC_URL": "your_url_optional", "ETH_SEPOLIA_RPC_URL": "your_sepolia_url_optional", "BSC_RPC_URL": "your_url_optional", "BSC_TESTNET_RPC_URL": "your_bsc_testnet_url_optional" } } } } ``` #### Claude Code <a href="#id-19" id="id-19"></a> ```bash claude mcp add -s project usdd-analytics -- usdd-skills mcp-server claude mcp add -s project usdd-full -- mcp-server-usdd ``` #### Cursor <a href="#id-20" id="id-20"></a> Setup writes or merges: ``` ~/.cursor/mcp.json ``` Use the same `mcpServers` shape as Claude Desktop. #### Codex <a href="#id-21" id="id-21"></a> Setup writes or merges: ```bash ~/.codex/mcp.json ``` Recommended: ```bash npx --yes \ --package=git+https://github.com/decentralized-usd/usdd-skills.git \ usdd-skills setup --client codex --yes ``` Manual config shape is the same two-server `mcpServers` block shown above. Restart Codex after editing config. Verify: ```bash ls ~/.agents/skills/usdd-skills usdd-skills list-tools ``` The skills directory should contain: ``` usdd-vault-v1/ usdd-psm-v1/ usdd-earn-v1/ usdd-analytics-v1/ ``` #### OpenCode <a href="#id-22" id="id-22"></a> The package includes an OpenCode plugin shim at: ``` .opencode/plugins/usdd-skills.js ``` That shim registers the 4 skills and the local `usdd-analytics` MCP server with: ```json command: "node" args: ["./scripts/mcp_server.mjs"] ``` The setup installer currently supports `project`, `claude-desktop`, `cursor`, and `codex` clients. It does not list `opencode` as a setup client option. #### PATH fallback <a href="#id-23" id="id-23"></a> If a desktop client cannot find `usdd-skills` or `mcp-server-usdd`, use an absolute command path or run local-source setup so the analytics MCP uses the current Node executable and an absolute script path for user-level configs. *** ### Skill Catalog <a href="#id-24" id="id-24"></a> | Skill | Scope | Writes? | Primary MCP dependency | | ------------------- | ------------------------------------------------------------------- | ------- | ---------------------------------------------------------------- | | `usdd-vault-v1` | Vault/CDP: open, deposit, mint, repay, withdraw, close, risk review | Yes | Official MCP | | `usdd-psm-v1` | PSM stablecoin <-> USDD swaps | Yes | Official MCP | | `usdd-earn-v1` | Savings: deposit USDD -> sUSDD, withdraw USDD from sUSDD | Yes | Official MCP plus local analytics for APY/supply | | `usdd-analytics-v1` | Public read-only analytics and routing | No | Local analytics MCP, official MCP for current wallet-aware state | #### Global routing rules <a href="#id-25" id="id-25"></a> * Chain-dependent official MCP work requires an explicit `network` before any MCP tool call. * Never default to TRON, mainnet, testnet, `set_network`, `get_network`, or a configured default when the user omitted the network. * Protocol, token, Vault join, PSM, and Savings addresses must come from official Chainlog-backed tools: `get_protocol_addresses({ network })` or `get_chainlog_address({ network, key })`. * Do not use local full-address tables or copy addresses from docs. * If Chainlog resolution fails with TronGrid `429` or another RPC error and no cache is available, stop and ask the user to configure the relevant RPC or `TRONGRID_API_KEY`. * Official write tools use the active MCP wallet and do not accept a `from` argument. Call `get_wallet_address({ network })` before confirmation. *** ### Tool Reference <a href="#id-26" id="id-26"></a> #### Local Analytics MCP tools <a href="#id-27" id="id-27"></a> <table><thead><tr><th width="250.203125">Tool</th><th width="208.8046875">Inputs</th><th>Description</th></tr></thead><tbody><tr><td><code>get_earn_apy</code></td><td>none</td><td>USDD Savings APY per chain</td></tr><tr><td><code>get_susdd_supply</code></td><td>none</td><td>sUSDD total supply by chain</td></tr><tr><td><code>get_usdd_supply</code></td><td>none</td><td>USDD supply by chain, excluding sUSDD</td></tr><tr><td><code>get_supply_history</code></td><td>none</td><td>Daily USDD and sUSDD supply time series</td></tr><tr><td><code>get_collateral_history</code></td><td>none</td><td>Daily protocol-wide collateral value by chain</td></tr><tr><td><code>get_circulating_supply</code></td><td>none</td><td>Raw USDD circulating supply number</td></tr><tr><td><code>get_total_supply</code></td><td>none</td><td>Raw USDD total supply number</td></tr><tr><td><code>get_public_protocol_overview</code></td><td>none</td><td>Public protocol overview with total supply, TVL, Earn TVL, APY fields</td></tr><tr><td><code>get_public_protocol_overview_info</code></td><td>none</td><td>Public overview with 24h change fields</td></tr><tr><td><code>get_public_dsr_apy</code></td><td>none</td><td>DSR APY current, average, and history</td></tr><tr><td><code>get_vault_collaterals</code></td><td>none</td><td>Public Vault collateral configuration list</td></tr><tr><td><code>get_latest_collateral</code></td><td><code>chain</code>: <code>tron</code>, <code>eth</code>, <code>bsc</code></td><td>Per-chain collateral snapshot</td></tr><tr><td><code>get_chain_collateral_history</code></td><td><code>chain</code>, <code>interval</code></td><td>Per-chain collateral history for <code>WEEKLY</code>, <code>MONTHLY</code>, <code>BIANNUAL</code>, <code>ANNUAL</code></td></tr><tr><td><code>get_smart_allocator_detail</code></td><td>none</td><td>Smart Allocator allocations, earnings, and vault info</td></tr></tbody></table> Every local analytics response adds: ```json { "_meta": { "dataTime": "ISO8601 fetch time", "source": "openapi.usdd.io" } } ``` `dataTime` is the moment this package fetched the data, not necessarily the upstream record timestamp. #### Official MCP tool groups used by skills <a href="#id-28" id="id-28"></a> <table><thead><tr><th width="198.7109375">Group</th><th>Tools referenced by actual skills</th></tr></thead><tbody><tr><td>Wallet/network</td><td><code>get_supported_networks</code>, <code>set_network</code>, <code>get_network</code>, <code>connect_browser_wallet</code>, <code>set_wallet_mode</code>, <code>get_wallet_mode</code>, <code>get_wallet_address</code>, <code>list_wallets</code>, <code>import_wallet</code>, <code>set_active_wallet</code></td></tr><tr><td>Common preflight</td><td><code>get_native_balance</code>, <code>get_token_balance</code>, <code>check_allowance</code>, <code>approve_token</code></td></tr><tr><td>Protocol reads</td><td><code>get_protocol_addresses</code>, <code>get_chainlog_address</code>, <code>get_protocol_overview</code>, <code>get_supported_ilks</code>, <code>get_oracle_status</code>, <code>get_protocol_metrics</code>, <code>get_chain_metrics</code>, <code>get_collateral_prices</code></td></tr><tr><td>Vault</td><td><code>get_user_vaults</code>, <code>get_vault_summary</code>, <code>analyze_vault_risk</code>, <code>open_vault</code>, <code>deposit_and_mint</code>, <code>mint_usdd</code>, <code>repay_usdd</code>, <code>withdraw_collateral</code>, <code>close_vault</code></td></tr><tr><td>PSM</td><td><code>get_psm_status</code>, <code>get_psm_metrics</code>, <code>psm_swap_to_usdd</code>, <code>psm_swap_from_usdd</code></td></tr><tr><td>Savings</td><td><code>get_savings_status</code>, <code>deposit_savings</code>, <code>withdraw_savings</code></td></tr><tr><td>Token transfer</td><td><code>prepare_token_transfer</code>, <code>confirm_token_transfer</code></td></tr><tr><td>Treasury / allocator</td><td><code>get_treasury_summary</code>, <code>get_jst_buyback_stats</code>, <code>get_smart_allocator_overview</code>, <code>get_assets_breakdown</code>, <code>get_proof_of_reserve</code>, <code>get_debt_overview</code></td></tr></tbody></table> For full schemas, use the official MCP documentation/source for `@usdd/mcp-server-usdd`. *** ### CLI Reference <a href="#id-29" id="id-29"></a> The CLI mirrors the local analytics MCP and prints JSON to stdout. ``` node scripts/usdd_api.mjs <command> [args] ``` | Command | Args | | -------------------------- | -------------------- | | `earn-apy` | none | | `usdd-supply` | none | | `susdd-supply` | none | | `supply-history` | none | | `collateral-history` | none | | `circulating-supply` | none | | `total-supply` | none | | `public-overview` | none | | `public-overview-info` | none | | `dsr-apy` | none | | `vault-collaterals` | none | | `latest-collateral` | `<chain>` | | `chain-collateral-history` | `<chain> <interval>` | | `smart-allocat
프로젝트로 돌아가기