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.1.9.tar.gz (11.5 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.1.9-py3-none-any.whl (13.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for tasty_agent-0.1.9.tar.gz
Algorithm Hash digest
SHA256 8eb09ed721c7f5c1d6ccc6d37a518b6c265d03c4f87e339457bcfdf17525f669
MD5 982b31e3aaa021a19e080e083e2c40f9
BLAKE2b-256 837e37ace6ca8b4367fcd0ad6830dced7c477f34945b7660c6d9bc45594d382e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tasty_agent-0.1.9-py3-none-any.whl
Algorithm Hash digest
SHA256 d7731002acad6f3e340a69ecf2a55fe931472294bfc112e61e2baf76ba214f32
MD5 bcee23d001804565ca7203713ddfcddb
BLAKE2b-256 cff00ec0e3e8143ccde553d6607b1e3548cf0c3312af2f76f76f6b3359a082f3

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