- Home
- MCP servers
- Indian Stock Analysis
Indian Stock Analysis
- python
4
GitHub Stars
python
Language
6 months ago
First Indexed
2 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": {
"ingpoc-stock_mcp_server": {
"command": "python",
"args": [
"server.py"
],
"env": {
"CACHE_TTL": "3600",
"LOG_LEVEL": "INFO",
"MONGODB_URI": "mongodb://localhost:27017",
"CACHE_ENABLED": "True",
"MCP_SERVER_NAME": "stock-analysis-mcp",
"MONGODB_DB_NAME": "stock_data",
"MCP_SERVER_VERSION": "0.1.0",
"ALPHA_VANTAGE_API_KEY": "YOUR_API_KEY",
"ALPHA_VANTAGE_BASE_URL": "https://www.alphavantage.co/query",
"MONGODB_HOLDINGS_COLLECTION": "holdings",
"ALPHA_VANTAGE_RATE_LIMIT_DAY": "500",
"MONGODB_FINANCIALS_COLLECTION": "detailed_financials",
"ALPHA_VANTAGE_DEFAULT_EXCHANGE": "NSE",
"ALPHA_VANTAGE_RATE_LIMIT_MINUTE": "5",
"MONGODB_KNOWLEDGE_GRAPH_COLLECTION": "stock_knowledge_graph"
}
}
}
}You deploy and use an MCP server focused on Indian stock analysis to access your NSE/BSE data, analyze portfolios, and receive insights through Claude. It integrates with MongoDB for raw stock data, Alpha Vantage for Indian market data, and a persistent knowledge graph to build context over time. This server helps you get segmented portfolio analysis, optimized data for Claude, and automated handling of Alpha Vantage free-tier limits.
How to use
You interact with the Indian Stock Analysis MCP Server through an MCP client to analyze your Indian stock portfolio, get recommendations, and review market trends. Start small by asking for a portfolio summary, then drill into segments to understand performance and risk. Use the knowledge graph capabilities to retrieve historical analyses and stable context about stocks you care about.
Key capabilities you can rely on include getting portfolio holdings, obtaining a high-level portfolio summary, performing segment-wise analysis, requesting stock recommendations, exploring market trends, querying the knowledge graph for insights, and retrieving Alpha Vantage data or symbol information for Indian stocks.
When working with large portfolios, start with a summary, then analyze one segment at a time. You can adjust the segment size to fit your latency preferences and Claude’s processing capacity. If a response is too large, the server automatically simplifies the data and may truncate text fields to keep interactions smooth.
How to install
Prerequisites you need before installing the MCP server are as follows.
# Prerequisites
python3.9+
# Ensure MongoDB is running on the default port with the stock_data database
# Obtain an Alpha Vantage API key for Indian market data
# Claude Desktop app is used as the client
Step-by-step installation flow.
# 1. Clone the MCP server repository
git clone <repository-url>
cd stock-mcp-server
# 2. Create a virtual environment (optional but recommended)
python3 -m venv venv
source venv/bin/activate # On Windows use: venv\Scripts\activate
# 3. Install dependencies
pip install -r requirements.txt
# 4. Create the environment configuration from a template
cp .env.example .env
# 5. Edit the .env file to configure MongoDB and Alpha Vantage settings
# (See example configuration values below in the configuration section)
# 6. Start the MCP server
python server.py
Configuration and startup notes
The server relies on environment configuration to connect to MongoDB, Alpha Vantage, and to define how Claude will access the data. You will typically set MongoDB connection details, the Alpha Vantage API key, and Indian market defaults.
{
"MONGODB_URI": "mongodb://localhost:27017",
"MONGODB_DB_NAME": "stock_data",
"MONGODB_HOLDINGS_COLLECTION": "holdings",
"MONGODB_FINANCIALS_COLLECTION": "detailed_financials",
"MONGODB_KNOWLEDGE_GRAPH_COLLECTION": "stock_knowledge_graph",
"ALPHA_VANTAGE_API_KEY": "your_api_key_here",
"ALPHA_VANTAGE_DEFAULT_EXCHANGE": "NSE",
"ALPHA_VANTAGE_BASE_URL": "https://www.alphavantage.co/query",
"ALPHA_VANTAGE_RATE_LIMIT_MINUTE": "5",
"ALPHA_VANTAGE_RATE_LIMIT_DAY": "500",
"LOG_LEVEL": "INFO",
"CACHE_ENABLED": "True",
"CACHE_TTL": "3600",
"MCP_SERVER_NAME": "stock-analysis-mcp",
"MCP_SERVER_VERSION": "0.1.0"
}
Claude Desktop configuration
Configure Claude Desktop to connect to the MCP server by creating or editing the MCP configuration file. Use the full path to your Python executable and the absolute path to the server script.
{
"mcpServers": {
"stock-analysis-mcp": {
"command": "/path/to/your/python",
"args": [
"/path/to/stock_mcp_server/server.py"
],
"cwd": "/path/to/stock_mcp_server",
"env": {
"ALPHA_VANTAGE_API_KEY": "your_api_key_here",
"MONGODB_URI": "mongodb://localhost:27017",
"MONGODB_DB_NAME": "stock_data",
"MONGODB_HOLDINGS_COLLECTION": "holdings",
"MONGODB_FINANCIALS_COLLECTION": "detailed_financials",
"MONGODB_KNOWLEDGE_GRAPH_COLLECTION": "stock_knowledge_graph",
"ALPHA_VANTAGE_BASE_URL": "https://www.alphavantage.co/query",
"ALPHA_VANTAGE_RATE_LIMIT_MINUTE": "5",
"ALPHA_VANTAGE_RATE_LIMIT_DAY": "500",
"ALPHA_VANTAGE_DEFAULT_EXCHANGE": "NSE",
"MCP_SERVER_NAME": "stock-analysis-mcp",
"MCP_SERVER_VERSION": "0.1.0",
"LOG_LEVEL": "INFO",
"CACHE_ENABLED": "True",
"CACHE_TTL": "3600"
}
}
}
}
Available tools
get_portfolio_holdings
Retrieve current Indian stock portfolio holdings with basic information and optional summary limit.
get_portfolio_summary
Return a high-level overview of the portfolio including total stocks, sector breakdown, segmentation guidance, and recommendations.
analyze_portfolio
Analyze portfolio holdings with metrics and recommendations, with options for segment and detail level.
get_stock_recommendations
Provide Indian stock recommendations based on criteria such as growth, value, or dividend, with limits and filters.
get_removal_recommendations
Identify stocks that should be considered for removal from the portfolio based on performance signals.
get_market_trend_recommendations
Identify must-buy Indian stocks based on current market trends, excluding current holdings.
query_knowledge_graph
Query the stock knowledge graph for historical analyses and insights.
get_alpha_vantage_data
Access Alpha Vantage data for Indian stocks within free-tier limits.
search_stock_symbol
Search Indian stock symbols by name or keywords.
get_technical_analysis
Get technical indicators (SMA, RSI) for a given Indian stock symbol.
get_optimized_technical_analysis
Perform efficient technical analysis by requesting specific indicators with rate-limit awareness.
get_alpha_vantage_status
Check current Alpha Vantage API usage status and remaining calls.