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 with comprehensive market data and order management capabilities.

Installation

uvx tasty-agent

Authentication

Set up credentials via command line (stored in system keyring):

uvx tasty-agent setup

Or set environment variables:

  • TASTYTRADE_USERNAME
  • TASTYTRADE_PASSWORD
  • TASTYTRADE_ACCOUNT_ID (optional - uses first account if multiple)

MCP Tools

Account Information

  • get_account_balances - Get current cash balance, buying power, net liquidating value, and maintenance excess

    • Always returns fresh data from TastyTrade API
    • No parameters required
  • get_current_positions - Get all open stock and option positions

    • Includes symbol, type, quantity, mark price, and current value
    • Always returns fresh data with current mark prices
    • No parameters required
  • get_live_orders - Get all currently live (open) orders

    • Shows order ID, symbol, action, quantity, type, price, and status
    • Always returns fresh data from TastyTrade API
    • No parameters required

Trading Operations

  • place_trade - Execute stock/option trades

    • Supports: Buy to Open, Sell to Close
    • Auto-calculates mid-price or accepts custom limit price
    • Market hours validation (preventive for live trades)
    • Dry-run testing capability
    • Parameters: action, quantity, underlying_symbol, strike_price*, option_type*, expiration_date*, order_price*, dry_run
  • cancel_order - Cancel live orders by ID

    • Dry-run testing supported
    • Parameters: order_id, dry_run
  • modify_order - Modify existing order quantity or price

    • Single-leg orders only
    • Validates order is editable before modification
    • Parameters: order_id, new_quantity*, new_price*, dry_run

Portfolio Analysis

  • get_nlv_history - Net Liquidating Value history with OHLC data

    • Time periods: 1d, 1m, 3m, 6m, 1y, all
    • Returns formatted table with dates sorted most recent first
    • Parameters: time_back (default: 1y)
  • get_transaction_history - Detailed transaction history

    • Defaults to last 90 days if no start date provided
    • Includes date, sub-type, description, and net value
    • Parameters: start_date* (YYYY-MM-DD format)

Market Data & Analysis

  • get_metrics - Comprehensive market metrics for symbols

    • IV Rank, IV Percentile, Beta, Liquidity Rating, Lendability, Earnings dates
    • Supports multiple symbols in single request
    • Parameters: symbols (list of strings)
  • get_prices - Real-time bid/ask quotes via DXLink streaming

    • Supports both stocks and options
    • May return stale data when market is closed
    • Parameters: underlying_symbol, expiration_date*, option_type*, strike_price*
  • check_market_status - Current market status with next open time

    • Uses NYSE calendar for accurate trading hours
    • Shows time remaining until next market open when closed
    • No parameters required

* Optional parameters

Key Features

Performance & Efficiency

  • Fresh Data: Account information always fetched live from TastyTrade API
  • Efficient Streaming: Real-time quotes via DXLink WebSocket
  • Optimized Operations: Direct API calls minimize latency

Safety & Validation

  • Market Hours Protection: Prevents live trades when market is closed
  • Price Validation: Automatic bid-ask range checking and adjustment
  • Dry-Run Testing: Test all operations without executing
  • Order Status Validation: Confirms orders are modifiable before changes

Intelligence & Automation

  • Auto-Pricing: Mid-price calculation when no price specified
  • Price Adjustment: User prices adjusted to valid bid-ask range when necessary
  • Instrument Resolution: Automatic option chain lookup and instrument creation
  • Error Handling: Comprehensive error messages and warnings

Usage with Claude Desktop

Add to claude_desktop_config.json:

{
  "mcpServers": {
    "tastytrade": {
      "command": "uvx",
      "args": ["tasty-agent"]
    }
  }
}

Examples

Basic Trading

"Buy 100 shares of AAPL at market price"
"Sell 50 shares of TSLA at $250"
"Test buying 5 NVDA call options, strike 500, expiring 2024-12-20" (dry run)

Order Management

"Get my live orders"
"Cancel order 12345"
"Change order 67890 quantity to 200 shares"
"Modify order 11111 price to $150"

Portfolio Analysis

"Get my current positions"
"Get my account balance and buying power"
"Get my portfolio performance over the last 6 months"
"Show transaction history from 2024-01-01"

Market Research

"Get current prices for AAPL December 200 calls"
"Check metrics for TSLA, NVDA, AAPL"
"Is the market currently open?"
"Get IV rank and earnings data for SPY, QQQ, IWM"

Development

Debug with MCP inspector:

npx @modelcontextprotocol/inspector uvx tasty-agent

License

MIT License

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-0.2.0.tar.gz (11.6 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-0.2.0-py3-none-any.whl (13.3 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tasty_agent-0.2.0.tar.gz
  • Upload date:
  • Size: 11.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.8

File hashes

Hashes for tasty_agent-0.2.0.tar.gz
Algorithm Hash digest
SHA256 24e08fd2062da45e95c5841832c695d600216256033830cca96d917f7eb80d2c
MD5 1dd5e8b7e33f9d97ce410ed3e3d7cb19
BLAKE2b-256 df835d60b64fb173d4fe5414ae45015c148495bb4d90d011fd9d35cbdbddc71b

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tasty_agent-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9bdb6e78228d882c8f5e124e8b0d0fea03650dd0bb2477ad51249ad3bc536ff5
MD5 482d47e096583f126198a1c9404c249c
BLAKE2b-256 c785b8db2e8feea7d81b8881c85e13a8a089eee29d0e0e3309f7d076e7783598

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