Indian NSE Stock Insights ๐ฎ๐ณ๐
MCP serverDev toolsThis integration lets your AI analyze stocks from India's Nifty 500 index. Once added, you can ask about price action, demand zones, and technicals, or screen the market for stocks that match your criteria. It turns stock research into a simple conversation.
Use Indian NSE Stock Insights ๐ฎ๐ณ๐ in Claude, ChatGPT or Ahel Desktop
Free. Sign in, add Indian NSE Stock Insights ๐ฎ๐ณ๐ and connect your AI. About a minute.
Also: Claude Code ยท Cursor ยท Codex
Then ask your AI: use Indian NSE Stock Insights ๐ฎ๐ณ๐ to get stock quote
No key or account is asked for. Not verified by us yet: Ahel has not run a call through it.
Details
Available today. Use it from your connected AI after setup.
No key or account is asked for. Not verified by us yet: Ahel has not run a call through it.
After adding it, ask your AI to analyze a Nifty 500 stock by name, such as its price action or technicals. Setup details are in the repository at github.com/alokbarnwal/nse-public-mcp.
What your AI can do with it
- Analyze any stock in the Nifty 500
- Review a stock's price action
- Identify demand zones
- Check technical indicators
- Screen stocks to find ones matching your criteria
Install Indian NSE Stock Insights ๐ฎ๐ณ๐
The serverโs own address, for the clients that take one directly. Or connect Ahel once and every client you use reads it from one address, with the account kept on Ahel rather than in each clientโs config.
Claude Code
claude mcp add --transport http --scope user indian-nse-stock-insights 'https://stockmcp.alokbarnwal.com/mcp'Run it once in your project, then open /mcp to approve any sign-in the server asks for.
Claude Desktop
https://stockmcp.alokbarnwal.com/mcpAdd a custom connector in Settings, paste this address, and approve the sign-in.
Cursor
cursor://anysphere.cursor-deeplink/mcp/install?name=indian-nse-stock-insights&config=eyJ1cmwiOiJodHRwczovL3N0b2NrbWNwLmFsb2tiYXJud2FsLmNvbS9tY3AifQ==Open the link and Cursor adds the server at that address.
ChatGPT
https://stockmcp.alokbarnwal.com/mcpIn Settings, enable Developer mode, create an MCP app, and paste this address. Your plan and workspace must allow custom apps.
Codex
codex mcp add indian-nse-stock-insights --url 'https://stockmcp.alokbarnwal.com/mcp'Run it once, then sign in with codex mcp login indian-nse-stock-insights if the server asks for an account.
From the project's README
As published by alokbarnwal/nse-public-mcp in README.md.
Public MCP server for Indian stock market analysis โ Nifty 500 universe, 12 tools, 3 timeframes.
Built with FastMCP ยท Data from yfinance ยท Hosted at stockmcp.alokbarnwal.com
Educational only. Not investment advice. See DISCLAIMER.md.
Quick Connect โ 30 Seconds
Claude.ai โ Settings โ Connectors โ Add custom MCP connector:
Name: Indian NSE Stock Insights
URL: https://stockmcp.alokbarnwal.com/mcp
That's it. Start asking questions about Indian stocks.
12 Tools
| # | Tool | Parameters | What it returns |
|---|---|---|---|
| 1 | get_stock_quote | symbol | Last close, prev close, change %, day H/L, volume |
| 2 | get_ohlc_data | symbol, timeframe?, limit? | OHLCV candles (up to 500, newest first) |
| 3 | get_technical_indicators | symbol, timeframe? | EMAs, SMAs, RSI, MACD, Bollinger, ADX, Stoch, ATR, OBV, VWAP |
| 4 | get_support_resistance | symbol, timeframe? | Pivot points + historical S/R levels |
| 5 | get_demand_supply_zones | symbol, timeframe?, status? | Demand/supply zones (DBR/RBR/RBD/DBD) |
| 6 | get_candlestick_patterns | symbol, timeframe?, limit? | HAMMER, DOJI, ENGULFING, etc. |
| 7 | get_chart_patterns | symbol, timeframe?, status? | DOUBLE_TOP, HEAD_AND_SHOULDERS, etc. |
| 8 | get_fibonacci_levels | symbol, timeframe? | Retracement swings (UP/DOWN) with fib levels |
| 9 | get_volume_analysis | symbol | 5min hotspots, OBV trend, volume ratio |
| 10 | get_market_overview | (none) | Indices, top gainers/losers, most active, breadth |
| 11 | compare_stocks | symbols (2-5) , timeframe? | Side-by-side: quote, RSI/MACD/ADX, trend, 30d return |
| 12 | screen_stocks | filters | Filter by RSI, ADX, trend, pattern, sector, etc. |
timeframe defaults to daily. Options: daily, 15min, 5min.
Example Prompts
Try these in Claude.ai after connecting:
- "RELIANCE ka technical analysis do โ RSI, MACD, aur support/resistance levels batao"
- "Show me Nifty 500 stocks with RSI below 30 and ADX above 25"
- "Compare TCS, INFY, and WIPRO โ which one has the best setup right now?"
- "What does the overall market look like today? Show me top gainers and losers"
- "HDFC Bank ke demand and supply zones dikhao on the 15-minute chart"
Architecture
graph TB
subgraph Internet
C[Claude.ai / MCP Client]
end
subgraph Server["Production Server"]
subgraph Protection
F2B[fail2ban<br/>auto-ban repeat abusers]
NG[nginx<br/>rate limit 20r/s ยท conn limit ยท TLS]
end
subgraph Application
MCP["FastMCP Server<br/>port 8089 ยท 12 tools"]
TOOLS["Tool Modules<br/>quote ยท ohlc ยท indicators<br/>levels ยท zones ยท patterns<br/>fibonacci ยท volume ยท market<br/>compare ยท screener"]
end
subgraph Data
DB[(MySQL: nse_public<br/>500 stocks ร 3 timeframes)]
CRON[Cron Jobs<br/>5min ยท 15min ยท daily]
end
end
subgraph External
YF[Yahoo Finance<br/>yfinance API]
end
C -->|HTTPS POST /mcp| NG
NG -->|proxy_pass| MCP
MCP --> TOOLS
TOOLS -->|read-only queries| DB
YF -->|OHLCV data| CRON
CRON -->|upsert| DB
F2B -.->|monitors| NG
Data Coverage
| Timeframe | Retention | Update Frequency | Stocks |
|---|---|---|---|
| Daily | 5 years | EOD (18:00 IST) | 500 |
| 15-minute | 2 years | Every 15 min (market hours) | 500 |
| 5-minute | 6 months | Every 5 min (market hours) | 500 |
Market hours: 09:15โ15:30 IST, MondayโFriday (excluding NSE holidays).
Rate Limits
| Layer | Limit | Action |
|---|---|---|
| nginx | 20 requests/sec per IP (burst 40) | HTTP 429 |
| nginx | 10 simultaneous connections per IP | HTTP 429 |
| fail2ban | 5ร rate-limit violations in 2 min | IP banned for 1 hour |
Self-Hosting
Runs on
/home/ubuntu/nse-public-mcp/โ completely isolated from/home/ubuntu/swingtrader/.
1. Clone
cd /home/ubuntu
git clone https://github.com/alokbarnwal/nse-public-mcp.git
cd nse-public-mcp
2. Create database and user
sudo mysql <<'SQL'
CREATE DATABASE IF NOT EXISTS nse_public CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER IF NOT EXISTS 'nse_writer'@'localhost' IDENTIFIED BY 'CHANGE_ME_STRONG_PASSWORD';
GRANT ALL PRIVILEGES ON nse_public.* TO 'nse_writer'@'localhost';
FLUSH PRIVILEGES;
SQL
3. Apply schema
mysql -u nse_writer -p nse_public < db/schema.sql
mysql -u nse_writer -p nse_public < db/schema_indicators.sql
mysql -u nse_writer -p nse_public < db/schema_price_action.sql
4. Install dependencies
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
5. Configure environment
cp .env.example .env
chmod 600 .env
nano .env # set DB_PASSWORD to match step 2
6. (Optional) Refresh full Nifty 500 list
The repo ships with the top ~100 stocks hardcoded. To expand to all 500:
python -m config.stocks --refresh # fetches NSE archives, rewrites config/stocks.py
7. Load stock universe into DB
python -m config.stocks --load-to-db
8. Backfill historical data (long-running, use screen/tmux)
screen -S backfill
source .venv/bin/activate
python -m data.backfill --all
# Ctrl-A D to detach. Reattach: screen -r backfill
Expected runtime:
daily 5y ร 500: ~30 min15min 2y ร 500: ~2 h5min 6mo ร 500: ~1 h
If anything fails, the failure list is written to backfill_failures_<timeframe>.json. Re-run:
python -m data.backfill --timeframe 15min --resume
8b. Bulk-compute indicators (long-running, use screen/tmux)
After the candle backfill completes, populate the indicators table for all 500 stocks across all 3 timeframes:
screen -S indicators
cd /home/ubuntu/nse-public-mcp
python3 -m indicators.runner --all
# Ctrl-A D to detach
Expected runtime: ~30โ45 min. Idempotent โ safe to re-run if interrupted.
8c. Bulk-compute price action (long-running, use screen/tmux)
After indicators are populated, compute price-action features (zones, S/R, patterns, breakouts, fibs, gaps, volume profile) for all 500 stocks across all 3 timeframes:
screen -S price_action
cd /home/ubuntu/nse-public-mcp
python3 -m price_action.runner --timeframe daily --all-features
python3 -m price_action.runner --timeframe 15min --all-features
python3 -m price_action.runner --timeframe 5min --all-features
# Ctrl-A D to detach
Expected runtime: ~60โ90 min total. Idempotent โ safe to re-run if interrupted.
9. Install crontab
crontab -e
Add:
# nse-public-mcp candle updaters
*/5 9-15 * * 1-5 cd /home/ubuntu/nse-public-mcp && /home/ubuntu/nse-public-mcp/.venv/bin/python -m jobs.cron_5min >> logs/cron_5min.log 2>&1
*/15 9-15 * * 1-5 cd /home/ubuntu/nse-public-mcp && /home/ubuntu/nse-public-mcp/.venv/bin/python -m jobs.cron_15min >> logs/cron_15min.log 2>&1
0 18 * * 1-5 cd /home/ubuntu/nse-public-mcp && /home/ubuntu/nse-public-mcp/.venv/bin/python -m jobs.cron_daily >> logs/cron_daily.log 2>&1
# nse-public-mcp indicator updaters (each runs after the matching candle fetch)
30 18 * * 1-5 cd /home/ubuntu/nse-public-mcp && /usr/bin/python3 -m jobs.cron_indicators_daily >> logs/indicators_daily.log 2>&1
20,35,50 9-15 * * 1-5 cd /home/ubuntu/nse-public-mcp && /usr/bin/python3 -m jobs.cron_indicators_15min >> logs/indicators_15min.log 2>&1
5 16 * * 1-5 cd /home/ubuntu/nse-public-mcp && /usr/bin/python3 -m jobs.cron_indicators_15min >> logs/indicators_15min.log 2>&1
2-57/5 9-15 * * 1-5 cd /home/ubuntu/nse-public-mcp && /usr/bin/python3 -m jobs.cron_indicators_5min >> logs/indicators_5min.log 2>&1
# nse-public-mcp price-action updaters (each runs after the matching indicator cron)
35 18 * * 1-5 cd /home/ubuntu/nse-public-mcp && /usr/bin/python3 -m jobs.cron_price_action_daily >> logs/price_action_daily.log 2>&1
25,55 9-15 * * 1-5 cd /home/ubuntu/nse-public-mcp && /usr/bin/python3 -m jobs.cron_price_action_15min >> logs/price_action_15min.log 2>&1
9-54/15 9-15 * * 1-5 cd /home/ubuntu/nse-public-mcp && /usr/bin/python3 -m jobs.cron_price_action_5min >> logs/price_action_5min.log 2>&1
Cron times are server-local. Verify the server is on IST (
timedatectl) โ if not, shift the hour ranges. The 5-min indicator cron is offset to2-57/5so it runs ~2 minutes aftercron_5minand never reads stale candles. The price-action 5-min cron is offset to9-54/15(minutes 9, 24, 39, 54) so it runs ~2 minutes after eachcron_indicators_5minslot.
10. Verification
mysql -u nse_writer -p nse_public <<'SQL'
SELECT 'daily' AS tf, COUNT(*) AS n FROM candles_daily
UNION ALL SELECT '15min', COUNT(*) FROM candles_15min
UNION ALL SELECT '5min', COUNT(*) FROM candles_5min;
-- Per-stock coverage on daily โ flag any with < 1000 rows (~4 trading years)
SELECT symbol, COUNT(*) AS n
FROM candles_daily
GROUP BY symbol
HAVING n < 1000
ORDER BY n;
-- Latest data freshness
SELECT MIN(candle_date) AS earliest, MAX(candle_date) AS latest
FROM candles_daily;
-- Recent cron health
SELECT job_type, timeframe, symbols_success, symbols_failed, started_at, duration_seconds
FROM fetch_log
ORDER BY started_at DESC
LIMIT 20;
SQL
DB size on disk:
sudo du -sh /var/lib/mysql/nse_public/
Service Management
# Server status
sudo systemctl status nse-public-mcp
# Restart
sudo systemctl restart nse-public-mcp
# Logs
sudo journalctl -u nse-public-mcp -n 100 -f
# nginx
sudo nginx -t && sudo systemctl reload nginx
# fail2ban
sudo fail2ban-client status nginx-mcp-ratelimit
Layout
See PROJECT.md for architecture and data-flow diagram.
config/ # settings, stock universe, holiday calendar
data/ # yfinance fetcher, backfill CLI, shared upsert helpers
db/ # schema and pooled connection
indicators/ # technical indicator compute, persist, runner
price_action/ # zones, patterns, levels, trends
mcp_server/ # FastMCP server + 12 tool modules
jobs/ # cron entrypoints (candles + indicators + price action)
deploy/ # systemd service, nginx config, fail2ban rules
tests/ # mocked unit tests (82 tests)
Operational Notes
- Be respectful to Yahoo Finance. The fetcher sleeps 1โ3 s between requests and retries with backoff. Don't reduce these.
- Idempotent. All inserts are
INSERT โฆ ON DUPLICATE KEY UPDATE. Replaying a cron tick or rerunning backfill is safe. - Holiday calendar lives in
config/holidays.py. Update it once a year when NSE publishes the next year's list. - Retention cleanup runs at the end of
jobs/cron_daily.py. Daily candles older than 5 y, 15min older than 2 y, 5min older than 6 mo are purged.
License
MIT โ free to use, modify, and distribute.
Disclaimer
This project is for educational and informational purposes only. Not investment advice. See DISCLAIMER.md.
Tools it offers (12)
What this server listed when Ahel dialed its public endpoint in Sep 2026, with no key and no account of yours. The names are the serverโs own.
get_stock_quoteget_ohlc_dataget_technical_indicatorsget_support_resistanceget_demand_supply_zonesget_candlestick_patternsget_chart_patternsget_fibonacci_levelsget_volume_analysisget_market_overviewcompare_stocksscreen_stocks
Signals
- GitHub stars
- 1
- Last commit
- Apr 2026
Advanced
- Delivery
- nse-public-mcp MCP server โ your Ahel connector (mcp.ahel.ai) โ your AI.
- Item type
- mcp-server
- Key
io-github-alokbarnwal-nse-public-mcp- Source
- github.com/alokbarnwal/nse-public-mcp
- Hosted endpoint
https://stockmcp.alokbarnwal.com/mcp
github.com/alokbarnwal/nse-public-mcp
More in Dev tools
MCP server ยท adarsh4052
More in Dev toolsdraw.io
MCP server ยท jgraph
More in Dev toolsairtreks-mcp
MCP server ยท airtreks
More in Dev tools0nMCP
MCP server ยท 0nork
More in Dev toolssportwizzard
MCP server ยท adamruehle
More in Dev toolsgithub-mcp-server
MCP server ยท github
More in Dev tools