tasty-agent
by: ferdousbhai
Let Claude manage your 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
- Python 3.12
- uv package manager (https://docs.astral.sh/uv/)
- A TastyTrade account
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
-
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.
- Input:
-
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"
-
get_open_positions
Retrieves all currently open positions.- Returns: Formatted table with Symbol, Position Type, Quantity, Mark Price, and Current Value.
-
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.
- Input:
Trade Management
-
schedule_trade
Schedule a trade for execution.- Inputs:
action
(string): "Buy to Open" or "Sell to Close"quantity
(integer): Number of shares/contractsunderlying_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.
- Inputs:
-
list_scheduled_trades
Lists all pending scheduled trades.- Returns: Formatted table with Position, ID, Action, Instrument, Quantity, and Status.
-
remove_scheduled_trade
Removes a scheduled trade.- Input:
task_id
(string): ID of the task to remove
- Returns: Confirmation message.
- Input:
Market Analysis
-
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).
- Input:
-
get_prices
Retrieves current bid and ask prices.- Input:
symbol
(string): Stock or option symbol.
- Returns: Current bid and ask prices.
- Input:
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:
- Use the MCP inspector (see Debugging section)
- 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.