Repository avatar
AI Tools
v1.2.1
active

indian-option-mcp

io.github.devag7/indian-option-mcp

NSE F&O options: live option chains, Greeks, 34 strategies, OI, max pain, IV vs HV

Documentation

๐Ÿ‡ฎ๐Ÿ‡ณ 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.

npm Downloads CI Stars 29 tools MIT Glama MCP

Indian Option MCP: live NIFTY option chain excerpt (spot 25,606.95, 8 Dec expiry, 2 Dec 2026 10:29 IST) with ATM IV 16.1%, HV20 18.6%, IV/HV20 0.87 and India VIX 15.77, from the get_option_chain and historical_volatility tools


โšก 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

Cursor: Add to Cursor

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 askWhat 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
"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:

#SourceWhen it is usedWhat you get
1NSE option-chain-v3 (+ contract-info)Normal caseLive chain with IV, change-in-OI, bid/ask
2Legacy NSE option-chain APIIf v3 failsSame fields (kept for resilience)
3NSE live derivatives feedIf both failSnapshot with OI, LTP, volume
4Official NSE F&O bhavcopy (nsearchives)NSE live API unreachablePrevious 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

ToolDescription
get_option_chainFull option chain with strikes, LTP, OI, IV, volume, bid/ask for calls & puts
get_expiry_datesAll available expiry dates for any F&O symbol
get_spot_priceCurrent spot/underlying price of any stock or index

๐Ÿ”ข Greeks & Pricing

ToolDescription
calculate_greeksAll Greeks โ€” Delta, Gamma, Theta, Vega, Rho โ€” via Black-Scholes
calculate_ivImplied Volatility from market price (Newton-Raphson method)
calculate_option_priceTheoretical option price using Black-Scholes model
what_if_greeksScenario analysis โ€” how Greeks change under hypothetical conditions

๐Ÿ—๏ธ Strategy Builder โ€” 34 Pre-Built Strategies

ToolDescription
build_strategyBuild any of 34 strategies with real market prices, payoff & breakevens
custom_strategyBuild custom multi-leg strategies with specific strikes
suggest_strategyGet strategy suggestions based on outlook & risk preference
list_strategiesBrowse all available strategies by category
calculate_payoffPayoff/P&L table at expiry across price scenarios

๐Ÿ“ˆ Open Interest Analysis

ToolDescription
calculate_max_painMax Pain strike โ€” where option buyers lose the most
get_pcrPut-Call Ratio (OI, Volume, and Change based) with interpretation
highest_oi_strikesOI-based support & resistance levels
oi_change_analysisChange in OI patterns โ€” emerging support/resistance

๐Ÿ“‰ IV Analytics

ToolDescription
iv_smileIV Smile curve + IV Skew across strikes
expected_moveExpected price range by expiry (1ฯƒ, 1.645ฯƒ, 1.96ฯƒ)

๐ŸŒ Market Data

ToolDescription
market_overviewNIFTY & BANKNIFTY snapshot โ€” spot, ATM IV, PCR, lot size
market_statusIs the NSE market currently open or closed?
lot_sizeLot size for any F&O instrument
next_expiryNext weekly (NIFTY Tue / SENSEX Thu) or monthly expiry, holiday-adjusted

๐Ÿ“œ Historical Data & Volatility โ€” official NSE archives

ToolDescription
get_price_historyDaily OHLCV for any NSE index (NIFTY, BANKNIFTY, INDIAVIX โ€ฆ) or NSE stock, up to 250 sessions
historical_volatilityHV 10/20/60-day, Parkinson HV, HV percentile, India VIX and IV vs HV verdict (are options cheap or expensive?)

lot_size also reads the current lot from the latest NSE F&O contract file, so it stays correct after NSE revisions.

๐Ÿ›ก๏ธ Risk Management

ToolDescription
estimate_marginSPAN + Exposure margin estimate for option strategies
probability_of_profitPOP calculation using log-normal distribution
position_sizingOptimal lot count based on capital & risk tolerance

๐Ÿ” Scanners

ToolDescription
scan_high_oiFind strikes with highest institutional OI buildup
unusual_activityDetect abnormally high volume/OI ratio

๐Ÿ’ฌ MCP Prompts

PromptDescription
strategy_advisorFull strategy recommendation workflow โ€” chains, PCR, max pain, expected move, build & size
market_analysisComprehensive 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
OSPath
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

StrategyLegs
long_call1
bull_call_spread2
bull_put_spread2
put_credit_spread2
synthetic_long2
covered_call2
collar3
strap2
jade_lizard3

๐Ÿ“‰ Bearish

StrategyLegs
long_put1
bear_put_spread2
bear_call_spread2
put_debit_spread2
call_credit_spread2
synthetic_short2
protective_put2
strip2

โš–๏ธ Neutral

StrategyLegs
short_straddle2
short_strangle2
iron_condor4
iron_butterfly4
butterfly3
calendar_spread2
double_diagonal4

