Back to guides
6
4 min

Deploy & Connect

Earnings Alerts, MCP, & Monitoring

From Dev to Production

A financial analysis system on localhost helps nobody. This module deploys the Finance Analyst to production and connects it to the tools and workflows that financial analysts already use — Slack for real-time alerts, MCP for cross-tool integration, and scheduled reports for routine analysis.

Production Deployment

Environment Management

Financial AI systems handle sensitive data and expensive API calls. Environment variables must be managed carefully:

  • API keys — Anthropic, embedding service, market data providers
  • Database URLs — pgvector connection string with SSL
  • Feature flags — Enable/disable expensive features (cross-company comparisons, scheduled reports)
  • Cost limits — Per-user and per-organization daily budgets
  • Health Checks

    A standard health endpoint (/api/health) should check:

  • Database connectivity (can we reach pgvector?)
  • Embedding model availability (can we generate embeddings?)
  • Data freshness (when was the last filing ingested? Is it stale?)
  • API key validity (are external service keys still active?)
  • The data freshness check is uniquely important for financial systems. If your latest filing is 6 months old and it's earnings season, something is broken in the ingestion pipeline.

    Slack Integration

    Slash Command

    /finance-analyst Compare NVDA and AMD gross margins

    The analyst types a query in Slack, and the Finance Analyst processes it through the full pipeline: retrieval → gateway → LLM → validation → response. The formatted response appears in the Slack channel with:

  • Rich message blocks (metrics in bold, tables as code blocks)
  • Source citations as secondary text
  • Confidence badge (emoji: green circle for high, yellow for medium, red for low)
  • Thread for follow-up questions
  • Earnings Alerts

    Automated notifications when new data arrives:

  • New filing detected: "NVDA filed 10-Q for Q3 2024. Revenue: $18.1B (+94% YoY). Gross margin: 74.0%."
  • Earnings call completed: "AAPL Q4 2024 earnings call transcript available. Key topics: Services growth, China demand, AI investments."
  • Analyst rating change: "Goldman Sachs upgraded MSFT from Hold to Buy. New PT: $480 (was $420)."
  • These alerts post to a configured #earnings channel and include a thread with the full AI-generated summary. The ingestion pipeline triggers alerts when it processes new documents.

    Thread-Based Conversations

    When an analyst replies to an alert thread, the Finance Analyst maintains context:

  • "How does this compare to last quarter?" (knows which company from the alert)
  • "What did the CEO say about AI?" (knows to search this company's transcript)
  • "Show me the competitive landscape" (knows to pull peer comparisons)
  • MCP Server

    The Model Context Protocol (MCP) server exposes your financial retrieval system as a data source for other AI tools. Any MCP-compatible client (Claude Desktop, Cursor, etc.) can query your Finance Analyst.

    Tools

  • search_filings(query, ticker?, period?) — Search SEC filings with optional filters
  • get_company_metrics(ticker, period) — Return structured financial metrics (revenue, margins, EPS)
  • compare_companies(tickers[], metric, period) — Side-by-side comparison table
  • get_analyst_ratings(ticker) — Current ratings, price targets, and recent changes
  • get_earnings_summary(ticker, period) — AI-generated summary of earnings call
  • Resources

  • company_list — All companies in the system with tickers and sectors
  • available_periods — Which fiscal periods have data for each company
  • analyst_coverage — Which analysts cover which companies
  • This means a user in Claude Desktop can ask "What's NVDA's gross margin trend?" and Claude will call your MCP server's get_company_metrics tool to get real data from your financial database — not from its training data.

    Scheduled Reports

    Weekly Portfolio Summary

    Every Monday morning, automatically:

  • Pull the latest data for all tracked companies
  • Run the analysis agent for each company (parallel)
  • Generate a summary with: price changes, margin trends, rating changes, notable earnings call themes
  • Distribute via email and Slack
  • Earnings Season Automation

    During earnings season (Jan-Feb, Apr-May, Jul-Aug, Oct-Nov):

  • Monitor for new SEC filings (daily check)
  • When a filing arrives, auto-ingest it into the data lake
  • Generate a standardized analysis
  • Post to Slack with comparison to consensus estimates
  • Update metric dashboards
  • Price Alert Integration

    When market data shows significant moves:

  • Stock drops >5% in a day → Trigger analysis of recent filings and analyst notes
  • Stock hits new 52-week high/low → Generate technical + fundamental summary
  • Analyst consensus shifts → Summary of rating changes and new thesis arguments
  • Monitoring

    Financial-Specific Metrics

    Beyond standard latency and error rates, monitor:

  • Number validation pass rate — What percentage of generated numbers are verified against sources? Target: >90%. If this drops below 80%, the retrieval system or prompts need attention.
  • Data freshness — How old is the most recent filing for each tracked company? Alert when expected filings are late.
  • Cache hit ratio — Financial queries should have 30-40% cache hits during normal trading days (analysts ask similar questions). If cache hit ratio drops, check if TTLs are too aggressive.
  • Cost per analysis — Average token usage per query type. Comparison queries cost 3-5x more than simple lookups.
  • Alerting Thresholds

  • Error rate > 5% → Page on-call
  • p95 latency > 5 seconds → Investigate (likely database query performance)
  • Number validation pass rate < 80% → Review retrieval quality
  • Data freshness for any company > threshold → Check ingestion pipeline
  • Daily cost exceeds budget → Notify admin, throttle expensive queries
  • Operations Runbook

    Document the common failure modes:

  • Database connection exhausted → Connection pool sizing and cleanup
  • Embedding model timeout → Retry logic with circuit breaker
  • LLM rate limit hit → Fallback model chain (Opus → Sonnet → Haiku)
  • Stale data alert → Manual ingestion pipeline trigger
  • Number validation failure spike → Review recent prompt changes, check retrieval relevance
  • The Complete System

    At the end of this module, you have a production financial AI system:

  • Data pipeline ingesting SEC filings, transcripts, market data, analyst notes
  • Vector database with table-aware chunking and financial metadata
  • Hybrid retrieval with numerical awareness and period filtering
  • AI gateway with number validation, freshness checks, and disclaimers
  • Financial dashboard with streaming analysis and metric comparisons
  • Slack integration with earnings alerts and threaded conversations
  • MCP server exposing financial data to other AI tools
  • Monitoring tracking accuracy, freshness, cost, and latency
  • This is a system a real financial analysis team could use daily — and the monitoring and compliance trail to prove it's reliable.

    This is chapter 6 of AI Finance Analyst.

    Get the full hands-on course for $100 and build the complete system. Your projects become your portfolio.

    View course details