Skip to main content

A Model Context Protocol server for interacting with TastyTrade brokerage accounts

Project description

tasty-agent: A TastyTrade MCP Server

A Model Context Protocol server for TastyTrade brokerage accounts. Enables LLMs to monitor portfolios, analyze positions, and execute trades.

Installation

uvx tasty-agent

Authentication

OAuth Setup:

  1. Create an OAuth app at https://my.tastytrade.com/app.html#/manage/api-access/oauth-applications
  2. Check all scopes, save your client ID and client secret
  3. Create a "New Personal OAuth Grant" in your OAuth app settings (check all scopes)
  4. Copy the generated refresh token
  5. Configure the MCP server with your credentials (see Usage section below)

MCP Tools

Account & Portfolio

  • get_balances() - Account balances and buying power
  • get_positions() - All open positions with current values
  • get_net_liquidating_value_history(time_back='1y') - Portfolio value history ('1d', '1m', '3m', '6m', '1y', 'all')
  • get_history(start_date=None) - Transaction history (format: YYYY-MM-DD, default: last 90 days)

Market Data & Research

  • get_quote(symbol, option_type=None, strike_price=None, expiration_date=None, timeout=10.0) - Real-time quotes for stocks and options via DXLink streaming
  • get_market_metrics(symbols) - IV rank, percentile, beta, liquidity for multiple symbols
  • market_status(exchanges=['Equity']) - Market hours and status ('Equity', 'CME', 'CFE', 'Smalls')
  • search_symbols(symbol) - Search for symbols by name/ticker

Order Management

  • get_live_orders() - Currently active orders
  • place_order(symbol, order_type, action, quantity, price, strike_price=None, expiration_date=None, time_in_force='Day', dry_run=False) - Simplified order placement for stocks and options
  • delete_order(order_id) - Cancel orders by ID

Watchlist Management

  • get_watchlists(watchlist_type='private', name=None) - Get watchlists ('public'/'private', all if name=None)
  • manage_private_watchlist(action, symbol, instrument_type, name='main') - Add/remove symbols from private watchlists
  • delete_private_watchlist(name) - Delete private watchlist

Watchlist Entry Format

Watchlist entries use this format:

[
  {
    "symbol": "AAPL",
    "instrument_type": "Equity"
  },
  {
    "symbol": "AAPL240119C00150000",
    "instrument_type": "Equity Option"
  }
]

Key Features

  • OAuth authentication for secure API access without exposing login credentials
  • Real-time streaming quotes via DXLink WebSocket
  • Watchlist management for portfolio organization
  • Dry-run testing for all order operations
  • Automatic symbol normalization for options
  • Fresh data always from TastyTrade API

Usage with Claude Desktop

Add to 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"
      }
    }
  }
}

Examples

"Get my account balances and current positions"
"Get real-time quote for SPY"
"Get quote for TQQQ C option with strike 100 expiring 2026-01-16"
"Place dry-run order: buy 100 AAPL shares at $150"
"Place order: buy 17 TQQQ C contracts at $8.55, strike 100, expiring 2026-01-16"
"Cancel order 12345"
"Get my private watchlists"
"Add TSLA to my main watchlist"
"Remove AAPL from my tech watchlist"

Development

Testing with client.py

For interactive testing during development:

# Install dev dependencies
uv sync --group dev

# Set up environment variables in .env file:
# TASTYTRADE_CLIENT_SECRET=your_secret
# TASTYTRADE_REFRESH_TOKEN=your_token  
# TASTYTRADE_ACCOUNT_ID=your_account_id (optional)
# OPENAI_API_KEY=your_openai_key

# Run the interactive client
uv run client.py

The client provides a chat interface to test MCP tools directly. Example commands:

  • "Get my account balances"
  • "Get quote for SPY"
  • "Place dry-run order: buy 100 AAPL at $150"

Debug with MCP inspector

npx @modelcontextprotocol/inspector uvx tasty-agent

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tasty_agent-2.0.0.tar.gz (91.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tasty_agent-2.0.0-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

Details for the file tasty_agent-2.0.0.tar.gz.

File metadata

  • Download URL: tasty_agent-2.0.0.tar.gz
  • Upload date:
  • Size: 91.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for tasty_agent-2.0.0.tar.gz
Algorithm Hash digest
SHA256 b694d479a4a0780334d124c270d36e3d645bcdec7fc0c61f8e715187908b34d0
MD5 ddbb6801fa9e9a5486ab8d5cb904a9b2
BLAKE2b-256 e8981abfed0dc9d7b0f8b208d0c3de3db42afd2287500a5e2ae0b10a4db21b0b

See more details on using hashes here.

File details

Details for the file tasty_agent-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: tasty_agent-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 8.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for tasty_agent-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2498e4080d08836b94321b1b804a7ef698b3dd391741efecc3c960240e85a5dc
MD5 ed5081f3983be6557bf69df68fcd5635
BLAKE2b-256 b85f336fdf2ebf7dc9376309bbe22aa84d5bf12e8b1089b224480611daa5efd2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page