tasty-agent: A TastyTrade MCP Server
以下摘录自该仓库的 README(片段) · 在 GitHub 读完整 README →
A Model Context Protocol server for TastyTrade brokerage accounts. Enables LLMs to monitor portfolios, analyze positions, and execute trades. Features automated IV analysis prompts and compact tool output.
Written in TypeScript against the Tastytrade REST API and DXLink directly (no SDK). The same code runs locally over stdio (npx tasty-agent) or as a remote MCP server on Cloudflare Workers.
> **v7 is a rewrite.** The Python package (uvx tasty-agent, 6.x) is replaced by the npm package, and the Modal deployment by Cloudflare Workers. Tool names are unchanged. What differs from 6.x:
> - get_quotes no longer takes timeout: quotes come from REST market data, so they also answer outside market hours.
> - get_greeks accepts at most 100 contracts and a timeout of at most 30 seconds.
> - Orders and replacements are refused when the broker's dry run returns any warning.
> - A cancel, order, or watchlist change the broker may have applied without answering reports an unknown outcome instead of failing.
> - Prices are rounded with the broker's tick schedules read as upper bounds (e.g. sub-penny below $1, a cent from $1), and futures options can now be priced.
> - The GTD time-in-force and the local SSE/HTTP transports are gone; a blank TASTYTRADE_ACCOUNT_ID counts as unset.
Authentication
**OAuth Setup**:
1. Create an OAuth app at https://my.tastytrade.com/app.html#/manage/api-access/oauth-applications
2. Check all scopes, save your client ID and client secret
3. Create a "New Personal OAuth Grant" in your OAuth app settings (check all scopes)
4. Copy the generated refresh token
5. Configure the MCP server with your credentials (see Usage below)
| Variable | Required | Notes |
| --- | --- | --- |
| TASTYTRADE_CLIENT_SECRET | yes | OAuth app client secret |
| TASTYTRADE_REFRESH_TOKEN | yes | Personal OAuth grant refresh token |
| TASTYTRADE_ACCOUNT_ID | no | Needed only when the grant exposes several accounts; otherwise the one account is used |
| TASTYTRADE_API_BASE | no | Defaults to https://api.tastyworks.com; use https://api.cert.tastyworks.com for the sandbox |
| MCP_BEARER_TOKEN | Cloudflare only | Clients must send Authorization: Bearer |
MCP Tools
Account & Portfolio
- **account_overview(include=["balances","positions"])** - Account balances (including net liquidating value) and open positions.
Market Data & Research
- **get_quotes(instruments)** - Live bid/ask/mid quotes for stocks, options, futures, and indices (indices without a two-sided market report their last price)
- **get_greeks(options, timeout=10.0)** - Greeks (delta, gamma, theta, vega, rho) for equity and futures options via DXLink streaming (up to 100 contracts, timeout at most 30s)
- **get_market_metrics(symbols)** - IV rank, percentile, beta, liquidity for multiple symbols
- **market_status(exchanges=['Equity'])** - Market hours, status, holidays, and current NYC time ('Equity', 'CME', 'CFE', 'Smalls')
- **search_symbols(symbol, limit=10)** - Search for symbols by name/ticker
History
- **get_history(type, days=None, underlying_symbol=None, transaction_type=None, page_offset=0, limit=25)** - Transaction history (type="transactions", default 90 days) or order history (type="orders", default 7 days). Paginated — use page_offset and limit for large result sets. Filter transactions by "Trade" or "Money Movement".
Order Management
- **place_order(legs, target_value=None, time_in_force="Day", dry_run=false)** - Place multi-leg orders with quote-derived mid pricing only. The tool fetches live quotes for the exact resolved instruments, computes the signed net mid, validates the final limit against bid/ask guardrails, and optionally sizes quantity from target_value.