magpie-mcp

v0.1.1
io.github.magpiecapital/magpie-mcp Checked 3 days ago Published 5 months ago

Agent-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.

ParameterTypeDescription
limitinteger

magpie_loan

Fetch a single Magpie loan by its u64 ID. Free.

ParameterTypeDescription
loan_id *string

magpie_wallet_loans

All loans owned by a wallet. Optional ?status filter. Free, 8s cache.

ParameterTypeDescription
wallet *string
statusstring

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.

ParameterTypeDescription
amount *string
decimals *string
mint *string
pricePerTokenUsd *string
solPriceUsd *string
tierstring

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.

ParameterTypeDescription
limitinteger
within_secondsinteger

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.

ParameterTypeDescription
wallet *string

magpie_credit_score

Magpie credit score (300-850) + tier benefits for a wallet. Paid: 0.001 SOL per lookup.

ParameterTypeDescription
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.

ParameterTypeDescription
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.

ParameterTypeDescription
borrower_wallet *string
collateral_amount *string
collateral_mint *string
tier *integer
has_exit_armingbooleanWhen 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.

ParameterTypeDescription
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.

ParameterTypeDescription
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.

ParameterTypeDescription
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.

ParameterTypeDescription
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.

ParameterTypeDescription
borrower_wallet *string
collateral_amount *string
collateral_mint *string
condition_params *object
condition_type *string
tier *integer
expires_in_secondsinteger
webhook_urlstringOptional 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.

ParameterTypeDescription
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…

ParameterTypeDescription
loan_id *stringThe u64 loan ID of your active V4 loan to arm the exit on.
deststringProceeds asset accumulated in the vault. Defaults to sol.
directionstringabove = take-profit (default), below = stop-loss.
mc_usdstringMarket-cap trigger, e.g. '5M' or '1.2B'. One trigger only.
price_usdstringAbsolute USD price-per-token trigger. One trigger only.
slicestringOptional fraction/size of the position to sell at this trigger (for laddered exits). Omit to sell the full position.
slippage_bpsintegerMax slippage tolerance for the in-vault sell, in basis points.
targetstringMultiplier trigger, e.g. '2x' for a 2x take-profit or '0.7x' for a stop-loss. One trigger only.
trailing_bpsintegerTrailing 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.

ParameterTypeDescription
order_id *stringThe ID of the armed exit order to modify.
deststringNew proceeds asset for the in-vault sell.
mc_usdstringNew market-cap trigger, e.g. '5M'.
price_usdstringNew absolute USD price trigger.
slippage_bpsintegerNew max slippage tolerance in basis points.
targetstringNew multiplier trigger, e.g. '2x' / '0.7x'.
trailing_bpsintegerNew 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.

ParameterTypeDescription
order_id *stringThe 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.

ParameterTypeDescription
wallet *stringThe 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.

ParameterTypeDescription
loan_pda *stringThe 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.