indian-stock-market-mcp
MCP server providing real-time Indian stock market data through 15 tools, including stock details, historical data, market overview, and news. Works with Claude Desktop, Claude Code, Cursor, Windsurf, and other MCP clients using an API key from IndianAPI.in.
README
Indian Stock Market MCP Server
MCP server that provides real-time access to Indian stock market data through 15 tools. Works with Claude Desktop, Claude Code, Cursor, Windsurf, and any MCP-compatible client.
Powered by IndianAPI.in.
Prerequisites
- Node.js 18+ (Download)
- API Key from IndianAPI.in - subscribe to get your API key and base URL
Installation
The server runs via npx - no clone or install needed.
Universal Config Shape
Every MCP client uses the same config structure:
{
"mcpServers": {
"indian-stock-market": {
"command": "npx",
"args": ["-y", "indian-stock-market-mcp"],
"env": {
"INDIAN_STOCK_API_KEY": "your_api_key_here",
"INDIAN_STOCK_API_BASE_URL": "https://your-api-base-url.com"
}
}
}
}
Claude Desktop
Add to your Claude Desktop config file:
| OS | Path |
|---|---|
| macOS | ~/Library/Application Support/Claude/claude_desktop_config.json |
| Linux | ~/.config/Claude/claude_desktop_config.json |
| Windows | %APPDATA%\Claude\claude_desktop_config.json |
Paste the universal config shape above, then restart Claude Desktop.
Claude Code
claude mcp add indian-stock-market \
-e INDIAN_STOCK_API_KEY=your_api_key_here \
-e INDIAN_STOCK_API_BASE_URL=https://your-api-base-url.com \
-- npx -y indian-stock-market-mcp
Cursor
Add the universal config shape to .cursor/mcp.json in your project root (or global settings).
Windsurf
Add the universal config shape to ~/.codeium/windsurf/mcp_config.json.
Available Tools (15)
Stock Information
- get_stock_details - Detailed info about any stock
- get_historical_data - Historical price data with multiple timeframes
- get_stock_target_price - Analyst target prices
- get_corporate_actions - Dividends, bonuses, splits
- get_recent_announcements - Latest company announcements
- get_financial_statement - Income statement, balance sheet, cash flow
Market Overview
- get_trending_stocks - Currently trending stocks
- get_nse_most_active - Most active NSE stocks
- get_bse_most_active - Most active BSE stocks
- get_price_shockers - Significant gainers and losers
- get_52_week_high_low - Stocks at 52-week extremes
Market Data
- get_market_news - Latest market news
- get_ipo_data - Current and upcoming IPOs
- get_commodities - Commodity prices
- search_industry - Find stocks by sector/industry
Usage Examples
Once configured, use natural language in your AI assistant:
Get me the latest details for Tata Steel
Show me the 1-year price history for HDFC Bank
What are the trending stocks today?
Find all banking stocks and their performance
Get financial statements for Infosys - income statement and balance sheet
Give me today's market briefing: NSE most active, price shockers, and commodity prices
Tool Reference
get_stock_details
| Parameter | Type | Required | Description |
|---|---|---|---|
name |
string | yes | Stock name (e.g., "Tata Steel", "HDFC Bank") |
Returns: Stock price, market cap, P/E, 52-week high/low, volume, etc.
get_historical_data
| Parameter | Type | Required | Description |
|---|---|---|---|
stock_name |
string | yes | Stock name |
period |
enum | yes | 1m, 6m, 1yr, 3yr, 5yr, 10yr, max |
filter |
enum | no | default, price, pe, sm, evebitda, ptb, mcs (default: price) |
get_financial_statement
| Parameter | Type | Required | Description |
|---|---|---|---|
stock_name |
string | yes | Stock name |
stats |
string | yes | income, balance, cashflow |
get_corporate_actions
| Parameter | Type | Required | Description |
|---|---|---|---|
stock_name |
string | yes | Stock name |
get_recent_announcements
| Parameter | Type | Required | Description |
|---|---|---|---|
stock_name |
string | yes | Stock name |
get_stock_target_price
| Parameter | Type | Required | Description |
|---|---|---|---|
stock_id |
string | yes | Stock ID or symbol |
search_industry
| Parameter | Type | Required | Description |
|---|---|---|---|
query |
string | yes | Industry/sector name (e.g., "Banking", "Pharma", "IT") |
Zero-parameter tools
get_trending_stocks, get_market_news, get_nse_most_active, get_bse_most_active, get_price_shockers, get_52_week_high_low, get_ipo_data, get_commodities — no parameters required.
Environment Variables
| Variable | Required | Description |
|---|---|---|
INDIAN_STOCK_API_BASE_URL |
yes | API base URL from IndianAPI.in |
INDIAN_STOCK_API_KEY |
yes | Your API key from IndianAPI.in |
INDIAN_STOCK_API_KEY_ALTERNATE |
no | Fallback key for rate-limit rotation |
Response Filtering
The server automatically filters and limits API responses to stay within token limits:
- Stock Details — essential fields only (price, market cap, P/E, 52-week high/low, volume, sector)
- List Responses — top 20 items with essential fields
- Historical Data — last 100 data points
- Financial Statements — arrays limited to 10 items
- News/Announcements — 15 items, descriptions truncated to 300 chars
- Fallback — if still >20,000 tokens, a summary is returned with data type, count, and sample
Development
For contributors working on the server itself:
git clone https://github.com/aswin-s/indian-stock-market-mcp.git
cd indian-stock-market-mcp
bun install
# Create .env with your API credentials
cp .env.example .env
# Build TypeScript to dist/
bun run build
# Run in development mode (uses tsx, no build step needed)
bun run dev
Adding New Tools
- Add a
server.registerTool(...)call insrc/index.ts - Add response filtering logic in
filterResponse()if needed - Update this README
Troubleshooting
"INDIAN_STOCK_API_KEY not found" / "INDIAN_STOCK_API_BASE_URL is required"
Ensure the environment variables are set in your MCP client config (see Installation above).
"Cannot find module '@modelcontextprotocol/sdk'"
If running from source, run bun install (or npm install). If using npx, try npx -y indian-stock-market-mcp to force a fresh install.
Server not appearing in your client
- Verify the config JSON is valid (no trailing commas)
- Restart your MCP client completely
- Check client logs for errors
API requests timing out
Default timeout is 30 seconds. If your API is slower, modify the timeout value in createApiClient in src/index.ts.
API Endpoints
| MCP Tool | API Endpoint |
|---|---|
| get_stock_details | /stock |
| get_historical_data | /historical_data |
| get_trending_stocks | /trending |
| get_market_news | /news |
| get_nse_most_active | /NSE_most_active |
| get_bse_most_active | /BSE_most_active |
| get_price_shockers | /price_shockers |
| get_52_week_high_low | /fetch_52_week_high_low_data |
| get_ipo_data | /ipo |
| get_corporate_actions | /corporate_actions |
| get_recent_announcements | /recent_announcements |
| get_financial_statement | /statement |
| get_stock_target_price | /stock_target_price |
| search_industry | /industry_search |
| get_commodities | /commodities |
License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。