Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

indian-stocks-mcp

Ask Claude about Indian stocks. Minute-by-minute. No setup.

Connect one hosted MCP server and query Indian market history from conversation: 136 NSE index series, 117 NIFTY 100 stock symbols, 6+ years of OHLCV candles, and backtests with 8 strategy types and a full Indian cost model.

Hosted on HuggingFace MCP endpoint License: MIT

Hosted endpoint: https://vjaiswal-nifty-mcp.hf.space/mcp

Transport: streamable-http


Connect

Claude Desktop

Add this to ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "indian-stocks": {
      "type": "http",
      "url": "https://vjaiswal-nifty-mcp.hf.space/mcp"
    }
  }
}

Restart Claude Desktop after editing the file.

Claude.ai

Go to Settings -> Integrations -> Add custom MCP, then paste:

https://vjaiswal-nifty-mcp.hf.space/mcp

VS Code, Cursor, and other MCP clients

Use the same hosted HTTP endpoint:

{
  "mcpServers": {
    "indian-stocks": {
      "type": "http",
      "url": "https://vjaiswal-nifty-mcp.hf.space/mcp"
    }
  }
}

For clients that ask for transport explicitly, choose streamable-http.


What to ask

"What was RELIANCE's intraday price action on Union Budget day 2024?"

"Run a 20/50 SMA crossover backtest on NIFTY 50 daily from 2019 to 2024. What's the Sharpe ratio?"

"Compare RSI mean reversion vs EMA crossover on INFY 1-minute data. Which had better risk-adjusted returns?"

"Show me NIFTY BANK 15-minute candles during the March 2020 crash week"

"Backtest a Supertrend strategy on NIFTY IT with a 2% trailing stop loss. What was the worst drawdown?"

"Run a MACD crossover backtest on RELIANCE from 2020 to 2024. Compare it against Bollinger Bands on the same data."

"Use a Stochastic oscillator strategy on BANK NIFTY 15-minute data with a 1.5% stop loss"

"Which NIFTY 100 stocks have more than 5 years of 1-minute data available?"

"Compare 5 different SMA window combinations on NIFTY 50 and rank them by profit factor"

"Show me the latest day's 1-minute candles for NIFTY 50"

"What's the average 1-minute range for HDFC BANK in Q1 2024?"

Claude calls the MCP tools automatically, so answers are grounded in the hosted data instead of guessed from model memory.


Available Data

Dataset Symbols Intervals History Notes
Indices 136 index series 1minute, 5minute, 15minute, 60minute, day 6+ years Includes broad-market, sector, factor, bond, thematic, and volatility series
Stocks 117 NIFTY 100 stock symbols as advertised by the hosted server 1minute 6+ years Use list_symbols(dataset="stocks") for the live authoritative list

Row scale: 187M+ candles.

Timezone: all timestamps are returned in Asia/Kolkata (+05:30).

Refresh cadence: twice-weekly (Monday and Thursday) from Kaggle-backed source datasets.

Representative index symbols: NIFTY 50, NIFTY BANK, NIFTY IT, NIFTY PHARMA, NIFTY AUTO, NIFTY REALTY, INDIA VIX.

Representative stock symbols: RELIANCE, TCS, INFY, HDFCBANK, ICICIBANK, WIPRO, BAJFINANCE, TITAN, MARUTI, COALINDIA.

See docs/symbols.md for the static public symbol catalog and notes on verification.


MCP Tools

Tool What Claude can do
dataset_status Check data availability, latest available date, row counts per dataset
list_symbols Browse symbols, intervals, date coverage, and per-symbol row counts
get_candles Fetch raw OHLCV candles for a symbol, interval, date range, and row limit. Use desc=True to get the latest N candles without needing to know the date
run_backtest Run a strategy config and return metrics, trades, and equity curve
compare_strategies Run up to 10 strategy configs side-by-side
get_backtest_report Retrieve a saved backtest report by run_id, or list recent reports
help List all available tools with descriptions, parameters, and usage examples

All tools are read-only. This MCP does not place trades, manage portfolios, or write to brokerage accounts.


Backtesting

Strategy types

Strategy What it does Key parameters
sma_crossover Buy when fast SMA crosses above slow SMA fast_window, slow_window
ema_crossover Buy when fast EMA crosses above slow EMA fast_window, slow_window
rsi_mean_reversion Buy oversold, exit overbought rsi_window, oversold, overbought
breakout Buy on N-period high breakout lookback_window
supertrend ATR-based trend following atr_window, multiplier
macd_crossover Buy when MACD line crosses above signal line fast_window (12), slow_window (26), macd_signal (9)
bollinger_bands Buy at lower band, sell at upper band bb_window (20), num_std (2.0)
stochastic Buy oversold %K/%D, sell overbought stoch_window (14), stoch_signal (3), oversold (20), overbought (80)

Exit rules

Every strategy can include:

{
  "stop_loss_pct": 0.02,
  "take_profit_pct": 0.05,
  "trailing_stop_pct": 0.03
}

Indian cost model

Backtests can include:

STT, brokerage per order, SEBI charges, exchange transaction fee, stamp duty, GST, and slippage.

Metrics

Backtests return final equity, total return, CAGR, Sharpe ratio, max drawdown, win rate, trade count, average trade return, total costs, full trades, and full equity curve.


Example Backtest Config

Ask Claude to run this, or pass it directly to run_backtest:

{
  "name": "NIFTY 50 MACD crossover",
  "dataset": "index",
  "symbol": "NIFTY 50",
  "interval": "day",
  "start": "2019-01-01",
  "end": "2024-12-31",
  "initial_cash": 100000,
  "strategy": {
    "type": "macd_crossover",
    "fast_window": 12,
    "slow_window": 26,
    "macd_signal": 9,
    "stop_loss_pct": 0.03
  },
  "position_sizing": {
    "type": "fractional",
    "fraction": 1.0
  },
  "costs": {
    "brokerage_per_order": 20,
    "stt_sell_pct": 0.001,
    "slippage_pct": 0.0005
  }
}

Troubleshooting

Check hosted server health:

curl https://vjaiswal-nifty-mcp.hf.space/health

A healthy response looks like:

{"status":"ready","mode":"remote","db_ready":true}

If your client cannot connect:

  • Confirm the URL is exactly https://vjaiswal-nifty-mcp.hf.space/mcp.
  • Confirm the MCP type is http or the transport is streamable-http.
  • Restart the MCP client after changing config.
  • If HuggingFace is waking the Space, retry after a short wait.

FAQ

Is this free?

Yes. The hosted server is free to use and does not require an API key.

How fresh is the data?

The source datasets are refreshed twice a week (Monday and Thursday).

Does this provide live prices?

No. It provides historical OHLCV candles. Live quotes are out of scope.

Can it trade for me?

No. Every MCP tool is read-only.

Something broken or a symbol missing?

Open an issue in this repository and include the symbol, interval, date range, and MCP client you used.


Releases

Packages

Contributors