IndiaQuant MCP
Persists virtual portfolio data including positions, trade history, and risk metrics using SQLite database.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
IndiaQuant MCP
Real-time Indian stock market AI assistant built on Model Context Protocol (MCP). Plugs into Claude Desktop (or any MCP-compatible AI agent) to provide full stock market intelligence + virtual trading capabilities using 100% free APIs.
Architecture
┌─────────────────────────────────────────────────┐
│ Claude Desktop (Client) │
│ "Should I buy HDFC Bank right now?" │
└──────────────────┬──────────────────────────────┘
│ MCP Protocol (stdio / SSE)
▼
┌─────────────────────────────────────────────────┐
│ server.py — MCP Tools Layer │
│ 10 registered tools with JSON schemas │
│ Routes requests → modules │
└──────┬───────┬───────┬───────┬──────────────────┘
│ │ │ │
▼ ▼ ▼ ▼
┌────────┐┌────────┐┌────────┐┌────────┐
│ Market ││ Signal ││Options ││Portfol-│
│ Data ││ Gener- ││ Chain ││io Risk │
│ Engine ││ ator ││Analyzer││Manager │
└───┬────┘└───┬────┘└───┬────┘└───┬────┘
│ │ │ │
▼ ▼ ▼ ▼
yfinance NewsAPI yfinance SQLite
Alpha V. VADER Black-
pandas-ta Scholes5 Modules
Module | File | Purpose |
Market Data Engine |
| Live prices, historical OHLCV, sector heatmap, market scanner via yfinance |
Signal Generator |
| RSI/MACD/Bollinger via pandas-ta, VADER sentiment on NewsAPI headlines, weighted BUY/SELL/HOLD signal |
Options Chain Analyzer |
| Options chain via yfinance, max pain calculation, OI spike detection, unusual activity alerts |
Black-Scholes Greeks |
| Pure mathematical Black-Scholes: Delta, Gamma, Theta, Vega, IV — no pricing libraries |
Portfolio Risk Manager |
| Virtual portfolio in SQLite, live P&L, stop-loss/target tracking, volatility-based risk scoring |
10 MCP Tools
# | Tool | Input | Output |
1 |
| symbol | price, change%, volume |
2 |
| symbol, expiry | strikes, CE/PE OI, max pain, PCR |
3 |
| symbol | score, headlines, signal |
4 |
| symbol, timeframe | BUY/SELL/HOLD, confidence |
5 |
| — | positions, total P&L |
6 |
| symbol, qty, side | order_id, status |
7 |
| symbol, strike, expiry, type | delta, gamma, theta, vega |
8 |
| symbol | alerts, anomalies |
9 |
| filter criteria | matching symbols |
10 |
| — | sectors with % change |
Related MCP server: indian-stock-market-mcp
Free API Stack
Purpose | API | Limits |
Live NSE/BSE prices | yfinance | Unlimited, free |
Historical OHLC | yfinance | Full history, free |
Options chain | yfinance | Free, NSE supported |
News & sentiment | NewsAPI.org | 100 req/day free |
Macro indicators | Alpha Vantage | 25 req/day free |
Technical analysis | pandas-ta | Fully free, open source |
Greeks calculation | Custom Black-Scholes | From scratch |
Setup Guide
Prerequisites
Python 3.11+
Claude Desktop installed
1. Clone & Install
git clone https://github.com/YOUR_USERNAME/indiaquant-mcp.git
cd indiaquant-mcp
# Create virtual environment
python -m venv .venv
# Activate (Windows)
.venv\Scripts\activate
# Activate (macOS/Linux)
source .venv/bin/activate
# Install dependencies
pip install -e ".[dev]"2. Get API Keys (Free)
NewsAPI: Register at newsapi.org → get free key
Alpha Vantage: Get key at alphavantage.co
3. Configure Environment
cp .env.example .env
# Edit .env with your API keys4. Connect to Claude Desktop
Edit Claude Desktop config file:
Windows:
%APPDATA%\Claude\claude_desktop_config.jsonmacOS:
~/Library/Application Support/Claude/claude_desktop_config.json
Add this to the config:
{
"mcpServers": {
"indiaquant": {
"command": "python",
"args": ["C:\\FULL\\PATH\\TO\\indiaquant-mcp\\server.py"],
"env": {
"NEWSAPI_KEY": "your_key_here",
"ALPHA_VANTAGE_KEY": "your_key_here"
}
}
}
}Important: Use the full absolute path to
server.py. On Windows, use double backslashes.
5. Restart Claude Desktop
Close and reopen Claude Desktop. You should see a 🔧 (hammer) icon in the chat input box — click it to verify all 10 IndiaQuant tools are listed.
6. Test It
Ask Claude:
"What's the live price of Reliance?"
"Generate a signal for HDFC Bank"
"Buy 10 shares of TCS"
"Show my portfolio P&L"
"What's the max pain for Nifty?"
Running Tests
# Run all tests
pytest tests/ -v
# Run only Black-Scholes tests (offline, no API needed)
pytest tests/test_black_scholes.py -v
# Run signal/tool tests (needs internet)
pytest tests/test_signals.py tests/test_tools.py -vDeploy on Render (24/7 Availability)
See the Deployment Guide section below for full step-by-step instructions.
Quick Steps
Push code to GitHub
Create a new Web Service on render.com
Connect your GitHub repo
Set build command:
pip install -e .Set start command:
python server.py --transport sseAdd environment variables (API keys)
Deploy
Then update Claude Desktop config to use the SSE endpoint:
{
"mcpServers": {
"indiaquant": {
"url": "https://your-app.onrender.com/sse"
}
}
}Design Decisions & Trade-offs
Caching Strategy
30s TTL for live prices — balances freshness vs. rate limits
5min TTL for options chain — chains don't change drastically
1hr TTL for news sentiment — avoid burning NewsAPI free quota
In-memory (cachetools) — simple, no Redis needed for single-server
Signal Confidence Scoring
40% technicals (RSI, MACD, Bollinger) — most reliable for short-term
30% sentiment (VADER on news headlines) — captures market mood
30% trend/patterns (SMA crossovers, chart patterns) — confirms direction
Score maps to 0–100 confidence via distance from neutral (50)
Black-Scholes Implementation
Pure math with
scipy.stats.normfor CDF/PDF only (standard normal distribution)Newton-Raphson for implied volatility calculation
Per-day theta (divided by 365) for practical use
Vega per 1% volatility change for readability
Portfolio Manager
SQLite for zero-config persistence — portfolio survives restarts
Position averaging on repeated buys of same stock
Risk score based on annualized historical volatility (3-month window)
Edge Case Handling
Market holidays: yfinance returns last available data, cache prevents redundant calls
Missing data: graceful fallbacks (signal works on technicals alone if news API fails)
Symbol normalization: auto-appends
.NS, handles indices like NIFTY →^NSEI
Project Structure
indiaquant-mcp/
├── server.py # MCP server entry point (10 tools)
├── config.py # API keys, constants, sector maps
├── pyproject.toml # Dependencies
├── .env.example # Environment template
├── .gitignore
├── README.md
├── modules/
│ ├── __init__.py
│ ├── market_data.py # Module 1: yfinance + caching
│ ├── signal_generator.py # Module 2: TA + sentiment
│ ├── options_analyzer.py # Module 3: chain + Greeks
│ ├── black_scholes.py # Pure Black-Scholes implementation
│ ├── portfolio_manager.py # Module 4: SQLite + risk
│ └── cache.py # TTL cache wrapper
└── tests/
├── __init__.py
├── test_black_scholes.py # Greeks math validation
├── test_signals.py # Signal generator tests
└── test_tools.py # Integration testsLicense
MIT
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Hosted MCP server for Indian market quotes, option-chain Greeks and multi-broker telemetry.
Hosted MCP server for Indian NSE/BSE stock research: 59 tools for quotes, financials and ratios, peers, shareholding and pledge, filings with extracted facts, screens, F&O and FII/DII context. Source and freshness on every answer; no buy/sell calls.
Connect Claude, ChatGPT, Codex, Claude Code or another MCP client to your real multi-broker investment portfolio. Fortunest tracks stocks, ETFs and crypto across brokers and exchanges; its MCP server lets your agent read holdings, returns, allocation, risk, trades and tax lots, calculated by Fortunest rather than guessed by the model. Reads run on their own; every change waits for your approval in the Fortunest app, and no tool places an order or moves money. Sign-in is OAuth 2.1 and needs Fortunest Pro (14-day trial, no card). A free demo that needs no account is listed as Fortunest demo.
Indian broker accounts for AI agents: positions, holdings, orders, P&L, option chains, 10+ brokers.
Related MCP Servers
- AlicenseCqualityBmaintenanceMCP Server for Indian Options — Real-time option chains, Greeks, 34+ strategies, OI analysis, IV smile, Max Pain. Works with Claude Desktop. Replaces Sensibull.12733 npm23MIT
- AlicenseNot gradedqualityDmaintenanceMCP server providing real-time Indian stock market data through 15 tools, including stock details, historical data, market overview, and news. Works with Claude Desktop, Claude Code, Cursor, Windsurf, and other MCP clients using an API key from IndianAPI.in.MIT
- FlicenseNot gradedqualityDmaintenanceA real-time Indian stock market assistant providing live prices, trading signals, options data, sentiment analysis, and portfolio tracking via MCP integration with Claude Desktop.-
- AlicenseBqualityCmaintenanceComprehensive MCP server for Indian stock market with 60 tools covering NSE/BSE, derivatives, mutual funds, technicals, and more, requiring no API keys. Enables users to access live market data, analyze indicators, and manage investments through natural language.601MIT