IndiaQuant MCP Server

IndiaQuant MCP Server

Provides real-time Indian stock market analysis, including live price tracking, technical indicators, and options Greeks calculations for NSE/BSE securities. It also enables news-based sentiment analysis, market scanning for NIFTY 50 stocks, and virtual portfolio management.

Category
访问服务器

README

IndiaQuant MCP Server

A Model Context Protocol (MCP) server for Indian stock market analysis providing real-time market data, technical analysis, options analytics, and portfolio management using 100% free APIs.

Overview

IndiaQuant MCP provides 11 tools for NSE/BSE market analysis:

  • Live market data (prices, volume, percentage changes)
  • Technical analysis (RSI, MACD, Bollinger Bands)
  • Options analytics (Black-Scholes Greeks calculated from scratch)
  • Sentiment analysis (news-based scoring with NewsAPI + TextBlob)
  • Market scanning (NIFTY 50 overbought/oversold detection)
  • Portfolio management (virtual trading with P&L tracking)
  • Sector analysis (IT, Banking, Auto, Pharma, FMCG heatmaps)

Architecture

Module Structure

IndiaQuant/
├── server.py                    # MCP server entry point (stdio transport)
├── market_data/
│   └── fetcher.py              # Live NSE/BSE price fetching (yfinance)
├── trading_signals/
│   └── signal_generator.py     # RSI, MACD, Bollinger Bands (pandas-ta)
├── options_analysis/
│   ├── options_analyzer.py     # Options chain data (yfinance)
│   ├── greeks.py               # Black-Scholes Greeks implementation
│   └── unusual_activity.py     # Volume/OI spike detection
├── utils/
│   ├── sentiment.py            # News sentiment analysis
│   └── market_scanner.py       # NIFTY 50 scanner, sector heatmap
├── portfolio_management/
│   └── portfolio_manager.py    # Virtual portfolio with SQLite
└── database/
    └── portfolio.db            # SQLite database

Design Decisions

1. Modular Architecture

  • Each module handles a specific domain (market data, signals, options, etc.)
  • Clean separation of concerns for maintainability
  • Easy to extend with new tools

2. 100% Free API Stack

  • yfinance: Live NSE/BSE prices, historical data (unlimited, free)
  • NewsAPI: News headlines for sentiment (100 requests/day free tier)
  • pandas-ta: Technical indicators (open source)
  • TextBlob: Sentiment scoring (open source)
  • Custom Black-Scholes: Greeks calculation from scratch

3. MCP Protocol Implementation

  • Stdio transport for maximum compatibility
  • Proper tool registration with JSON schemas
  • Type-safe parameter validation
  • Structured error handling

Trade-offs & Limitations

What Works:

  • Live NSE/BSE stock prices for all securities
  • Technical indicators (RSI, MACD, Bollinger Bands)
  • Greeks calculation for any stock option
  • News sentiment analysis
  • Portfolio tracking with real-time P&L
  • Sector performance analysis

Known Limitations:

  • NSE Options Chain Data: yfinance has limited support for NSE options chains. Works reliably for US stocks but inconsistent for Indian stocks due to Yahoo Finance's data coverage. For production, would use NSE Official API or broker APIs (Zerodha, Angel One).
  • NewsAPI Rate Limits: Free tier allows 100 requests/day
  • Index Options: NIFTY/BANKNIFTY index options not supported via yfinance

Design Justification:

  • Chose yfinance for zero-cost, zero-setup advantage despite NSE options limitations
  • Prioritized breadth of features (11 tools) over depth
  • Greeks calculation works perfectly when stock price is provided
  • Assignment requires 100% free APIs - no paid alternatives allowed

MCP Tools (11 Total)

1. health_check

Check if server is running.

Parameters: None

Returns: {"status": "server running"}


2. get_live_price

Fetch live NSE stock price.

Parameters:

  • symbol (string): Stock symbol (e.g., 'RELIANCE', 'TCS')

Example Response:

{
  "symbol": "RELIANCE.NS",
  "current_price": 1408.40,
  "change_percent": 1.54,
  "volume": 5234567
}

3. generate_trading_signal

Generate BUY/SELL/HOLD signals using RSI, MACD, Bollinger Bands.

Parameters:

  • symbol (string): Stock symbol
  • period (string, optional): '1d', '5d', '1mo', '3mo', '1y' (default: '3mo')

