v2.99 — Full Section Support, Shape-Detection Fixes, and a New Official MCP Integration
Two things in this release: a full audit pass that found and fixed everything left over from the
Akamai fix in v2.98, and a brand-new feature — NSE just launched their own official MCP server, and
both libraries now wrap all 36 of its tools.
Bug Fixes (full function-by-function audit, every one live-tested, several independently
re-verified by a second skeptical pass before shipping)
nse_quote(symbol, section=X)now supports every section value —trade_info,info,
metadata,priceInfo,securityInfo,industryInfo,preOpenMarket— not justtrade_info
from v2.98. An unrecognized section value raises a clear error instead of hitting a dead path.pcr()andnse_quote_meta()had a real bug: they assumed option-chain data always came in the
nested{'CE':{...},'PE':{...}}per-strike shape, but silently returned a wrong-looking0.0/{}
when fed the flat per-leg shapense_quote_derivatives()actually returns now. Both functions
auto-detect which shape they were given and return the correct answer either way.nse_optionchain_ltp()— same root issue. It was doingentry.get(optionType), which only makes
sense for the nested shape; fixed to handle the flat per-leg shape too (confirmed: CE/PE prices now
resolve correctly against both).- Case-insensitive symbol handling across
nse_quote_ltp/nse_quote_meta/nse_quote_derivatives
("banknifty"now works, not just"BANKNIFTY"). MIDCPNIFTYandNIFTYNXT50were missing from the recognized index list — added.get_fao_participant_oi()had garbageUnnamed: Ncolumns from a header-row parsing issue — fixed.nse_preopen_movers(filter=X)was silently ignoring its ownfilterargument — fixed.nse_holidays(type=X)crashed withUnboundLocalErroron a badtype— now a clearValueError.- Crash-on-edge-case guards added to
black_scholes_dexter(),get_beta(),expiry_history(),
nse_preopen()(zero variance, blank dates, empty pre-open window, etc).
One claimed-broken item from internal testing turned out to be a false alarm on re-check:
derivative_history(instrumentType="futures") works fine with a real, valid expiry date — an earlier
test pass had used expired/invalid expiry dates and mistook the correctly-empty result for a bug.
New: NSE’s Own Official MCP Server, Wrapped
NSE now runs its own free, no-auth-required MCP server at
mcp.nseindia.in — announced at nseindia.com/nse-mcp. 36 tools
across two endpoints: historical OHLCV, corporate actions, index valuation, moving averages, 52-week
high/low, volume analysis, stock comparisons on one side (21 tools); live quotes, market movers,
gainers/losers, index data on the other (15 tools).
This matters because it’s a second, independent data path — not the scrape-based nseindia.com
site this library normally talks to, so it isn’t subject to any of the Akamai Bot Manager issues v2.98
spent its whole changelog working around. No session warm-up, no TLS fingerprint dance, no API key.
Every function is prefixed nse_mcp_ so it’s obvious at a glance which data path a line of code is
using:
- One named wrapper per tool —
nse_mcp_get_stock_history(symbol, months=3, ...),
nse_mcp_cm_get_stock_quote(symbol),nse_mcp_compare_stocks(symbols, months=6), all 36 of them. nse_mcp_list_tools()— live discovery, returns the real tool list straight from the server (not a
hardcoded copy), so it stays accurate if NSE adds more tools.nse_mcp_call(tool_name, **kwargs)— generic escape hatch, works for any tool by name, including
future ones this library hasn’t caught up to yet.
No new dependency — it reuses the same curl_cffi session the rest of the library already needs.
Full docs + the complete tool list + working examples:
Known gap, NSE’s bug not ours: 2 of the 36 tools (nse_mcp_nse_get_gainers,
nse_mcp_nse_get_losers) currently raise a clear error because NSE’s own server throws a Java
ArrayList/Map cast exception internally — confirmed reproducible, not something fixable from this
side. Use nse_mcp_nse_get_market_movers() instead, which covers the same data and works fine.
Links
- GitHub - aeron7/nsepython: The Unofficial Python Wrapper for NSEIndia API · GitHub — commit
f30e58f,
release v2.99 - GitHub - aeron7/nsepythonserver: The Unofficial Python Wrapper for NSEIndia API For Servers · GitHub — commit
17d33f0,
release v2.99 - Both live on PyPI right now:
pip install -U nsepython/pip install -U nsepythonserver - Docs updated: NSEPython Documentation — NSE Data in Python ·
NSEPython Basic Functions — FNO List, Logger & More ·
NSEPython Special Functions — Results, FII/DII & Beta (new Dividend Timeline / Shareholding
Pattern sections) · NSE MCP Server Wrapper - Unofficed (new)
As always — if you hit anything broken, reply here with the exact call and the error.