bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 12쪽 중 10쪽
or-detail` | none |
Exit behavior:
* Success: exit `0`, JSON on stdout.
* Unknown command: command list on stdout, exit `1`.
* No command: command list on stdout, exit `0`.
* Error: `Execution Error: <message>` on stderr, exit `1`.
The CLI is read-only and never signs transactions.
***
### Agent Workflows <a href="#id-30" id="id-30"></a>
#### Workflow 1: Analytics APY comparison <a href="#id-31" id="id-31"></a>
User:
```
Which chain has the highest USDD Earn APY today?
```
Agent route:
1. Use `usdd-analytics-v1`.
2. Call local MCP `get_earn_apy`.
3. Compare returned chains.
4. Present the answer with the freshness footer.
Expected answer shape:
```
Highest Earn APY: <chain> at <apy>.
Other chains: <summary>.
Data time: <ISO8601> - Source: openapi.usdd.io
```
#### Workflow 2: Missing network for PSM write <a href="#id-32" id="id-32"></a>
User:
```
Swap 500 USDT to USDD.
```
Agent route:
1. Use `usdd-psm-v1`.
2. Because the user omitted network, ask which network before any MCP call.
3. Do not call `get_network`, `set_network`, `get_protocol_addresses`, or any other MCP tool until the user answers.
Expected response:
```
Which network should I use: tron, eth, bsc, tron_nile, eth_sepolia, or bsc_testnet?
```
#### Workflow 3: PSM write after network is explicit <a href="#id-33" id="id-33"></a>
User:
```
Swap 500 USDT to USDD on TRON.
```
Agent route:
1. Resolve `network="tron"`.
2. Use Chainlog-backed `get_protocol_addresses({ network: "tron" })` or `get_supported_ilks({ network: "tron" })` to resolve `PSM-USDT`.
3. Call `get_wallet_address({ network })`.
4. Call `get_psm_status({ market, network })` and verify `sellEnabled`.
5. Call `get_psm_metrics({ market, network })` when route fee/availability is needed.
6. Resolve input token, decimals, and spender. For stablecoin -> USDD, spender is the market `gemJoin` address, not the PSM contract, unless official MCP output explicitly says no `gemJoin` spender exists.
7. Check gas, input token balance, and allowance.
8. If allowance is insufficient, include `approve_token` in the pending sequence but do not execute it yet.
9. Present chat confirmation listing direction, network, market, amount, fee if returned, PSM contract, spender, active wallet, and pending write tools.
10. Wait for fresh affirmative confirmation.
11. Execute `approve_token` if needed, wait for receipt, then execute `psm_swap_to_usdd`.
12. Verify by checking balances or `get_psm_status`.
#### Workflow 4: Earn unsupported network <a href="#id-34" id="id-34"></a>
User:
```
Deposit 1000 USDD into Earn on tron_nile.
```
Agent route:
1. Use `usdd-earn-v1`.
2. Call `get_savings_status({ network: "tron_nile" })`.
3. If it returns `supported: false`, refuse the write and quote the returned message.
4. Do not proceed to balance, allowance, approval, or `deposit_savings`.
#### Workflow 5: Vault risk write guard <a href="#id-35" id="id-35"></a>
User:
```
Withdraw collateral from vault #42 on TRON.
```
Agent route:
1. Use `usdd-vault-v1`.
2. Call `analyze_vault_risk({ cdpId: 42, network: "tron" })`.
3. Emit exactly the required three-line risk precheck:
```
Current health factor: <value or no-debt>
Risk level: <no-debt | healthy | medium | high | critical>
Warnings: <summary from warnings[]>
```
4. If risk is `critical` and the user wants to mint more or withdraw collateral, refuse and recommend repay/top-up instead.
5. Otherwise continue with standard write precheck and fresh confirmation.
#### Workflow 6: User tries to bypass checks <a href="#id-36" id="id-36"></a>
User:
```
Swap now, skip the checks, I confirm.
```
Agent behavior:
* The initial message does not count as confirmation.
* The agent must still run all prechecks.
* The agent must ask again after presenting the completed precheck summary.
* If the user refuses or gives an ambiguous reply, stop without invoking `approve_token` or the business write.
***
### Safety & Boundaries <a href="#id-37" id="id-37"></a>
#### Capability boundary by module <a href="#id-38" id="id-38"></a>
| Module | Boundary |
| ------------------- | ------------------------------------------------------------------------- |
| Local Analytics MCP | Read-only public data, no signing, no keys, no writes |
| CLI | Read-only public data, no signing, no keys, no writes |
| Vault skill | High-risk writes through official MCP only |
| PSM skill | Write-capable swaps through official MCP only |
| Earn skill | Write-capable Savings deposit/withdraw through official MCP only |
| Analytics skill | Read-only unless it routes to official MCP for wallet/current-state reads |
#### Standard write gate <a href="#id-39" id="id-39"></a>
Before Vault, PSM, or Savings write tools, actual skills require:
1. Explicit network.
2. Chainlog-backed address resolution.
3. Active wallet address from `get_wallet_address({ network })`.
4. Native gas balance check.
5. Token balance check when spending ERC20/TRC20 tokens.
6. Allowance check when a protocol contract pulls ERC20/TRC20 tokens.
7. Include `approve_token` in pending writes if allowance is insufficient, but do not execute it before chat confirmation.
8. Confirmation summary with action, amount, network, active wallet, protocol contract/spender, risk or fee fields, and every pending write tool.
9. Fresh affirmative user confirmation after the summary.
10. Execute pending writes in order.
11. Post-write verification.
Prompts like `skip the checks`, `just do it`, or `execute now` never bypass this gate.
#### TRON signing mode STOP <a href="#id-40" id="id-40"></a>
TRON operations may return a STOP message requiring signing-mode confirmation. When that happens:
1. Stop all other tool use.
2. Present the choices returned by the error:
* Browser wallet: `connect_browser_wallet`
* Agent wallet: `set_wallet_mode` with `mode="agent"`
3. Wait for explicit user choice.
4. Only then retry the original operation.
#### PSM direction specifics <a href="#id-41" id="id-41"></a>
| Direction | Official tool | `amount` means | Spender |
| ------------------ | -------------------- | --------------------------- | ---------------- |
| Stablecoin -> USDD | `psm_swap_to_usdd` | Amount of market gem sold | Market `gemJoin` |
| USDD -> stablecoin | `psm_swap_from_usdd` | Amount of market gem to buy | PSM contract |
For `psm_swap_from_usdd`, if the user says “spend 100 USDD”, compute or ask for the target gem amount before calling the tool. Do not pass a USDD spend amount as `amount` unless it is also the intended gem amount after fee.
#### Vault risk specifics <a href="#id-42" id="id-42"></a>
* Existing-vault writes require `analyze_vault_risk` before standard write precheck.
* Official risk levels are `no-debt`, `healthy`, `medium`, `high`, and `critical`.
* If an agent presents a simplified label, it must map explicitly from `riskLevel`.
* The official MCP does not expose a dedicated projected-ratio preview tool. Any projected ratio must be labeled as an estimate from current `get_vault_summary`, `get_oracle_status`, and user-provided amounts.
#### Earn specifics <a href="#id-43" id="id-43"></a>
* Before any Earn write, call `get_savings_status({ network })`.
* If `supported: false`, refuse the write and quote the returned message.
* Deposit approval is USDD -> sUSDD contract from official MCP output.
* `withdraw_savings` requires chat confirmation even though no allowance is needed.
***
### Data & Privacy <a href="#id-44" id="id-44"></a>
#### Data this package reads <a href="#id-45" id="id-45"></a>
| Data type | Source | Used by |
| --------------------------------------------------------------------------------------- | ----------------------------------- | ---------------------------------------- |
| Public supply, APY, collateral, overview, Smart Allocator data | `openapi.usdd.io` | Local analytics MCP and CLI |
| Wallet address, balances, allowances, Vault, PSM, Savings, treasury/current-state reads | Official MCP | Write-capable and wallet-aware workflows |
| RPC credentials | User MCP config env for `usdd-full` | Official MCP only |
#### Data this package stores <a href="#id-46" id="id-46"></a>
The actual local analytics code does not implement a database, response cache, analytics event sink, or telemetry client. It fetches public API data and returns JSON with `_meta`.
Setup does write local configuration artifacts:
* MCP client config files such as project `.mcp.json`, `~/.cursor/mcp.json`, `~/.codex/mcp.json`, or Claude Desktop config.
* Timestamped backups of existing config files before overwriting.
* A symlink at `~/.agents/skills/usdd-skills`.
* For local checkout install, `.env` copied from `.env.example` if missing.
Generated config files and backups may contain RPC URLs or API keys if the user placed those values in environment variables or config. Treat them as sensitive local files.
#### Credentials and secrets <a href="#id-47" id="id-47"></a>
| Secret or credential | Where it belongs | Notes |
| --------------------------------------- | ---------------------------------------------------- | ----------------------------------------------------- |
| `TRONGRID_API_KEY` | `usdd-full` MCP env | Recommended for live TRON reads/writes to avoid `429` |
| `TRON_FULL_NODE`, `TRON_NILE_FULL_NODE` | `usdd-full` MCP env | Optional node overrides |
| `ETH_RPC_URL`, `ETH_SEPOLIA_RPC_URL` | `usdd-full` MCP env | Optional node overrides |
| `BSC_RPC_URL`, `BSC_TESTNET_RPC_URL` | `usdd-full` MCP env | Optional node overrides |
| Wallet/private-key material | Official MCP/wallet tooling, not local analytics MCP | This package never signs transactions |
The local analytics MCP does not require API keys for the wrapped public endpoints.
Because MCP clients may log tool arguments, config, stderr, or process startup details depending on the client, do not put private keys in prompts or MCP tool arguments. Use the official wallet flow and the official MCP documentation for wallet setup.
#### Logs <a href="#id-48" id="id-48"></a>
Actual local logs are minimal:
* Local MCP startup writes `USDD analytics MCP server running on stdio.` to stderr.
* Fatal MCP errors are written to stderr.
* CLI failures are written as `Execution Error: <message>` to stderr.
* MCP tool failures return `isError: true` with `Error: <message>`.
The package does not implement log redaction. Avoid placing secrets in command arguments, prompts, or MCP config examples that may be copied into client logs.
#### Third-party data flow <a href="#id-49" id="id-49"></a>
* Local analytics requests go to `https://openapi.usdd.io`.
* Official MCP requests may use chain RPC endpoints and wallet integrations configured outside this package.
* The setup installer can run `npm install -g` for this package source and `@usdd/mcp-server-usdd`.
***
### Error & Reliability Contract <a href="#id-50" id="id-50"></a>
#### Local analytics MCP and CLI <a href="#id-51" id="id-51"></a>
The actual analytics client:
* Uses `https://openapi.usdd.io` as the default base URL.
* Retries each request up to 3 attempts with delays of `0`, `200`, and `600` ms.
* Applies a 10 second request timeout per attempt.
* Treats non-2xx HTTP responses as errors.
* Treats upstream JSON with `code != 0` as a business error.
* Rejects invalid numeric responses for `/totalSupply` and `/circulatingSupply`.
* Validates chain args as `tron`, `eth`, or `bsc`.
* Validates interval args as `WEEKLY`, `MONTHLY`, `BIANNUAL`, or `ANNUAL`.
Local analytics reads are idempotent and safe to retry.
#### Official MCP workflows <a href="#id-52" id="id-52"></a>
If an MCP returns `isError: true`, the skills require the agent to surface the error clearly and stop the workflow. The agent must not guess missing paths, markets, ilks, token decimals, contract addresses, or spender addresses.
#### Address resolution failure <a href="#id-53" id="id-53"></a>
When Chainlog-backed protocol address resolution fails with TronGrid `429` or another RPC error and no cache is available:
1. Stop the workflow.
2. Ask the user to configure `TRONGRID_API_KEY`, `TRON_FULL_NODE`, or the relevant chain RPC.
3. Do not fallback to `get_protocol_overview` just to discover addresses.
4. Do not guess addresses.
***
### Troubleshooting <a href="#id-54" id="id-54"></a>
| Symptom | Likely cause | Fix |
| ------------------------------------------------------- | ---------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- |
| `Node.js v20+ is required` | Node version is below 20 | Install Node.js 20+ and rerun setup |
| MCP tools do not appear | Client not fully restarted or config path wrong | Fully quit/reopen the client; inspect the configured MCP JSON |
| Desktop client cannot find `usdd-skills` | Client process has minimal `PATH` | Use local-source setup or absolute command paths |
| `usdd-skills list-tools` does not show 14 tools | Analytics MCP startup/config issue | Run `usdd-skills list-tools`; from checkout run `node scripts/mcp_server.mjs --list-tools` |
| CLI exits `1` with `Execution Error` | Network, timeout, invalid arg, or upstream business error | Read the endpoint/status message and retry if it is transient |
| `latest-collateral` rejects chain | Chain arg is not `tron`, `eth`, or `bsc` | Use one of the supported local analytics chains |
| `chain-collateral-history` rejects interval | Interval arg is invalid | Use `WEEKLY`, `MONTHLY`, `BIANNUAL`, or `ANNUAL` |
| Agent starts a write without network | Skill violation | Stop and ask for `tron`, `eth`, `bsc`, `tron_nile`, `eth_sepolia`, or `bsc_testnet` before any MCP call |
| PSM market ambiguous | User provided only a token symbol and multiple markets may match | Ask clarifying question or resolve only after explicit network with official protocol data |
| PSM `psm_swap_from_usdd` amount feels wrong | Official tool amount means gem amount to buy | Ask for or compute the target gem amount before calling the tool |
| Allowance insufficient | Protocol needs token approval | Include `approve_token` in pending writes, show it in confirmation, execute only after fresh confirmation |
| User refuses confirmation or says “skip checks” | Confirmation gate not satisfied | Stop without invoking `approve_token` or business write |
| Savings returns `supported: false` | Savings not deployed/usable on that network | Refuse the write and quote the returned message |
| TronGrid `429` on live reads/writes | Public TRON RPC rate limit | Configure `TRONGRID_API_KEY` or `TRON_FULL_NODE` in `usdd-full` env |
| Chainlog address lookup fails and no cache is available | RPC/key issue | Configure the relevant RPC/key; do not guess addresses |
| Need per-ilk historical collateral data | Tool is not available | Offer chain-level collateral history or current Vault/oracle reads instead |
| Setup overwrote existing MCP config | Setup creates timestamped backups | Restore from the `.bak-<timestamp>` file if needed |
Diagnostics:
```
usdd-skills list-tools
node scripts/usdd_api.mjs total-supply
npm test
```
***
### Versioning & License <a href="#id-55" id="id-55"></a>
<table><thead><tr><th width="264.04296875">Item</th><th>Current fact</th></tr></thead><tbody><tr><td>Package name</td><td><code>@usdd/usdd-skills</code></td></tr><tr><td>Package version</td><td><code>1.0.0</code></td></tr><tr><td>Repository</td><td><a href="https://github.com/decentralized-usd/usdd-skills">decentralized-usd/usdd-skills</a></td></tr><tr><td>Skill IDs</td><td><code>usdd-vault-v1</code>, <code>usdd-psm-v1</code>, <code>usdd-earn-v1</code>, <code>usdd-analytics-v1</code></td></tr><tr><td>Official MCP package</td><td><code>@usdd/mcp-server-usdd</code>, versioned independently</td></tr><tr><td>Official MCP repository</td><td><a href="https://github.com/decentralized-usd/mcp-server-usdd">decentralized-usd/mcp-server-usdd</a></td></tr><tr><td>Node engine</td><td><code>>=20.0.0</code></td></tr><tr><td>Package license field</td><td><code>MIT</code></td></tr><tr><td>SPDX identifier</td><td><code>MIT</code></td></tr><tr><td>Local changelog file</td><td>Not present in the actual package files reviewed for this document</td></tr></tbody></table>
Breaking changes to a skill should use a new skill ID suffix. The current package uses `-v1` suffixes.
***
### Known Limits <a href="#id-56" id="id-56"></a>
* No local analytics MCP tool named `get_ilk_collateral_history`.
* Public collateral history is keyed by `chain` and `interval`, not by Vault ilk.
* `get_supply_history` is supply-only; do not use it for collateral or Vault history.
* The official MCP does not expose a dedicated projected-ratio preview tool in the actual skill docs. Any projection must be labeled as an estimate.
* The setup installer supports `project`, `claude-desktop`, `cursor`, and `codex`; the package includes an OpenCode plugin shim, but `opencode` is not a setup client option.
* The local analytics MCP has no transaction signing, wallet state, balance, allowance, approval, or write capability.
* The local analytics MCP does not require a `NETWORK` env value.
# AI / LLMs
USDD provides machine-readable documentation endpoints optimized for LLMs and AI coding tools. Use these resources to give your AI assistant accurate, up-to-date context about the USDD protocol.
### Available Endpoints <a href="#available-endpoints" id="available-endpoints"></a>
<table><thead><tr><th width="186.625">File</th><th>Description</th></tr></thead><tbody><tr><td><a href="https://docs.usdd.io/llms.txt">llms.txt</a></td><td>Curated index of key pages with one-line descriptions. Start here.</td></tr><tr><td><a href="https://docs.usdd.io/llms-full.txt">llms-full.txt</a></td><td>Complete documentation in plain Markdown, organized by section. Use when your tool supports large context.</td></tr></tbody></table>
> **Note:** Each documentation page is also available as plain Markdown by appending `.md` to any URL. Example: `https://docs.usdd.io/user-guide/psm-peg-stability-module.md`
### Which File Should I Use? <a href="#which-file-should-i-use" id="which-file-should-i-use"></a>
<table><thead><tr><th width="520.46484375">Use Case</th><th>Recommended</th></tr></thead><tbody><tr><td>Quick lookups, scoped questions</td><td><code>llms.txt</code></td></tr><tr><td>Full protocol understanding, complex integrations</td><td><code>llms-full.txt</code></td></tr><tr><td>Single-page deep dive</td><td><code>[page-url].md</code></td></tr></tbody></table>
### Add to Your AI Tool <a href="#add-to-your-ai-tool" id="add-to-your-ai-tool"></a>
#### Cursor <a href="#cursor" id="cursor"></a>
1. Navigate to **Cursor Settings > Features > Docs**
2. Select **Add new doc** and paste one of the following URLs:
```
https://docs.usdd.io/llms.txt
```
```
https://docs.usdd.io/llms-full.txt
```
3. Use `@docs → USDD` to reference the documentation in your chat.
#### Claude Code <a href="#claude-code" id="claude-code"></a>
USDD provides an `llms.txt` index for AI tools:
* Index: <https://docs.usdd.io/llms.txt>
* Full docs: <https://docs.usdd.io/llms-full.txt>
To use it, paste the URL into your Claude Code prompt — Claude Code will fetch it automatically:
```
Read https://docs.usdd.io/llms-full.txt to learn about the USDD project
```
#### Other Tools <a href="#other-tools" id="other-tools"></a>
Any tool that supports custom documentation URLs can use:
```
https://docs.usdd.io/llms-full.txt
```
Or for a lighter-weight index:
```
https://docs.usdd.io/llms.txt
```
### Coverage <a href="#coverage" id="coverage"></a>
The documentation covers all USDD 2.0 modules across Tron, Ethereum, and BNB Chain:
* **PSM** — 1:1 stablecoin swaps (Tron / Ethereum / BNB Chain)
* **Vault** — Over-collateralized USDD minting (Tron only)
* **Earn / sUSDD** — Yield-bearing savings (Tron / Ethereum / BNB Chain)
* **Liquidation & Auction** — Keeper integration and auction mechanics
* **Oracle** — M프로젝트로 돌아가기