Skip to main content

MoonPay CLI for AI agents

Crypto onramp for AI agents — non-custodial wallets, swaps, bridges, transfers, DCA, limit orders, deposits, market data, and fiat on/off ramps via CLI or MCP.

Updated yesterday

Overview


MoonPay CLI gives AI agents and humans full access to crypto with non-custodial wallets, multi-chain trading, market intelligence, and fiat on/off-ramps. Keys are encrypted locally and never leave your machine. Available as a CLI (mp), local MCP server (mp mcp), or REST API.

Key benefits


  • Non-custodial wallets — Local HD wallets with OS keychain encryption; keys never leave the machine

  • Multi-chain support — Solana, Ethereum, Base, Polygon, Arbitrum, Optimism, BNB, Avalanche, TRON, Bitcoin

  • Full trading suite — Swap, bridge, transfer, DCA, limit orders, stop losses

  • Market intelligence — Trending tokens, token analysis, price data, price alerts

  • Fiat integration — Buy crypto with USD, virtual accounts with KYC

  • Multi-surface access — CLI, local MCP server, REST API, or web chat

Getting started


Choose how you want to access MoonPay CLI based on your use case. The CLI is recommended for direct terminal usage, the MCP server integrates with AI assistants like Claude, and the REST API supports custom applications.

Option A: CLI (recommended)

</> Bash

# Install
npm install -g @moonpay/cli

# Login (opens browser for captcha verification)
mp login --email [email protected]

# Open the URL, solve captcha, get code from email
mp verify --email [email protected] --code 123456

# Create a wallet
mp wallet create --name main

# List tools
mp tools

# Search for a token
mp token search --query "SOL" --chain solana --limit 5

# Check balances
mp token balance list --wallet main --chain solana

Option B: MCP server (local)

Run mp mcp to start a local MCP server over stdio. This exposes all CLI and remote tools to any MCP-compatible client (Claude Desktop, Cursor, Claude Code).

</> JSON

{
"mcpServers": {
"moonpay": {
"command": "mp",
"args": ["mcp"]
}
}
}

Option C: REST API

</> Bash

curl -X POST https://agents.moonpay.com/api/tools/token_search \
-H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{"query": "SOL", "chain": "solana", "limit": 5}'

Authentication


All MoonPay CLI operations require authentication to ensure secure access to your wallets and trading features.

CLI authentication

Run mp login --email [email protected] to open a browser page with hCaptcha. After solving the captcha, a verification code is sent to your email. Run mp verify --email [email protected] --code 123456.

Credentials are stored encrypted at ~/.config/moonpay/credentials.json and auto-refresh. Run mp logout to clear stored credentials.

REST API authentication

Use a Bearer token in the Authorization header. Obtain tokens via the login/verify flow or OAuth 2.0 with PKCE.

Rate limits


  • Anonymous: 5 requests/min

  • Authenticated: 60 requests/min

Managing your wallets


MoonPay CLI uses HD wallets (BIP39) where one mnemonic derives addresses for all supported chains. EVM wallets share a single address across Ethereum, Base, Polygon, Arbitrum, Optimism, BNB, and Avalanche.

</> Bash

mp wallet create --name main # Create HD wallet (Solana + EVM + Bitcoin + TRON)
mp wallet import --name funded # Import from mnemonic or private key (interactive)
mp wallet list # List all wallets (shows all chain addresses)
mp wallet retrieve --wallet main # Get wallet details
mp wallet rename --wallet old --name new # Rename a wallet
mp wallet export --wallet main # Export mnemonic (interactive only)
mp wallet delete --wallet old # Permanently delete a wallet

Trading tokens


Execute swaps, bridges, and transfers with local signing — your keys never leave your machine. All trading operations support simulation mode to preview outcomes before execution.

Swapping tokens on the same chain

</> Bash

mp token swap \
--wallet main --chain solana \
--from-token EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v \
--from-amount 5 \
--to-token So11111111111111111111111111111111111111111

