stock_mcp_server
The Indian Stock Analysis MCP Server is designed to provide in-depth stock market analysis and recommendations for the Indian stock exchange markets. It integrates with MongoDB and Alpha Vantage to offer users insights and manage stock portfolios efficiently, focusing exclusively on NSE and BSE stocks.
Indian Stock Analysis MCP Server
This project is a Model Context Protocol (MCP) server specifically designed to interact with MongoDB for analyzing Indian stock market data, focusing on the NSE and BSE markets. The server integrates with Alpha Vantage API and builds a persistent knowledge graph for portfolio analysis. It provides features such as direct MongoDB access, modular architecture, and LLM-optimized data handling. The server also allows personalized stock recommendations, segmented portfolio analysis, and optimizes data for Claude desktop app usage.
Features
- Exclusive focus on NSE and BSE stocks
- Direct MongoDB database interaction
- Knowledge graph for persistent data analysis
- Automatic rate limiting for API calls
- Modular and clean code structure
- Environment configuration via .env file
- Segmented portfolio analysis
Usage
To start the server, run the setup, configure the environment settings, and start the MCP server using Python. Connect Claude Desktop App to the server by editing the configuration file and adding stock analysis configurations. Once set up, users can interact with the server for portfolio analysis, stock recommendations, and market insights.
Installation
Prerequisites
- Python 3.9+
- MongoDB with
stock_data
database - Alpha Vantage API key
- Claude Desktop app
Setup
- Clone the repository and install dependencies.
- Configure the .env file with MongoDB URI and Alpha Vantage API settings.
- Start the MCP Server using
python server.py
.
Example Prompts
- "Can you provide a summary of my portfolio?"
- "What new NSE stocks would complement my current portfolio?"
Troubleshooting
If tools aren't appearing in Claude, check logs, verify server naming, and ensure paths are correct.
Performance Optimizations
The server features adaptive response sizing, financial data compression, and segmented analysis to optimize data handling for Claude.
Configuration
Environment variables control MongoDB settings, API parameters, logging, and caching.