dh-mcp
v0.5.25MCP server for the Diamond Hands protocol
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
loan_create Create a new lending position
Mint a new PKP, create a Bitcoin custody vault, and register a new lending position with the given term. May take 60–90 seconds against the live protocol (LIT Action invocation). Requires human confirmation (confirmed: true).
| Parameter | Type | Description |
|---|---|---|
selectedTerm * | integer | Loan term in months (e.g. 3, 6, 12, 24) |
confirmed | boolean | Human authorization gate — must be set to true by a HUMAN (not the model) to execute this irreversible action. |
loan_mint Mint UCD against a position
Mint (borrow) UCD against an existing lending position's BTC collateral. The origination fee is ADDED TO YOUR DEBT — you receive the full amount, you owe amount + fee. Ceiling: position_status → valuation.maxMintableUcd (directly usable as amountUcd). May take 60–90 seconds against the live protocol (LIT Action invocation). Requires human confirmation (confirmed: true).
| Parameter | Type | Description |
|---|---|---|
amountUcd * | number | Amount of UCD to mint |
positionId * | string | |
confirmed | boolean | Human authorization gate — must be set to true by a HUMAN (not the model) to execute this irreversible action. |
loan_pay Make a UCD payment toward a position's debt
Repay (partial or full) a position's UCD debt. Moves UCD out of your wallet (irreversible). To pay off EVERYTHING exactly — including dust smaller than the 6-decimal input allows — pass repayAll: true instead of amountUcd (fleet finding: debt can carry more precision than amountUcd accepts). May take 60–90 seconds against the live protocol (LIT Action invocation). Requires human confirmation (confirmed: true).
| Parameter | Type | Description |
|---|---|---|
positionId * | string | |
amountUcd | number | Amount of UCD to repay (max 6 decimals; omit when repayAll) |
confirmed | boolean | Human authorization gate — must be set to true by a HUMAN (not the model) to execute this irreversible action. |
repayAll | boolean | true = repay the position's EXACT outstanding debt (wei-precise) |
loan_extend Extend / renew a position's term
ADDS selectedTerm onto the position's CURRENT expiry (12 months = exactly 365 days; any other term = N × 30-day months) — never replaces or shortens it. Only available in the FINAL 30 DAYS of the current term, and refused if the remaining runway would exceed 2× the new term. (Per-network caveat: some DEPLOYED contracts predate this window/runway rule — a live extend may execute from now rather than refuse; the MCP reports the on-chain result truthfully.) Fee: ADDED TO YOUR DEBT (your wallet is not charged), at most the term's extension fee rate × your current debt (see protocol_terms; a…
| Parameter | Type | Description |
|---|---|---|
positionId * | string | |
selectedTerm * | integer | Months to ADD to the current expiry (must be an offered term: see protocol_terms) |
confirmed | boolean | Human authorization gate — must be set to true by a HUMAN (not the model) to execute this irreversible action. |
loan_withdraw Withdraw BTC from a position vault
Withdraw BTC from a position's custody vault to an external BTC address. BTC sends are UNRECOVERABLE — verify the destination address carefully. Result identifiers: txid (and txRef.id) is the Bitcoin transaction of the withdrawal reservation; authorization.digest is the borrower wallet's signature over the approval — they are different things. May take 60–90 seconds against the live protocol (LIT Action invocation). Requires human confirmation (confirmed: true).
| Parameter | Type | Description |
|---|---|---|
amountSats * | integer | GROSS amount in satoshis committed from the vault (1 BTC = 100,000,000 sats). The destination receives amountSats − networkFeeSats; the vault's available drops by amountSats. amountSats may be up to… |
btcAddress * | string | Destination BTC address (must match the configured BTC network) |
positionId * | string | |
confirmed | boolean | Human authorization gate — must be set to true by a HUMAN (not the model) to execute this irreversible action. |
networkFeeSats | integer | BTC network fee in sats (declared default 1000); deducted FROM amountSats, not added on top |
loan_withdraw_retry Re-run a stalled BTC withdrawal's execute step
Finish a withdrawal that authorized but never broadcast. loan_withdraw has two steps: the first commits the reservation on-chain, the second signs a time-stamped hash whose window is under a minute — often nearer twenty seconds. If that second signature is not given in time the withdrawal fails with the reservation ALREADY committed and the coins still in the vault, and it does not clear itself: loan_recover_stale_spend needs the coins to have MOVED, which is exactly what did not happen. This re-runs the second step alone with a fresh stamp. Destination and amount come from the on-chain reco…
| Parameter | Type | Description |
|---|---|---|
positionId * | string | |
confirmed | boolean | Human authorization gate — must be set to true by a HUMAN (not the model) to execute this irreversible action. |
networkFeeSats | integer | BTC network fee in sats (declared default 1000); taken FROM the authorized amount, not added on top |
loan_allowlist_destination Allowlist a BTC withdrawal destination
Add a BTC address to the borrower's withdrawal allowlist (BitcoinWithdrawalAddressRegistry). The protocol refuses withdrawBTC to any destination not on the borrower's own allowlist. For a SAFE borrower this is itself a Safe transaction — owner signatures are collected, and owners can sign at their leisure (no expiry on this ceremony). The destination becomes usable after the registry's address delay, read LIVE from the contract at execution — the result's usableAtSec is the chain-derived moment it becomes usable (never assume a fixed delay). Requires human confirmation (confirmed: true).
| Parameter | Type | Description |
|---|---|---|
btcAddress * | string | Destination BTC address to allowlist (must match the configured BTC network) |
confirmed | boolean | Human authorization gate — must be set to true by a HUMAN (not the model) to execute this irreversible action. |
loan_delegation_setup Install delegation on the Safe (one owner ceremony)
NOT AVAILABLE on the real protocol in this build — the real adapter answers UPSTREAM_UNAVAILABLE ('not wired in this delivery'). It runs on the practice (mock) adapter only. Say so before a user plans around it. The ONE-TIME Safe delegation batch (signer mode 'safe-module'): your owners sign a single durable Safe transaction — at their leisure, no time window — that enables the Safe's AgentModule, binds the agent key, registers it in the delegation registry, and pre-approves the given BTC withdrawal destinations. After it, day-to-day operations (create/mint/pay/extend) run agent-solo; wi…
| Parameter | Type | Description |
|---|---|---|
btcAddresses * | array | BTC withdrawal destinations to pre-approve in the same ceremony (avoids a second owner gathering before the first withdrawal) |
confirmed | boolean | Human authorization gate — must be set to true by a HUMAN (not the model) to execute this irreversible action. |
loan_delegation_grant Grant the agent per-position scopes (owners sign)
NOT AVAILABLE on the real protocol in this build — the real adapter answers UPSTREAM_UNAVAILABLE ('not wired in this delivery'). It runs on the practice (mock) adapter only. Say so before a user plans around it. Set what the delegated agent may do on ONE position — RENEW (extend), REPAY (pay down), MINT (borrow, only while the post-mint collateral ratio stays at or above mintFloorBps — required for MINT, it is the owners' risk bound). Grants are user-only expansion: for a Safe this is a QUORUM signature (durable Safe transaction, owners sign at leisure) — the agent can never widen its…
| Parameter | Type | Description |
|---|---|---|
positionId * | string | |
confirmed | boolean | Human authorization gate — must be set to true by a HUMAN (not the model) to execute this irreversible action. |
mintFloorBps | integer | Allow MINT while post-mint CR ≥ this floor (bps, e.g. 15000 = 150%) — required for the MINT scope |
renew | boolean | Allow the agent to extend/renew this position |
repay | boolean | Allow the agent to pay down this position's debt |
loan_recover_stale_spend Recover a stale BTC reservation via LIT-attested proof
NOT AVAILABLE on the real protocol in this build — the real adapter answers UPSTREAM_UNAVAILABLE ('not wired in this delivery'); it runs on the practice (mock) adapter only. For a withdrawal that authorized but never broadcast, loan_withdraw_retry is the working path. Clear a stale authorized BTC spend on BTCSpendAuthorizer using a LIT-attested StaleSpendRecovery attestation. The original UTXO must already be consumed on Bitcoin with ≥6 confirmations. `invalidatorTxid` is either the borrower's authorized broadcast (after confirmations) or a PKP self-spend that invalidated the reservation.…
| Parameter | Type | Description |
|---|---|---|
invalidatorTxid * | string | Txid of the BTC transaction that consumed the original UTXO (≥6 confirmations) |
positionId * | string | |
utxoTxid * | string | The original authorized UTXO's txid |
utxoVout * | integer | The original authorized UTXO's vout |
minConfirmations | integer | Override minimum confirmations (default 6) |
position_status Get a position's full status
Return detailed status for a single position: chain facts (debt, term, expiry, state), live collateral (confirmed sats + per-transaction pending deposits, plus maxWithdrawableSats — directly usable as a withdrawal amountSats), and a basis-carrying valuation (maxMintableUcd is directly usable as amountUcd). If a withdrawal reservation was already spent on Bitcoin but availableSats still shows it deducted, run loan_recover_stale_spend to release the redundant hold. Any `reading` notes in the result are authoritative interpretation instructions for that exact payload — follow them. Field guid…
| Parameter | Type | Description |
|---|---|---|
id * | string |
position_list List lending positions
List positions with optional filters. `borrower` and `state` COMBINE (logical AND); with no filter, returns active positions. Rows are the INDEXER's view — `state` here is an indexer snapshot that can lag the chain; position_status reads the chain and is authoritative for one position. Field guide: state = lifecycle state. On position_status it is read from the CHAIN (authoritative); on position_list rows it is an INDEXER snapshot that can lag the chain. PENDING_DEPOSIT/PENDING_MINT mean 'not yet minted' — activation happens on the FIRST mint, never on deposit confirmation alone; debtUcdWe…
| Parameter | Type | Description |
|---|---|---|
borrower | string | Filter by borrower address (0x-prefixed) |
page | integer | Page number |
pageSize | integer | Page size |
state | string | Filter by state (PENDING_DEPOSIT, PENDING_MINT, ACTIVE, EXPIRED, LIQUIDATABLE, LIQUIDATED, REPAID, CLOSED) |
position_events Get a position's event history
Return mint, payment, withdrawal, renewal, and liquidation events for a position (indexer view). NOT IMPLEMENTED on the real protocol adapter in this build — it answers NOT_IMPLEMENTED there (a PERMANENT gap, not a transient outage: do not retry). Available on the practice (mock) adapter.
| Parameter | Type | Description |
|---|---|---|
id * | string |
position_pending_withdrawals List a position's pending BTC withdrawal reservations
Query the spend authorizer for BTC withdrawal reservations on a position. Each entry has txid/vout, satoshis, and target address (txid/vout feed recovery).
| Parameter | Type | Description |
|---|---|---|
id * | string |
btc_balance Get BTC balance for an address
Query the confirmed BTC balance for an address (source-tagged).
| Parameter | Type | Description |
|---|---|---|
address * | string | BTC address to query |
btc_price Get the current BTC price
Return the current BTC price (USD, 8 decimals) from the price oracle.
protocol_status Get protocol configuration and status
Return protocol status: pause flag, mint LTV limit (ltvBps), liquidation threshold (liquidationThresholdBps — a COLLATERAL RATIO in bps, i.e. collateralValue/debt, so 11000 = 110%; note this is the inverse basis of ltvBps which is debt/collateral), deposit confirmation threshold, BTC network.
protocol_terms List available loan terms with fees
Return all configured loan terms (in months) with their fees. Term length: 12 months = exactly 365 days; any other term = N × 30-day months. originationFeeBps: % of a mint, ADDED to debt. extensionFeeRateBps: the renewal fee CEILING as % of outstanding debt PER RENEWAL (a flat rate, NOT per month); the charged fee is ADDED TO DEBT and reduced by origination fees already paid this term.
psm_quote Quote a UCD ↔ stablecoin exchange (peg-stability module)
Quote the PSM exchange (read-only, live on-chain views — never an indexer). direction 'to-ucd' = pay the stablecoin, receive UCD; the ENTRY fee is charged IN UCD on the gross converted amount. direction 'from-ucd' = pay UCD, receive the stablecoin back from the PSM's reserves; the EXIT fee is charged IN that stablecoin and deducted from what you receive. amount is in the INPUT token's user units (to-ucd: the stablecoin; from-ucd: UCD). The result names both amounts, the fee WITH its token, and (from-ucd) the live reserves. Executing an exchange on-chain requires a minimum-out floor — a zer…
| Parameter | Type | Description |
|---|---|---|
amount * | number | Amount of the INPUT token in user units (to-ucd: the stablecoin; from-ucd: UCD). Max 6 decimals. |
direction * | string | 'to-ucd' = pay the stablecoin, get UCD (contract swap); 'from-ucd' = pay UCD, get the stablecoin back (contract redeem) |
stablecoin * | string | The stablecoin to exchange, by SYMBOL (e.g. 'USDC', 'USDT') or by 0x address. REQUIRED and deliberately has NO DEFAULT: the PSM can support several coins, and choosing one for the user would move thei… |
psm_swap Exchange UCD ↔ a stablecoin through the PSM
Execute a PSM exchange (irreversible, fund-moving). direction 'to-ucd' = pay the stablecoin, receive UCD; 'from-ucd' = pay UCD (burned), receive the stablecoin from the PSM's reserves. Runs as explicit on-chain ceremonies, each signed by the session signer and all reported in the result: (1) the approvals the input token NEEDS, planned against its standing allowance — none when the allowance already covers the amount; one EXACT-AMOUNT approval when it is 0; a reset to 0 followed by the exact approval when a partial allowance stands. to-ucd approves the stablecoin to the PSM contract (the PSM…
| Parameter | Type | Description |
|---|---|---|
amount * | number | Amount of the INPUT token in user units (to-ucd: the stablecoin; from-ucd: UCD). Max 6 decimals. |
direction * | string | 'to-ucd' = pay the stablecoin, get UCD (contract swap); 'from-ucd' = pay UCD, get the stablecoin back (contract redeem) |
stablecoin * | string | The stablecoin to exchange, by SYMBOL (e.g. 'USDC', 'USDT') or by 0x address. REQUIRED and deliberately has NO DEFAULT: the PSM can support several coins, and choosing one for the user would move thei… |
confirmed | boolean | Human authorization gate — must be set to true by a HUMAN (not the model) to execute this irreversible action. |
guide Diamond Hands product guide
Curated guidance on using Diamond Hands — START HERE for new users. Topics: getting-started | first-setup | connect-wallet | lifecycle | fees | psm | authorization | safe | delegation | safety | switch-network | connector | troubleshooting | glossary | reading-data. No topic = the index + orientation. Covers first setup (choosing how to authorize by conversation), connecting the user's own wallet, the full lifecycle with exact tool names, fees, safety, troubleshooting, and a synonym glossary for mapping ANY user's vocabulary (any language) to the right tools.
| Parameter | Type | Description |
|---|---|---|
topic | string | One of: getting-started | first-setup | connect-wallet | lifecycle | fees | psm | authorization | safe | delegation | safety | switch-network | connector | troubleshooting | glossary | reading-data (o… |
signer_setup Choose how operations are authorized
Pick or inspect the authorization mode by conversation — no config files. Modes: 'external' = you approve each operation in YOUR OWN wallet (browser popup, or mobile via WalletConnect); 'keystore' = a local keystore signs automatically after each confirmation; 'safe' = operate AS a Safe smart-account (provide safeAddress; owners and threshold are discovered, never typed; operations are authorized by owner signatures); 'safe-module' = a Safe WITH DELEGATION: owners approve ONCE (loan_delegation_setup), then the keystore key acts as the Safe's agent for day-to-day operations — withdrawals an…
| Parameter | Type | Description |
|---|---|---|
action * | string | What to do — 'status' explains everything |
mode | string | For 'use': external | keystore | safe | safe-module | mock-simulated |
safeAddress | string | For 'use safe'/'use safe-module': the Safe's 0x address (the borrowing identity) |
network_switch Show or switch the active network
Which world this server is on — and switching it by conversation (real adapter). 'status' states the active network and whether money is real. 'switch' moves this session between sepolia (practice funds) and mainnet (REAL MONEY) after an explicit human confirmation; positions, vaults, and signer bindings are per-network and do not carry across. Fund-moving operations work on BOTH networks — loan operations and PSM swaps alike (on mainnet they move REAL money). The switch lasts for this server session only; the configured default returns on restart. After a switch, re-read boundary://info a…
| Parameter | Type | Description |
|---|---|---|
action * | string | status = current world; switch = change network (needs confirmed:true) |
confirmed | boolean | HUMAN approval of this exact switch — never auto-set |
network | string | switch target: sepolia | mainnet |