Bridging tokens across chains

</> Bash

mp token bridge \
--from-wallet main --from-chain polygon \
--from-token 0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174 \
--from-amount 6 \
--to-chain solana \
--to-token EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v \
--to-wallet

Transferring tokens

</> Bash

mp token transfer \
--wallet main --chain solana \
--token EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v \
--amount 10 \
--to

Accessing market data


Get real-time token information, search for assets, track trending tokens, and monitor your portfolio balances.

</> Bash

# Search tokens
mp token search --query "BONK" --chain solana --limit 5


# Token details + market data
mp token retrieve --token
--chain solana


# Trending tokens
mp token trending list --chain solana --limit 10 --page 1


# Check balances
mp token balance list --wallet
--chain solana

Buying crypto with fiat


Convert fiat currency to crypto through MoonPay's checkout or set up automated virtual account deposits with KYC verification.

Buy crypto with fiat

</> Bash

# Amount in USD, returns checkout URL
mp buy --token sol --amount 50 --wallet
--email

Virtual account (KYC-based fiat on-ramp)

</> Bash

mp virtual-account create
mp virtual-account wallet register --wallet main --chain solana
mp virtual-account onramp create --name "USD to USDC" --fiat USD --chain solana --stablecoin USDC

Creating deposit links


Generate multi-chain deposit links to receive crypto payments with automatic stablecoin conversion.

</> Bash

# Create a multi-chain deposit link
mp deposit create --name "My Deposit" --wallet
--chain solana --token USDC

# Check deposit details
mp deposit retrieve --id

# List deposit transactions
mp deposit transaction list --id

Signing messages and transactions


Sign messages and transactions locally for maximum security, then broadcast them to the network.

</> Bash

# Sign a message
mp message sign --wallet main --chain solana --message "hello"

# Sign a transaction
mp transaction sign --wallet main --chain solana --transaction

# Send a signed transaction
mp transaction send --chain solana --transaction

Safety rules for trading


CLI tools (mp token swap, mp token bridge, mp token transfer) handle the full build, sign, broadcast flow automatically. Keys are signed locally and never sent to the server.

For server-side tools (REST API / MCP), use the simulate-then-execute pattern:

  1. Always simulate first — Call with "simulation": true to get a quote

  2. Show the quote — Display expected output, fees, slippage

  3. Get explicit confirmation — Never auto-execute without user approval

  4. Execute — Call with "simulation": false only after confirmation

Available CLI tools


All MoonPay CLI functionality is organized into the following categories for easy discovery and use.

Auth

Tool

Description

login

Open browser for hCaptcha verification, sends email code

verify

Verify login code and store encrypted credentials

logout

Log out and clear stored credentials

user retrieve

Get the currently authenticated user

consent check

Check whether Terms of Service have been accepted

consent accept

Accept the Terms of Service and Privacy Policy

Wallet

Tool

Description

wallet create

Create multi-chain HD wallet

wallet import

Import from mnemonic or private key

wallet list

List all local wallets

wallet retrieve

Get wallet details

wallet rename

Rename a wallet

wallet delete

Delete a local wallet

wallet export

Export mnemonic (interactive only)

Token trading

Tool

Description

token swap

Swap tokens on the same chain

token bridge

Bridge tokens across chains

token transfer

Transfer tokens to another address

Market data

Tool

Description

token search

Search tokens by name/symbol/address

token retrieve

Token metadata + market data

token trending list

Trending tokens by chain

token balance list

List token balances for a wallet

bitcoin balance retrieve

Get BTC balance

Transactions

Tool

Description

transaction list

List swap/bridge transaction history

transaction retrieve

Get transaction details

transaction sign

Sign a transaction locally

transaction send

Broadcast a signed transaction

message sign

Sign a message (EIP-191, ed25519, ECDSA)

Fiat

Tool

Description

buy

Buy crypto with fiat via MoonPay checkout (amount in USD)

virtual-account create

Create virtual account + start KYC

