How hi-imcodeman/stock-nse-india works
This package provides direct Node.js access to NSE India market data, plus REST and GraphQL servers, a CLI, and MCP integrations. The main workflow is a caller request entering one of those interfaces, being dispatched to NSE data operations, and returning market results. It also supports AI-assisted natural-language queries with optional session memory and context summarization. The graph preserves the documented data domains and interfaces; unsampled resolver and endpoint internals are represented only where their wiring is supported by the available evidence.
Main entry points: index.ts NSE client library · routes.ts REST routes · mcp-client.ts Natural-language client · server.ts GraphQL server
Components 19
User Interfaces
- CLI commands
src/cli/index.ts - CLI data views
src/cli/api.ts
Market Data
- NSE client library
src/index.ts - Equity mapping
src/equity-mappers.ts - Market analysis helpers
src/helpers.ts
MCP and AI
- MCP stdio server
src/mcp/server/mcp-server.ts - MCP tool handlers
src/mcp/mcp-tools.ts - Natural-language client
src/mcp/client/mcp-client.ts - Conversation memory
src/mcp/memory-manager.ts - Context summarizer
src/mcp/context-summarizer.ts
API Server
- REST routes
src/routes.ts - GraphQL server
src/server.ts - GraphQL resolver
src/root.resolver.ts - Route error handling
src/route-errors.ts
Other components
- Package / API caller
- AI assistant user
- MCP host
- NSE India services
- OpenAI API
Connections 23
- Package / API caller → NSE client library: calls data methods
- NSE client library → NSE India services: fetches market data
- NSE client library → Equity mapping: maps equity data
- Package / API caller → GraphQL server: sends GraphQL query
- GraphQL server → GraphQL resolver: dispatches queries
- Package / API caller → REST routes: sends REST request
- GraphQL server → REST routes: mounts routes
- REST routes → NSE client library: calls data methods
- REST routes → Market analysis helpers: requests analysis
- REST routes → Natural-language client: processes AI query
- REST routes → Route error handling: formats failures
- CLI commands → CLI data views: dispatches commands
- CLI data views → NSE client library: calls data methods
- CLI commands → MCP stdio server: starts server
- MCP host → MCP stdio server: sends MCP messages
- MCP stdio server → MCP tool handlers: dispatches tool calls
- MCP tool handlers → NSE client library: calls data methods
- AI assistant user → Natural-language client: submits query
- Natural-language client → OpenAI API: requests tool selection
- Natural-language client → MCP tool handlers: executes tool calls
- Natural-language client → Conversation memory: reads and updates context
- Conversation memory → Context summarizer: summarizes conversations
- GraphQL resolver → NSE client library: queries market data