nse-mcp

nse-mcp

Enables 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.

Category
访问服务器

README

NSE MCP

An MCP (Model Context Protocol) server that turns National Stock Exchange of India (NSE) data into AI tools. If you use an AI assistant on your computer (Claude Desktop, Codex, Gemini CLI, Cursor, or similar), this lets that assistant answer questions about Indian stocks in plain English — "What's the live quote for RELIANCE?", "Is the market open right now?" — with real data instead of guesses.

MCP is the standard plug that lets AI apps use extra tools: you install the server once, connect it in the app's settings, and then just ask questions. Powered by jugaad-data.

Quick install

Install with one command. No Python or venv needed — the installer bundles its own runtime and prints the config entry to paste.

Windows: open PowerShell (search for "PowerShell" in the Start menu), then run:

powershell -ExecutionPolicy ByPass -c "irm https://raw.githubusercontent.com/jugaad-py/nse-mcp/main/install.ps1 | iex"

Linux / macOS: open the Terminal app, then run:

curl -LsSf https://raw.githubusercontent.com/jugaad-py/nse-mcp/main/install.sh | sh

You should see a short log ending in nse-mcp installed. If Windows asks for permission, click Yes. If something fails, copy the error text and show it to your AI assistant.

Already have Python or uv? These work too (optional):

pip install nse-mcp
# or
uv tool install nse-mcp   # on-demand alternative: uvx nse-mcp

Connect your AI app

Your AI app (the "MCP client") reads a small settings file at startup. Add the block below to that file, save it, then fully quit and reopen the app:

{
  "mcpServers": {
    "nse-mcp": {
      "command": "nse-mcp"
    }
  }
}

This is the same block the installer prints in the terminal — paste whichever is easier.

Finding the settings file: the folders start with a dot (macOS/Linux) or are hidden by default (Windows). Fastest way — open the folder directly:

  • Windows: press Win + R, paste %APPDATA%\Claude, press Enter
  • macOS: in Finder choose Go → Go to Folder… (Cmd+Shift+G), paste ~/Library/Application Support/Claude, press Enter
  • Linux: the file is at ~/.codex/config.toml — open the ~/.codex folder (in your file manager press Ctrl+H to show hidden folders)

If the file already contains text: don't delete it. If it already has an mcpServers section, add a comma after the last entry, then paste the block after it.

Where the settings file lives, by app:

App Settings file
Claude Desktop claude_desktop_config.json (macOS: ~/Library/Application Support/Claude/, Windows: %APPDATA%\Claude\)
ChatGPT desktop / Codex CLI ~/.codex/config.toml, as [mcp_servers.nse-mcp]
Gemini CLI ~/.gemini/settings.json
Claude Code, Cursor, VS Code .mcp.json in the project root, or mcp add nse-mcp -- nse-mcp

ChatGPT on the web connects only to remote servers, so use a desktop app.

What you can ask

  • "Get a live quote for RELIANCE" — price, change, volume, market cap
  • "Is the NSE market open right now?"
  • "Which stocks gained the most today?"
  • "Show me INFY's closing price for the last 6 months"
  • "What's NIFTY 50's P/E compared to a year ago?"

Features

  • Live prices and trades — current price, the day's high and low, volume, buy/sell depth, and futures/options contracts for a symbol (stock_quote, stock_quote_fno, trade_info, chart_data)
  • Market overview — open/closed status, total turnover, biggest gainers and losers, pre-market prices, trading holidays, F&O securities, and large bulk trades (market_status, market_turnover, pre_open_market, top_stocks, holiday_list, live_fno, block_deal_session)
  • Indices — live index quotes and which stocks belong to an index (all_indices, live_index, index_list)
  • Option chains — the contracts available for an index, stock, or currency pair, with their set prices and dates (index_option_chain, equities_option_chain, currency_option_chain, option_chain_contract_info)
  • Corporate actions — announcements, symbol metadata, registrar details (corporate_announcements, symbol_meta, reg_details)
  • History — past daily prices for stocks and indices, plus index P/E, P/B, and dividend yield (stock_history, index_history, index_pe_history)

Plain-language glossary for the jargon above:

Term Meaning
OHLC Open, high, low, close — the day's price range
F&O Futures and options — contracts to buy or sell at a set price and date
Option chain All the contracts for a symbol at their set prices (strikes) and dates (expiries)
P/E Price-to-earnings — how expensive a stock is relative to its profits (P/B is the same idea, vs. its book value)
Dividend yield The annual dividend paid, as a percentage of the share price
Block deal A single very large trade, usually between institutions

For developers

git clone https://github.com/jugaad-py/nse-mcp
cd nse-mcp
python3 -m venv .venv
.venv/bin/pip install -r requirements.txt

Run the tests (live NSE data; needs a stable network):

.venv/bin/python -m pytest tests/ -v

Run the server directly:

.venv/bin/python server.py

Troubleshooting

  • Tools don't appear after the config change? Fully quit and reopen the app.
  • Check the settings file is valid (quotes and commas in JSON, one = per line in TOML) and that nse-mcp starts without errors when run in a terminal.
  • NSE rate-limits IPs. A transient failure just means retry the question.

Project structure

nse-mcp/
├── server.py          # MCP server: NSE tools, exposes the nse-mcp CLI entry
├── pyproject.toml     # Packaging source of truth
├── install.sh         # Linux/macOS one-line installer
├── install.ps1        # Windows one-line installer
├── .github/workflows/ # CI: tests, PyPI publish, version check
├── tests/             # Live-data pytest suite
└── requirements.txt   # Developer dependencies

Disclaimer

For research and personal use. Data comes from public NSE endpoints and may be delayed or unavailable. Not investment advice.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选