Example Response:

{
  "symbol": "TCS",
  "signal": "BUY",
  "confidence": 75,
  "reasoning": "RSI oversold (28.5), MACD bullish crossover"
}

4. get_options_chain

Fetch options chain with calls, puts, OI, PCR.

Parameters:

  • symbol (string): Stock symbol
  • expiry (string, optional): Expiry date YYYY-MM-DD

Note: Limited data availability for NSE stocks (see Limitations section)


5. calculate_greeks

Calculate Black-Scholes Greeks from scratch.

Parameters:

  • symbol (string): Stock symbol
  • strike_price (number): Strike price
  • expiry_date (string): YYYY-MM-DD
  • option_type (string): 'call' or 'put'
  • volatility (number, optional): IV (default: 0.25)
  • risk_free_rate (number, optional): Rate (default: 0.065)

Example Response:

{
  "greeks": {
    "delta": 0.575,
    "gamma": 0.0057,
    "theta": -1.107,
    "vega": 1.075,
    "rho": 0.295
  }
}

Implementation: Pure mathematical Black-Scholes using scipy.stats


6. detect_unusual_activity

Detect volume/OI spikes in options.

Parameters:

  • symbol (string): Stock symbol
  • volume_threshold (number, optional): Spike multiplier (default: 3.0)
  • oi_threshold (number, optional): OI multiplier (default: 2.0)

7. scan_nifty50

Scan NIFTY 50 for overbought/oversold stocks.

Parameters:

  • rsi_threshold (number, optional): RSI threshold (default: 30)
  • condition (string, optional): 'oversold' or 'overbought'

8. get_sector_heatmap

Sector performance heatmap.

Parameters:

  • period (string, optional): '1d', '5d', '1mo', '3mo' (default: '1d')

9. place_trade

Place virtual trade in portfolio.

Parameters:

  • symbol (string): Stock symbol
  • quantity (number): Number of shares
  • side (string): 'buy' or 'sell'
  • price (number, optional): Price (defaults to live market price)

10. get_portfolio_pnl

View portfolio positions with real-time P&L.

Parameters: None


11. analyze_sentiment

Analyze news sentiment using NewsAPI + TextBlob.

Parameters:

  • symbol (string): Stock symbol
  • days (number, optional): Days to look back (default: 7)

Note: Free tier limited to 100 requests/day

Installation

Prerequisites

  • Python 3.8+ (tested on 3.13.5)
  • Claude Desktop or any MCP-compatible client
  • NewsAPI Key (free: https://newsapi.org/)

Setup

# Clone repository
git clone https://github.com/Shirshak-dugtal/mcp.git
cd mcp

# Install dependencies
pip install -r requirements.txt

# Configure environment
echo "NEWS_API_KEY=your_key_here" > .env

# Test server
python server.py

Dependencies

mcp>=1.0.0
yfinance>=0.2.40
pandas>=2.0.0
pandas-ta>=0.4.0
numpy>=1.24.0
scipy>=1.10.0
newsapi-python>=0.2.7
textblob>=0.18.0
python-dotenv>=1.0.0

Running the Server

Connect to Claude Desktop

Windows:

Edit %APPDATA%\Claude\claude_desktop_config.json:

{
  "mcpServers": {
    "IndiaQuant": {
      "command": "python",
      "args": ["D:/code/mcp/IndiaQuant/server.py"]
    }
  }
}

Replace path with your actual installation path.

macOS/Linux:

Edit ~/.config/Claude/claude_desktop_config.json with appropriate paths.

Restart Claude Desktop completely (exit from system tray).

Verify: Settings → Developer → Local MCP Server → IndiaQuant should show green checkmark.

Example Tool Responses

get_live_price:

{"symbol": "RELIANCE.NS", "current_price": 1408.40, "change_percent": 1.54}

generate_trading_signal:

{"symbol": "TCS", "signal": "BUY", "confidence": 75, "reasoning": "RSI oversold, MACD bullish"}

calculate_greeks:

{"delta": 0.575, "gamma": 0.0057, "theta": -1.107, "vega": 1.075}

scan_nifty50:

{"matches": [{"symbol": "TATAMOTORS", "rsi": 28.3, "price": 945.20}]}

get_portfolio_pnl:

{"total_invested": 44580, "total_pnl": 314, "pnl_percent": 0.70}

License

MIT License

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选