demo-redshift-mcp

demo-redshift-mcp

Enables natural-language analysis of insurance customer migration data through CrewAI agents, providing tools for querying renewals, churn, competitor returns, and feature adoption.

Category
Visit Server

README

Insurance Customer Migration Analysis POC

A production-grade proof-of-concept demonstrating customer migration analysis using:

  • Data Layer: Mock legacy (Excel) + new product (CSV) + competitor data
  • MCP Server: Data access tools exposed to CrewAI agents
  • CrewAI: Query router + analysis agents for multi-step reasoning
  • Gradio UI: Executive-friendly natural language interface

Architecture

Executive Question
    ↓
Gradio UI
    ↓
CrewAI Router Agent (query understanding)
    ↓
CrewAI Analysis Agent (data fetching + insights)
    ↓
MCP Tools (GetRenewedCount, GetLeftCount, etc.)
    ↓
Data Layer (pandas + Excel/CSV queries)
    ↓
Response formatted for executives

Setup

1. Install Dependencies

# Install using uv (recommended)
uv sync

# OR using pip
pip install -r requirements.txt

2. Environment Setup

cp .env.example .env
# Edit .env and add your ANTHROPIC_API_KEY

3. Generate Mock Data

python -m demo_redshift_mcp.data_generator

This creates:

  • data/legacy_product.xlsx - 900 legacy customers
  • data/new_product_customers.csv - 100 new product customers
  • data/competitor_coverage.csv - Competitor history

Running the Application

Web UI (Recommended)

# Launch Gradio interface
python -m demo_redshift_mcp

# Opens at http://localhost:7860

Command Line (Testing)

python -c "
from src.demo_redshift_mcp.crew_agents import run_customer_migration_analysis
result = run_customer_migration_analysis('How many customers renewed?')
print(result)
"

Sample Questions for Executives

  1. "How many customers renewed into the new product?"

    • Returns: Count + percentage of migration success
  2. "How many customers left and went to competitors?"

    • Returns: Count + breakdown by status (ACTIVE/EXPIRED/CANCELLED)
  3. "How many came back from competitors and why?"

    • Returns: Return count + reasons (price, features, etc.)
  4. "What's the overall migration summary?"

    • Returns: Comprehensive analysis of all segments
  5. "Tell me about customers in California"

    • Returns: State-specific metrics
  6. "Who adopted the CONNECTED feature?"

    • Returns: Feature adoption breakdown

Project Structure

demo-redshift-mcp/
├── src/demo_redshift_mcp/
│   ├── app.py                 # Gradio UI entry point
│   ├── crew_agents.py         # CrewAI agents + workflow
│   ├── mcp_server.py          # MCP tools definition
│   ├── data_layer.py          # Data access logic
│   ├── data_generator.py      # Mock data generation
│   └── __init__.py
├── data/                      # Generated mock data
│   ├── legacy_product.xlsx
│   ├── new_product_customers.csv
│   └── competitor_coverage.csv
├── INSURANCE_POC_ARCHITECTURE.md
├── pyproject.toml
└── .env

Key Design Decisions

Data Separation (Excel vs CSV)

  • Legacy: Excel (simulates existing systems)
  • New: CSV in "Redshift" (simulates cloud OLAP)
  • Reason: Tests cross-store join logic early

MCP Over Direct Queries

  • Clean abstraction between data and reasoning
  • Production-ready: swap CSV with Redshift later
  • Agents stay focused on reasoning, not plumbing

Template + Dynamic Fallback

  • Fast path: pre-defined queries for common questions
  • Flexible path: CrewAI creates logic for edge cases
  • Soft inference: combine pricing + feature signals to explain why customers returned

Next Steps

Phase 1: Data ✅

  • Mock data generation (900 legacy, 100 new, competitor coverage)

Phase 2: MCP ✅

  • Data access tools (GetRenewedCount, GetLeftCount, etc.)

Phase 3: CrewAI ✅

  • Query router + analysis agents

Phase 4: Testing

  • Run sample questions and verify accuracy
  • Test edge cases

Phase 5: UI ✅

  • Gradio interface for executives

Future Enhancements

  • [ ] Replace CSV with actual AWS Redshift
  • [ ] Add state-level dashboards
  • [ ] Export reports as PDF/Excel
  • [ ] Add historical trend analysis
  • [ ] Deploy as FastAPI endpoint

Troubleshooting

"Module not found" error

# Ensure you're in the right directory
cd /Users/Balu/Documents/Projects/MyCode/demo-redshift-mcp

# Reinstall dependencies
uv sync

"Data not found" error

# Generate mock data
python -m demo_redshift_mcp.data_generator

CrewAI errors

  • Ensure ANTHROPIC_API_KEY is set in .env
  • Check that you have Claude 3.5 Sonnet (or later) access

Development

Adding a New Query Tool

  1. Add method to DataLayer (data_layer.py)
  2. Wrap it in InsuranceMCPTools (mcp_server.py)
  3. Create CrewAI @tool wrapper (crew_agents.py)
  4. Update routing logic in analysis_task

Testing Locally

from src.demo_redshift_mcp.data_layer import DataLayer

data = DataLayer()
result = data.customers_renewed()
print(result)

License

Internal POC - Not for production use without proper data governance.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured