yield-agentkit-moonpay
Yield.xyz AgentKit × MoonPay
Discover and enter on-chain yield positions end-to-end, Yield.xyz AgentKit MCP builds the transactions, MoonPay signs and broadcasts them.
⚠️ Never Call Yield.xyz API Directly
Never call the Yield.xyz API directly (e.g. via curl or HTTP requests). Direct API calls require an API key and will return 401 Unauthorized. All Yield.xyz data and transactions must go through the connected MCP server, no API key is needed when using MCP.
Two MCPs, One Flow
This skill requires both MCP servers to be connected:
| MCP | Role | Tools used |
|---|---|---|
| Yield.xyz AgentKit | Yield discovery + transaction building | yields_get_all, yields_get, yields_get_validators, yields_get_balances, yields_get_reward_rate_history, yields_get_tvl_history, yields_get_risk, actions_enter, actions_exit, actions_manage, actions_get, actions_get_all, submit_hash, get_transaction, networks_get_all, providers_get_all |
| MoonPay | Auth + wallet + sign + broadcast | wallet_list, transaction_sign, transaction_send, token_balance_list and more |
If either MCP is missing, stop and tell the user. See
references/setup.md for connection instructions.
Input & Output Formatting
For exact input types for all Yield.xyz AgentKit MCP tools, see references/input-format.md.
For all Yield.xyz tool display rules, number formatting, badges, tables, and action summaries, see references/output-formats.md.
Never dump raw JSON or plain comma-separated data. Always follow the formats defined there.
MANDATORY: Before querying anything from Yield.xyz AgentKit MCP read references/input-format.md and before displaying any results, read references/output-formats.md using the Read tool. Do not skip this step.
⚠️ API Usage Policy
You must follow the guidelines defined in policies.md for Yield AgentKit MCP API usage, data fetching, and efficiency.
Full Flow
Step 1 — Check MoonPay auth and wallet
Before anything else:
- Call MoonPay
wallet_listto confirm a wallet exists - If no wallet or not authenticated, guide the user through login:
- They will receive a code by email
- Once verified they can proceed
- Note the wallet address, this is the
addressused in all AgentKit MCP calls
Step 2 — Discover yields
Call yields_get_all with the user's preferred network and token.
- Pass
sort: "rewardRateDesc"— always use server-side sort, never re-sort client-side - Pass
networksas an array e.g.["base"] - Default to
limit: 20unless user asks for more - Show a table: Protocol, Type, APY, Network, Token
- Valid
typesvalues:staking,restaking,lending,vault,fixed_yield,real_world_asset,concentrated_liquidity_pool,liquidity_pool - If the user's network name doesn't match a known slug, call
networks_get_allto resolve it first
Step 3 — Inspect the yield
Call yields_get with the chosen yieldId. Read:
mechanics.arguments.enter— exact fields required for this yieldmechanics.entryLimits— min/max amountsinputTokens[]— what tokens are acceptedmechanics.requiresValidatorSelection— if true, callyields_get_validators
Never skip this step. Each yield has a different schema.
Step 4 — Select validator (if required)
If mechanics.requiresValidatorSelection === true:
- Call
yields_get_validators - Show table: Validator, Commission, APY, TVL, Voting Power
- Preferred validators first, then APY descending
- Recommend the top preferred validator but always confirm with user
- Never pick autonomously
Step 5 — Build the transaction
Call actions_enter with:
yieldIdaddress— from MoonPay wallet (Step 1)arguments— exactly as defined inmechanics.arguments.enter- Amounts are human-readable:
"1"= 1 ETH,"100"= 100 USDC
The response contains transactions[] ordered by stepIndex.
Step 6 — Sign and broadcast via MoonPay
This step is critical. Read references/moonpay-tools.md in full before proceeding.
Mistakes here result in permanent loss of funds or a silent failure
You now have transactions[] from Step 5, ordered by stepIndex.
Execute each transaction sequentially, never in parallel, never out of order.
Do not begin transaction N+1 until transaction N is CONFIRMED.
After MoonPay broadcasts each transaction:
- Call
submit_hashwith thetransactionId(fromtransactions[].id) and the on-chain hash — this is mandatory - Poll
get_transactionuntil status isCONFIRMEDorFAILEDbefore moving to the next step
Step 7 — Confirm
After all transactions are confirmed:
- Call
yields_get_balanceswith the network and address - Show the user their new position: balance, pending rewards, APY
Manage / Exit Flow
For claiming rewards, restaking, or exiting:
- Call
yields_get_balances— readpendingActions[] - Each action has
type,passthrough, optionalarguments - Call
actions_manageoractions_exitwith values from the response - Sign each transaction via MoonPay (same as Step 6)
- Call
submit_hashafter each broadcast (mandatory), then pollget_transactionuntilCONFIRMED
Intelligence Notes
- Multi-network intent detection: Detect whether the user wants a unified search or a fair comparison. Keywords like "compare", "vs", "which network is better", "ethereum vs arbitrum" → parallel calls (one per network,
limit: 20each) so every network gets fair representation. Keywords like "show me yields on ethereum and arbitrum", "find yields across chains" → single call (networks: [...],limit: 50). The API sorts globally — without parallel calls for comparisons, a high-APY network will crowd out all others from the results. - High APY (>20%): Check
rewardRate.components— if driven by incentives, flag as potentially short-lived. - submit_hash is mandatory: Always call after every broadcast. Never skip — without it, the platform cannot track the transaction.
- Network resolution: If a user mentions a chain name that doesn't match a known slug (e.g. "Binance Smart Chain", "BNB Chain"), call
networks_get_allwith a search term before calling any other tool.
Error Handling
| Situation | Action |
|---|---|
| MoonPay not authenticated | Guide through mp login + email code verification |
| No wallet found | Guide through mp wallet create MyWallet |
| Yield.xyz 400 — wrong arguments | Re-fetch yield schema, rebuild arguments |
| Transaction FAILED | Do not retry automatically — report to user with txHash |
| 429 rate limit | Respect retry-after header |
References
Read these on demand when you need specifics:
references/setup.md— installing both MCPs, auth flow, prerequisitesreferences/key-rules.md— argument rules, amount formatting, tx orderingreferences/moonpay-tools.md— MoonPay MCP tool referencereferences/policies.md— API usage and policiesreferences/output-formats.md— output formats for agent to follow to display the outputs to user