Indian NSE Stock Insights

io.github.alokbarnwal由 GitHub 帳號 alokbarnwal 發布v1.0.1更新於 Oct 24, 2026

Analyze any Nifty 500 stock with AI — price action, demand zones, technicals & screener.

已驗證Streamable HTTP可網頁執行金融資料與分析

概覽

AI 產生的概覽

針對印度 NSE 股票的遠端 MCP 伺服器:報價、K 線、技術指標、價格行為價位與 Nifty 500 選股篩選。

可以做什麼
  • 取得 NSE 個股最新報價與 OHLCV K 線,支援日線、15 分鐘與 5 分鐘週期
  • 讀取 EMA、SMA、RSI、MACD、布林通道、ADX、ATR、OBV、VWAP 等技術指標
  • 檢視價格行為價位:樞軸點與歷史支撐壓力、供需區、斐波那契回撤位
  • 辨識單根 K 線型態與多根圖表型態,並查看成交量熱點與 OBV 趨勢
  • 並排比較 2 至 5 檔股票,並依 RSI、ADX、趨勢、型態、量比或類股篩選股票池
  • 取得大盤總覽:指數、漲幅榜、跌幅榜、活躍股與市場寬度
適用情境
適合讓助理回答印度股市相關問題,例如技術型態、支撐壓力、篩選 Nifty 500 個股或比較幾檔股票,而不必自行建置資料管線。
執行需求
需要一個遠端 MCP 端點;未宣告帳號、API 金鑰或本機執行環境。將 MCP 用戶端連線到託管伺服器網址即可。資料來自 Yahoo Finance,於 NSE 交易時段(IST 09:15–15:30,平日)定時更新。
安裝前請注意
專案聲明僅供教育與資訊參考,不構成投資建議,輸出應視為參考資訊。託管端點依 IP 限流,並會封鎖反覆超限者,高頻自動化使用可能被限速。資料來自第三方來源,可能延遲或不完整。自行部署需自備 MySQL 資料庫與憑證。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Indian NSE Stock Insights,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Web executable,透過 Streamable HTTP。 遠端服務在工作區中設定後即可從網頁執行環境執行。

交給代理程式安裝

把這段提示詞貼上到 Claude Code、Codex、Cursor 等代理程式,或 SourceWeft 對話中。代理程式會讀取該伺服器的安裝指南,先向你展示發布者、端點和登入方式,經你同意後再把它新增到你的客戶端。金鑰不會寫進任何命令。

閱讀 https://sourceweft.com/mcp/io.github.alokbarnwal%2Fnse-public-mcp/install.md,並按其中說明把這個 MCP 伺服器接入我的客戶端。修改任何設定之前,先告訴我它的發布者、端點和登入方式,等我確認。不要把 API 金鑰寫進命令或我會提交的檔案;問我金鑰應從哪裡取得。

檢視代理程式所依據的安裝指南

其他 MCP 客戶端

把它新增到你客戶端的 mcpServers 設定中。

{
  "mcpServers": {
    "indian-nse-stock-insights": {
      "type": "http",
      "url": "https://stockmcp.alokbarnwal.com/mcp"
    }
  }
}

README

Indian NSE Stock Insights 🇮🇳📈

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 InsightsURL:  https://stockmcp.alokbarnwal.com/mcp

That's it. Start asking questions about Indian stocks.


12 Tools

#ToolParametersWhat it returns
1get_stock_quotesymbolLast close, prev close, change %, day H/L, volume
2get_ohlc_datasymbol, timeframe?, limit?OHLCV candles (up to 500, newest first)
3get_technical_indicatorssymbol, timeframe?EMAs, SMAs, RSI, MACD, Bollinger, ADX, Stoch, ATR, OBV, VWAP
4get_support_resistancesymbol, timeframe?Pivot points + historical S/R levels
5get_demand_supply_zonessymbol, timeframe?, status?Demand/supply zones (DBR/RBR/RBD/DBD)
6get_candlestick_patternssymbol, timeframe?, limit?HAMMER, DOJI, ENGULFING, etc.
7get_chart_patternssymbol, timeframe?, status?DOUBLE_TOP, HEAD_AND_SHOULDERS, etc.
8get_fibonacci_levelssymbol, timeframe?Retracement swings (UP/DOWN) with fib levels
9get_volume_analysissymbol5min hotspots, OBV trend, volume ratio
10get_market_overview(none)Indices, top gainers/losers, most active, breadth
11compare_stockssymbols (2-5) , timeframe?Side-by-side: quote, RSI/MACD/ADX, trend, 30d return
12screen_stocksfiltersFilter 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

mermaid
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

TimeframeRetentionUpdate FrequencyStocks
Daily5 yearsEOD (18:00 IST)500
15-minute2 yearsEvery 15 min (market hours)500
5-minute6 monthsEvery 5 min (market hours)500

Market hours: 09:15–15:30 IST, Monday–Friday (excluding NSE holidays).


Rate Limits

LayerLimitAction
nginx20 requests/sec per IP (burst 40)HTTP 429
nginx10 simultaneous connections per IPHTTP 429
fail2ban5× rate-limit violations in 2 minIP banned for 1 hour

Self-Hosting

Click to expand — full deployment runbook

Runs on /home/ubuntu/nse-public-mcp/ — completely isolated from /home/ubuntu/swingtrader/.

1. Clone

bash
cd /home/ubuntugit clone https://github.com/alokbarnwal/nse-public-mcp.gitcd nse-public-mcp

2. Create database and user

bash
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

bash
mysql -u nse_writer -p nse_public < db/schema.sqlmysql -u nse_writer -p nse_public < db/schema_indicators.sqlmysql -u nse_writer -p nse_public < db/schema_price_action.sql

4. Install dependencies

