Solana Perp Trading from Claude: Drift Protocol MCP Integration
Trading perpetual futures on Solana just got easier for Claude Desktop users. With WAIaaS's new MCP integration for Drift Protocol, your AI agent can now execute leveraged trades, manage positions, and monitor PnL directly from conversation — no web interface required.
Why Perp Trading Needs AI Agents
Manual perpetual trading is exhausting. Markets run 24/7, position sizing requires constant calculation, and emotional decisions kill profits. Meanwhile, AI agents excel at systematic execution, risk management, and monitoring multiple markets simultaneously.
The problem? Most AI agents can't actually execute trades. They can analyze charts and suggest strategies, but when it comes to placing orders on Drift Protocol or managing leverage, you're back to manual execution.
WAIaaS bridges this gap by providing Claude with native MCP tools for Solana perpetual trading, including Drift Protocol integration with position management, leverage control, and automated risk limits.
The MCP Solution for Onchain Trading
Model Context Protocol (MCP) lets Claude Desktop connect to external systems through tool servers. WAIaaS provides 45 MCP tools, including specialized ones for Drift Protocol perp trading.
Here's how to give Claude perpetual trading capabilities in under 5 minutes:
Step 1: Start WAIaaS Daemon
npm install -g @waiaas/cli
waiaas init
waiaas start
waiaas quickset --mode mainnet # Creates Solana wallet + session
The quickset command creates a Solana mainnet wallet and prints the MCP configuration. Save this output — you'll need it next.
Step 2: Add MCP Configuration
Add WAIaaS to your Claude Desktop config at ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"waiaas": {
"command": "npx",
"args": ["-y", "@waiaas/mcp"],
"env": {
"WAIAAS_BASE_URL": "http://127.0.0.1:3100",
"WAIAAS_SESSION_TOKEN": "wai_sess_<your-token>",
"WAIAAS_DATA_DIR": "~/.waiaas"
}
}
}
}
Or use the CLI auto-setup:
waiaas mcp setup --all
Step 3: Fund Your Wallet
Your Claude agent needs SOL for trading and transaction fees. Transfer some SOL to your wallet address:
waiaas status # Shows wallet address and current balance
Step 4: Configure Trading Policies
Set up risk management policies before letting Claude trade:
curl -X POST http://127.0.0.1:3100/v1/policies \
-H "Content-Type: application/json" \
-H "X-Master-Password: <your-password>" \
-d '{
"walletId": "<wallet-uuid>",
"type": "PERP_MAX_LEVERAGE",
"rules": {
"max_leverage": 5
}
}'
Claude's New Trading Capabilities
Once configured, restart Claude Desktop. Your agent now has access to Drift Protocol through MCP tools. Here's what Claude can do:
Execute Leveraged Trades
You: "Open a 3x long SOL position with $100"
Claude: Uses the action-provider tool with Drift Protocol to execute:
curl -X POST http://127.0.0.1:3100/v1/actions/drift/open-position \
-H "Content-Type: application/json" \
-H "Authorization: Bearer wai_sess_<token>" \
-d '{
"market": "SOL-PERP",
"side": "long",
"amount": "100",
"leverage": 3
}'
The transaction goes through WAIaaS's 7-stage pipeline: validation → authentication → policy check → execution → confirmation.
Monitor Positions and PnL
You: "What's my current PnL on all positions?"
Claude: Calls get-defi-positions to fetch Drift positions:
curl http://127.0.0.1:3100/v1/defi/positions \
-H "Authorization: Bearer wai_sess_<token>"
Returns real-time position data including unrealized PnL, margin ratios, and liquidation prices across all Drift markets.
Risk Management
You: "Close positions if SOL drops below $180"
Claude: Can monitor prices and automatically execute closes using the position management tools when conditions are met.
Advanced Trading Strategies
The MCP integration supports sophisticated trading workflows:
Dollar-Cost Averaging with Leverage
# Claude can execute recurring leveraged buys
curl -X POST http://127.0.0.1:3100/v1/actions/drift/open-position \
-H "Authorization: Bearer wai_sess_<token>" \
-d '{
"market": "SOL-PERP",
"side": "long",
"amount": "50",
"leverage": 2,
"timeInForce": "IOC"
}'
Cross-Market Arbitrage
Claude can simultaneously monitor spot prices via Jupiter and perp prices on Drift, executing arbitrage when spreads exceed thresholds.
Portfolio Rebalancing
Using get-assets and get-defi-positions, Claude can maintain target allocations across spot holdings and leveraged perp positions.
Policy-Based Risk Controls
WAIaaS's 21 policy types provide granular risk management for automated trading:
Leverage Limits
{
"type": "PERP_MAX_LEVERAGE",
"rules": {
"max_leverage": 10,
"per_market_limits": {
"SOL-PERP": 5,
"BTC-PERP": 3
}
}
}
Position Size Limits
{
"type": "PERP_MAX_POSITION_USD",
"rules": {
"max_position_usd": 1000,
"per_market_limits": {
"SOL-PERP": 500,
"ETH-PERP": 300
}
}
}
Market Restrictions
{
"type": "PERP_ALLOWED_MARKETS",
"rules": {
"allowed_markets": ["SOL-PERP", "BTC-PERP", "ETH-PERP"]
}
}
The 4-tier security system (INSTANT/NOTIFY/DELAY/APPROVAL) applies to perp trading. Large positions can require human approval via WalletConnect, while small trades execute instantly.
Beyond Drift: Multi-Protocol Perp Trading
WAIaaS integrates 15 DeFi protocol providers including Hyperliquid for additional perpetual trading options:
# Trade on Hyperliquid through the same MCP interface
curl -X POST http://127.0.0.1:3100/v1/actions/hyperliquid/place-order \
-H "Authorization: Bearer wai_sess_<token>" \
-d '{
"symbol": "SOL",
"side": "A",
"sz": "10",
"px": "180",
"orderType": "Limit"
}'
Claude can compare funding rates across Drift and Hyperliquid, executing trades on the most profitable venue.
Quick Start: Your First AI-Driven Perp Trade
- Install and configure:
waiaas quickset --mode mainnet && waiaas mcp setup --all - Fund wallet: Transfer SOL to your wallet address from
waiaas status - Set policies: Configure leverage and position limits via the REST API
- Restart Claude: The MCP tools will be available in new conversations
- Start trading: "Open a 2x long SOL position with $50" and watch Claude execute
Your trading positions and wallet state sync in real-time. Claude sees the same data as Drift's web interface, but can act on it programmatically.
For more advanced perp trading setups, check out AI Agent Wallet Security: 3-Layer Defense for Onchain Operations and Self-Hosted Web3: Why AI Agents Need Their Own Wallets.
What's Next
This integration is just the beginning. WAIaaS's MCP server provides 45 tools covering DeFi, NFTs, bridging, and x402 payments. Your Claude agent can now participate in the full Solana ecosystem, not just perpetual trading.
Try the integration yourself: clone the repo at GitHub or learn more at waiaas.ai. The future of AI-driven trading is conversational, and it starts with giving your agents real wallets.