Most common issue. Observed causes during development:
NSE_MCP_MAX_CONCURRENCY low (default 2),
keep NSE_MCP_MIN_INTERVAL_MS ≥ 250, keep the cache on (NSE_MCP_CACHE_TTL_S=60).
Do not try to get around it by rotating User-Agents or IPs — that is evading NSE’s controls.502 Bad Gateway / 504 Gateway Time-out
or time out entirely (seen on 2026-10-06 for several minutes, once on both servers at the same time).
→ The dashboard shows which server is down. Retry later or switch to npm run dev:mock.Check reachability yourself:
curl -s -o /dev/null -w '%{http_code}\n' -X POST https://mcp.nseindia.in/cmmkt/mcp -H 'Content-Type: application/json' -H 'Accept: application/json, text/event-stream' -d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"check","version":"1"}}}'
200 = healthy; 000 = timeout; 502/504 = NSE origin problem.
The backend connects in the background at startup. If NSE was unreachable then, the next tool call retries the connection automatically. Refresh the dashboard after running a tool.
NSE reports most failures inside a successful result: {"error": "..."} with isError: false.
| Message | Meaning |
|---|---|
Symbol 'X' not found / Symbol not found: X |
Use the exact NSE ticker — find it with nse_lookup_symbol. |
Failed to parse cached data: … ArrayList cannot be cast to … Map |
Known NSE bug in nse_get_gainers / nse_get_losers. Use nse_get_market_movers. |
Bhavcopy tools answer for the nearest/latest trading day when the date is a holiday, weekend,
outside the 5-year window or badly formatted (yyyy-MM-dd is required). Always read the
returned date.
That’s almost certainly a 1:1 bonus or a split — Bhavcopy prices are unadjusted. Check
get_corporate_actions; the Insights → Stock deep dive page adjusts automatically.
Outside 09:15–15:30 IST (Mon–Fri) the live data is the last snapshot. During market hours the
caches refresh every 1–5 minutes (cm_get_data_status).
NSE only allows its own origins. Call NSE MCP from a backend (as this project does), never from browser JavaScript.
ImportError: cannot import name 'streamablehttp_client'mcp 2.x renamed it to streamable_http_client, which yields (read, write) (two values)
and uses snake_case fields (server_info, is_error). The example targets mcp>=2.
Pass terminate_on_close=False — NSE doesn’t support the session-ending DELETE.
PORT=5190 npm run dev
Set ANTHROPIC_API_KEY in .env and restart. The rest of the app doesn’t need it.