virtual-account retrieve

Get account status

virtual-account wallet list

List wallets registered for fiat on-ramp

virtual-account wallet register

Register wallet for fiat on-ramp

virtual-account onramp create

Create fiat to stablecoin onramp

virtual-account onramp retrieve

Get onramp details and banking info

virtual-account onramp list

List onramps

virtual-account onramp delete

Cancel an onramp

virtual-account onramp payment create

Create open banking payment link

virtual-account onramp payment retrieve

Get payment status

virtual-account transaction list

List fiat to stablecoin conversion history

virtual-account kyc restart

Start or restart KYC verification

virtual-account kyc continue

Check KYC status or get verification link

virtual-account agreement list

List legal agreements (pending or accepted)

virtual-account agreement accept

Accept a required legal agreement

Deposits

Tool

Description

x402 request

Make paid API request with automatic payment

Skills

Tool

Description

skill list

List available AI skills

skill retrieve

Get skill instructions

skill install

Install skills for Claude Code

Deposits

Tool

Description

feedback create

Submit feedback (type: bug, feature, or general)

Upgrading your rate limit with x402


Pay to increase your API rate limit via the x402 protocol. Payment is USDC via x402 on Solana or Base.


Endpoint: POST https://agents.moonpay.com/x402/upgrade

Duration

Price

Lenght

day

$1 USDC

24 hours

month

$20 USDC

30 days

</> Bash

# With CLI (handles payment automatically)
mp upgrade --duration day --wallet main --chain solana

Note: Requires login. Payment is only settled on success.

Pre-built AI skills


Install AI skills for Claude Code to enable guided workflows and automation.

</> Bash

mp skill install

Tool

Description

moonpay-auth

CLI setup, login, wallet creation

moonpay-block-explorer

Open tx/wallet/token in chain explorers

moonpay-buy-crypto

Buy crypto with fiat

moonpay-check-wallet

View balances and portfolio

moonpay-deposit

Create deposit links with stablecoin conversion

moonpay-discover-tokens

Search, trending, risk assessment

moonpay-export-data

Export portfolio/tx history to CSV/JSON

moonpay-feedback

Submit bug reports and feature requests

moonpay-mcp

Configure MoonPay as MCP server

moonpay-missions

Guided walkthrough of capabilities

moonpay-fund-polymarket

Install Polymarket CLI and fund its wallet

moonpay-price-alerts

Desktop notifications at target prices

moonpay-swap-tokens

Swap and bridge tokens

moonpay-trading-automation

DCA, limit orders, stop losses via cron/launchd

moonpay-upgrade

Upgrade rate limit via x402 payment

moonpay-virtual-account

Fiat on-ramp with KYC

moonpay-x402

Paid API requests

Supported chains


MoonPay CLI supports multiple blockchains with varying feature sets. Solana offers the most comprehensive trading capabilities.

Chain

Chain ID

Features

Solana

solana

Full trading, limit orders, DCA

Ethereum

ethereum

Swap, bridge, transfer, market data

Base

base

Swap, bridge, transfer, market data

Polygon

polygon

Swap, bridge, transfer, market data

Arbitrum

arbitrum

Swap, bridge, transfer, market data

Optimism

optimism

Swap, bridge, transfer, market data

BNB

bnb

Swap, bridge, transfer, market data

Avalanche

avalanche

Swap, bridge, transfer, market data

TRON

tron

Wallet addresses

Bitcoin

bitcoin

Balance, bridges

Tips for AI agents


Follow these best practices when building AI agents that use MoonPay CLI.

  • Resolve token addresses first — Call token search before trading if you only have a name/symbol

  • Check balances — Use token balance list before trading to confirm available amounts

  • Native token addresses — Solana: So11111111111111111111111111111111111111111, EVM: 0x0000000000000000000000000000000000000000

  • EVM wallets share one address across Ethereum, Base, Polygon, Arbitrum, Optimism, BNB, Avalanche

Did this answer your question?