bash
python3 -m venv .venvsource .venv/bin/activatepip install -r requirements.txt

5. Configure environment

bash
cp .env.example .envchmod 600 .envnano .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:

bash
python -m config.stocks --refresh        # fetches NSE archives, rewrites config/stocks.py

7. Load stock universe into DB

bash
python -m config.stocks --load-to-db

8. Backfill historical data (long-running, use screen/tmux)

bash
screen -S backfillsource .venv/bin/activatepython -m data.backfill --all# Ctrl-A D to detach. Reattach: screen -r backfill

Expected runtime:

  • daily 5y × 500: ~30 min
  • 15min 2y × 500: ~2 h
  • 5min 6mo × 500: ~1 h

If anything fails, the failure list is written to backfill_failures_<timeframe>.json. Re-run:

bash
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:

bash
screen -S indicatorscd /home/ubuntu/nse-public-mcppython3 -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:

bash
screen -S price_actioncd /home/ubuntu/nse-public-mcppython3 -m price_action.runner --timeframe daily --all-featurespython3 -m price_action.runner --timeframe 15min --all-featurespython3 -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

bash
crontab -e

Add:

cron
# 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>&10    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>&120,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>&15        16   * * 1-5 cd /home/ubuntu/nse-public-mcp && /usr/bin/python3 -m jobs.cron_indicators_15min >> logs/indicators_15min.log 2>&12-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>&125,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>&19-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 to 2-57/5 so it runs ~2 minutes after cron_5min and never reads stale candles. The price-action 5-min cron is offset to 9-54/15 (minutes 9, 24, 39, 54) so it runs ~2 minutes after each cron_indicators_5min slot.

10. Verification

bash
mysql -u nse_writer -p nse_public <<'SQL'SELECT 'daily' AS tf, COUNT(*) AS n FROM candles_dailyUNION ALL SELECT '15min', COUNT(*) FROM candles_15minUNION ALL SELECT '5min',  COUNT(*) FROM candles_5min;
-- Per-stock coverage on daily — flag any with < 1000 rows (~4 trading years)SELECT symbol, COUNT(*) AS nFROM candles_dailyGROUP BY symbolHAVING n < 1000ORDER BY n;
-- Latest data freshnessSELECT MIN(candle_date) AS earliest, MAX(candle_date) AS latestFROM candles_daily;
-- Recent cron healthSELECT job_type, timeframe, symbols_success, symbols_failed, started_at, duration_secondsFROM fetch_logORDER BY started_at DESCLIMIT 20;SQL

DB size on disk:

bash
sudo du -sh /var/lib/mysql/nse_public/

Service Management

bash
# Server statussudo systemctl status nse-public-mcp
# Restartsudo systemctl restart nse-public-mcp
# Logssudo journalctl -u nse-public-mcp -n 100 -f
# nginxsudo nginx -t && sudo systemctl reload nginx
# fail2bansudo fail2ban-client status nginx-mcp-ratelimit

Layout

See PROJECT.md for architecture and data-flow diagram.

config/        # settings, stock universe, holiday calendardata/          # yfinance fetcher, backfill CLI, shared upsert helpersdb/            # schema and pooled connectionindicators/    # technical indicator compute, persist, runnerprice_action/  # zones, patterns, levels, trendsmcp_server/    # FastMCP server + 12 tool modulesjobs/          # cron entrypoints (candles + indicators + price action)deploy/        # systemd service, nginx config, fail2ban rulestests/         # 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.

來源:README.md,提交 aaefc5c

工具

12

get_stock_quote

Latest price snapshot for an NSE stock — last close, prev close, change %, day H/L, volume.

輸入參數symbol必填

get_ohlc_data

Recent OHLCV candles. timeframe in {daily, 15min, 5min}; limit capped at 500; newest first.

輸入參數limitsymbol必填timeframe

get_technical_indicators

Latest technical indicators (EMAs, SMAs, RSI, MACD, BB, ADX, Stoch, ATR, OBV, VWAP).

輸入參數symbol必填timeframe

get_support_resistance

Pivot points + historical support/resistance levels, ordered by price desc.

輸入參數symbol必填timeframe

get_demand_supply_zones

Demand/supply zones (DBR/RBR/RBD/DBD) split into demand_zones and supply_zones.

輸入參數statussymbol必填timeframe

get_candlestick_patterns

Recent single-bar candlestick patterns (HAMMER, DOJI, ENGULFING, ...) newest first.

輸入參數limitsymbol必填timeframe

get_chart_patterns

Multi-bar chart patterns (DOUBLE_TOP, HEAD_AND_SHOULDERS, ...). 'ACTIVE' = PENDING/CONFIRMED.

輸入參數statussymbol必填timeframe

get_fibonacci_levels

Latest fibonacci retracement swings (UP/DOWN) with 236/382/500/618/786 levels.

輸入參數symbol必填timeframe

get_volume_analysis

Volume diagnostic: top 5min hotspots + peak slot + OBV 20-day trend + today/20-day volume ratio.

輸入參數symbol必填

get_market_overview

Market-wide snapshot: indices, top_gainers, top_losers, most_active, breadth.

無需輸入參數。

compare_stocks

Side-by-side comparison of 2-5 symbols: quote, RSI/MACD/ADX, trend, 30d return, latest pattern.

輸入參數symbols必填timeframe

screen_stocks

Filter the active universe. Keys: rsi_min, rsi_max, adx_min, trend, near_demand_zone, pattern, min_volume_ratio, sector. At least one required.

輸入參數filters必填

版本歷史

1
  1. v1.0.1最新Sep 16, 2026

評分

已滿足適用檢查項的 100%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通必需25 分
  • 已宣告認證方式必需10 分
  • 已列出工具必需15 分
  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分