magpie-mcp
v0.1.1Agent-native lending on Solana via x402: borrow against tokens, arm in-vault TP/SL, repay.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
magpie_pool_state
Get live on-chain Magpie LendingPool state — totalDeposits, totalBorrowed, totalShares, utilization, fees earned. Free, 15s cache.
magpie_protocol_pulse
24h protocol aggregates: active loans, active borrowers, borrows in last 1h + 24h, borrow volume in SOL, repays, liquidations. Pure aggregates, no per-wallet data. Free, 30s cache.
magpie_recent_activity
Anonymized recent borrow/repay/liquidate events across the protocol. Wallets reduced to Xxxx…Yyyy. Useful as 'is this protocol active right now' signal. Free, 15s cache.
| Parameter | Type | Description |
|---|---|---|
limit | integer |
magpie_loan
Fetch a single Magpie loan by its u64 ID. Free.
| Parameter | Type | Description |
|---|---|---|
loan_id * | string |
magpie_wallet_loans
All loans owned by a wallet. Optional ?status filter. Free, 8s cache.
| Parameter | Type | Description |
|---|---|---|
wallet * | string | |
status | string |
magpie_tiers
Magpie loan tier constants — three fixed tiers (Express / Quick / Standard) with their LTV, duration, and fee parameters. Free, 1h cache.
magpie_simulate_borrow
Preview a loan WITHOUT submitting. Pure math from caller-supplied prices + the public tier constants. Use tier='all' to compare all three tiers. Free.
| Parameter | Type | Description |
|---|---|---|
amount * | string | |
decimals * | string | |
mint * | string | |
pricePerTokenUsd * | string | |
solPriceUsd * | string | |
tier | string |
magpie_collateral_eligible
Catalog of every token currently approved as Magpie collateral. Mint, symbol, decimals, category. First-touch endpoint for new agent integrations. Free, 1h cache.
magpie_liquidatable
Active loans at or past their on-chain due timestamp — the canonical liquidation-bot data feed. Sorted most-past-due-first. Use within_seconds for pre-positioning. Free, 8s cache.
| Parameter | Type | Description |
|---|---|---|
limit | integer | |
within_seconds | integer |
magpie_credit_leaderboard
Top wallets ranked by Magpie credit score (anonymized to Xxxx…Yyyy). Free, 60s cache.
magpie_lp_state
Read a wallet's LP position in the main LendingPool — shares, deposited lamports, current value, yield earned, share-of-pool, plus pool context. Free, 10s cache.
| Parameter | Type | Description |
|---|---|---|
wallet * | string |
magpie_credit_score
Magpie credit score (300-850) + tier benefits for a wallet. Paid: 0.001 SOL per lookup.
| Parameter | Type | Description |
|---|---|---|
wallet * | string |
magpie_token_risk
Per-token risk profile from Magpie's internal risk engine — risk score (0-100), dimension breakdown (volatility, liquidity, concentration, volume, rug_pull), market data, max allowed LTV the program will enforce, operator flags. Useful pre-borrow collateral check. Paid: 0.001 SOL per lookup.
| Parameter | Type | Description |
|---|---|---|
mint * | string |
magpie_build_borrow
Build an UNSIGNED borrow transaction. Server runs the full anti-exploit gate eval (ban registry, TWAP, pool floor, cross-source price, RWA-only guard, etc.) and returns a partial-signed tx. Agent signs locally and submits to magpie.capital/api/v1/cosign-borrow. Set has_exit_arming=true to route the loan into the V4 in-vault exit pool so you can later arm self-owned TP/SL exits on it (via magpie_arm_exit); leave false for a plain memecoin (V1) borrow. Paid: 0.005 SOL.
| Parameter | Type | Description |
|---|---|---|
borrower_wallet * | string | |
collateral_amount * | string | |
collateral_mint * | string | |
tier * | integer | |
has_exit_arming | boolean | When true, routes the borrow into the V4 program so the loan supports in-vault auto-sell exits (TP/SL/trailing). When false, a standard V1 borrow with no exit arming. |
magpie_build_repay
Build an unsigned repay tx for an existing loan. Paid: 0.002 SOL.
| Parameter | Type | Description |
|---|---|---|
borrower_wallet * | string | |
loan_id * | string |
magpie_build_deposit
Build an UNSIGNED LP-deposit transaction (wraps SOL → wSOL → deposits into the main LendingPool → closes wSOL ATA). Agent signs and submits. Paid: 0.002 SOL.
| Parameter | Type | Description |
|---|---|---|
depositor * | string | |
lamports * | string |
magpie_build_withdraw
Build an unsigned LP-withdraw tx for the requested shares. Server pre-validates the on-chain position and refuses chunks larger than max_safe_shares. Paid: 0.002 SOL.
| Parameter | Type | Description |
|---|---|---|
depositor * | string | |
shares * | string |
magpie_build_liquidate
Build an unsigned liquidate-loan tx for a past-due active loan. The keeper (your wallet) receives keeper_reward_bps share of the seized collateral as bounty; the rest goes to the lender authority for pool recovery. Permissionless — any wallet can liquidate. Server pre-validates the loan exists, is active, and is past due. Paid: 0.003 SOL. Workflow: poll magpie_liquidatable to find candidates, then call this on the loan_pda.
| Parameter | Type | Description |
|---|---|---|
keeper * | string | |
loan_pda * | string |
magpie_create_intent
Post a CONDITIONAL borrow intent. Bot watches the trigger condition (price_above / price_below / time_after / pool_liq_above) and builds the unsigned tx when matched. Single payment covers entire intent lifecycle. Paid: 0.01 SOL. Optional webhook_url — server POSTs an HMAC-SHA256-signed payload on match instead of forcing you to poll. The webhook_secret is returned ONCE in the response; persist it to verify signatures on receive.
| Parameter | Type | Description |
|---|---|---|
borrower_wallet * | string | |
collateral_amount * | string | |
collateral_mint * | string | |
condition_params * | object | |
condition_type * | string | |
tier * | integer | |
expires_in_seconds | integer | |
webhook_url | string | Optional HTTPS endpoint to receive the match notification. Must be HTTPS; private IPs blocked. |
magpie_get_intent
Poll the status of a conditional borrow intent. When status='matched', the response includes partial_signed_tx_b64 ready to sign + submit. Paid: 0.0005 SOL per poll.
| Parameter | Type | Description |
|---|---|---|
id * | string |
magpie_arm_exit
Arm a self-owned in-vault exit (take-profit / stop-loss / trailing) on YOUR OWN active V4 loan. When the trigger fires, the collateral is auto-sold IN-VAULT: SOL (or USDC) accumulates inside the loan's per-loan proceeds vault and the loan stays Active — the proceeds only leave to your wallet via your own borrower-signed repay. Pick exactly one trigger: target (e.g. '2x' TP / '0.7x' SL), price_usd, mc_usd (e.g. '5M','1.2B'), or trailing_bps (SL only). direction defaults to 'above' (TP); use 'below' for a stop-loss. The envelope is signed with the configured payer keypair, and the x402 payment…
| Parameter | Type | Description |
|---|---|---|
loan_id * | string | The u64 loan ID of your active V4 loan to arm the exit on. |
dest | string | Proceeds asset accumulated in the vault. Defaults to sol. |
direction | string | above = take-profit (default), below = stop-loss. |
mc_usd | string | Market-cap trigger, e.g. '5M' or '1.2B'. One trigger only. |
price_usd | string | Absolute USD price-per-token trigger. One trigger only. |
slice | string | Optional fraction/size of the position to sell at this trigger (for laddered exits). Omit to sell the full position. |
slippage_bps | integer | Max slippage tolerance for the in-vault sell, in basis points. |
target | string | Multiplier trigger, e.g. '2x' for a 2x take-profit or '0.7x' for a stop-loss. One trigger only. |
trailing_bps | integer | Trailing stop distance in basis points (stop-loss / direction=below only). One trigger only. |
magpie_modify_exit
Modify an existing armed in-vault exit order on your own V4 loan — change its trigger or execution params without cancelling and re-arming. Signed with the configured payer keypair (payer==signer). FREE.
| Parameter | Type | Description |
|---|---|---|
order_id * | string | The ID of the armed exit order to modify. |
dest | string | New proceeds asset for the in-vault sell. |
mc_usd | string | New market-cap trigger, e.g. '5M'. |
price_usd | string | New absolute USD price trigger. |
slippage_bps | integer | New max slippage tolerance in basis points. |
target | string | New multiplier trigger, e.g. '2x' / '0.7x'. |
trailing_bps | integer | New trailing stop distance in basis points (SL only). |
magpie_cancel_exit
Cancel an armed in-vault exit order on your own V4 loan. The loan stays Active and unaffected; only the pending auto-sell is removed. Signed with the configured payer keypair (payer==signer). FREE.
| Parameter | Type | Description |
|---|---|---|
order_id * | string | The ID of the armed exit order to cancel. |
magpie_list_exits
List the armed in-vault exit orders for a wallet — each order's loan, direction, trigger, distance-to-trigger, and status. Use to audit what's armed before modifying or cancelling. FREE.
| Parameter | Type | Description |
|---|---|---|
wallet * | string | The wallet whose armed exit orders to list. |
magpie_loan_by_pda
Fetch a single Magpie loan by its on-chain loan PDA (account address). Returns the loan's program version, status, collateral, due timestamp, and (for V4) proceeds-vault context. FREE.
| Parameter | Type | Description |
|---|---|---|
loan_pda * | string | The on-chain loan PDA / account address. |
magpie_pools
List the Magpie lending pools (program versions and their pool context) — V1 memecoin and V4 in-vault-exit lanes. FREE.