A production-ready, enterprise-grade financial analysis system powered by 13 specialized MCP servers with real market data orchestrated by Archestra AI agents.
Features • Quick Start • Architecture • Documentation • License
AutoFinance is an AI-powered financial control plane that combines:
- 🔌 13 Specialized MCP Servers - Market data, technical analysis, risk management, execution, compliance, strategy allocation
- 🤖 12 AI Agents - Hierarchical agent orchestration via Archestra
- 📊 Real Market Data - Live Yahoo Finance integration (no mocks!)
- 🛡️ Production Governance - Risk validation, audit logging, compliance tracking
- 📢 Multi-Channel Notifications - Slack, WhatsApp, SMS, Email
- 📈 Short-term trading with technical analysis
- 💼 Long-term investing with fundamental research
- 🎯 Portfolio management and rebalancing
⚠️ Risk assessment and position validation- 🔔 Price alerts and strategy simulations
- 📝 Comprehensive audit trails for compliance
GitHub Copilot CLI Challenge Submission
AutoFinance was developed extensively using GitHub Copilot CLI, showcasing all major features:
-
🎯 Custom Instructions - Repository-wide and path-specific instructions guide development
.github/copilot-instructions.md- Project coding standards and financial domain guidelines.github/instructions/- Context-aware instructions for MCP servers, CLI, and tests
-
🤖 Custom Agents - Specialized AI agents for different development roles
mcp-server-developer- Expert in MCP protocol and financial APIsfinancial-analyst- Technical analysis and trading strategy specialistcli-dashboard-developer- Textual framework and terminal UI experttest-engineer- Comprehensive testing and quality assurance
-
💡 Agent Skills - Reusable knowledge for common tasks
financial-data-validation- Market data accuracy verificationmcp-server-debugging- Systematic server troubleshootingtechnical-analysis-implementation- Indicator calculation patternscli-dashboard-testing- Component testing strategies
-
🔗 Hooks - Automated quality checks at key development points
- Session logging and environment validation
- Pre/post tool execution checks
- Automated syntax validation
- Security and dependency monitoring
📚 See COPILOT_CLI_USAGE.md for detailed documentation on how Copilot CLI accelerated development!
Port 9001: Market - Real-time prices from Yahoo Finance
Port 9002: Risk - Trade validation and position limits
Port 9003: Execution - Portfolio state and trade execution
Port 9004: Compliance - Audit logging and compliance metrics
Port 9005: Technical - RSI, MACD, Bollinger Bands (real data)
Port 9006: Fundamental - P/E, ROE, growth analysis (real data)
Port 9007: Macro - GDP, inflation, rates (realistic simulation)
Port 9008: News - Sentiment analysis (keyword-based)
Port 9009: Portfolio - Portfolio analytics and metrics
Port 9010: Volatility - Historical volatility calculations (real data)
Port 9011: Alert Engine - Price alerts and monitors
Port 9012: Simulation - Monte Carlo "what-if" scenarios
Port 9013: Notifications - Multi-channel delivery
Level 1: Portfolio Manager (CEO)
├── Level 2: Trading Director
│ ├── Level 3: Market Analyzer
│ ├── Level 3: Signal Generator
│ └── Level 3: Risk Assessor
├── Level 2: Investment Director
│ ├── Level 3: Research Analyst
│ └── Level 3: Portfolio Optimizer
└── Level 2: Operations Director
├── Level 3: Alert Manager
├── Level 3: Strategy Simulator
└── Level 3: Notification Dispatcher
See Agent_def.md for complete agent configurations.
- Python 3.14+
- Docker (for Archestra)
- Arch Linux with fish shell (or adapt commands for bash/zsh)
cd AutoFinance
. venv/bin/activate
pip install -r mcp-servers/requirements.txtKey packages: mcp>=0.9.0, fastmcp>=0.2.0, yfinance>=1.1.0
./start_sse_servers.shThis starts all 13 servers on ports 9001-9013. Each server uses Streamable HTTP transport on /mcp endpoint.
Verify servers are running:
ps aux | grep "mcp_sse_server.py" | grep -v grep | wc -l
# Should return: 13# Archestra runs in Docker on localhost:3000
docker ps | grep archestra
# If not running, start it according to Archestra docsAccess Archestra UI: http://localhost:3000
Go to Archestra UI → MCP Registry and add these 13 servers:
{
"mcpServers": {
"autofinance-market": {
"url": "http://172.17.0.1:9001/mcp"
},
"autofinance-risk": {
"url": "http://172.17.0.1:9002/mcp"
},
"autofinance-execution": {
"url": "http://172.17.0.1:9003/mcp"
},
"autofinance-compliance": {
"url": "http://172.17.0.1:9004/mcp"
},
"autofinance-technical": {
"url": "http://172.17.0.1:9005/mcp"
},
"autofinance-fundamental": {
"url": "http://172.17.0.1:9006/mcp"
},
"autofinance-macro": {
"url": "http://172.17.0.1:9007/mcp"
},
"autofinance-news": {
"url": "http://172.17.0.1:9008/mcp"
},
"autofinance-portfolio-analytics": {
"url": "http://172.17.0.1:9009/mcp"
},
"autofinance-volatility": {
"url": "http://172.17.0.1:9010/mcp"
},
"autofinance-alert-engine": {
"url": "http://172.17.0.1:9011/mcp"
},
"autofinance-simulation-engine": {
"url": "http://172.17.0.1:9012/mcp"
},
"autofinance-notification-gateway": {
"url": "http://172.17.0.1:9013/mcp"
}
}
}Important: Use 172.17.0.1 (Docker bridge IP), NOT localhost!
Follow the detailed instructions in Agent_def.md to create all 12 agents with proper system prompts and tool assignments.
Quick Agent Creation:
- Go to Agents → Create New
- Copy Name and System Prompt from Agent_def.md
- Enable listed tools from MCP servers
- Configure sub-agents if applicable
- Save and repeat for all 12 agents
AutoFinance includes a beautiful, intuitive terminal-based interface for interactive trading and portfolio management.
- 📊 Live Charts - Multiple stock/crypto charts with braille-dot graphics
- 💬 Copilot Chat - Interactive AI chat with MCP tool access
- 💼 Portfolio Tracker - Real-time portfolio value and P&L
- 🔍 Symbol Search - Quick search and favorites management
- ⌨️ Keyboard Navigation - Intuitive shortcuts, no mouse required
cd cli
./install.sh # Install dependencies
./run.sh # Launch TUI interfaceOr run directly:
cd cli
python main.py| Key | Action |
|---|---|
1 |
Charts View |
2 |
Search View |
3 |
Chat View |
H |
Help |
R |
Refresh |
Q |
Quit |
- Binance - Real-time crypto prices (WebSocket)
- Yahoo Finance - Stock market data (polling)
- Both sources work without API keys for public data
For complete TUI documentation, see cli/CLI_README.md
cd tests
python test_all_servers.pyThis runs 8 comprehensive test scripts covering all major servers.
cd tests
python test_market_server.py # Test real Yahoo Finance data
python test_technical_server.py # Test RSI, MACD, Bollinger Bands
python test_fundamental_server.py # Test P/E, ROE, fundamental analysis
python test_volatility_server.py # Test volatility calculations
python test_news_server.py # Test sentiment analysis
python test_macro_server.py # Test macro indicators
python test_risk_server.py # Test risk validation
python test_execution_server.py # Test portfolio execution✅ 100% Real Data:
- AAPL: $255.78 (Yahoo Finance)
- BTC: $69,690, 67.43% volatility
- MSFT: P/E 25.13, 48.5% upside potential
✅ All Indicators Working:
- RSI, MACD, Bollinger Bands from real prices
- P/E ratios, ROE, profit margins from ticker.info
- Volatility with log returns and annualization
✅ Risk Management:
- 5% max position size enforced
- 70% minimum confidence threshold
- Trade rejections working correctly
# Get live AAPL price
→ get_live_price("AAPL")
← {"symbol": "AAPL", "price": 255.78, "change_24h": -2.3, "source": "yahoo_finance"}# Generate signal for Apple
→ generate_signal("AAPL", "3mo")
← {
"signal": "HOLD",
"confidence": 0.4,
"indicators": {
"rsi": 50.56,
"macd": 1.09,
"sma_20": 262.09,
"current_price": 255.78
},
"reasons": ["Below SMA20", "Neutral RSI"],
"source": "yahoo_finance",
"data_points": 62
}# Analyze Apple fundamentals
→ analyze_fundamentals("AAPL")
← {
"recommendation": "BUY",
"confidence": 0.7,
"scores": {
"valuation": 0.25,
"quality": 0.8,
"growth": 0.85
},
"fundamentals": {
"market_cap": 3.76e12,
"pe_ratio": 32.38,
"roe": 1.5202,
"profit_margin": 0.2704,
"target_price": 292.15
},
"source": "yahoo_finance"
}# Check Bitcoin volatility
→ get_volatility_score("BTCUSDT")
← {
"volatility_pct": 67.43,
"risk_level": "HIGH",
"risk_score": 0.889,
"regime": "EXTREME",
"percentile": 98.2,
"source": "yahoo_finance"
}User → Portfolio Manager:
"Should I buy 10 shares of Apple?"
Portfolio Manager → Trading Director
Trading Director → Market Analyzer: Get current price
Trading Director → Signal Generator: Get technical signal
Trading Director → Risk Assessor: Pre-validate
Results flow back:
- Market: AAPL at $255.78
- Technical: HOLD (RSI 50.56, downtrend)
- Fundamental: BUY (strong company, undervalued)
- Risk: Position OK (2.5% of portfolio)
Trading Director → Risk Server: validate_trade()
Risk Server → ✅ APPROVED
Trading Director → Execution Server: execute_trade()
Execution Server → ✅ FILLED
Trading Director → Compliance Server: log_event()
Compliance Server → ✅ LOGGED
Final result → User: "Trade executed. You now own 10 AAPL @ $255.78"
User → Portfolio Manager:
"Give me a long-term investment analysis for Microsoft"
Portfolio Manager → Investment Director
Investment Director → Research Analyst: Deep dive on MSFT
Investment Director → Portfolio Optimizer: Check allocation
Research Analyst:
- MSFT: P/E 25.13 (reasonable for growth)
- Profit margin: 39.04% (excellent)
- ROE: 34.39% (strong)
- Target price: $596 (48.5% upside!)
- Recommendation: STRONG BUY
Portfolio Optimizer:
- Current tech allocation: 15%
- Max tech sector: 30%
- Room for 15% more tech exposure
Investment Director recommends:
"Strong BUY for long-term. Allocate 10% of portfolio to MSFT.
Excellent fundamentals, significant upside, tech sector not overweight."
User → Portfolio Manager:
"Alert me when Bitcoin goes above $75,000"
Portfolio Manager → Operations Director
Operations Director → Alert Manager: Create alert
Alert Manager creates rule:
- Symbol: BTCUSDT
- Condition: price > 75000
- Channel: Slack
- Status: ACTIVE
[Days later, BTC hits $75,100]
Alert Manager → Notification Dispatcher: Send alert
Notification Dispatcher → Slack:
"🚨 PRICE ALERT: Bitcoin (BTCUSDT) reached $75,100 (above your $75,000 threshold)"
Notification Dispatcher → Compliance Server: Log notification
Compliance Server → ✅ LOGGED
- Position Limits: Max 5% per position (configurable)
- Confidence Threshold: Min 70% for trade approval
- Portfolio Risk Cap: Max 30% total risk exposure
- Two-Phase Validation: Pre-assessment + formal Risk server approval
- Event Logging: All trades, validations, rejections logged
- Audit Trails: Timestamped records with trade details
- Compliance Metrics: Track validation rate, rejection reasons
- Report Generation: On-demand audit reports
- Separation of Concerns: Analysis agents can't execute trades
- Zero-Trust Model: Every trade requires Risk server approval
- Agent Hierarchy: Clear delegation paths, no rogue execution
- MCP Protocol: Standardized, secure tool invocation
- Sign up at https://newsapi.org/ (100 requests/day free)
- Get API key
- Set environment variable:
export NEWS_API_KEY="your_key_here"
- Restart news server:
pkill -f "news/server.py" python mcp_sse_server.py news &
- Sign up at https://fred.stlouisfed.org/ (unlimited free)
- Get API key
- Set environment variable:
export FRED_API_KEY="your_key_here"
- Restart macro server:
pkill -f "macro/server.py" python mcp_sse_server.py macro &
Edit mcp-servers/risk/server.py:
RISK_POLICY = {
"max_position_size_pct": 5.0, # Change to 10.0 for aggressive
"max_portfolio_risk_pct": 30.0, # Change to 50.0 for aggressive
"min_confidence_threshold": 0.7, # Change to 0.6 for more trades
"max_daily_trades": 10,
"max_leverage": 1.0
}AutoFinance/
├── mcp-servers/ # 13 MCP server implementations
│ ├── market/server.py # Yahoo Finance integration
│ ├── risk/server.py # Risk validation logic
│ ├── execution/server.py # Portfolio state & trades
│ ├── compliance/server.py # Audit logging
│ ├── technical/server.py # RSI, MACD, Bollinger Bands
│ ├── fundamental/server.py # P/E, ROE, fundamentals
│ ├── volatility/server.py # Volatility calculations
│ ├── news/server.py # Sentiment analysis
│ ├── macro/server.py # GDP, inflation, rates
│ ├── portfolio-analytics/server.py # Portfolio metrics
│ ├── alert-engine/server.py # Price alerts
│ ├── simulation-engine/server.py # Monte Carlo simulations
│ ├── notification-gateway/server.py # Multi-channel notifications
│ ├── llm_client.py # LLM integration utilities
│ └── requirements.txt # Python dependencies
├── cli/ # Terminal-based interface
│ ├── main.py # CLI entry point
│ ├── dashboard.py # Dashboard view
│ ├── dashboard_textual.py # Textual-based dashboard
│ ├── config.yaml # CLI configuration
│ ├── CLI_README.md # CLI documentation
│ ├── install.sh # Installation script
│ ├── run.sh # Launch script
│ ├── components/ # UI components
│ │ ├── charts.py
│ │ ├── chatbox.py
│ │ ├── portfolio.py
│ │ └── search.py
│ ├── data/ # Data fetchers
│ │ └── fetchers.py
│ └── utils/ # Utilities
│ └── keyboard.py
├── tests/ # Comprehensive test suite
│ ├── test_market_server.py
│ ├── test_technical_server.py
│ ├── test_fundamental_server.py
│ ├── test_volatility_server.py
│ ├── test_news_server.py
│ ├── test_macro_server.py
│ ├── test_risk_server.py
│ ├── test_execution_server.py
│ ├── test_all_servers.py # Master test runner
│ └── README.md # Testing documentation
├── mcp_sse_server.py # Main server wrapper
├── start_sse_servers.sh # Startup script
├── alert_monitor.py # Alert monitoring daemon
├── Agent_def.md # Agent configurations
├── README.md # This file
├── LICENSE # MIT License
├── .gitignore # Git ignore rules
└── venv/ # Python virtual environment
- 🎯 Add investor features (retirement planning, diversification scoring)
- 📊 Integrate paid APIs (Bloomberg, Refinitiv) for institutional data
- 🔄 Implement backtesting engine for strategy validation
- 🌐 Add web UI for direct user interaction
- ☁️ Deploy to cloud (AWS, GCP, Azure) with Kubernetes
- 📱 Mobile app integration
- 🔔 Advanced alert conditions and triggers
This project is optimized for GitHub Copilot CLI!
We have defined specialized agents in AGENTS.md to help you navigate the codebase:
- @Finance Expect: Understands market data and trading strategies.
- @Test Runner: Expert in our test suite.
- @Compliance Officer: strict code reviewer for financial safety.
Try:
copilot
> @Finance Expert analyze the risk of buying 100 AAPL sharesCopilot is context-aware thanks to .github/copilot-instructions.md, understanding our specific microservices architecture and avoiding hallucinations.
You can connect Copilot safely to your local MCP servers! Run the configuration helper:
python configure_copilot.pyThis generates copilot_mcp_config.json. Add this to your ~/.copilot/mcp-config.json.
Then start Copilot and ask:
copilot -p "What is the current price of Bitcoin?"Copilot will use the real local market server to fetch the data!
This project is licensed under the MIT License - see the LICENSE file for details.


