Enables automated sending of financial analysis reports via email with chart attachments through Gmail's SMTP server.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Financial Data MCP Serveranalyze my tech portfolio and show buy/sell signals"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
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
git clone https://github.com/j1c4b/finance_mcp_server.git
cd finance_mcp_server2. Create and activate virtual environment
python3 -m venv mcp_fin_server_venv
source mcp_fin_server_venv/bin/activate # On Windows: mcp_fin_server_venv\Scripts\activate3. Install dependencies
pip install -r clean_requirements.txtConfiguration
Portfolio Setup
Edit portfolio.json to add your portfolios:
{
"tech_stocks": {
"portfolio": "Technology Giants",
"stock_list": ["AAPL", "GOOGL", "MSFT", "AMZN", "META"]
},
"dividend_portfolio": {
"portfolio": "Dividend Champions",
"stock_list": ["JNJ", "PG", "KO", "PEP", "MMM"]
}
}Email Configuration (Optional)
For email reports, create email_config.json:
{
"smtp_server": "smtp.gmail.com",
"smtp_port": 587,
"sender_email": "your_email@gmail.com",
"sender_password": "your_app_password",
"recipient_emails": ["recipient@example.com"],
"subject_prefix": "π Financial Analysis Report",
"max_attachment_size_mb": 25
}Usage
Running the MCP Server
source mcp_fin_server_venv/bin/activate
python3 financial_mcp_server.pyBatch Analysis
Analyze all portfolios and generate reports:
python3 batch_fin_mcp_server.pyResults are saved to batch_financial_charts/
Send Email Reports
python3 email_report_script.pyTrack Recommendations
python3 daily_tracking_script.pyResults 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
finance_mcp_server/
βββ financial_mcp_server.py # Main MCP server
βββ batch_fin_mcp_server.py # Batch analysis engine
βββ email_report_script.py # Email automation
βββ daily_tracking_script.py # Performance tracking
βββ portfolio.json # Portfolio configuration
βββ requirements.txt # Python dependencies
βββ clean_requirements.txt # Cleaned dependencies
βββ CLAUDE.md # AI assistant guidance
βββ mcp-http-bridge/ # HTTP bridge for MCP
βββ batch_financial_charts/ # Generated analysis charts
βββ tracking_charts/ # Performance tracking chartsRequirements
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.