Indian Option MCP
Indian options (NSE F&O) for AI assistants: live option chains, Greeks and IV, payoffs for 34 strategies, OI change and PCR, max pain, IV vs realised volatility, margin estimates and position sizing. Free, no API key. npx -y indian-option-mcp
Dokumentasi
๐ฎ๐ณ Indian Option MCP
An options desk for NSE F&O inside your AI assistant.
Live option chains, Greeks, 34 strategies, OI & max pain, IV vs realised volatility, all in plain English.
Free, open source, no API key, and it keeps working when NSE blocks your network.
[!IMPORTANT] Not investment advice. This server gives analytics and calculators only. It does not place orders and is not a SEBI-registered adviser. Market data comes from NSE's public website and end-of-day archives (or your own Zerodha Kite account): it can be delayed, incomplete or unavailable, and NSE can change or block these endpoints at any time. Check prices and numbers with your broker before you trade. Options trading carries a high risk of loss.
โก Install in 30 seconds
Needs Node.js 20+. Nothing else: no API key, no account.
Claude Code
claude mcp add indian-options -- npx -y indian-option-mcp
VS Code
code --add-mcp '{"name":"indian-options","command":"npx","args":["-y","indian-option-mcp"]}'
Claude Desktop and any other MCP client: add this to the client's MCP config (for Claude Desktop, Settings โ Developer โ Edit Config) and restart it.
{
"mcpServers": {
"indian-options": { "command": "npx", "args": ["-y", "indian-option-mcp"] }
}
}
Then just ask: "Show me the NIFTY option chain".
๐ก What you can ask
| You ask | What happens |
|---|---|
| "Are NIFTY options cheap or expensive right now?" | Compares ATM IV with 10/20/60-day realised volatility, its 1-year percentile and India VIX |
| "Build an iron condor on BANKNIFTY, 3 strikes out" | Picks strikes from the live chain, prices every leg, returns max profit/loss, breakevens and payoff |
| "Where is OI support and resistance for NIFTY?" | Highest call/put OI strikes, change in OI, PCR and max pain |
| "Greeks for NIFTY 26000 CE, 5 days to expiry" | Delta, gamma, theta, vega, rho via Black-Scholes, with IV solved from the market price |
| "I'm mildly bullish on RELIANCE, low risk" | Suggests fitting strategies from the 34 built in and sizes one to your capital |
| "Size a short straddle for โน10L at 2% risk" | Position size, margin estimate and probability of profit |
| "What's NIFTY's IV rank?" | ATM IV against its own 1-year range (rank and percentile), plus India VIX rank |
| "How are FIIs positioned in index futures?" | FII, DII, Pro and Client long/short/net in index futures and options, with the day's change |
| "I'm short NIFTY 26000 CE and 25500 PE, how am I doing?" | Live P&L per leg, net Greeks, P&L if NIFTY moves ยฑ1โ5%, breakevens |
| "NIFTY futures basis and rollover?" | Premium to spot, annualised carry, OI build-up and rollover by expiry |
| "When is the next expiry?" | Holiday-adjusted NSE/BSE expiry (NIFTY Tuesday, SENSEX Thursday) |
Built for traders who'd otherwise juggle an options platform, a spreadsheet and a Black-Scholes calculator. It complements broker tools such as Sensibull or Opstra rather than replacing your broker.
๐ 24/7 Availability โ Works Even After Market Hours
Most NSE scrapers break after market hours, after NSE API changes, or on networks NSE blocks (cloud servers, many VPNs). This server falls through four sources automatically:
| # | Source | When it is used | What you get |
|---|---|---|---|
| 1 | NSE option-chain-v3 (+ contract-info) | Normal case | Live chain with IV, change-in-OI, bid/ask |
| 2 | Legacy NSE option-chain API | If v3 fails | Same fields (kept for resilience) |
| 3 | NSE live derivatives feed | If both fail | Snapshot with OI, LTP, volume |
| 4 | Official NSE F&O bhavcopy (nsearchives) | NSE live API unreachable | Previous session's full chain: closing prices, OI, change in OI, volume, IV solved from closing prices |
No configuration needed. Tier 4 works from any network, so the server always answers; the response says clearly when it is end-of-day data. If NSE blocks your IP, the server stops retrying the live API for 10 minutes so answers stay fast.
๐ Features
๐ Option Chain Tools
| Tool | Description |
|---|---|
get_option_chain | Full option chain with strikes, LTP, OI, IV, volume, bid/ask for calls & puts |
get_expiry_dates | All available expiry dates for any F&O symbol |
get_spot_price | Current spot/underlying price of any stock or index |
๐ข Greeks & Pricing
| Tool | Description |
|---|---|
calculate_greeks | All Greeks โ Delta, Gamma, Theta, Vega, Rho โ via Black-Scholes |
calculate_iv | Implied Volatility from market price (Newton-Raphson method) |
calculate_option_price | Theoretical option price using Black-Scholes model |
what_if_greeks | Scenario analysis โ how Greeks change under hypothetical conditions |
๐๏ธ Strategy Builder โ 34 Pre-Built Strategies
| Tool | Description |
|---|---|
build_strategy | Build any of 34 strategies with real market prices, payoff & breakevens |
custom_strategy | Build custom multi-leg strategies with specific strikes |
suggest_strategy | Get strategy suggestions based on outlook & risk preference |
list_strategies | Browse all available strategies by category |
calculate_payoff | Payoff/P&L table at expiry across price scenarios |
๐ Open Interest Analysis
| Tool | Description |
|---|---|
calculate_max_pain | Max Pain strike โ where option buyers lose the most |
get_pcr | Put-Call Ratio (OI, Volume, and Change based) with interpretation |
highest_oi_strikes | OI-based support & resistance levels |
oi_change_analysis | Change in OI patterns โ emerging support/resistance |
๐ IV Analytics
| Tool | Description |
|---|---|
iv_smile | IV Smile curve + IV Skew across strikes |
expected_move | Expected price range by expiry (1ฯ, 1.645ฯ, 1.96ฯ) |
iv_rank | IV rank and IV percentile: today's ATM IV against its own history (default 1 year) from NSE bhavcopies; India VIX rank for NIFTY |
๐ Market Data
| Tool | Description |
|---|---|
market_overview | NIFTY & BANKNIFTY snapshot โ spot, ATM IV, PCR, lot size |
market_status | Is the NSE market currently open or closed? |
lot_size | Lot size for any F&O instrument |
next_expiry | Next weekly (NIFTY Tue / SENSEX Thu) or monthly expiry, holiday-adjusted |
๐ Historical Data & Volatility โ official NSE archives
| Tool | Description |
|---|---|
get_price_history | Daily OHLCV for any NSE index (NIFTY, BANKNIFTY, INDIAVIX โฆ) or NSE stock, up to 250 sessions |
historical_volatility | HV 10/20/60-day, Parkinson HV, HV percentile, India VIX and IV vs HV verdict (are options cheap or expensive?) |
futures_analysis | Futures by expiry: basis to spot, annualised carry, OI and change in contracts, OI build-up (long/short build-up, short covering, long unwinding) and rollover % |
fii_dii_positioning | FII / DII / Pro / Client positioning in F&O from NSE's participant-wise OI: index futures long/short/net, index call and put net, stock futures, with the day's change |
lot_size also reads the current lot from the latest NSE F&O contract file, so it stays correct after NSE revisions.
๐ก๏ธ Risk Management
| Tool | Description |
|---|---|
analyze_position | Your open position (options and futures, any expiries): live P&L per leg, net delta/gamma/theta/vega in โน, P&L if spot moves ยฑ1โ5% now and at expiry, breakevens, max profit/loss. Read-only |
estimate_margin | SPAN + Exposure margin estimate for option strategies |
probability_of_profit | POP calculation using log-normal distribution |
position_sizing | Optimal lot count based on capital & risk tolerance |
๐ Scanners
| Tool | Description |
|---|---|
scan_high_oi | Find strikes with highest institutional OI buildup |
unusual_activity | Detect abnormally high volume/OI ratio |
๐ฌ MCP Prompts
| Prompt | Description |
|---|---|
strategy_advisor | Full strategy recommendation workflow โ chains, PCR, max pain, expected move, build & size |
market_analysis | Comprehensive analysis โ OI, PCR, IV smile, max pain, expected move synthesized |
๐ ๏ธ Run from source
git clone https://github.com/devag7/Indian-Option-MCP.git
cd Indian-Option-MCP
pnpm install && pnpm build
Point your MCP client at the build instead of npx:
{
"mcpServers": {
"indian-options": { "command": "node", "args": ["/absolute/path/to/Indian-Option-MCP/dist/bundle.mjs"] }
}
}
Claude Desktop config file locations
| OS | Path |
|---|---|
| macOS | ~/Library/Application Support/Claude/claude_desktop_config.json |
| Windows | %APPDATA%\Claude\claude_desktop_config.json |
| Linux | ~/.config/Claude/claude_desktop_config.json |
๐ฌ Example Conversations
Once configured, just talk naturally to Claude:
You: Show me the NIFTY option chain for the nearest expiry
You: Build an iron condor on BANKNIFTY with 3 strikes OTM
You: What's the max pain for NIFTY? Where is OI-based support?
You: I'm bullish on RELIANCE. Suggest a strategy with low risk.
You: Calculate Greeks for NIFTY 26000 CE, 10 days to expiry, 14% IV
You: Show the expected move for NIFTY at 95% confidence
You: Size a short straddle on BANKNIFTY for โน10L capital, max 2% risk
๐๏ธ Strategy Library
All 34 pre-built strategies, ready to deploy with live market prices:
๐ Bullish
|
๐ Bearish
| ||||||||||||||||||||||||||||||||||||||
โ๏ธ Neutral
|
๐ Volatility
|
๐ก Tip: Use
list_strategiesto browse by category, orsuggest_strategyto get recommendations based on your market view.
๐งฉ Using Alongside Other MCP Servers
Every tool here is self-contained: NSE live data, NSE archives, analytics and strategy maths need no other server. It also runs alongside other market-data MCP servers in Claude Desktop (tool names don't collide), for example a cash-market NSE server for live gainers/losers and market breadth, or a broker server for your positions. Add each as its own entry under mcpServers:
{
"mcpServers": {
"indian-options": { "command": "npx", "args": ["-y", "indian-option-mcp"] },
"another-market-server": { "command": "โฆ", "args": ["โฆ"] }
}
}
๐ Data Providers
| Provider | API Key | Features | Speed |
|---|---|---|---|
| NSE India (default) | โ Not needed | Full option chains, OI, IV, volume, spot prices | โก Fast |
| NSE Archives (always on) | โ Not needed | End-of-day option chains, price history, lot sizes โ works on every network | ๐พ Cached on disk |
| Zerodha Kite (optional) | โ Required | Full option chains, tick-level data, order book depth | โกโก Faster |
NSE (Default โ Zero Config)
Works out of the box. The server fetches data directly from NSE India's public endpoints.
# No configuration needed โ just build and run
DATA_PROVIDER=nse # this is the default
Zerodha Kite (Optional)
For traders with a Zerodha account who want faster data and deeper order book:
DATA_PROVIDER=zerodha
KITE_API_KEY=your_api_key
KITE_API_SECRET=your_api_secret
KITE_ACCESS_TOKEN=your_access_token # refreshed daily
Get credentials from developers.kite.trade
Check that Kite works with your keys (they are read from the environment, never printed):
export KITE_API_KEY=... KITE_ACCESS_TOKEN=...
pnpm run build && pnpm run kite-check NIFTY
โ๏ธ Environment Variables
Copy .env.example to .env and configure as needed:
cp .env.example .env
| Variable | Default | Description |
|---|---|---|
DATA_PROVIDER | nse | Data source โ nse (free) or zerodha (needs API key) |
KITE_API_KEY | โ | Zerodha Kite API key (only if zerodha) |
KITE_API_SECRET | โ | Zerodha Kite API secret (only if zerodha) |
KITE_ACCESS_TOKEN | โ | Zerodha session token, refreshed daily (only if zerodha) |
RISK_FREE_RATE | 7 | Annual risk-free rate in percent for Black-Scholes, IV and probability of profit. Option-chain IVs barely depend on it (they are solved against the options-implied forward); calculate_iv and the other calculators use it directly, and some brokers quote those with 0 |
INDIAN_OPTION_MCP_CACHE_DIR | ~/.cache/indian-option-mcp | Where downloaded NSE archive files are kept (past files never change). off disables the disk cache |
๐๏ธ Architecture
indian-option-mcp/
โโโ src/
โ โโโ index.ts # Entry point โ stdio transport
โ โโโ server.ts # MCP server โ core tools, resource and prompts
โ โโโ tools/
โ โ โโโ analytics-tools.ts # iv_rank, fii_dii_positioning, futures_analysis, analyze_position
โ โ โโโ tool-metadata.ts # Titles and read-only annotations for every tool
โ โ
โ โโโ data/
โ โ โโโ providers/
โ โ โ โโโ base.provider.ts # Data provider interface
โ โ โ โโโ nse.provider.ts # Live NSE API (default)
โ โ โ โโโ nse-archives.ts # Official NSE end-of-day archives (bhavcopies, participant OI)
โ โ โ โโโ eod-option-chain.ts # Option chain rebuilt from the F&O bhavcopy
โ โ โ โโโ zerodha.provider.ts # Kite Connect API client
โ โ โโโ provider-factory.ts # Picks the provider from DATA_PROVIDER
โ โ โโโ iv-history.ts # Daily ATM IV history (for iv_rank), cached on disk
โ โ โโโ cache/
โ โ โ โโโ memory-cache.ts # TTL-based in-memory cache
โ โ โโโ constants/
โ โ โโโ lot-sizes.ts # Fallback F&O lot sizes (live values come from NSE)
โ โ โโโ expiry-calendar.ts # Expiry rules and NSE holidays
โ โ โโโ indices.ts # Index metadata & strike intervals
โ โ
โ โโโ engine/
โ โ โโโ black-scholes.ts # Option pricing & Greeks (ฮ, ฮ, ฮ, ฮฝ, ฯ)
โ โ โโโ implied-volatility.ts # IV solver (Newton-Raphson + bisection)
โ โ โโโ iv-surface.ts # IV smile, skew, rank, percentile
โ โ โโโ historical-volatility.ts# Close-to-close and Parkinson HV
โ โ โโโ atm-iv.ts # ATM IV from closing prices
โ โ โโโ strategy-builder.ts # 34 strategy templates + builder
โ โ โโโ payoff.ts # Payoff/P&L at expiry engine
โ โ โโโ position.ts # Open-position P&L, Greeks and scenarios
โ โ โโโ futures.ts # Basis, carry, rollover, OI build-up
โ โ โโโ participants.ts # FII/DII/Pro/Client positioning
โ โ โโโ max-pain.ts # Max Pain calculator
โ โ โโโ pcr.ts # Put-Call Ratio analyzer
โ โ โโโ oi-analysis.ts # OI distribution & activity detection
โ โ โโโ margin-calculator.ts # SPAN margin estimator
โ โ โโโ risk-metrics.ts # POP, Kelly, position sizing
โ โ
โ โโโ utils/
โ โโโ date.ts # Market hours, DTE, expiry helpers (IST)
โ โโโ format.ts # Currency, number, OI formatting
โ โโโ math.ts # Normal CDF, statistical functions
โ
โโโ scripts/smoke.mjs # End-to-end test: calls every tool through the built bundle
โโโ dist/ # Compiled output
โโโ package.json
โโโ tsconfig.json
โโโ .env.example
Design Principles
- Zero external trading dependencies โ only
@modelcontextprotocol/sdkandzod - Provider pattern โ swap between NSE and Zerodha with one env variable
- Pure computation engine โ all pricing, Greeks, and analytics are self-contained
- MCP-safe logging โ all output goes to
stderr, neverstdout(protects stdio transport) - Startup validation โ Zod schemas validate all config at boot, not at runtime
๐ ๏ธ Development
# Watch mode (recompile on save)
pnpm run dev
# Type-check without emitting
pnpm run lint
# Run tests
npm test
# Inspect with MCP Inspector
pnpm run inspect
# Clean build artifacts
pnpm run clean
๐ค Contributing
Contributions are welcome! Here's how to get started:
- Fork the repository
- Create a feature branch โ
git checkout -b feat/my-feature - Commit your changes โ
git commit -m "feat: add my feature" - Push to your branch โ
git push origin feat/my-feature - Open a Pull Request
Areas for Contribution
- ๐ New strategies (e.g., seagull, condor variations)
- ๐ Additional data providers (Upstox, Angel One, etc.)
- ๐ Enhanced analytics (IV term structure, correlation analysis)
- ๐งช Test coverage for engine modules
- ๐ Documentation improvements
๐ License
This project is licensed under the MIT License โ see the LICENSE file for details.
โญ Star history
Built with โค๏ธ for the Indian options trading community
If it saves you time on expiry day, a โญ helps other traders find it.
Not investment advice. Data comes from NSE's public website and archives and may be delayed or incomplete; verify before trading.