Documentation
Complete reference for the Solobank SDK, CLI, and MCP server — everything you need to give AI agents a bank account on Solana.
Architecture
Quickstart
Up and running in 30 seconds.
Using with Claude / Cursor
Add to your MCP config:
Using as a library
CLI Reference
@solobank/cli — 14 commands wrapping the SDK. Binary: solobank.
solobank init--forceGenerate a new Solana Ed25519 keypair and save it to ~/.config/solobank/id.json.
solobank addressPrint the wallet's base58 public key.
solobank balanceShow SOL and USDC balances for the current wallet.
solobank send <amount> <to>--asset <SOL|USDC|USDT|JUP>Transfer SOL or SPL tokens to any Solana address. Defaults to USDC.
solobank pay <url>--method --data --max-pricePay an MPP-protected HTTP endpoint. Handles 402 negotiation automatically.
solobank swap-quote <amount> <from> <to>--slippage-bps <50>Get a Jupiter swap quote without executing.
solobank swap <amount> <from> <to>--slippage-bps <50>Execute a token swap via Jupiter best route.
solobank lend-rates <asset>--protocol <auto|kamino|marginfi>List current lending APYs across Kamino and marginfi.
solobank lend <amount> <asset>--protocolDeposit to the best lending venue. Auto-routes to highest APY.
solobank borrow <amount> <asset>--protocol --market --bank --reserveBorrow against deposited collateral.
solobank withdraw <amount> <asset>--protocol --market --bank --reserve --allWithdraw from a lending position. Use --all for full withdrawal.
solobank repay <amount> <asset>--protocol --market --bank --reserve --allRepay an outstanding borrow position. Use --all to clear debt.
solobank rebalance <amount> <asset>--protocol --target-protocol --min-apy-deltaMove funds from one lending venue to a higher-APY venue.
solobank mcpPrint MCP stdio configuration JSON for Claude / Cursor integration.
SDK Reference
@solobank/sdk — full TypeScript SDK. Exports: ".", "./browser", "./adapters".
Wallet
| Method | Returns | Description |
|---|---|---|
| Solobank.init(options?) | Promise<{address, keypairPath, rpcUrl}> | Generate a new keypair and save to disk. Options: { configDir?, force?, rpcUrl?, keypairPath? }. |
| Solobank.create(options?) | Promise<Solobank> | Load existing wallet or create if createIfMissing: true. |
| Solobank.load(options?) | Promise<Solobank> | Alias for create(). |
| Solobank.fromSecretKey(key, opts?) | Solobank | Instantiate from raw secret key (Uint8Array, base64, or JSON array). |
| .address() | string | Returns the wallet's base58 public key. |
| .balance() | Promise<BalanceSnapshot> | SOL + USDC balances with raw bigint values. |
Transfers
| Method | Returns | Description |
|---|---|---|
| .send(options) | Promise<SendResult> | Transfer SOL or SPL tokens. Options: { amount, to, asset?, mint?, dryRun? }. |
| .pay(options) | Promise<PayResult> | Pay an MPP endpoint. Options: { url, method?, headers?, body?, maxPrice? }. |
Swaps
| Method | Returns | Description |
|---|---|---|
| .getSwapQuote(options) | Promise<SwapQuoteResult> | Get Jupiter quote. Options: { fromAsset, toAsset, amount, slippageBps?, swapMode?, onlyDirectRoutes? }. |
| .swap(options) | Promise<SwapExecutionResult> | Execute Jupiter swap. Returns quote fields + signature + explorerUrl. |
Lending
| Method | Returns | Description |
|---|---|---|
| .getLendingRates(options) | Promise<LendingRate[]> | APYs across Kamino + marginfi. Options: { asset, protocol? }. |
| .lend(options) | Promise<LendResult> | Deposit to best venue. Options: { asset, amount, protocol?, dryRun? }. |
| .borrow(options) | Promise<LendingActionResult> | Borrow from lending protocol. Options: { asset, amount, protocol?, marketAddress?, bankAddress?, reserveAddress?, dryRun? }. |
| .withdraw(options) | Promise<LendingActionResult> | Withdraw from position. Options: { asset, amount, withdrawAll?, protocol?, dryRun? }. |
| .repay(options) | Promise<LendingActionResult> | Repay a borrow. Options: { asset, amount, repayAll?, protocol?, dryRun? }. |
| .rebalance(options) | Promise<RebalanceResult> | Move funds to higher-APY venue. Options: { asset, amount, targetProtocol?, minApyDelta?, dryRun? }. |
Key Types
Browser Client
Lightweight MPP client for wallet-adapter integration:
Utility Functions
| Function | Description |
|---|---|
| resolveAsset(input) | Resolve asset symbol or mint to { symbol, mint, decimals } |
| truncateAddress(addr, prefix?, suffix?) | Truncate address: 7xKp...3mNq |
| formatUsd(amount) | Format number as $1,234.56 |
| formatAssetAmount(amount, asset) | Format with asset-specific decimals |
| formatPercent(value, digits?) | Format as percentage string |
| walletExists(configDir?, keypairPath?) | Check if wallet file exists on disk |
| keypairFromPrivateKey(key) | Parse base64, JSON array, or Uint8Array to Keypair |
MCP Server
@solobank/mcp — Model Context Protocol server for Claude, Cursor, Windsurf, and other MCP-compatible AI platforms.
Tools
solobank_addressnoneReturns the current Solana wallet address.
solobank_balancenoneReturns wallet balance snapshot — SOL + USDC with raw values.
solobank_sendto, amount, asset?, dryRun?Send SOL or SPL tokens. Validates address format. Enforces per-tx spending cap (maxAmountPerTx, default 1.0).
solobank_payurl, method?, body?, maxPrice?, headers?Pay an MPP-protected HTTP endpoint. Handles 402 negotiation. Blocks internal/private network URLs.
Programmatic Usage
Payments
@solobank/mpp-solana — Solana USDC payment method for the Machine Payments Protocol (MPP). Handles 402 negotiation, multi-account transfers, and on-chain verification.
Client (payer)
Server (verifier)
Utility Functions
| Function | Description |
|---|---|
| fetchTokenAccounts(conn, owner, mint) | Fetch SPL token accounts sorted by balance |
| buildTransferPlan(accounts, amount) | Greedy multi-account spend plan |
| sumReceivedTokenAmount(pre, post, mint, owner) | Compute token delta for verification |
| parseAmountToRaw(amount, decimals) | Convert decimal string to bigint (e.g. "1.50" → 1500000n) |
Constants
Environment Variables
Optional configuration via environment variables.
| Variable | Default | Description |
|---|---|---|
| SOLOBANK_CONFIG_DIR | ~/.config/solobank | Wallet config directory. |
| SOLOBANK_KEYPAIR_PATH | id.json | Keypair filename within config dir. |
| SOLOBANK_RPC_URL | devnet RPC | Solana RPC endpoint. |
| SOLOBANK_JUP_BASE_URL | https://lite-api.jup.ag | Jupiter API base URL. |
| SOLOBANK_JUP_API_KEY | none | Jupiter Pro API key for higher rate limits. |