Enables automated sending of financial analysis reports via email with chart attachments through Gmail's SMTP server.
Financial Data MCP Server
A comprehensive Model Context Protocol (MCP) server for financial data analysis, portfolio management, and automated trading recommendations.
Features
📊 Real-time Stock Data - Uses free yfinance (Yahoo Finance) API - no API keys required
💼 Portfolio Management - Track multiple portfolios with automated analysis
📈 Technical Analysis - EMA-based trend detection and MACD charts
🎯 Trading Signals - Automated buy/sell recommendations with confidence levels
📧 Email Reports - Automated batch analysis reports with chart attachments
📉 Performance Tracking - Daily monitoring of recommendation performance
🤖 MCP Integration - Full integration with Claude Code and other MCP clients
Architecture
Core Components
financial_mcp_server.py - Main MCP server
Provides MCP tools and resources for financial analysis
Integrates with Claude Code
Real-time stock data via yfinance
batch_fin_mcp_server.py - Batch analysis engine
Analyzes all portfolios at once
Generates comprehensive reports and charts
Implements 4 trading scenarios based on EMA analysis
email_report_script.py - Email automation
Sends analysis results via email
Attaches charts and detailed reports
Saves buy recommendations for tracking
daily_tracking_script.py - Performance tracking
Monitors buy recommendation performance
Creates tracking charts
Generates daily performance reports
Installation
1. Clone the repository
2. Create and activate virtual environment
3. Install dependencies
Configuration
Portfolio Setup
Edit portfolio.json
to add your portfolios:
Email Configuration (Optional)
For email reports, create email_config.json
:
Usage
Running the MCP Server
Batch Analysis
Analyze all portfolios and generate reports:
Results are saved to batch_financial_charts/
Send Email Reports
Track Recommendations
Results are saved to tracking_charts/
MCP Tools
The server provides these tools for Claude Code integration:
load_portfolio
- Load portfolio data from portfolio.jsonanalyze_portfolio
- Detailed analysis of specific portfolioportfolio_performance
- Performance metrics over timeget_stock_info
- Comprehensive stock informationget_earnings_calendar
- Upcoming earnings announcementsget_analyst_changes
- Recent analyst upgrades/downgradesgenerate_macd_chart
- MACD technical analysis chartsget_market_overview
- Major market indices status
Trading Scenarios
The batch analyzer identifies 4 key trading scenarios:
Scenario A: Price >10% above 50 EMA → SELL signal
Scenario B: Price above 50 EMA, touched recently → BUY signal
Scenario C: Price >5% below 50 EMA, decreasing 3+ days, above 200 EMA → BUY signal
Scenario D: Price below 50 EMA, touched 200 EMA recently → BUY signal
Technical Analysis
Trend Detection: Golden Cross / Death Cross analysis
EMAs: 50-day and 200-day exponential moving averages
MACD: Moving Average Convergence Divergence charts
Volume Analysis: Trading volume patterns
Confidence Scores: Each recommendation includes confidence level
Project Structure
Requirements
Python 3.8+
yfinance (free Yahoo Finance API)
pandas, numpy, matplotlib
MCP SDK (mcp>=1.0.0)
Disclaimer
⚠️ This software is for informational purposes only. It does not constitute financial advice. Always do your own research before making investment decisions.
License
MIT License - See LICENSE file for details
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Support
For issues and questions, please open an issue on GitHub.
This server cannot be installed
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
Provides real-time stock data analysis, portfolio management, technical analysis with EMA/MACD indicators, and automated trading recommendations with confidence levels using Yahoo Finance API.