TastyTrade
STDIOTastyTrade经纪账户管理服务器
TastyTrade经纪账户管理服务器
A Model Context Protocol server for TastyTrade brokerage accounts. Enables LLMs to monitor portfolios, analyze positions, and execute trades. Features AI-powered trade idea generation, automated IV analysis prompts, and built-in rate limiting (2 requests/second) to prevent API errors.
OAuth Setup:
get_balances() - Account balances and buying powerget_positions() - All open positions with current valuesget_net_liquidating_value_history(time_back='1y') - Portfolio value history ('1d', '1m', '3m', '6m', '1y', 'all')get_transaction_history(days=90, underlying_symbol=None, transaction_type=None) - All transactions: trades + cash flows (default: last 90 days, transaction_type: 'Trade' or 'Money Movement')get_order_history(days=7, underlying_symbol=None) - Order history including filled, canceled, and rejected orders (default: last 7 days)get_quotes(instruments, timeout=10.0) - Real-time quotes for multiple stocks and/or options via DXLink streamingget_greeks(options, timeout=10.0) - Greeks (delta, gamma, theta, vega, rho) for multiple options via DXLink streamingget_market_metrics(symbols) - IV rank, percentile, beta, liquidity for multiple symbolsmarket_status(exchanges=['Equity']) - Market hours and status ('Equity', 'CME', 'CFE', 'Smalls')search_symbols(symbol) - Search for symbols by name/tickerget_current_time_nyc() - Current time in New York timezone (market time)get_live_orders() - Currently active ordersplace_order(legs, price=None, time_in_force='Day', dry_run=False) - Place multi-leg orders with automatic price discovery from market quotes
replace_order(order_id, price) - Modify existing order price (for complex changes, cancel and place new order)delete_order(order_id) - Cancel orders by IDget_watchlists(watchlist_type='private', name=None) - Get watchlists ('public'/'private', all if name=None)manage_private_watchlist(action, symbols, name='main') - Add/remove multiple symbols from private watchlistsdelete_private_watchlist(name) - Delete private watchlistgenerate_trade_ideas(focus_symbols=None, risk_tolerance='moderate', max_ideas=5) - Generate specific, actionable trade ideas using AI analysis of current positions, watchlists, market metrics, and volatility environmentAdd to your MCP client configuration (e.g., claude_desktop_config.json):
{ "mcpServers": { "tastytrade": { "command": "uvx", "args": ["tasty-agent"], "env": { "TASTYTRADE_CLIENT_SECRET": "your_client_secret", "TASTYTRADE_REFRESH_TOKEN": "your_refresh_token", "TASTYTRADE_ACCOUNT_ID": "your_account_id" } } }, "capabilities": { "sampling": {} } }
Note: The sampling capability enables AI-powered trade analysis features. Currently supported in VS Code, not yet in Claude Desktop.
"Get my account balances and current positions"
"Get real-time quotes for SPY and AAPL"
"Get quotes for TQQQ C option with strike 100 expiring 2026-01-16"
"Get Greeks for AAPL P option with strike 150 expiring 2024-12-20"
"Buy 100 AAPL shares" (auto-pricing)
"Buy 100 AAPL at $150"
"Buy to open 17 TQQQ calls, strike 100, exp 2026-01-16"
"Place a call spread: buy to open AAPL 150C and sell to open AAPL 155C, both exp 2024-12-20"
"Close my AAPL position: sell to close 10 AAPL calls"
"Modify order 12345 to price $10.05"
"Cancel order 12345"
"Get my trading history from January"
"Get my private watchlists"
"Add TSLA and NVDA to my tech watchlist"
"Remove AAPL from my tech watchlist"
"Generate trade ideas for my portfolio"
"Generate aggressive trade ideas for AAPL and TSLA"
Run automated trading strategies:
# Run once with instructions uv run background.py "Check my portfolio and rebalance if needed" # Run every hour uv run background.py "Monitor SPY and alert on significant moves" --hourly # Run every day uv run background.py "Generate daily portfolio summary" --daily # Custom period (seconds) uv run background.py "Scan for covered call opportunities" --period 1800 # every 30 minutes # Schedule start time (NYC timezone) uv run background.py "Execute morning trading strategy" --schedule "9:30am" --hourly # Market open shorthand (9:30am) uv run background.py "Buy the dip strategy" --market-open --hourly
For interactive testing during development:
# Set up environment variables in .env file: # TASTYTRADE_CLIENT_SECRET=your_secret # TASTYTRADE_REFRESH_TOKEN=your_token # TASTYTRADE_ACCOUNT_ID=your_account_id (defaults to the first account) # OPENAI_API_KEY=your_openai_key (you can provide alternative provider of your choice as supported by pydantic-ai) # MODEL_IDENTIFIER=model_provider:model_name (defaults to openai:gpt-5-mini) # Run the interactive client uv run chat.py
The client provides a chat interface to test MCP tools directly. Example commands:
npx @modelcontextprotocol/inspector uvx tasty-agent
MIT