๐ŸŒŠ Volatility

StrategyLegs
long_straddle2
long_strangle2
back_spread_call2
back_spread_put2
ratio_call_spread2
ratio_put_spread2
short_call1
short_put1
broken_wing_butterfly3
christmas_tree3

๐Ÿ’ก Tip: Use list_strategies to browse by category, or suggest_strategy to 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

ProviderAPI KeyFeaturesSpeed
NSE India (default)โŒ Not neededFull option chains, OI, IV, volume, spot pricesโšก Fast
NSE Archives (always on)โŒ Not neededEnd-of-day option chains, price history, lot sizes โ€” works on every network๐Ÿ’พ Cached on disk
Zerodha Kite (optional)โœ… RequiredFull 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


โš™๏ธ Environment Variables

Copy .env.example to .env and configure as needed:

cp .env.example .env
VariableDefaultDescription
DATA_PROVIDERnseData 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)
CACHE_TTL_SECONDS5Real-time data cache lifetime in seconds
INSTRUMENT_CACHE_TTL_HOURS12Instrument master cache lifetime in hours
RISK_FREE_RATE0.07Annual risk-free rate for Black-Scholes (7% = Indian 10Y bond)
LOG_LEVELinfoLogging verbosity โ€” debug, info, warn, error
INDIAN_OPTION_MCP_CACHE_DIR~/.cache/indian-option-mcp/nse-archivesWhere 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 โ€” all 35+ tools registered here
โ”‚   โ”œโ”€โ”€ config.ts                   # Zod-validated env configuration
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ data/
โ”‚   โ”‚   โ”œโ”€โ”€ providers/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ base.provider.ts    # Abstract data provider interface
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ nse.provider.ts     # NSE India scraper (default)
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ zerodha.provider.ts # Kite Connect API client
โ”‚   โ”‚   โ”œโ”€โ”€ provider-factory.ts     # Provider factory pattern
โ”‚   โ”‚   โ”œโ”€โ”€ cache/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ memory-cache.ts     # TTL-based in-memory cache
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ instrument-cache.ts # Long-lived instrument master cache
โ”‚   โ”‚   โ”œโ”€โ”€ constants/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ lot-sizes.ts        # F&O lot sizes (NIFTY=65, BANKNIFTY=30, etc.)
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ expiry-calendar.ts  # Expiry date calculations
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ indices.ts          # Index metadata & strike intervals
โ”‚   โ”‚   โ””โ”€โ”€ models/
โ”‚   โ”‚       โ”œโ”€โ”€ option-chain.ts     # Option chain data models
โ”‚   โ”‚       โ”œโ”€โ”€ instrument.ts       # Instrument definitions
โ”‚   โ”‚       โ”œโ”€โ”€ quote.ts            # Quote/tick models
โ”‚   โ”‚       โ”œโ”€โ”€ strategy.ts         # Strategy type definitions
โ”‚   โ”‚       โ””โ”€โ”€ index.ts            # Model barrel exports
โ”‚   โ”‚
โ”‚   โ”œโ”€โ”€ engine/
โ”‚   โ”‚   โ”œโ”€โ”€ black-scholes.ts        # Option pricing & Greeks (ฮ”, ฮ“, ฮ˜, ฮฝ, ฯ)
โ”‚   โ”‚   โ”œโ”€โ”€ implied-volatility.ts   # IV solver (Newton-Raphson)
โ”‚   โ”‚   โ”œโ”€โ”€ iv-surface.ts           # IV Smile, Skew, Rank, Percentile, HV
โ”‚   โ”‚   โ”œโ”€โ”€ strategy-builder.ts     # 34 strategy templates + builder
โ”‚   โ”‚   โ”œโ”€โ”€ payoff.ts               # Payoff/P&L at expiry engine
โ”‚   โ”‚   โ”œโ”€โ”€ 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
โ”‚       โ”œโ”€โ”€ format.ts               # Currency, number, OI formatting
โ”‚       โ”œโ”€โ”€ math.ts                 # Normal CDF, statistical functions
โ”‚       โ””โ”€โ”€ logger.ts               # Stderr-only logger (MCP-safe)
โ”‚
โ”œโ”€โ”€ dist/                           # Compiled output
โ”œโ”€โ”€ package.json
โ”œโ”€โ”€ tsconfig.json
โ””โ”€โ”€ .env.example

Design Principles

  • Zero external trading dependencies โ€” only @modelcontextprotocol/sdk and zod
  • 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, never stdout (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:

  1. Fork the repository
  2. Create a feature branch โ€” git checkout -b feat/my-feature
  3. Commit your changes โ€” git commit -m "feat: add my feature"
  4. Push to your branch โ€” git push origin feat/my-feature
  5. 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

Star history chart

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.

NPM
indian-option-mcp
Install Command
npm install indian-option-mcp