### Server Setup Steps Source: https://github.com/hi-imcodeman/stock-nse-india/blob/master/README.md Provides a consolidated list of commands for setting up the stock-nse-india API server, including cloning, dependency installation, and environment configuration. ```bash git clone https://github.com/hi-imcodeman/stock-nse-india.git cd stock-nse-india npm install cp .env.example .env npm start ``` -------------------------------- ### Local Development Setup Source: https://github.com/hi-imcodeman/stock-nse-india/blob/master/docs/index.html Commands to clone the repository, install dependencies, and start the development server with auto-reloading. Also includes commands for building, testing, and generating documentation. ```bash # Clone repository git clone https://github.com/hi-imcodeman/stock-nse-india.git cd stock-nse-india # Install dependencies npm install # Development mode with auto-reload npm run start:dev # Build project npm run build # Run tests npm test # Generate documentation npm run docs ``` -------------------------------- ### API Server Setup Source: https://github.com/hi-imcodeman/stock-nse-india/blob/master/docs/index.html Instructions to set up and run the stock-nse-india API server. This involves cloning the repository, installing dependencies, and starting the server. ```bash # Clone and setup git clone https://github.com/hi-imcodeman/stock-nse-india.git cd stock-nse-india npm install # Create local environment file cp .env.example .env # Start the server npm start ``` -------------------------------- ### Clone and Setup API Server Source: https://github.com/hi-imcodeman/stock-nse-india/blob/master/README.md Steps to clone the repository, install dependencies, and set up the environment file for the API server. Requires Git and Node.js. ```bash git clone https://github.com/hi-imcodeman/stock-nse-india.git cd stock-nse-india npm install # Create local environment file cp .env.example .env # Start the server npm start ``` -------------------------------- ### Start Production Server Source: https://github.com/hi-imcodeman/stock-nse-india/blob/master/README.md Start the production server. ```bash npm start ``` -------------------------------- ### Local HTTPS Setup with mkcert Source: https://github.com/hi-imcodeman/stock-nse-india/blob/master/docs/index.html Steps to install mkcert, create local SSL certificates for localhost, and configure the environment for HTTPS. Assumes Node.js 18+. ```bash # Install mkcert once (macOS) brew install mkcert mkcert -install # Create local certs for localhost mkdir -p certs mkcert -key-file certs/localhost-key.pem -cert-file certs/localhost.pem localhost 127.0.0.1 ::1 # Enable HTTPS in .env, then start # HTTPS_ENABLED=true # HOST_URL=https://localhost:3000 npm start ``` -------------------------------- ### Start MCP Server Source: https://github.com/hi-imcodeman/stock-nse-india/blob/master/README.md Start the stdio MCP server. ```bash npm run start:mcp ``` -------------------------------- ### Run Memory Example Source: https://github.com/hi-imcodeman/stock-nse-india/blob/master/demo/README.md Execute the focused memory example demonstrating conversation flow and context tracking. ```bash npm run demo:memory ``` -------------------------------- ### Start MCP Server Source: https://github.com/hi-imcodeman/stock-nse-india/blob/master/MCP_README.md Starts the standard I/O MCP server for local AI assistant integration. ```bash yarn start:mcp ``` -------------------------------- ### Enable HTTPS and Start Server Source: https://github.com/hi-imcodeman/stock-nse-india/blob/master/README.md Enables HTTPS in the .env file and starts the Node.js server. ```bash # Enable HTTPS in .env, then start # HTTPS_ENABLED=true # HOST_URL=https://localhost:3000 npm start ``` -------------------------------- ### Clone and Install Dependencies Source: https://github.com/hi-imcodeman/stock-nse-india/blob/master/README.md Clone the repository, navigate to the project directory, and install necessary dependencies using npm. ```bash git clone https://github.com/hi-imcodeman/stock-nse-india.git cd stock-nse-india npm install ``` -------------------------------- ### Setup MCP Client Source: https://github.com/hi-imcodeman/stock-nse-india/blob/master/demo/README.md Set the OpenAI API key and build the project before running demos. ```bash # Set OpenAI API Key export OPENAI_API_KEY=your-api-key # Build the project npm run build ``` -------------------------------- ### Install NPM Package (Yarn) Source: https://github.com/hi-imcodeman/stock-nse-india/blob/master/README.md Alternative installation command for the stock-nse-india package using Yarn. ```bash yarn add stock-nse-india ``` -------------------------------- ### Create Local Environment File Source: https://github.com/hi-imcodeman/stock-nse-india/blob/master/README.md Copies the example environment file to .env for local configuration. ```bash cp .env.example .env ``` -------------------------------- ### Memory Example Output Source: https://github.com/hi-imcodeman/stock-nse-india/blob/master/demo/README.md Illustrative output from the memory example, showing context window usage and summarization triggers. ```text Query 1: 📊 Context Window: 37.0% used (2,964 tokens) [GREEN] Query 2: 📊 Context Window: 45.1% used (3,605 tokens) [GREEN] Query 3: 📊 Context Window: 58.9% used (4,713 tokens) [GREEN] Query 4: 📊 Context Window: 74.6% used (5,967 tokens) [YELLOW] ⚠️ Context Summarization Triggered! Query 5: 📊 Context Window: 45.2% used (3,616 tokens) [GREEN] ``` -------------------------------- ### Install CLI Tool Globally Source: https://github.com/hi-imcodeman/stock-nse-india/blob/master/README.md Installs the stock-nse-india command-line interface tool globally on your system. ```bash npm install -g stock-nse-india ``` -------------------------------- ### Start and Test MCP Server Source: https://github.com/hi-imcodeman/stock-nse-india/blob/master/docs/index.html Commands to start the standard I/O (stdio) MCP server and run tests for it. These commands are executed in the terminal. ```bash # Start the stdio MCP server npm run start:mcp# Test the stdio MCP server npm run test:mcp ``` -------------------------------- ### Install Dependencies Source: https://github.com/hi-imcodeman/stock-nse-india/blob/master/MCP_README.md Installs project dependencies using yarn. ```bash yarn install ``` -------------------------------- ### Start and Test MCP Server Source: https://github.com/hi-imcodeman/stock-nse-india/blob/master/README.md Commands to start the standard I/O (stdio) MCP server and run tests. These commands are executed in the terminal within the project directory. ```bash # Start the stdio MCP server npm run start:mcp # Test the stdio MCP server npm run test:mcp ``` -------------------------------- ### Run Development Server Source: https://github.com/hi-imcodeman/stock-nse-india/blob/master/README.md Start the development server with auto-reload enabled for a seamless development experience. ```bash npm run start:dev ``` -------------------------------- ### Install Package Globally Source: https://github.com/hi-imcodeman/stock-nse-india/blob/master/MCP_README.md Installs the stock-nse-india package globally using npm. This is optional but recommended for faster startup. ```bash npm install -g stock-nse-india ``` -------------------------------- ### Install NPM Package Source: https://github.com/hi-imcodeman/stock-nse-india/blob/master/README.md Install the stock-nse-india package using npm. This is the first step to using the library in your Node.js projects. ```bash npm install stock-nse-india ``` -------------------------------- ### CLI: Get Help Source: https://github.com/hi-imcodeman/stock-nse-india/blob/master/docs/index.html Displays help information for the stock-nse-india CLI. ```bash # Get help nseindia --help ``` -------------------------------- ### Install mkcert and Generate Local HTTPS Certificates Source: https://github.com/hi-imcodeman/stock-nse-india/blob/master/README.md Installs mkcert (macOS) and generates local SSL certificates for HTTPS. ```bash # Install mkcert once (macOS) brew install mkcert mkcert -install # Create local certs for localhost mkcert -key-file certs/localhost-key.pem -cert-file certs/localhost.pem localhost 127.0.0.1 ::1 ``` -------------------------------- ### API Server Setup and Usage Source: https://github.com/hi-imcodeman/stock-nse-india/blob/master/docs/index.html Instructions for setting up and running the stock-nse-india API server, including access to GraphQL and REST API endpoints. ```APIDOC ## API Server Setup and Usage ### Description This section details how to set up and run the `stock-nse-india` as a standalone API server. It provides information on cloning the repository, installing dependencies, starting the server, and accessing its GraphQL and REST API endpoints. ### Prerequisites * Node.js: Version 18 or higher * npm: Version 8 or higher ### Server Setup 1. **Clone the repository:** ```bash git clone https://github.com/hi-imcodeman/stock-nse-india.git cd stock-nse-india ``` 2. **Install dependencies:** ```bash npm install ``` 3. **Configure environment variables:** ```bash cp .env.example .env ``` 4. **Start the server:** ```bash npm start ``` ### Server URLs * **Main App:** `http://localhost:3000` * **GraphQL Playground:** `http://localhost:3000/graphql` * **API Documentation:** `http://localhost:3000/api-docs` *Note: For Safari compatibility with Apollo Studio, run the server on HTTPS and use `https://localhost:3000/graphql`.* ### GraphQL API Example Queries **Get equity information:** ```graphql query GetEquity { equities(symbolFilter: { in : ["IRCTC","TCS"] }) { symbol details { info { companyName industry isFNOSec } metadata { listingDate status } } } } ``` **Get indices data:** ```graphql query GetIndices { indices(filter: { filterBy: "NIFTY" }) { key index last variation percentChange } } ``` ``` -------------------------------- ### Run Demo 4: Investment Recommendations Source: https://github.com/hi-imcodeman/stock-nse-india/blob/master/demo/README.md Execute the fourth demo to get investment recommendations based on technical analysis. ```bash npm run demo:mcp-client 4 ``` -------------------------------- ### Basic Query Example Source: https://github.com/hi-imcodeman/stock-nse-india/blob/master/demo/README.md Perform a simple query without using memory. Requires the MCPClient to be imported and instantiated. ```javascript const { MCPClient } = require('./build/mcp/client/mcp-client.js'); const client = new MCPClient(); const response = await client.processQuery({ query: 'What is the current market status?', useMemory: false }); console.log(response.response); ``` -------------------------------- ### Install stock-nse-india NPM Package Source: https://github.com/hi-imcodeman/stock-nse-india/blob/master/docs/index.html Install the stock-nse-india package using npm or yarn. This is the first step to integrate the package into your Node.js projects. ```bash npm install stock-nse-india ``` ```bash yarn add stock-nse-india ``` -------------------------------- ### NPM Package Usage Example Source: https://github.com/hi-imcodeman/stock-nse-india/blob/master/README.md Demonstrates how to import and use the NseIndia class from the stock-nse-india package to fetch stock data. Requires Node.js 18+. ```javascript import { NseIndia } from "stock-nse-india"; const nseIndia = new NseIndia(); // Get all stock symbols const symbols = await nseIndia.getAllStockSymbols(); console.log(symbols); // Get equity details const details = await nseIndia.getEquityDetails('IRCTC'); console.log(details); // Get historical data const range = { start: new Date("2020-01-01"), end: new Date("2023-12-31") }; const historicalData = await nseIndia.getEquityHistoricalData('IRCTC', range); console.log(historicalData); ``` -------------------------------- ### Check Node.js Version Source: https://github.com/hi-imcodeman/stock-nse-india/blob/master/MCP_README.md Verifies that Node.js version 18.0.0 or higher is installed. ```bash node --version ``` -------------------------------- ### GET /api/glossary Source: https://github.com/hi-imcodeman/stock-nse-india/blob/master/README.md Fetches the NSE glossary for financial terms. ```APIDOC ## GET /api/glossary ### Description Fetches the NSE glossary for financial terms. ### Method GET ### Endpoint /api/glossary ``` -------------------------------- ### OpenAI Functions MCP Client Example Source: https://github.com/hi-imcodeman/stock-nse-india/blob/master/docs/index.html Demonstrates how to use the MCP client for both simple and complex multi-step queries using natural language. Ensure the client is imported correctly. ```typescript import { mcpClient } from './mcp/client/mcp-client'// Simple queryconst response = await mcpClient.processQuery({ query: "What is the current price of TCS stock?", model: "gpt-4o-mini" })// Complex multi-step queryconst complexResponse = await mcpClient.processQueryWithMemory({ query: "Compare the performance of Reliance and TCS over the last month and analyze their trends" }) ``` -------------------------------- ### NPM Package Usage Source: https://github.com/hi-imcodeman/stock-nse-india/blob/master/docs/index.html Demonstrates how to install and use the stock-nse-india NPM package to fetch stock symbols, equity details, and historical data. ```APIDOC ## NPM Package Usage ### Description Install the `stock-nse-india` package to integrate NSE India data directly into your Node.js applications. This example shows how to instantiate the `NseIndia` class and use its methods to retrieve stock symbols, equity details, and historical data. ### Installation ```bash npm install stock-nse-india ``` ### Usage ```javascript import { NseIndia } from "stock-nse-india"; const nseIndia = new NseIndia(); // Get all stock symbols const symbols = await nseIndia.getAllStockSymbols(); console.log(symbols); // Get equity details for a specific symbol const details = await nseIndia.getEquityDetails('IRCTC'); console.log(details); // Get historical data for a specific symbol within a date range const range = { start: new Date("2020-01-01"), end: new Date("2023-12-31") }; const historicalData = await nseIndia.getEquityHistoricalData('IRCTC', range); console.log(historicalData); ``` ### Methods * **`getAllStockSymbols()`**: Retrieves a list of all available stock symbols. * **`getEquityDetails(symbol)`**: Fetches detailed information for a given stock symbol. * **`getEquityHistoricalData(symbol, range)`**: Retrieves historical data for a stock symbol within a specified date range. ``` -------------------------------- ### CLI: Get Equity Details Source: https://github.com/hi-imcodeman/stock-nse-india/blob/master/docs/index.html Fetches details for a specific equity symbol using the stock-nse-india CLI. ```bash # Get equity details nseindia equity IRCTC ``` -------------------------------- ### Server and CORS Configuration Source: https://github.com/hi-imcodeman/stock-nse-india/blob/master/docs/index.html Example environment variables for server configuration (PORT, HOST_URL, NODE_ENV, HTTPS_ENABLED) and CORS settings (CORS_ORIGINS, CORS_METHODS, CORS_HEADERS, CORS_CREDENTIALS). ```dotenv # Server Configuration PORT=3000 HOST_URL=http://localhost:3000 NODE_ENV=development HTTPS_ENABLED=false SSL_KEY_PATH=./certs/localhost-key.pem SSL_CERT_PATH=./certs/localhost.pem # CORS Configuration CORS_ORIGINS=https://myapp.com,https://admin.myapp.com CORS_METHODS=GET,POST,OPTIONS CORS_HEADERS=Content-Type,Authorization,X-Requested-With CORS_CREDENTIALS=true ``` -------------------------------- ### CLI: Get Indices Information Source: https://github.com/hi-imcodeman/stock-nse-india/blob/master/docs/index.html Retrieves general indices information using the stock-nse-india CLI. ```bash # Get indices information nseindia index ``` -------------------------------- ### CLI: Get Market Status Source: https://github.com/hi-imcodeman/stock-nse-india/blob/master/docs/index.html Retrieves the current market status using the stock-nse-india CLI. ```bash # Get market status nseindia ``` -------------------------------- ### MCP Server Configuration Source: https://github.com/hi-imcodeman/stock-nse-india/blob/master/MCP_README.md Configuration for starting the MCP server using npx. This JSON object specifies the command, arguments, and environment variables for the server. ```json { "mcpServers": { "npx-stock-nse-india": { "command": "npx", "args": ["stock-nse-india", "mcp"], "env": { "NODE_ENV": "production" } } } } ``` -------------------------------- ### MCPClient Basic Usage (TypeScript) Source: https://github.com/hi-imcodeman/stock-nse-india/blob/master/MCP_README.md Initialize and use the MCPClient for processing natural language queries with context summarization enabled. Ensure Node.js 18+ and necessary installations. ```typescript import { MCPClient } from 'stock-nse-india' const client = new MCPClient({ enableMemory: true, enableContextSummarization: true, memoryConfig: { contextWindowConfig: { maxTokens: 8000, reservedTokens: 2000, summarizationThreshold: 0.9, // Trigger at 90% minMessagesToSummarize: 6 } } }) // Process a natural language query const result = await client.processQuery({ query: "What is the current price of TCS?", sessionId: "user123", maxIterations: 5 }) ``` -------------------------------- ### CLI: Get Specific Index Details Source: https://github.com/hi-imcodeman/stock-nse-india/blob/master/docs/index.html Retrieves details for a specific market index using the stock-nse-india CLI. ```bash # Get specific index details nseindia index "NIFTY AUTO" ``` -------------------------------- ### Update User Preferences Source: https://github.com/hi-imcodeman/stock-nse-india/blob/master/demo/README.md Set user preferences to tailor future responses. This example shows how to inform the client about a preference for detailed technical analysis. ```javascript await client.processQuery({ query: 'I prefer detailed technical analysis', sessionId, useMemory: true, updatePreferences: true }); ``` -------------------------------- ### Get Gainers and Losers Tool Call (JSON) Source: https://github.com/hi-imcodeman/stock-nse-india/blob/master/MCP_README.md Fetch the list of gainers and losers for a specified index symbol, such as NIFTY 50. ```json { "name": "get_gainers_and_losers_by_index", "arguments": { "index_symbol": "NIFTY 50" } } ``` -------------------------------- ### Get Equity Historical Chart Data (NPM Package) Source: https://github.com/hi-imcodeman/stock-nse-india/blob/master/docs/index.html Fetches historical chart data for a given equity symbol using the stock-nse-india NPM package. An optional date range can be provided. If the token is omitted, it is auto-fetched. ```javascript import { NseIndia } from "stock-nse-india"; const nseIndia = new NseIndia(); // Optional date range and optional token. // If token is omitted, it is auto-fetched internally using getEquitySymbolInfo(). const chartData = await nseIndia.getEquityChartHistoricalData( "ONGC", { start: new Date("2026-04-10"), end: new Date("2026-04-12") } ); // You can also fetch symbol info/token explicitly. const symbolInfo = await nseIndia.getEquitySymbolInfo("ONGC"); console.log(symbolInfo.scripcode); ``` -------------------------------- ### Run Demo 7: Tools & Configuration Source: https://github.com/hi-imcodeman/stock-nse-india/blob/master/demo/README.md Execute the seventh demo to display available tools and configuration details. ```bash npm run demo:mcp-client 7 ``` -------------------------------- ### Run Demo 1: Basic Query with Memory Source: https://github.com/hi-imcodeman/stock-nse-india/blob/master/demo/README.md Execute the first demo to showcase basic querying with memory and summarization features. ```bash npm run demo:mcp-client 1 ``` -------------------------------- ### Run Demo 6: Context Summarization Source: https://github.com/hi-imcodeman/stock-nse-india/blob/master/demo/README.md Execute the sixth demo for a long conversation showcasing automatic context summarization. ```bash npm run demo:mcp-client 6 ``` -------------------------------- ### Run Demo 2: Session Conversation Source: https://github.com/hi-imcodeman/stock-nse-india/blob/master/demo/README.md Execute the second demo to demonstrate multi-query conversations that maintain context. ```bash npm run demo:mcp-client 2 ``` -------------------------------- ### GET /api/indices Source: https://github.com/hi-imcodeman/stock-nse-india/blob/master/README.md Retrieves information about market indices. ```APIDOC ## GET /api/indices ### Description Retrieves information about market indices. ### Method GET ### Endpoint /api/indices ``` -------------------------------- ### Run Demo 5: Multi-user Sessions Source: https://github.com/hi-imcodeman/stock-nse-india/blob/master/demo/README.md Execute the fifth demo to demonstrate handling multiple users with separate sessions. ```bash npm run demo:mcp-client 5 ``` -------------------------------- ### GET /api/marketStatus Source: https://github.com/hi-imcodeman/stock-nse-india/blob/master/README.md Retrieves the current market status information. ```APIDOC ## GET /api/marketStatus ### Description Retrieves the current market status information. ### Method GET ### Endpoint /api/marketStatus ``` -------------------------------- ### Configure MCP Client Source: https://github.com/hi-imcodeman/stock-nse-india/blob/master/demo/README.md Initialize the MCPClient with various configuration options for memory, summarization, and logging. ```javascript const client = new MCPClient({ enableMemory: true, enableContextSummarization: true, enableDebugLogging: false, memoryConfig: { maxConversationHistory: 50, contextWindowConfig: { maxTokens: 8000, summarizationThreshold: 0.8 } } }); ``` -------------------------------- ### Get market status Source: https://github.com/hi-imcodeman/stock-nse-india/blob/master/MCP_README.md Fetches the current status of the stock market. ```APIDOC ## get_market_status ### Description Fetches the current status of the stock market. ### Method TOOL_CALL ### Parameters #### Arguments - None ``` -------------------------------- ### GET /api/equity/:symbol/historical Source: https://github.com/hi-imcodeman/stock-nse-india/blob/master/README.md Fetches historical data for a specific equity symbol. ```APIDOC ## GET /api/equity/:symbol/historical ### Description Fetches historical data for a specific equity symbol. ### Method GET ### Endpoint /api/equity/:symbol/historical ### Parameters #### Path Parameters - **symbol** (string) - Required - The stock symbol for which to retrieve historical data. ``` -------------------------------- ### Get equity details Source: https://github.com/hi-imcodeman/stock-nse-india/blob/master/MCP_README.md Fetches detailed information for a specific stock symbol. ```APIDOC ## get_equity_details ### Description Fetches detailed information for a specific stock symbol. ### Method TOOL_CALL ### Parameters #### Arguments - **symbol** (string) - Required - The stock symbol for which to retrieve details (e.g., "TCS"). ``` -------------------------------- ### constructor Source: https://github.com/hi-imcodeman/stock-nse-india/blob/master/docs/classes/NseIndia.html Initializes a new instance of the NseIndia class. ```APIDOC ## constructor ### Description Initializes a new instance of the NseIndia class. ### Method constructor ### Returns - NseIndia: An instance of the NseIndia class. ``` -------------------------------- ### constructor Source: https://github.com/hi-imcodeman/stock-nse-india/blob/master/docs/classes/NseIndia.html Initializes a new instance of the NseIndia class. ```APIDOC ## constructor ### Description Initializes a new instance of the NseIndia class. ### Parameters This method does not take any parameters. ``` -------------------------------- ### Get gainers and losers by index Source: https://github.com/hi-imcodeman/stock-nse-india/blob/master/MCP_README.md Retrieves the top gainers and losers for a specified index. ```APIDOC ## get_gainers_and_losers_by_index ### Description Retrieves the top gainers and losers for a specified index. ### Method TOOL_CALL ### Parameters #### Arguments - **index_symbol** (string) - Required - The symbol of the index (e.g., "NIFTY 50"). ``` -------------------------------- ### Get technical indicators Source: https://github.com/hi-imcodeman/stock-nse-india/blob/master/MCP_README.md Calculates and retrieves technical indicators for a given stock symbol. ```APIDOC ## get_equity_technical_indicators ### Description Calculates and retrieves technical indicators for a given stock symbol. ### Method TOOL_CALL ### Parameters #### Arguments - **symbol** (string) - Required - The stock symbol (e.g., "TCS"). - **period** (integer) - Optional - The period for calculating indicators (e.g., 200). - **sma_periods** (array of integers) - Optional - List of Simple Moving Average periods (e.g., [5, 10, 20, 50]). - **ema_periods** (array of integers) - Optional - List of Exponential Moving Average periods (e.g., [5, 10, 20, 50]). - **rsi_period** (integer) - Optional - The period for the Relative Strength Index (RSI) calculation (e.g., 14). - **show_only_latest** (boolean) - Optional - If true, only the latest indicator values are returned. ``` -------------------------------- ### Get all stock symbols Source: https://github.com/hi-imcodeman/stock-nse-india/blob/master/MCP_README.md Retrieves a list of all available stock symbols from NSE India. ```APIDOC ## get_all_stock_symbols ### Description Retrieves a list of all available stock symbols from NSE India. ### Method TOOL_CALL ### Parameters #### Arguments - None ``` -------------------------------- ### MCPClient Recommended Configuration Source: https://github.com/hi-imcodeman/stock-nse-india/blob/master/MCP_README.md Sets up MCPClient with memory and context summarization enabled, using a balanced approach with a 90% summarization threshold. This configuration is suitable for preserving context while managing costs. ```typescript const client = new MCPClient({ enableMemory: true, enableContextSummarization: true, memoryConfig: { contextWindowConfig: { maxTokens: 8000, reservedTokens: 2000, summarizationThreshold: 0.9, // 90% - less frequent minMessagesToSummarize: 6 } } }) ``` -------------------------------- ### Run MCP Client Demos Source: https://github.com/hi-imcodeman/stock-nse-india/blob/master/demo/README.md Execute all demos or specific ones by number. The memory demo can also be run separately. ```bash # All demos npm run demo:mcp-client # Specific demo (1-7) npm run demo:mcp-client 3 # Memory example npm run demo:memory ``` -------------------------------- ### Get Market Status Tool Call (JSON) Source: https://github.com/hi-imcodeman/stock-nse-india/blob/master/MCP_README.md Retrieve the current status of the stock market. ```json { "name": "get_market_status", "arguments": {} } ``` -------------------------------- ### Run Demo 3: Technical Analysis Source: https://github.com/hi-imcodeman/stock-nse-india/blob/master/demo/README.md Execute the third demo for fetching and analyzing technical indicators. ```bash npm run demo:mcp-client 3 ``` -------------------------------- ### DateRange Interface Source: https://github.com/hi-imcodeman/stock-nse-india/blob/master/docs/interfaces/DateRange.html Represents a date range for historical data queries, consisting of a start and an end date. ```APIDOC ## Interface: DateRange ### Description Defines a date range for historical data queries. This interface is used to specify the start and end dates for fetching historical stock data. ### Properties #### `start` - **Type**: `Date` - **Description**: The start date of the range. - **Defined in**: [interface.ts:54](https://github.com/hi-imcodeman/stock-nse-india/blob/536b6b8/src/interface.ts#L54) #### `end` - **Type**: `Date` - **Description**: The end date of the range. - **Defined in**: [interface.ts:55](https://github.com/hi-imcodeman/stock-nse-india/blob/536b6b8/src/interface.ts#L55) ``` -------------------------------- ### Build Project Source: https://github.com/hi-imcodeman/stock-nse-india/blob/master/MCP_README.md Builds the project using yarn. ```bash yarn build ``` -------------------------------- ### Build and Run NSE India Locally with Docker Source: https://github.com/hi-imcodeman/stock-nse-india/blob/master/README.md Builds the Docker image from the local Dockerfile and runs it, exposing port 3001. ```bash docker build -t nseindia . && docker run --rm -d -p 3001:3001 nseindia:latest ``` -------------------------------- ### GET /api/equity/intraday/:symbol Source: https://github.com/hi-imcodeman/stock-nse-india/blob/master/README.md Retrieves intraday chart data for an equity symbol, using 'GetQuoteApi' or charting data. ```APIDOC ## GET /api/equity/intraday/:symbol ### Description Retrieves intraday chart data for an equity symbol, using 'GetQuoteApi' or charting data. ### Method GET ### Endpoint /api/equity/intraday/:symbol ### Parameters #### Path Parameters - **symbol** (string) - Required - The stock symbol for which to retrieve intraday chart data. ``` -------------------------------- ### Build Project Source: https://github.com/hi-imcodeman/stock-nse-india/blob/master/demo/README.md Execute the build script to compile the project, which may resolve 'Module not found' errors. ```bash npm run build ``` -------------------------------- ### CLI: Get Historical Data Source: https://github.com/hi-imcodeman/stock-nse-india/blob/master/docs/index.html Retrieves historical data for a specific equity symbol using the stock-nse-india CLI. ```bash # Get historical data nseindia historical IRCTC ``` -------------------------------- ### Generate Documentation Source: https://github.com/hi-imcodeman/stock-nse-india/blob/master/README.md Generate TypeDoc documentation for the project. ```bash npm run docs ``` -------------------------------- ### Get historical data Source: https://github.com/hi-imcodeman/stock-nse-india/blob/master/MCP_README.md Retrieves historical stock data for a given symbol within a specified date range. ```APIDOC ## get_equity_historical_data ### Description Retrieves historical stock data for a given symbol within a specified date range. ### Method TOOL_CALL ### Parameters #### Arguments - **symbol** (string) - Required - The stock symbol (e.g., "RELIANCE"). - **start_date** (string) - Required - The start date for the historical data in YYYY-MM-DD format (e.g., "2024-01-01"). - **end_date** (string) - Required - The end date for the historical data in YYYY-MM-DD format (e.g., "2024-01-31"). ``` -------------------------------- ### GET /api/charts/symbol-info Source: https://github.com/hi-imcodeman/stock-nse-india/blob/master/README.md Looks up charting symbol details, including the 'scripcode' (token). Requires a symbol and optionally accepts a segment. ```APIDOC ## GET /api/charts/symbol-info ### Description Looks up charting symbol details, including the 'scripcode' (token). Requires a symbol and optionally accepts a segment. ### Method GET ### Endpoint /api/charts/symbol-info ### Parameters #### Query Parameters - **symbol** (string) - Required - The stock symbol. - **segment** (string) - Optional - The market segment. ``` -------------------------------- ### Get Summarization History Source: https://github.com/hi-imcodeman/stock-nse-india/blob/master/MCP_README.md Fetches the history of summarization events for a specific session, primarily used for monitoring the frequency of summarizations. ```typescript // Get summarization history const history = client.getSummarizationHistory(sessionId) console.log('Total Summarizations:', history.length) ``` -------------------------------- ### NSE India CLI Help Source: https://github.com/hi-imcodeman/stock-nse-india/blob/master/README.md Displays help information for the nseindia CLI tool. ```bash nseindia --help ``` -------------------------------- ### Run Tests with npm Source: https://github.com/hi-imcodeman/stock-nse-india/blob/master/README.md Execute unit/mock tests using 'npm test'. For coverage reports, append '-- --coverage'. Live end-to-end tests can be run with 'npm run test:e2e'. To run a specific test file, use 'npm test -- '. ```bash # Run unit/mock tests (default CI) npm test ``` ```bash # Run tests with coverage npm test -- --coverage ``` ```bash # Run live NSE e2e tests (requires network; runs daily in CI) npm run test:e2e ``` ```bash # Run specific test file npm test -- utils.spec.ts ``` -------------------------------- ### Run Docker Container Source: https://github.com/hi-imcodeman/stock-nse-india/blob/master/docs/index.html Pull the Docker image from Docker Hub and run it, or build the image locally and then run the container. Both commands map port 3001 from the container to the host. ```bash # Pull and run from Docker Hub docker run --rm -d -p 3001:3001 imcodeman/nseindia# Or build locally docker build -t nseindia . && docker run --rm -d -p 3001:3001 nseindia:latest ``` -------------------------------- ### GET /api/equity/tradeInfo/:symbol Source: https://github.com/hi-imcodeman/stock-nse-india/blob/master/README.md Fetches trade information and order book for a given equity symbol, with a fallback to pre-open data when blocked. ```APIDOC ## GET /api/equity/tradeInfo/:symbol ### Description Fetches trade information and order book for a given equity symbol, with a fallback to pre-open data when blocked. ### Method GET ### Endpoint /api/equity/tradeInfo/:symbol ### Parameters #### Path Parameters - **symbol** (string) - Required - The stock symbol for which to retrieve trade info. ``` -------------------------------- ### Build Project Source: https://github.com/hi-imcodeman/stock-nse-india/blob/master/README.md Compile the TypeScript code into JavaScript for production deployment. ```bash npm run build ``` -------------------------------- ### Process Query with Options Source: https://github.com/hi-imcodeman/stock-nse-india/blob/master/demo/README.md Submit a query to the client with detailed options for session management, context, preferences, and model parameters. ```javascript await client.processQuery({ query: 'Your question', sessionId: 'unique-session-id', userId: 'user-identifier', useMemory: true, includeContext: true, updatePreferences: true, maxIterations: 5, model: 'gpt-4o-mini', temperature: 0.7, max_tokens: 2000 }); ``` -------------------------------- ### Get Equity Details Tool Call (JSON) Source: https://github.com/hi-imcodeman/stock-nse-india/blob/master/MCP_README.md Fetch detailed information for a specific stock symbol. Requires the stock symbol as an argument. ```json { "name": "get_equity_details", "arguments": { "symbol": "TCS" } } ``` -------------------------------- ### Get All Stock Symbols Tool Call (JSON) Source: https://github.com/hi-imcodeman/stock-nse-india/blob/master/MCP_README.md Use this tool call to retrieve a list of all available stock symbols from NSE India. ```json { "name": "get_all_stock_symbols", "arguments": {} } ``` -------------------------------- ### Run Tests Source: https://github.com/hi-imcodeman/stock-nse-india/blob/master/README.md Execute the test suite to ensure code quality and functionality. ```bash npm test ``` -------------------------------- ### Test MCP Server Source: https://github.com/hi-imcodeman/stock-nse-india/blob/master/MCP_README.md Tests the standard I/O MCP server. ```bash yarn test:mcp ``` -------------------------------- ### Run ESLint Source: https://github.com/hi-imcodeman/stock-nse-india/blob/master/README.md Perform linting using ESLint to check for code style and potential errors. ```bash npm run lint ```