MCP HubMCP Hub
ferdousbhai

tasty-agent

by: ferdousbhai

Let Claude manage your tastytrade portfolio.

11created 08/11/2024
Visit
tastytrade
portfolio

📌Overview

Purpose: To provide a Model Context Protocol server for seamless interaction with TastyTrade brokerage accounts, allowing users to monitor portfolios, analyze positions, and execute trades.

Overview: Tasty-Agent is a sophisticated server designed to connect Large Language Models with TastyTrade accounts, facilitating various functionalities such as portfolio management, trade execution, and market analysis.

Key Features:

  • Portfolio Management: Enables users to track account balances, open positions, and transaction history, providing a comprehensive overview of portfolio performance.

  • Trade Management: Allows scheduling and managing trades effortlessly, including features to view and remove pending trades.

  • Market Analysis: Offers tools to retrieve current market metrics and price quotes, assisting users in making informed trading decisions.


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

Installation

Install uv if you haven't already:

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

Run tasty-agent directly using uvx:

uvx tasty-agent

Authentication

The server requires TastyTrade credentials. For security, set this up via command line and credentials are stored in your system's secure keyring:

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 ('1d', '1m', '3m', '6m', '1y', 'all')
    • Returns: Base64-encoded PNG image of the plot.
  2. get_account_balances
    Retrieves current account balances.

    • Returns: Formatted string with cash balance, buying power, net liquidating value, and maintenance excess.
    • Example: "Cash: $5,000.00, Buying Power: $10,000.00, NLV: $15,000.00"
  3. get_open_positions
    Retrieves all currently open positions.

    • Returns: Formatted table with Symbol, Position Type, Quantity, Mark Price, and Current Value.
  4. get_transaction_history
    Retrieves 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 with Transaction Date, 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): Stock symbol (e.g., "SPY", "AAPL")
      • Optional (for options): strike (float), option_type ("C" for calls, "P" for puts), expiration_date (YYYY-MM-DD)
      • dry_run (boolean): Simulate without executing (default: False)
    • Returns: Task ID and confirmation message
    • Notes: Trades execute immediately during market hours; trades during closure are scheduled for next market open.
  2. list_scheduled_trades
    Lists all pending scheduled trades.

    • Returns: Formatted table with Position, ID, Action, Instrument, Quantity, and Status.
  3. remove_scheduled_trade
    Removes a scheduled trade.

    • Input:
      • task_id (string): ID of the task to remove
    • Returns: Confirmation message.

Market Analysis

  1. get_metrics
    Retrieves market metrics for specified symbols.

    • Input:
      • symbols (string[]): List of stock symbols.
    • Returns: Formatted table with IV Rank, IV Percentile, Beta, Liquidity Rating, and Next Earnings Date/Time (when available).
  2. get_prices
    Retrieves current bid and ask prices.

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

Usage with Claude Desktop

Add the following 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

Use the MCP inspector to debug the server:

npx @modelcontextprotocol/inspector uvx tasty-agent

Log locations:

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

Development

For local development testing:

  1. Use the MCP inspector (see Debugging section)
  2. Use the following Claude Desktop 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.