Skip to main content
Glama
Sant1861

IndiaQuant MCP

by Sant1861
README.md
# IndiaQuant MCP – AI Stock Market Assistant

IndiaQuant MCP is a real-time Indian stock market assistant built using Python and Model Context Protocol (MCP). It integrates with Claude Desktop to provide live stock market intelligence such as stock prices, trading signals, options data, sentiment analysis, and portfolio tracking.

The system uses only free APIs and open-source libraries.

---

# Project Overview

Normally AI assistants like Claude do not have access to live stock market data.  
This project solves that problem by building an MCP server that connects Claude to a stock market backend.

Architecture:

Claude Desktop  
 
MCP Server (mcp_server.py)  
 
FastAPI Backend (main.py)  
 
Free Market APIs (yfinance, NewsAPI, Alpha Vantage)

Claude can then call the MCP tools and receive real-time market data.

---

# Features

This project implements the following capabilities:

1. Fetch live stock prices from NSE
2. Generate AI trading signals (BUY / SELL / HOLD)
3. Analyze options chain data
4. Calculate option Greeks (Delta, Gamma, Theta, Vega)
5. Detect unusual options activity
6. Scan the market for opportunities
7. Analyze news sentiment
8. Show sector performance heatmap
9. Maintain a virtual trading portfolio
10. Calculate real-time portfolio profit and loss

All tools return live market data using free APIs.

---

# Technologies Used

Python  
FastAPI  
yfinance  
pandas  
numpy  
pandas-ta  
SQLite  
Model Context Protocol (MCP)  
Claude Desktop

---

# Project Structure

indiaquant-project
 
 main.py                      # FastAPI backend server
 mcp_server.py                # MCP server exposing tools to Claude
 requirements.txt             # Python dependencies
 README.md                    # Project documentation


# Installation

cd indiaquant-mcp
 Install dependencies

pip install -r
 # requirements.txt
  fastapi
  uvicorn
  yfinance
  pandas
  numpy
  pandas-ta
  requests
  mcp
  scipy
  sqlite-utils
  python-dotenv
  newsapi-python
  alpha_vantage


---

# Running the Backend

Start the FastAPI server:
   uvicorn main:app --reload


This starts the API that provides market data and analysis.

---

# MCP Configuration

To connect the project with Claude Desktop, create the following configuration file:

C:\Users\MY_USERNAME\AppData\Roaming\Claude\claude_desktop_config.json


Add this configuration:

```json
{
  "mcpServers": {
    "indiaquant": {
      "command": "C:/Users/USERNAME/AppData/Local/Programs/Python/Python314/python.exe",
      "args": [
        "C:/Users/USERNAME/Desktop/indiaquant-project/mcp_server.py"
      ]
    }
  }
}

After adding the configuration, restart Claude Desktop.

Claude will automatically start the MCP server.

Example Queries in Claude

After connecting the MCP server, Claude can call the tools.

Example queries:

Use indiaquant to get live price of RELIANCE.NS
Use indiaquant to generate signal for HDFCBANK.NS
Use indiaquant to detect unusual options activity on INFY.NS
Use indiaquant to scan the market

Claude will call the MCP tools and return live market data.

APIs Used

This project only uses free APIs.

yfinance – live stock prices and options chain
NewsAPI – news sentiment analysis
Alpha Vantage – macro indicators
pandas-ta – technical indicators

No paid APIs are used.

Design Decisions

FastAPI was chosen for building a lightweight backend API.

yfinance provides free access to NSE stock data.

SQLite is used for storing virtual portfolio data because it is simple and portable.

The MCP layer allows Claude to communicate with the backend using tools.

Future Improvements

Possible future enhancements include:

• Deploy the server to cloud for 24/7 availability
• Add Redis caching for faster market data access
• Improve trading signals using machine learning
• Integrate real brokerage APIs for real trading