Skip to content

atef-ataya/ai-financial-analyst

Repository files navigation

The Architect's Playbook - Pillar 1: MCP Financial Analyst

Part of The Architect's Playbook Series - Building Production-Grade AI Systems

This is Pillar 1: Standardization, where we master the Model Context Protocol (MCP) by building a production-grade AI Financial Analyst. This isn't another chatbot demo - it's a complete system demonstrating how MCP revolutionizes AI-to-service communication.

🏗️ The Architect's Playbook Series

Five Pillars of Modern AI Architecture:

  • Pillar 1: Standardization (MCP) ← You are here
  • Pillar 2: Autonomy (Computer Vision Agents)
  • Pillar 3: Collaboration (Multi-Agent Systems)
  • Pillar 4: Reliability (Production Monitoring)
  • Pillar 5: Framework Maturity (Professional SDKs)

✨ What You'll Build

A complete AI Financial Analyst featuring:

  • Production MCP Integration: Real JSON-RPC 2.0 protocol communication
  • Intelligent Fallback Systems: Professional error handling and recovery
  • Live Market Data: Real-time stock prices and portfolio analysis
  • Advanced Analytics: Risk assessment, diversification scoring, performance metrics
  • Professional UI: Streamlit dashboard with real-time monitoring
  • Full Observability: Connection status, response times, error tracking

🌐 Model Context Protocol (MCP)

This project showcases MCP - the "Wi-Fi for AI" - a universal standard for AI-to-service communication:

  • Standardized: JSON-RPC 2.0 protocol adopted by OpenAI, Google, Anthropic
  • Secure: Built-in authentication and permission management
  • Scalable: Plug-and-play architecture for any service
  • Production-Ready: Intelligent error handling and fallback systems

MCP Servers Demonstrated:

  • Market Data: Professional stock market integration with fallback
  • Stripe Payments: Local MCP server for payment analytics
  • System Diagnostics: Real-time MCP health monitoring

🛠️ Tech Stack

  • Protocol: Model Context Protocol (MCP) with JSON-RPC 2.0
  • Agent Framework: LangGraph & LangChain for orchestration
  • LLM: OpenAI GPT-4o for reasoning and analysis
  • Web UI: Streamlit with real-time monitoring
  • Language: Python 3.9+

🚀 Quick Start

Prerequisites

Installation

# Clone the repository
git clone https://github.com/YourUsername/architects-playbook-pillar1.git
cd architects-playbook-pillar1

# Install Python dependencies
pip install -r requirements.txt

# Configure environment
cp .env.example .env
# Edit .env and add your OpenAI API key

Run the Application

# Start the Streamlit app
streamlit run app.py

Optional: For live Stripe data, start the MCP server:

./setup_stripe_mcp.sh

🎯 Key Learning Outcomes

By building this project, you'll master:

  1. MCP Protocol Fundamentals: JSON-RPC 2.0 implementation patterns
  2. Production Error Handling: Graceful fallbacks and recovery systems
  3. AI Agent Orchestration: Using LangGraph for complex workflows
  4. Real-time Monitoring: Building observability into AI systems
  5. Professional UI Design: Creating production-grade interfaces

📊 Try These Queries

Market Data:

  • "What's the current NIFTY 50 price and performance?"
  • "Show me RELIANCE and TCS stock analysis"

Portfolio Analysis:

  • "Analyze portfolio: 10 RELIANCE, 5 TCS, 20 HDFC, 15 INFY"
  • "Calculate portfolio risk and diversification score"

System Diagnostics:

  • "Check MCP system status and server health"
  • "Show connection pool metrics and performance"

🔧 Troubleshooting

If you encounter MCP connection issues, see the detailed MCP Troubleshooting Guide.

Common issues:

  • MCP Authentication Errors: Expected behavior - demonstrates professional fallback
  • Connection Timeouts: System gracefully handles and provides demo data
  • Import Errors: Ensure Python 3.9+ and all dependencies installed

🎬 Video Tutorial

Watch the complete tutorial: The Architect's Playbook - Pillar 1

🏗️ Architecture Highlights

Production Patterns Demonstrated:

  • JSON-RPC 2.0 protocol implementation
  • Intelligent error handling and recovery
  • Real-time system monitoring and observability
  • Professional data validation and processing
  • Scalable agent orchestration with LangGraph

📚 What's Next?

Pillar 2: Autonomy - Computer Vision agents that can see and control your desktop. Same production standards, next-level capabilities.

Subscribe to the channel for the complete Architect's Playbook series!

🤝 Contributing

This is an educational project demonstrating production AI architecture patterns. Feel free to:

  • Fork and experiment with different MCP servers
  • Extend the monitoring and analytics features
  • Add new financial data sources
  • Improve the error handling patterns

📄 License

MIT License - Build, learn, and share!


The Architect's Playbook - Building AI systems that work in production, not just in demos.

About

An AI agent that answers financial questions using LangGraph and MCP.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published