Skip to main content

A Model Context Protocol server for interacting with TastyTrade brokerage accounts

Project description

tasty-agent: A TastyTrade MCP Server

Overview

A Model Context Protocol server for interacting with TastyTrade brokerage accounts. This server enables Large Language Models to monitor portfolios, analyze positions, and execute trades through the TastyTrade platform.

Prerequisites

  • Python 3.12
  • uv package manager
  • A TastyTrade account

Installation

Install uv if you haven't already:

curl -LsSf https://astral.sh/uv/install.sh | sh

We will use uvx to directly run tasty-agent:

uvx tasty-agent

Authentication

The server requires TastyTrade credentials. For security, this is set up via command line and stored in your system's keyring (Keychain on macOS, Windows Credential Manager on Windows, or similar secure storage on other platforms):

uvx tasty-agent setup

Tools

Portfolio Management

  1. plot_nlv_history

    • Plots account net liquidating value history over time
    • Input:
      • time_back (string): Time period to plot ('1d', '1m', '3m', '6m', '1y', 'all')
    • Returns: Base64-encoded PNG image of the generated plot
  2. get_account_balances

    • Get current account balances
    • Returns: Formatted string with cash balance, buying power, net liquidating value, and maintenance excess
    • Example response: "Cash: $5,000.00, Buying Power: $10,000.00, NLV: $15,000.00"
  3. get_open_positions

    • Get all currently open positions
    • Returns: Formatted table showing Symbol, Position Type, Quantity, Mark Price, and Current Value
  4. get_transaction_history

    • Get transaction history
    • Input:
      • start_date (string, optional): Start date in YYYY-MM-DD format. Defaults to last 90 days if not provided.
    • Returns: Formatted table showing Transaction Date, Transaction Type, Description, and Value

Trade Management

  1. schedule_trade

    • Schedule a trade for execution
    • Inputs:
      • action (string): "Buy to Open" or "Sell to Close"
      • quantity (integer): Number of shares/contracts
      • underlying_symbol (string): The underlying stock symbol (e.g., "SPY", "AAPL")
      • strike (float, optional): For options only - strike price
      • option_type (string, optional): For options only - "C" for calls, "P" for puts
      • expiration_date (string, optional): For options only - expiration date in YYYY-MM-DD format
      • dry_run (boolean): Simulate without executing (default: False)
    • Returns: Task ID and confirmation message
    • Notes:
      • Trades execute immediately during market hours
      • Trades during market closure are automatically scheduled for next market open
  2. list_scheduled_trades

    • List all pending scheduled trades
    • Returns: Formatted table showing:
      • Position: Order in queue
      • ID: Unique task identifier
      • Action: Buy to Open or Sell to Close
      • Instrument: Symbol and option details if applicable
      • Quantity: Number of shares/contracts
      • Status: Time until execution or current status
  3. remove_scheduled_trade

    • Remove a scheduled trade
    • Input:
      • task_id (string): ID of task to remove
    • Returns: Confirmation message

Market Analysis

  1. get_metrics

    • Get market metrics for specified symbols
    • Input:
      • symbols (string[]): List of stock symbols
    • Returns: Formatted table showing IV Rank, IV Percentile, Beta, Liquidity Rating, and Next Earnings Date/Time (when available)
  2. get_prices

    • Get current bid and ask prices
    • Input:
      • symbol (string): Stock or option symbol
    • Returns: Current bid and ask prices

Usage with Claude Desktop

Add this to your claude_desktop_config.json:

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

Important: Scheduled trades will only execute while Claude Desktop is running. When Claude Desktop is closed, the server shuts down and trades are not executed.

Debugging

You can use the MCP inspector to debug the server:

npx @modelcontextprotocol/inspector uvx tasty-agent

For logs, check:

  • macOS: ~/Library/Logs/Claude/mcp*.log
  • Windows: %APPDATA%\Claude\logs\mcp*.log

Development

For local development testing:

  1. Use the MCP inspector (see Debugging)
  2. Test using Claude Desktop with this configuration:
{
  "mcpServers": {
    "tastytrade": {
      "command": "path/to/uv/command/uv",
      "args": [
        "--directory",
        "path/to/tasty-agent",
        "run",
        "tasty-agent"
      ]
    }
  }
}

License

This MCP server is licensed under the MIT License. See the LICENSE file for details.

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.6.tar.gz (15.3 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.6-py3-none-any.whl (18.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for tasty_agent-0.1.6.tar.gz
Algorithm Hash digest
SHA256 56098f1f2a6f6ce7ed982fb7fc6ce0c51bb1a3ea6cf68f1feba68e627e223adb
MD5 8e4d69d11e577eee66df074d880e69d4
BLAKE2b-256 2a9a880f33baf6db029869028177c565d057212b6323c5998a4966e4c19360cb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for tasty_agent-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 eb1ee965ec19ff9d35f299373409a31f08594539bac55b6823b3b070e2a0dc17
MD5 3435ec95f70f30eac20add346775583a
BLAKE2b-256 c04690064903e3d6de13fa0e75bab5646ce60963ef2518ce6139393e9058a944

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