NSE MCP Explorer

Getting Started

From zero to your first NSE MCP call in about ten minutes.

0. Prerequisites

1. Install and start

git clone <this-repository> nse-mcp-explorer
cd nse-mcp-explorer
npm install
npm run dev

Open http://localhost:5180. No configuration is needed — NSE MCP has no API keys.

No network, or NSE down? Use the bundled recorded data:

npm run dev:mock

2. Follow the learning path (left sidebar)

Step Page What you’ll learn
1 What is MCP? MCP client/server/tools, how a session works, what NSE exposes, MCP vs a REST API
2 Connect Live connection status, server info, protocol version, the 26 discovered tools
3 Tool explorer Search/filter tools, fill parameters (generated from the schema), execute, see Visual / Parsed / MCP result / Raw JSON-RPC / Code
4 Examples 17 guided examples: goal → tool → request → response → interpretation → how to use it
5 Build: insights Mini-apps combining several tools + analytics (stock deep dive, unusual volume, breadth trend, peers)
6 Integrate Client configs (Claude, ChatGPT, VS Code) and TypeScript/Python/curl code for any tool
· AI agent demo Optional: Claude picks NSE tools on its own
· Protocol log Every JSON-RPC message exchanged with NSE

3. Use NSE MCP in an AI client (no code)

Claude Desktop — Settings → Developer → Edit Config, then paste examples/config/claude_desktop_config.json:

{
  "mcpServers": {
    "cm-market":    { "url": "https://mcp.nseindia.in/cmmkt/mcp",       "transport": "streamable-http" },
    "nse-bhavcopy": { "url": "https://mcp.nseindia.in/bhavcopy/cm/mcp", "transport": "streamable-http" }
  }
}

Claude custom connectors / ChatGPT developer mode — add each URL as a connector with no authentication. VS Code — examples/config/vscode-mcp.json as .vscode/mcp.json. stdio-only clients — bridge with mcp-remote (examples/config/mcp-remote-stdio.json).

4. Call NSE MCP from your own code

TypeScript (uses this repo’s dependencies):

npm run example:ts                                   # quote + 52-week range for RELIANCE
npx tsx examples/typescript/quickstart.ts TCS
npx tsx examples/typescript/history-chunks.ts INFY 12 # 12 months of history via chained calls

Python:

python3 -m venv .venv && source .venv/bin/activate
pip install -r examples/python/requirements.txt
python examples/python/quickstart.py RELIANCE

The core of every integration is four lines:

const client = new Client({ name: 'my-app', version: '1.0.0' });
await client.connect(new StreamableHTTPClientTransport(new URL('https://mcp.nseindia.in/cmmkt/mcp')));
const result = await client.callTool({ name: 'cm_get_stock_quote', arguments: { symbol: 'RELIANCE' } });
const data = JSON.parse((result.content as { text: string }[])[0].text);   // check data.error — NSE reports errors inside the result

5. Optional: enable the AI agent page

cp .env.example .env
# edit .env → ANTHROPIC_API_KEY=...
npm run dev

6. Production build

npm run build      # typecheck + build the UI into web/dist
npm start          # serves UI + API on http://127.0.0.1:5180

Things to know before you build