options-scanner / MCP_SERVER.md
Reckless88's picture
MCP server doc + evaluation + Claude/Hermes import instructions
5a168ac verified
|
Raw History Blame Contribute Delete
7.02 kB

Options Scanner — MCP Server

Built with ML Intern

The options_scanner engine wrapped as a modular MCP server: any MCP client (Claude Desktop, Claude Code, Hermes, etc.) can scan markets, build multi-leg options structures, and manage positions with rolling mechanics through natural language.

Read-only by design. The server reads market data and computes structures. It never places orders, touches a broker, or writes anywhere on disk.


Tools (7)

Tool What it does
scan_universe Run the full multi-strategy scanner over the auto universe (large caps + high-IV names + ETFs) or a custom symbol list. Returns ranked candidates with credit/debit, max profit/loss, POP, breakevens, legs.
scan_symbol Build every eligible strategy on one ticker with full risk reports and gate reasons.
build_strategy Build one named family on a symbol: vertical, calendar, diagonal, butterfly, iron_condor, ratio_backspread, jade_lizard, double_diagonal, short_straddle, short_strangle.
chain_summary Quick read on a ticker: spot, 30-day ATM IV, front-expiry liquidity score, next earnings, quote count.
check_position Position management with rolling mechanics: take-profit (50% of credit), stop (2× credit), roll out / out-and-down / out-and-up at 21 DTE or when a short strike's delta hits 0.40.
list_strategies All 10 strategy families + default risk parameters and roll rules.
list_watchlists Built-in watchlist pools and the auto universe.

Every tool takes an optional provider argument (tradier | alpaca | polygon | yfinance); empty = auto-pick from environment keys.

Install

git clone https://huggingface.co/datasets/Reckless88/options-scanner
cd options-scanner
pip install "mcp>=1.0" yfinance          # yfinance only needed for the fallback provider
export TRADIER_API_KEY=...               # optional; see providers below
python mcp_server.py                     # stdio transport — this is what clients launch

Data providers (auto-selected in this order):

Env var(s) Feed
TRADIER_API_KEY Tradier real-time (verified: full chains, OI; greeks computed from quotes)
ALPACA_KEY_ID + ALPACA_SECRET_KEY Alpaca real-time IEX (thin quotes, no OI)
POLYGON_API_KEY Polygon real-time snapshot
none Yahoo Finance, ~15-min delayed

No keys? The server still works on the delayed yfinance feed.


Import into Claude Desktop

  1. Install the repo somewhere stable, e.g. ~/tools/options-scanner, and put your key in the file (see security note).
  2. Edit the config file:
    • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
    • Windows: %APPDATA%\Claude\claude_desktop_config.json
  3. Add:
{
  "mcpServers": {
    "options-scanner": {
      "command": "python3",
      "args": ["/Users/YOU/tools/options-scanner/mcp_server.py"],
      "env": { "TRADIER_API_KEY": "your-key-here" }
    }
  }
}
  1. Restart Claude Desktop. A tools icon appears; ask "Scan SPY, QQQ and NVDA for defined-risk strategies" or "Build an iron condor on COIN".

Claude Code (CLI) — one command instead of the JSON:

claude mcp add options-scanner \
  --env TRADIER_API_KEY=your-key-here \
  -- python3 /Users/YOU/tools/options-scanner/mcp_server.py

Import into Hermes

Option A — one command:

hermes mcp add options-scanner \
  --command python3 \
  --args /path/to/options-scanner/mcp_server.py \
  --env TRADIER_API_KEY=your-key-here

Option B — edit ~/.hermes/config.yaml:

mcp_servers:
  options-scanner:
    command: "python3"
    args: ["/path/to/options-scanner/mcp_server.py"]
    env:
      TRADIER_API_KEY: "your-key-here"
    enabled: true
    timeout: 120

Then start hermes chat. Hermes discovers the tools with an mcp_options-scanner_* prefix and you ask the same natural-language questions.


Security notes

  • API keys go in client config env blocks, never in the source. The repo contains no keys.
  • The server is read-only: it has no broker credentials, no order paths, no disk writes.
  • allow_undefined_risk=True unblocks naked straddles/strangles in analysis only — they are always flagged UNDEFINED RISK in the output.

Evaluation of the underlying engine (honest assessment)

Verified working (tested against live Tradier and Alpaca feeds, Oct 27 2026):

  • Full scan of 40 underlyings in ~40 s → 84 candidates across 13 strategy families, 0 feed errors.
  • Payoff-grid risk metrics with back-month legs priced via Black-Scholes; max loss floored at the debit paid.
  • POP by numeric integration of each structure's actual payoff over the lognormal distribution (catches debit-spread downside breakevens the naive short-strike method misses).
  • Gates: per-leg liquidity, bid-ask vs mid, finite max loss, buying-power cap, earnings-window avoidance, strike proximity (refuses to fake structures on sparse feeds).
  • MCP protocol end-to-end with the official mcp SDK 2.3.0: 7 tools discovered and called over stdio.

Known limitations — read before trading anything it prints:

  1. Pricing model is approximate. Back-month legs are valued with flat entry IV — no vol skew, no term structure, no IV crush modeling. Calendar/diagonal max-loss figures are lower bounds on reality, not guarantees.
  2. POP is model POP. Lognormal with ATM IV. Fat tails, realized-vs-implied gaps, and event risk are not in it.
  3. No backtest. The 0–100 composite score (expectancy 45% / POP 25% / credit efficiency 20% / liquidity 10%) is a heuristic ranking, not validated expected performance.
  4. Fills at mid, zero slippage. Real 4-leg structures fill worse than mid, especially outside regular hours.
  5. No early-assignment modeling (ITM short puts/calls near ex-dividend dates) and no pin-risk discussion for short strikes at expiry.
  6. No persistence or scheduling. Positions are passed per call; the server holds no state and runs nothing on a timer — automation loops live in the client or a cron job.
  7. Feed-dependent coverage. Tradier's free tier returned no greeks (computed per-quote instead); Alpaca IEX lacks open interest and has thin quotes on some names (guards drop them). Earnings dates come from a yfinance fallback that intermittently 404s — the earnings gate can be blind.
  8. Curated universe, not all of Nasdaq/NYSE. The auto pool is ~40 liquid names ranked by outcome; it is not a full-market sweep.

Bottom line: a solid idea-generation and risk-sizing tool for defined-risk options structures, with honest gating and verified real-time data plumbing. Treat every number as an estimate to be checked in your broker before ordering.