Provides comprehensive trading and market data tools for the Derive API by Lyra Finance, enabling real-time market data access, historical data queries, options/perpetuals/spot trading, account management, and risk monitoring on Ethereum-based derivatives markets.
MCP Derive
A comprehensive Model Context Protocol (MCP) server for the Derive API by Lyra Finance. This server provides 31+ tools to access real-time market data, historical data, trading capabilities, and account management for options, perpetuals, and spot trading.
Features
Real-time Market Data (Low Latency)
get_ticker - Real-time prices, bid/ask, volume, Greeks for single instruments
get_tickers - Multi-instrument ticker data efficiently
get_orderbook - Order book with configurable depth and spread analysis
get_currencies - All available trading pairs
get_instruments - Comprehensive instrument data with fees and constraints
Tick-by-Tick Historical Data
get_trade_history - Complete trade history with filtering and pagination
get_funding_rate_history - Perpetual funding rates with timestamps
get_spot_feed_history - Index price feed data
get_option_settlement_history - Option expiration and settlement data
get_liquidation_history - Platform liquidation events
Account Management
get_account - Account details, subaccounts, rate limits, fees
get_subaccounts - All subaccounts with labels
get_balance - Total balance across subaccounts and collaterals
get_positions - Open positions with PnL, Greeks, liquidation prices
get_collaterals - Collateral information and valuations
get_margin - Detailed margin metrics and status
Trading (All Instruments)
place_order - Market or limit orders for options, perps, and spot
cancel_order - Cancel individual orders
cancel_all_orders - Bulk cancel with filtering
replace_order - Atomic order replacement
get_open_orders - All open orders
get_orders_history - Complete order history with fills
Trade & Account History
get_my_trades - Personal trade history with fees and PnL
get_funding_history - Funding payments paid/received
get_deposit_history - Deposit transactions
get_withdrawal_history - Withdrawal transactions
RFQ (Request For Quote)
send_rfq - Request quotes from market makers
get_rfqs - View active RFQs
execute_quote - Execute at quoted prices
Risk Management
get_liquidation_price - Current liquidation price for positions
margin_watch - Accounts approaching liquidation
Installation
Configuration
Environment Variables
Setup with Claude Desktop
Add to Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):
Setup with Claude Code CLI
API Endpoints
Mainnet
HTTP:
https://api.lyra.financeWebSocket:
wss://api.lyra.finance/ws(not yet supported by MCP)
Testnet
HTTP:
https://api-demo.lyra.financeWebSocket:
wss://api-demo.lyra.finance/ws(not yet supported by MCP)
Tool Documentation
Public Market Data Tools
get_currencies
Get all available currencies on the platform.
get_instruments
Get tradeable instruments for a specific currency and type.
get_ticker
Real-time ticker for a single instrument.
get_tickers
Get tickers for multiple instruments (more efficient than get_ticker).
get_orderbook
Real-time order book with depth and spread analysis.
Historical Data Tools
get_trade_history
Tick-by-tick trade history across the platform.
get_funding_rate_history
Historical funding rates for perpetual contracts.
get_spot_feed_history
Historical index prices (spot feeds).
get_option_settlement_history
Option expiration and settlement data.
get_liquidation_history
Platform-wide liquidation events.
Account Management Tools
get_account
Account overview with rate limits and fees.
get_subaccounts
All subaccounts for a wallet.
get_balance
Total balance across all subaccounts.
get_positions
All open positions for a subaccount.
get_collaterals
Collateral information for a subaccount.
get_margin
Detailed margin metrics.
Trading Tools
place_order
Place a new order for any instrument (options, perps, spot).
cancel_order
Cancel a specific open order.
cancel_all_orders
Cancel all open orders with optional filtering.
replace_order
Replace an order atomically (cancel + place in one operation).
get_open_orders
View all open orders for a subaccount.
get_orders_history
Complete order history (filled, cancelled, rejected).
Account History Tools
get_my_trades
Personal trade history with P&L.
get_funding_history
Funding payments paid and received.
get_deposit_history
Deposit transactions.
get_withdrawal_history
Withdrawal transactions.
RFQ Tools
send_rfq
Request a quote from market makers.
get_rfqs
View active RFQs and quotes.
execute_quote
Execute a market maker quote.
Risk Management Tools
get_liquidation_price
Get liquidation price for an open position.
margin_watch
Accounts approaching liquidation.
Instrument Naming
Options Format
{CURRENCY}-{EXPIRY}-{STRIKE}-{TYPE}
Example:
ETH-20250131-3000-C(ETH call, Jan 31 2025, $3000 strike)Example:
BTC-20250228-50000-P(BTC put, Feb 28 2025, $50000 strike)Type:
C(call) orP(put)
Perpetuals Format
{CURRENCY}-PERP
Example:
BTC-PERP,ETH-PERP,SOL-PERP
Spot/ERC20 Format
{SYMBOL}
Example:
USDC,ETH,WBTC
Authentication
Public Endpoints
No authentication required. Works without any credentials.
Private Endpoints
Require:
DERIVE_WALLET: Your Ethereum wallet address
DERIVE_PRIVATE_KEY: Optional, used for signing transactions
Uses wallet-based authentication:
X-LyraWallet: Your wallet addressX-LyraTimestamp: Current timestampX-LyraSignature: HMAC signature of timestamp
Rate Limits
Derive implements TPS (transactions per second) limits. Each account has:
WebSocket matching TPS (for trading orders)
WebSocket non-matching TPS (for RFQ, margin watch, etc.)
Per-instrument limits (options, perpetuals)
Global per-endpoint limits
Check your account's rate limits using get_account tool.
Usage Examples
Get Real-time BTC Perpetual Price
View Your Positions
Place a Trade
Get Historical Trades
Analyze Funding Rates
Performance & Rate Limiting
REST API: HTTP/REST (used by this MCP) - Most stable, less likely to hit rate limits
No WebSocket: Uses REST only (simpler, more compatible)
Pagination: Automatic pagination support for large result sets
Caching: Results not cached in MCP (fresh data on each call)
Rate Limiting Strategy
Use
page_size=1000for efficient historical data fetchesBatch related queries together
Avoid polling the same endpoint more than once per second
Check
get_accountfor your specific TPS limits
Troubleshooting
"API Error" Responses
Invalid instrument name:
Use correct format:
BTC-PERP,ETH-20250131-3000-C, etc.Verify instrument is active using
get_instruments
Authentication errors (private endpoints):
Ensure
DERIVE_WALLETenvironment variable is setCheck wallet address is correct
For trading, ensure
DERIVE_PRIVATE_KEYis setVerify API key/credentials haven't expired
Rate limit exceeded:
Wait before making more requests
Check your TPS limits with
get_accountReduce page_size or request frequency
No positions/orders found:
Verify correct
subaccount_idCheck subaccount has active trading
Use
get_subaccountsto list available subaccounts
Network Issues
Verify network connectivity
Check if API is up: https://status.lyra.finance
Confirm correct environment (mainnet vs testnet)
Check
DERIVE_ENVIRONMENTsetting matches your API credentials
Additional Resources
License
MIT
Support
For issues with:
The MCP Server: File issues in this repository
Derive API: Check https://docs.derive.xyz or contact Derive support
Claude Integration: Check Claude documentation
Disclaimer
This is an unofficial MCP server for Derive. Use at your own risk. Always verify trades and transactions independently. The authors are not responsible for any financial losses resulting from use of this tool.
Risk Warning: Leverage trading involves significant risk of loss. Only trade with funds you can afford to lose.