- Home
- MCP servers
- NSE Ticker
NSE Ticker
- python
0
GitHub Stars
python
Language
6 months ago
First Indexed
3 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
Installation
Add the following to your MCP client configuration file.
Configuration
View docs{
"mcpServers": {
"sougatabh-nse-ticker-mcp": {
"command": "python",
"args": [
"--directory",
"/ABSOLUTE/PATH/TO/nse-ticker-mcp",
"ticker.py"
]
}
}
}You can run this MCP server to access real-time NSE data and historical OHLCV data through a simple MCP interface, enabling you to query minute, 30-minute, daily, weekly, and monthly candles via a consistent endpoint.
How to use
Use an MCP client to connect to the NSE Ticker MCP Server and request historical or real-time data through the exposed tools. You can obtain historical OHLCV candles by specifying a symbol, date range, and interval, and you can access real-time updates as part of your data workflow. Treat the server as a data provider that translates your requests into NSE Upstox API calls and returns structured results. Ensure your client handles errors gracefully, since the server returns detailed error messages for issues like invalid symbols, connection problems, and data validation failures.
How to install
# Prerequisites
- Python 3.11 or higher
- git
# Step 1: Clone the project (adjust path as needed)
git clone https://github.com/sougatabh/nse-ticker-mcp.git
cd nse-ticker-mcp
# Step 2: Set up a virtual environment
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
# Step 3: Install dependencies in editable mode
pip install -e .
Configuration
The server uses a local configuration that maps stock symbols to instrument keys. Symbol and instrument mappings are stored in a CSV file at configs/NSE.csv. Ensure this file exists and is kept up to date with the NSE symbols you intend to query.
To run the server in development mode and test with an MCP Inspector, execute the main script directly from the repository directory.
Usage examples
# Get historical data for a symbol (example)
response = await get_historical_candle(
symbol="HDFCBANK",
from_date="2024-01-01",
to_date="2024-03-31",
interval="day"
)
Notes on integration
If you want to run the server locally via a command, you can use the development command shown in the integration setup:
python ticker.py
For integration with Claude for Desktop, the following MCP configuration can be used to launch the server from the local path:
{ "mcpServers": { "nse-ticker": { "command": "python", "args": [ "--directory", "/ABSOLUTE/PATH/TO/nse-ticker-mcp", "ticker.py" ] } } }
Replace "/ABSOLUTE/PATH/TO/nse-ticker-mcp" with your actual absolute path to the project directory.
Error handling and troubleshooting
Expect clear error messages for issues such as invalid symbols, connection problems, API errors, data validation failures, and date format issues. Validate your input parameters before sending requests and ensure the NSE symbol in your query matches entries in configs/NSE.csv.
Notes
The server is designed with Python 3.11+ in mind and relies on standard Python tooling and dependencies listed in the project configuration. When testing locally, use a virtual environment to isolate dependencies from your system Python.
Example workflow
# Start the server (development)
python ticker.py
# Query historical data via your MCP client
# Use the get_historical_candle endpoint/tool exposed by the MCP server
Available tools
get_historical_candle
Retrieves historical OHLCV data for NSE stocks for a specified symbol, date range, and interval.