India Stock MCP Server
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@India Stock MCP ServerWhat's Reliance trading at, and is the market open right now?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
๐ฎ๐ณ India Stock MCP Server
A production-ready Model Context Protocol (MCP) server that gives AI assistants like Claude, Cursor and VS Code Copilot live access to Indian stock market data from NSE and BSE: quotes, price history, technical indicators, fundamentals and market indices.
It runs over Streamable HTTP, so anyone can connect to the hosted server with just a URL. Nothing to install.
โ ๏ธ Not investment advice. This project is for education and research. Data may be delayed (~15 minutes) and may contain errors. Always do your own research before making investment decisions.
โจ Tools
Tool | What it does | Example question to your AI |
| Latest price, change %, day range, volume | "What's Reliance trading at?" |
| OHLCV candles (1moโ5y, daily/weekly/monthly) + period return | "How has Tata Motors done this year?" |
| SMA 20/50/200, EMA 20, RSI(14), MACD, Bollinger Bands + plain-English signals | "Is Infosys overbought?" |
| Sector, market cap (โน crore), P/E, P/B, EPS, ROE, debt/equity, margins, dividend yield | "Is HDFC Bank cheap compared to its book value?" |
| Up to 5 stocks side by side: today, 1M, 6M and 1Y returns | "Compare TCS, Infosys and Wipro" |
| NIFTY 50, SENSEX, BANK NIFTY, sector indices, INDIA VIX | "How is the market doing today?" |
| Whether NSE/BSE is open right now (IST) | "Is the market open?" |
There is also a prompt, analyze_stock, that runs a complete analysis of one stock.
Symbols are NSE trading symbols such as RELIANCE, TCS, INFY, HDFCBANK, M&M or BAJAJ-AUTO.
Related MCP server: nse-mcp
๐ Connect to the hosted server
Server URL: https://YOUR-APP.onrender.com/mcp
Settings โ Connectors โ Add custom connector โ paste the server URL.
claude mcp add --transport http india-stocks https://YOUR-APP.onrender.com/mcp{
"mcpServers": {
"india-stocks": { "url": "https://YOUR-APP.onrender.com/mcp" }
}
}{
"servers": {
"india-stocks": { "type": "http", "url": "https://YOUR-APP.onrender.com/mcp" }
}
}The free hosting tier sleeps when idle, so the first request after a quiet period can take ~30โ60 seconds.
๐๏ธ Architecture
AI client โโHTTPS POST /mcpโโโถ Rate limiter โโโถ MCP server (stateless) โโโถ Tool
(60 req/min/IP) โ
TTL cache โโโโโโโโโโโโค
โ miss โ
โผ โ
Yahoo Finance โโ(retry)โโโStateless Streamable HTTP: every request is independent, so the server scales horizontally.
TTL caching: quotes 1 min, price history 15 min, fundamentals 6 h. Popular stocks cost one upstream call.
Retries with backoff: transient Yahoo failures are retried; real outages return a clear message.
Per-client rate limiting: token bucket keyed on client IP, resistant to forged
X-Forwarded-Forheaders.Input validation: symbols, periods and intervals are validated before any network call.
๐ป Run it locally
Requires uv and Python 3.11+.
git clone https://github.com/DiwakarReddy11/india-stock-mcp.git
cd india-stock-mcp
uv sync
uv run python -m india_stock_mcp.serverThe server starts at http://127.0.0.1:8000/mcp. Check it with:
curl http://127.0.0.1:8000/health # {"status":"ok"}
uv run python scripts/smoke_test.py # calls every toolWith Docker
docker build -t india-stock-mcp .
docker run -d --name india-stock-mcp -p 8000:8000 india-stock-mcpโ๏ธ Configuration
All settings are environment variables (or a .env file; see .env.example).
Variable | Default | Description |
|
| Interface to listen on |
|
| Port to listen on |
|
|
|
|
| Seconds to cache quotes |
|
| Seconds to cache price history |
|
| Seconds to cache fundamentals |
|
| Max MCP requests per minute per client IP |
|
| Load balancers in front of the app ( |
๐งช Development
uv sync # installs dev tools too
uv run pytest # 36 offline tests (Yahoo is mocked)
uv run ruff check src scripts tests # lint
uv run ruff format src scripts tests # formatProject structure
src/india_stock_mcp/
โโโ server.py # MCP server, tools, data fetching, indicators
โโโ config.py # settings from environment variables
โโโ ratelimit.py # per-client rate limiting middleware
tests/ # offline test suite
scripts/ # smoke test against a running server
Dockerfile # multi-stage, non-root production imageโ ๏ธ Limitations
Data source: prices come from Yahoo Finance via
yfinance, an unofficial API intended for personal and research use. Data can be delayed or temporarily unavailable. For commercial use, switch to a licensed provider (e.g. a broker API).BSE: use trading symbols with
exchange="BSE"(e.g.RELIANCE), not numeric scrip codes. Yahoo's BSE history is often limited, so previous close and technical analysis work best on NSE.Market status uses regular trading hours (MonโFri 09:15โ15:30 IST) and does not know exchange holidays.
Rate limits are per server instance (in memory).
๐ License
MIT ยฉ 2026 DiwakarReddy
Disclaimer: This software is provided for informational and educational purposes only and does not constitute financial, investment or trading advice. The authors accept no liability for any losses arising from its use.
This server cannot be deployed
Maintenance
Related MCP Connectors
NSE/BSE stock data via Tickertape as JSON: index lists, screener, 10-year fundamentals.
Hosted MCP server for Indian NSE/BSE stock research: 59 tools for quotes, financials and ratios, peers, shareholding and pledge, filings with extracted facts, screens, F&O and FII/DII context. Source and freshness on every answer; no buy/sell calls.
Live crypto + IDX stock market intelligence for AI agents โ 19 tools, no API key.
Stock research for AI assistants: scan US stocks, ETFs and futures, cite SEC filings, save queries.
Related MCP Servers
- AlicenseAqualityBmaintenanceIndian stock market (NSE & BSE) MCP server with 55 tools: live quotes, financials, technicals, a 326-ratio screener, FII/DII flows, option chains with IV, parsed annual reports and concall transcripts, IPOs and portfolio tracking for ~8,200 stocks.55110 npm143MIT
- FlicenseCqualityDmaintenanceEnables AI assistants to access National Stock Exchange of India (NSE) data, including live quotes, market status, indices, option chains, corporate actions, and historical data, through natural language.241-
- AlicenseAqualityBmaintenanceEnables AI assistants to query live NSE & BSE stock market data, with 55 tools covering quotes, financials, screeners, FII/DII flows, option chains, and company filings.55MIT
- AlicenseAqualityCmaintenanceGives AI assistants live Indian market data without any API keys, spanning NSE quotes and indices, option chains with Greeks, max pain and OI analytics, company financials, shareholding and corporate actions, plus mutual fund NAVs and trailing returns. It also ships research, market-brief and options-positioning prompts so users can compare stocks, trace sector leadership or size up an expiry through natural language.13MIT