# nikhilcherry/indian-stock-mcp architecture

> Architecture diagram of the GitHub repository nikhilcherry/indian-stock-mcp, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nikhilcherry/indian-stock-mcp
- Repository: https://github.com/nikhilcherry/indian-stock-mcp

## Overview

This repository is an MCP server that exposes Indian stock-market data to MCP clients such as Claude Desktop. The principal workflow is a client tool call, dispatch to a registered market-data handler, an authenticated request to the Indian Stock Exchange API, and a formatted result or explicit request error returned to the client. The handlers cover news, stock details/prices/history, market movers, and commodities. All runtime logic is in `src/index.ts`; the graph groups its distinct responsibilities. The source excerpts show the registered calls and API boundary; the README documents the client setup.

Main entry points: [`src/index.ts`](https://github.com/nikhilcherry/indian-stock-mcp/blob/main/src/index.ts) (MCP server)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["MCP interface"]
  node_runtime["MCP server<br/>[index.ts]"]
end

subgraph group_market["Market data tools"]
  node_news["News tool<br/>[index.ts]"]
  node_stocks["Stock tools<br/>[index.ts]"]
  node_movers["Market movers<br/>[index.ts]"]
  node_commodities["Commodities tool<br/>[index.ts]"]
end

subgraph group_integration["API integration"]
  node_request["API request<br/>[index.ts]"]
  node_format["Result formatter<br/>[index.ts]"]
end

node_client(("MCP client"))
node_api["Indian Stock API"]

node_client -->|"calls tools"| node_runtime
node_runtime -->|"registers"| node_news
node_runtime -->|"registers"| node_stocks
node_runtime -->|"registers"| node_movers
node_runtime -->|"registers"| node_commodities
node_news -->|"requests data"| node_request
node_stocks -->|"requests data"| node_request
node_movers -->|"requests data"| node_request
node_commodities -->|"requests data"| node_request
node_news -->|"formats result"| node_format
node_stocks -->|"formats result"| node_format
node_movers -->|"formats result"| node_format
node_commodities -->|"formats result"| node_format
node_request -->|"fetches data"| node_api

click node_runtime "https://github.com/nikhilcherry/indian-stock-mcp/blob/main/src/index.ts"
click node_news "https://github.com/nikhilcherry/indian-stock-mcp/blob/main/src/index.ts"
click node_stocks "https://github.com/nikhilcherry/indian-stock-mcp/blob/main/src/index.ts"
click node_movers "https://github.com/nikhilcherry/indian-stock-mcp/blob/main/src/index.ts"
click node_commodities "https://github.com/nikhilcherry/indian-stock-mcp/blob/main/src/index.ts"
click node_request "https://github.com/nikhilcherry/indian-stock-mcp/blob/main/src/index.ts"
click node_format "https://github.com/nikhilcherry/indian-stock-mcp/blob/main/src/index.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_runtime,node_client toneBlue
class node_news,node_stocks,node_movers,node_commodities toneAmber
class node_request,node_format,node_api toneMint
```

## Components

### MCP interface

- [MCP server](https://github.com/nikhilcherry/indian-stock-mcp/blob/main/src/index.ts): `src/index.ts`

### Market data tools

- [News tool](https://github.com/nikhilcherry/indian-stock-mcp/blob/main/src/index.ts): `src/index.ts`
- [Stock tools](https://github.com/nikhilcherry/indian-stock-mcp/blob/main/src/index.ts): `src/index.ts`
- [Market movers](https://github.com/nikhilcherry/indian-stock-mcp/blob/main/src/index.ts): `src/index.ts`
- [Commodities tool](https://github.com/nikhilcherry/indian-stock-mcp/blob/main/src/index.ts): `src/index.ts`

### API integration

- [API request](https://github.com/nikhilcherry/indian-stock-mcp/blob/main/src/index.ts): `src/index.ts`
- [Result formatter](https://github.com/nikhilcherry/indian-stock-mcp/blob/main/src/index.ts): `src/index.ts`

### Other components

- **MCP client**
- **Indian Stock API**

## Connections

- MCP client → MCP server: calls tools (evidence: `README.md`)
- MCP server → News tool: registers (evidence: `src/index.ts`)
- MCP server → Stock tools: registers (evidence: `src/index.ts`)
- MCP server → Market movers: registers (evidence: `src/index.ts`)
- MCP server → Commodities tool: registers (evidence: `src/index.ts`)
- News tool → API request: requests data (evidence: `src/index.ts`)
- Stock tools → API request: requests data (evidence: `src/index.ts`)
- Market movers → API request: requests data (evidence: `src/index.ts`)
- Commodities tool → API request: requests data (evidence: `src/index.ts`)
- News tool → Result formatter: formats result (evidence: `src/index.ts`)
- Stock tools → Result formatter: formats result (evidence: `src/index.ts`)
- Market movers → Result formatter: formats result (evidence: `src/index.ts`)
- Commodities tool → Result formatter: formats result (evidence: `src/index.ts`)
- API request → Indian Stock API: fetches data (evidence: `src/index.ts`)
