
A stateless streamable HTTP MCP server for interacting with the official source of government spending data.

A Model Context Protocol server that connects Claude to MongoDB stock data and Alpha Vantage to support portfolio recommendations and market insights for Indian NSE/BSE stocks.
Indian Stock Analysis MCP Server is cataloged as an MCP server attributed to ingpoc. A Model Context Protocol server that connects Claude to MongoDB stock data and Alpha Vantage to support portfolio recommendations and market insights for Indian NSE/BSE stocks. It is categorized under finance crypto. See the capability inspector for recorded interfaces and their independent review status; consult upstream documentation for the current interface.
Installation configuration is not reviewed. No executable setup is offered for this entry; inspect the source repository before proceeding.
Catalog license label: MIT License. Check the source repository's current license and terms before using, modifying or distributing this software.
Capability definitions are not reviewed. Unreviewed imports are not exposed as trusted interfaces.
No reviewed records to display. This does not establish that upstream lacks this capability.
No reviewed records to display. This does not establish that upstream lacks this capability.
No reviewed records to display. This does not establish that upstream lacks this capability.
Email delivery is not connected. This page does not collect email addresses or create subscriptions.
Browse the registry for current listings instead.
Reviews for Indian Stock Analysis MCP Server are not available yet
Review publishing and storage are not connected. This page does not collect or publish ratings or comments, including after sign-in.
It is designed exclusively for Indian stocks on the NSE and BSE and will not process other markets.
It applies automatic rate limiting for the free tier and provides status tracking and optimized tools to stay within the 5 calls per minute and 500 calls per day limits.
README.md · 650b546a67d1 · Fetched 2026-11-13 10:29:10 UTC
Original upstream text, without AI rewriting. Scripts, forms and unsafe links are filtered for safety.
Showing the last retrieved documentation snapshot; check the source for current changes.
A Model Context Protocol (MCP) server for interacting with MongoDB stock data to provide portfolio recommendations and market insights, exclusively for the Indian stock market (NSE/BSE).
This MCP server integrates with:
stock_data) for direct stock data accessIt enables Claude to access your Indian stock portfolio holdings, analyze stock performance, and provide personalized recommendations directly through the Claude desktop app, while building a persistent knowledge graph for improved context awareness.
Clone this repository:
git clone <repository-url>
cd stock-mcp-server
Install dependencies:
pip install -r requirements.txt
Create a .env file from the example:
cp .env.example .env
Edit the .env file to configure your settings:
# MongoDB Configuration
MONGODB_URI=mongodb://localhost:27017
MONGODB_DB_NAME=stock_data
# Alpha Vantage API
ALPHA_VANTAGE_API_KEY=your_api_key_here
# Indian Stock Market Settings
ALPHA_VANTAGE_DEFAULT_EXCHANGE=NSE # NSE or BSE
python server.py
Claude Desktop uses a configuration file to connect to MCP servers. You'll need to create or edit this file to include your stock analysis server.
Create or edit the configuration file at:
~/Library/Application Support/Claude/claude_desktop_config.json%APPDATA%\Claude\claude_desktop_config.jsonAdd the stock analysis MCP server configuration:
{
"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"
}
}
}
}
Important Notes:
/usr/bin/python3 or C:\Python39\python.exe)stock-analysis-mcp must use hyphens, not underscoresMCP_SERVER_NAME in env must match the server keyStart or restart Claude Desktop
Verify the server connection:
Once configured, you can ask Claude:
If the tools aren't appearing in Claude despite successful server startup:
Check your logs:
tail -f ~/Library/Logs/Claude/mcp-server-stock-analysis-mcp.log
Verify server naming:
claude_desktop_config.json uses hyphens (stock-analysis-mcp)MCP_SERVER_NAME environment variable matches this nameStart a new conversation in Claude after making changes
Enable developer mode in Claude's settings
Check paths: Make sure all paths in the configuration are absolute and correct
Full Python path: Use the full path to your Python executable (e.g., run which python to find it)
Check Claude app log:
tail -f ~/Library/Logs/Claude/app.log
get_portfolio_summaryportfolio_analysis using the segment parameterFor large portfolios (20+ stocks), the server implements a segmented approach:
Get Portfolio Summary:
get_portfolio_summary to see an overview of your portfolioAnalyze in Segments:
portfolio_analysis with the segment parameterControl Segment Size:
segment_size parameter to adjust (1-5 stocks per segment)Request Levels of Detail:
include_details=false for quick overview (default)include_details=true for comprehensive metrics and insightsResponse Size Management:
The server includes several optimizations to ensure Claude can process stock data efficiently:
Adaptive Response Sizing:
Financial Data Compression:
Parameter Limits:
Intelligent Segmentation:
Response Size Management:
Intelligent Internal Handling:
These optimizations ensure Claude can process your stock data efficiently without being overwhelmed by excessive information or experiencing timeouts.
This repository includes a comprehensive test suite for validating the functionality of the MCP server.
test_mcp_server.py: A comprehensive test script that validates all endpoints and tools in the MCP server.test_client.py: A simple client for testing MCP server endpoints.test_server_startup.sh: Script to test the server startup processTo verify the server can start properly:
./test_server_startup.sh
To run the comprehensive test script:
python test_mcp_server.py
This will test all aspects of the server, including:
If you want to skip the tests that make actual API calls to Alpha Vantage (to avoid rate limits):
python test_mcp_server.py --skip-alpha-vantage
The script will output detailed logs to both the console and a test_mcp_server.log file. At the end, you'll see a summary of test results:
=== Test Results Summary ===
database_connection: ✅ PASSED
portfolio_holdings: ✅ PASSED
knowledge_graph: ✅ PASSED
symbol_formatting: ✅ PASSED
alpha_vantage_api: ✅ PASSED
trending_stocks: ✅ PASSED
tools_handler: ✅ PASSED
Overall: 7/7 tests passed
If tests fail, check the following:
Database Connection: Ensure MongoDB is running on the configured URI (default: mongodb://localhost:27017) and the stock_data database exists.
Alpha Vantage API: Check that your API key is set in the .env file and has not exceeded rate limits.
Data Availability: Some tests require existing data in the MongoDB collections (e.g., portfolio holdings). Ensure your database has the necessary data.
Network Issues: The Alpha Vantage tests require internet connectivity.
0: All tests passed1: One or more tests failedThis allows you to integrate the tests into continuous integration pipelines that check for non-zero exit codes.
When working with the Indian stock market, keep in mind:
NSE:SYMBOL (e.g., NSE:RELIANCE)BSE:CODE (e.g., BSE:500325)The project follows a modular architecture for better maintainability and separation of concerns:
├── server.py # Main entry point
├── src/ # Source code
│ ├── __init__.py # Package initialization
│ ├── config.py # Configuration module
│ ├── handlers/ # MCP handler implementations
│ │ ├── __init__.py
│ │ ├── resources.py # Resource handlers
│ │ ├── tools.py # Tool handlers for Indian stock analysis
│ │ └── prompts.py # Prompt handlers
│ └── utils/ # Utility modules
│ ├── __init__.py
│ ├── database.py # MongoDB operations
│ └── alpha_vantage.py # Alpha Vantage API operations for Indian market
├── test_mcp_server.py # Comprehensive test script
├── test_client.py # Simple test client
├── requirements.txt # Dependencies
└── .env.example # Example environment configuration
The server provides the following MCP tools, organized by category:
limit: Maximum number of holdings to return (default: 10, max: 50)summary: Return simplified stock data (default: true)limit: Maximum stocks to analyze (default: 10, max: 15)include_details: Include comprehensive metrics (default: false)segment: Which segment of stocks to analyze (default: 1)segment_size: Number of stocks per segment (default: 5, max: 5)Get Stock Recommendations: Get recommendations for Indian stocks to add based on financial metrics
criteria: Type of recommendations to get (e.g., "growth", "value", "dividend") (default: "growth")limit: Maximum number of recommendations to return (default: 5, max: 8)Get Removal Recommendations: Identify Indian stocks that should be removed from portfolio
limit: Maximum number of stocks to analyze (default: 5, max: 10)limit: Maximum number of recommendations to return (default: 5, max: 8)Get Technical Analysis: Get technical analysis indicators for an Indian stock (SMA, RSI)
symbol: Stock symbol to analyze (e.g., "NSE:RELIANCE")Get Optimized Technical Analysis: Smart technical analysis that avoids rate limits
symbol: Stock symbol to analyze (e.g., "NSE:RELIANCE")indicators: Comma-separated list of indicators to analyze (e.g., "SMA,RSI")The server maintains a knowledge graph in MongoDB (collection: stock_knowledge_graph) that stores:
This provides Claude with persistent memory about your Indian stock portfolio and stocks of interest.
This server implements several strategies to optimize data for Claude's consumption:
Automatic Data Limiting:
Data Simplification:
Parameter Controls:
Segmented Processing:
Response Size Management:
Intelligent Internal Handling:
These optimizations ensure Claude can process your stock data efficiently without being overwhelmed by excessive information or experiencing timeouts.
This server is optimized for Alpha Vantage's free tier API, which includes:
GLOBAL_QUOTE - Current price informationTIME_SERIES_DAILY - Daily price historyOVERVIEW - Company informationSYMBOL_SEARCH - Finding Indian stock symbolsThe server implements automatic rate limiting to ensure you stay within these limits.
The server uses the following environment variables (defined in .env):
MONGODB_URI: MongoDB connection string (default: mongodb://localhost:27017)MONGODB_DB_NAME: Database name (default: stock_data)MONGODB_HOLDINGS_COLLECTION: Holdings collection name (default: holdings)MONGODB_FINANCIALS_COLLECTION: Financials collection name (default: detailed_financials)MONGODB_KNOWLEDGE_GRAPH_COLLECTION: Knowledge graph collection name (default: stock_knowledge_graph)ALPHA_VANTAGE_API_KEY: Your Alpha Vantage API keyALPHA_VANTAGE_BASE_URL: Alpha Vantage API URL (default: https://www.alphavantage.co/query)ALPHA_VANTAGE_RATE_LIMIT_MINUTE: API calls allowed per minute (default: 5)ALPHA_VANTAGE_RATE_LIMIT_DAY: API calls allowed per day (default: 500)ALPHA_VANTAGE_DEFAULT_EXCHANGE: Default exchange for Indian stocks (default: NSE)MCP_SERVER_NAME: Server name (default: stock-analysis-mcp)MCP_SERVER_VERSION: Server version (default: 0.1.0)LOG_LEVEL: Logging level (default: INFO)LOG_FORMAT: Log message formatCACHE_ENABLED: Enable caching (default: True)CACHE_TTL: Cache time-to-live in seconds (default: 3600)This server includes sophisticated management of Alpha Vantage API calls to stay within free tier limits:
get_alpha_vantage_status toolHere's how Claude should use the API efficiently:
Check API Status First:
Use Optimized Tools:
Batch Similar Requests:
Use Static Data When Appropriate:
Claim this server with your GitHub account to request manual ownership verification.
Link to the catalog listing for Indian Stock Analysis MCP Server from your README. This badge does not certify ownership, compatibility or security.
[](https://awesome-mcp.com/servers/stock_mcp_server)Public repository statistics could not be verified. Check the configured source address; unavailable counts are not zero.
Separate sources, scopes and periods. Never combined or treated as installations, active users or security reviews.
No reviewed package or image identity; download statistics are not listed yet.
Alternative and complementary servers in the same category

A stateless streamable HTTP MCP server for interacting with the official source of government spending data.

A hosted, remote MCP server for Fortnox that lets AI assistants answer questions from a company's bookkeeping and propose changes for approval before writing them.

OptimistFi is a read-only remote MCP server that provides perpetual futures market data, perps prop firm rules and pricing, and US equity investment research.