magpie-mcp — Claude Code MCP server: what it does, how to install
Connects AI assistants to the Magpie lending protocol on Solana. Borrow against tokens and configure in-vault profit targets or stop triggers without selling your stash.
claude mcp add magpie-mcp -- npx -y @magpieloans/magpie-mcpWhat magpie-mcp does
The server exposes 26 protocol tools via the Magpie x402 interface. Agents can inspect live lending pools, review liquidations, pull wallet credit data, and simulate borrow terms before acting. These informational queries require no wallet signature and function immediately upon launch.
Active borrowing and risk management run through localized transaction assembly. It lets agents build loan requests against memecoins or real-world assets, repay debt, and place take-profit or trailing-stop triggers directly inside V4 collateral vaults. When triggered, the collateral sells on-chain through a slippage buffer, retaining proceeds within the vault until the borrower settles the loan.
Without a local keypair in MAGPIE_MCP_PAYER_KEYPAIR, actions that build transactions or set vault orders will halt. Your secret key stays on the host machine because the server signs x402 fees and Ed25519 envelopes locally.
What it helps with
- query live Solana lending pool states and liquidations
- simulate SOL borrowing terms against token collateral
- arm take-profit or stop-loss triggers inside loan collateral vaults
- build transaction payloads to repay or deposit into Magpie loans
Example prompts for the agent
- Check my active Magpie loans and show current pool liquidation thresholds.
- Simulate a SOL borrow against my collateral and estimate the liquidation price.
- Set a 2x take-profit trigger on the collateral vault of my active loan.
How to install magpie-mcp
Platform CLI
claude mcp add magpie-mcp -- npx -y @magpieloans/magpie-mcpPlatform CLI
codex mcp add mcp -- npx -y @magpieloans/magpie-mcpConfig file
{
"mcpServers": {
"mcp": {
"command": "npx",
"args": [
"-y",
"@magpieloans/magpie-mcp"
]
}
}
}Config file
{
"servers": {
"mcp": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@magpieloans/magpie-mcp"
]
}
}
}Platform CLI
gemini mcp add mcp npx -y @magpieloans/magpie-mcpStep by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more
Questions about magpie-mcp
How to install magpie-mcp in Claude Code?
Run claude mcp add magpie-mcp -- npx -y @magpieloans/magpie-mcp in your terminal. To execute paid actions, also provide your Solana RPC endpoint and keypair path in the environment settings.
What does magpie-mcp do?
It turns Solana lending actions on Magpie into native tools for AI hosts. Agents can analyze pool risk, structure collateralized loans, and set automated stop-loss or profit exits.
Does the server transmit my private key over the network?
No, the keypair never leaves your machine. The local process signs small x402 payment fees and Ed25519 authorization messages internally, dispatching only signed envelopes to the protocol.