tastytrade-mcp
An MCP server that enables autonomous AI agents to connect to Tastytrade for market scanning, option strategies, account management, and optionally placing trades with built-in safety controls.
README
tastytrade-mcp
An MCP server that lets an autonomous AI agent (Claude, etc.) connect to Tastytrade — scan markets, build option strategies, inspect accounts/positions/orders, and (optionally) place and manage trades.
- OAuth2 authentication via the official
tastytradePython SDK (session tokens auto-refresh; refresh tokens are long-lived). - Credentials stored in the OS keyring (Windows Credential Manager / DPAPI, macOS Keychain, Linux Secret Service) — never in files, never in env vars, never logged. This mirrors the meic-trader pattern.
- Tool surface modeled on TastyScanner-MCP-Server.
- Live trading is gated behind
ENABLE_LIVE_TRADING— disabled by default so an agent cannot place real orders without an explicit opt-in. - stdio transport by default; optional HTTP transport hardened with CORS and per-IP rate limiting.
Install
pip install -e . # or: pip install -e .[dev] for tests
1. Create a Tastytrade OAuth application
- In the Tastytrade web app, open Manage → My Profile → API → OAuth Applications.
- Create an application, select the scopes you need (read + trading), and add
http://localhost:8000as a valid redirect/callback URI. - Save the client secret (shown once).
- Create a grant to obtain a long-lived refresh token. For sandbox you
can instead run
from tastytrade.oauth import login; login(is_test=True).
Never paste secrets into code,
.env, or version control.
2. Store credentials in the keyring
tastytrade-mcp secrets set --sandbox # or --production
tastytrade-mcp secrets status --sandbox
You'll be prompted (hidden input) for the client secret, refresh token, and an optional default account number.
3. Configure
Copy .env.example to .env and adjust. Key flags:
| Variable | Default | Meaning |
|---|---|---|
TASTYTRADE_SANDBOX |
false |
Use the sandbox/cert environment |
ENABLE_LIVE_TRADING |
false |
Register order-placing tools |
FORCE_DRY_RUN |
false |
Force all orders to dry-run (propose-only mode) |
BUYING_POWER_BUFFER_PCT |
0 |
Percent of buying power always kept in reserve (per order) |
ACCOUNT_DEPLOY_LIMIT_PCT |
0 |
Account-wide cap on deployed buying power (from live positions) |
MCP_CORS_ORIGIN |
http://localhost:3333 |
Allowed CORS origin (HTTP transport) |
MCP_RATE_LIMIT |
120/minute |
Per-IP rate limit (HTTP transport) |
MCP_HTTP_HOST / MCP_HTTP_PORT |
127.0.0.1 / 7698 |
HTTP bind address |
4. Run
tastytrade-mcp # stdio (default)
tastytrade-mcp --transport http # HTTP, CORS + rate limited
Connect an agent (stdio)
Claude Desktop / Claude Code MCP config:
{
"mcpServers": {
"tastytrade": {
"command": "tastytrade-mcp",
"env": { "TASTYTRADE_SANDBOX": "true" }
}
}
}
Tools
Always available (read-only):
get_connection_status, get_market_overview, get_option_chain,
get_strategies, get_account_info, get_positions, list_accounts,
get_working_orders, get_watchlists.
Only when ENABLE_LIVE_TRADING=true:
execute_trade, adjust_order, close_position, manage_watchlist.
Order tools default to dry_run=true (validate without submitting).
Order safety layers
A live order requires all of the following, so it cannot happen by accident:
ENABLE_LIVE_TRADING=true— otherwise the order tools are not registered at all.FORCE_DRY_RUN=false— when set totrue, every order is forced to dry-run regardless of what the agent requests ("propose-only" mode).- The agent explicitly passes
dry_run=falseon the call.
Before any submission, execute_trade / adjust_order run a pre-flight
dry-run and validate buying power: the order is rejected if it would leave
projected buying power below the required reserve (BUYING_POWER_BUFFER_PCT of
current buying power; with the default 0 it only blocks orders that would go
negative), or if the API returns errors. Rejections return
{"ok": false, "error": "pre-flight validation failed", "problems": [...]} and
nothing is submitted. The projected buying-power effect — including
required_reserve and buffer_pct when a buffer is set — is returned on every
call under "buying_power".
Account-wide deployment cap. ACCOUNT_DEPLOY_LIMIT_PCT adds a ceiling on
total deployed buying power (vs. the per-order BUYING_POWER_BUFFER_PCT). It is
derived from live account state — used_derivative_buying_power vs.
derivative_buying_power — not an in-memory counter. Capacity = used + available;
the limit is that percent of capacity, and an order is rejected if it would push
deployed buying power past it. Because it reads the account each time, it counts
buying power consumed by existing positions (even ones this server didn't
place) and stays correct across restarts and multiple server instances. The
figures (account_deployed_current, account_deployed_after,
account_deploy_limit, account_buying_power_capacity) appear in the
"buying_power" block.
Safety
- Defaults to sandbox + live-trading-off.
- Account numbers are masked in logs to the last 4 digits (
****1234); secrets are never logged. - HTTP transport restricts CORS to a single origin and rate-limits to 120 requests/minute per IP (HTTP 429 when exceeded).
Development
pip install -e .[dev]
pytest
Disclaimer
This software can place real orders against a live brokerage account. It is
provided "as is", with no warranty, and is not financial advice. You are
solely responsible for any trades it places and any resulting losses. Test in the
sandbox (TASTYTRADE_SANDBOX=true) before enabling live trading, and review the
order-safety controls above. The built-in risk checks reduce — but do not
eliminate — the risk of an unintended or oversized order.
This is an independent project and is not affiliated with, endorsed by, or
sponsored by tastytrade. It uses the unofficial third-party
tastytrade SDK.
License
MIT © 2026 Jon Covington
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。