Agent-native lending on Solana via x402: borrow against tokens, arm in-vault TP/SL, repay.
Copy the AI prompt to install this server into Claude Code, Cursor, or another agent β or use 1-click editor setup below.
One-click editor setup isnβt available for this listing yet β we donβt have a confirmed install command, and weβd rather show nothing than point your editor at the wrong package or host. Follow the projectβs own setup instructions, linked above.
Borrow SOL against your memecoins, tokenized stocks, and RWAs β and set take-profits and stops on that same collateral. Liquidity now, upside intact: collateral that can still sell itself.
x402 payment-required API endpoints for the Magpie Capital protocol. AI agents and other Solana protocols can pay-per-call for credit scores, token risk assessments, and protocol analytics β no API keys, no signups, just a Solana payment. Agents borrow programmatically: pay per call, get back an unsigned Solana transaction, sign and submit it yourself (the service holds zero keys).
Take-profit, stop-loss, ladders, trailing stops β they fire on-chain into your loan's vault, the loan stays open, and proceeds reach your wallet only when you repay. Auto-sell exits are V4 in-vault orders on supported collateral (memecoins + tokenized stocks/RWAs); they are auto-sell orders that fire on-chain through a slippage stack, not guaranteed fills.
| Method | Path | Price | Description |
|---|---|---|---|
| GET | / | Free | Service info + endpoint catalog |
| GET | /health | Free | Liveness check |
| GET | /.well-known/x402.json | Free | Machine-readable endpoint catalog (auto-discovery) |
| GET | /openapi.json | Free | OpenAPI 3.1 spec (for agent frameworks) |
| GET | /api/v1/pool | Free | Live on-chain LendingPool state β totalDeposits, totalBorrowed, lifetime counters. 15s cache. |
| GET | /api/v1/pools | Free | All three strategy pools (V1 memecoin / V3 RWA / V4 in-vault) in one call, with a partial map if any version is unreachable. 15s cache. |
| GET | /api/v1/loan/:loanId?borrower=<pubkey> | Free | Loans matching a u64 ID across V1/V3/V4. Returns a list (a borrower can hold the same numeric ID in more than one program) β each tagged with program_version. 10s cache. |
| GET | /api/v1/loan/by-pda/:loanPda | Free | Single loan by its PDA β unambiguous, routed to V1/V3/V4 from the on-chain owner. Returns program_version, V4 in-vault exit state, and exits_supported. 10s cache. |
| GET | /api/v1/wallet/:wallet/loans?status=... | Free | All loans owned by a wallet across V1/V3/V4 via getProgramAccounts + memcmp filter, each tagged with program_version (with a by_version count). Optional status filter. 8s cache. |
| GET | /api/v1/collateral/eligible | Free | Catalog of every token currently approved as Magpie collateral. First-touch for new agent integrations. 1h cache. |
| GET | /api/v1/markets/liquidatable | Free | Active loans at or past their on-chain due timestamp across V1/V3 β the canonical liquidation-bot data feed, each tagged with program_version. Sorted most-past-due-first. Optional ?within_seconds= for pre-positioning, ?include_v4=true to include in-vault V4 loans. 8s cache. |
| GET | /api/v1/agent/activity | Free | Anonymized recent borrow/repay/liquidate events. First-touch "is this protocol alive?" feed for arriving agents. 15s cache. |
| GET | /api/v1/agent/protocol-pulse | Free | 24h aggregates: active loans, active borrowers, borrow volume, liquidations. 30s cache. |
| GET | /api/v1/agent/leaderboard | Free | Top wallets by Magpie credit score, anonymized. 60s cache. |
| GET | /api/v1/agent/lp-state?wallet=<pubkey> | Free | Depositor position + pool context (shares, deposited, current value, yield, share-of-pool). 10s cache. |
| GET | /api/v1/agent/self-limit-close/list?wallet=<pubkey> | Free | A wallet's armed in-vault exit orders (TP/SL) on its V4 loans. |
| GET | /api/v1/credit-score?wallet=<pubkey> | 0.001 SOL | Magpie credit score (300β850) + tier benefits |
| POST | /api/v1/agent/build-borrow | 0.005 SOL | Build an unsigned borrow tx. Pass has_exit_arming: true to route to the V4 in-vault program (so exit orders can be armed on the loan); otherwise routes to V1 (memecoin) β and, once it launches, V3 (RWA). |
| POST | /api/v1/agent/build-deposit | 0.002 SOL | Build an unsigned LP-deposit tx (SOL β pool). Caller signs and submits. |
| POST | /api/v1/agent/build-withdraw | 0.002 SOL | Build an unsigned LP-withdraw tx (shares β SOL). Server validates against the on-chain position and refuses unsafe chunk sizes. |
| POST | /api/v1/agent/self-limit-close/arm | 0.001 SOL | Arm an in-vault take-profit / stop-loss on your OWN V4 loan. Body is an Ed25519 signed envelope; pays AND signs with the same keypair, so payer == signer. Bot enforces ownership + V4-only. |
| POST | /api/v1/agent/self-limit-close/modify | Free | Modify an armed exit order (signed envelope). |
| POST | /api/v1/agent/self-limit-close/cancel | Free | Cancel an armed exit order (signed envelope). |
All free endpoints query the on-chain Magpie program directly and have proper Cache-Control headers so CDN edges serve repeat reads without round-tripping.
Loan and pool reads are multi-version: every loan/pool is resolved across the V1 (memecoin), V3 (RWA β on the V3 launch), and V4 (in-vault auto-sell) programs and tagged with its program_version. These reads fail soft β if one version is unreachable, the rest still return and the affected version is reported in a partial map rather than erroring the whole call. The /api/v1/agent/self-limit-close/* surface lets a borrower-agent arm, modify, cancel, and list self-owned in-vault exit orders (take-profit / stop-loss) on its own V4 loans, authenticated by an Ed25519 signed envelope where the x402 payer is also the envelope signer.
π Building your first Magpie agent? Read
QUICKSTART.mdβ zero to a working autonomous borrow agent on Solana in 10 minutes, using the typed SDK.π¦ TypeScript SDK (
@magpieloans/magpie-agent): every action as a one-liner. Borrow, lend, liquidate, post conditional intents β no HTTP plumbing. Seesdk/README.md.π§© MCP server for Claude Desktop / Cursor / Windsurf / ChatGPT desktop: one config block, 26 tools. See
mcp/README.md.π― Limit-close agent quickstart β full end-to-end walkthrough for agents that arm, monitor, and steer limit-close (TP/SL) orders on borrowers' loans. Authorization flow, every endpoint, sample code, error reference, best practices. See
docs/AGENT_QUICKSTART_LIMIT_CLOSE.md.π Just want code examples?
/examples/β 13 turn-key TypeScript agents (credit fetch, liquidation keeper, full borrow loop, conditional intent, yield agent, webhook receiver, collateral screener, equity-leverage preview, more) that talk to the live production endpoint. Each is a single file, runs withnpx tsx.π§© Using Claude Desktop, Cursor, Windsurf, or ChatGPT desktop?
/mcp/ships a one-config-block MCP server that exposes the full API as native tools in your agent host. Free reads work without any keypair; paid endpoints sign x402 payments locally with a configured Solana wallet.
More paid endpoints in progress (token risk score, batch credit lookups, webhook subscriptions, MCP server, LP-side build-deposit / build-withdraw) β see MARKETING.md for the agent-distribution roadmap or open an issue if you want one prioritized.
Response:
No reviews yet β be the first to share how this listing worked for you.
Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.
[](https://allmcps.com/mcp/magpie-mcp)<a href="https://allmcps.com/mcp/magpie-mcp"><img src="https://allmcps.com/api/badge/magpie-mcp?style=directory" alt="Magpie MCP on AllMCPs" /></a>