Skip to main content
Glama

Insurance Customer Migration Analysis POC

本番レベルの概念実証(PoC)で、顧客移行分析を以下を用いて実証します:

  • データレイヤー: モックのレガシーデータ(Excel)+新製品データ(CSV)+競合他社データ

  • MCPサーバー: CrewAIエージェントに公開するデータアクセスツール

  • CrewAI: マルチステップ推論のためのクエリルーター+分析エージェント

  • Gradio UI: 経営者向けの自然言語インターフェース

アーキテクチャ

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

Related MCP server: Database MCP Server

セットアップ

1. 依存関係のインストール

# Install using uv (recommended)
uv sync

# OR using pip
pip install -r requirements.txt

2. 環境セットアップ

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

3. モックデータの生成

python -m demo_redshift_mcp.data_generator

以下が作成されます:

  • data/legacy_product.xlsx - レガシー顧客900件

  • data/new_product_customers.csv - 新製品顧客100件

  • data/competitor_coverage.csv - 競合他社の履歴

アプリケーションの実行

Web UI(推奨)

# Launch Gradio interface
python -m demo_redshift_mcp

# Opens at http://localhost:7860

コマンドライン(テスト)

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)
"

経営者向けサンプル質問

  1. 「新製品に更新した顧客は何人ですか?」

    • 返答: 件数+移行成功率

  2. 「競合他社へ流出した顧客は何人ですか?」

    • 返答: 件数+ステータス別の内訳(ACTIVE/EXPIRED/CANCELLED)

  3. 「競合他社から戻ってきた顧客は何人ですか?その理由は?」

    • 返答: 復帰件数+理由(価格、機能など)

  4. 「移行の全体サマリーはどうなっていますか?」

    • 返答: 全セグメントの総合分析

  5. 「カリフォルニアの顧客について教えてください」

    • 返答: 州別の指標

  6. 「CONNECTED機能を導入したのはどの顧客ですか?」

    • 返答: 機能採用の内訳

プロジェクト構造

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

主要な設計判断

データの分離(Excel vs CSV)

  • レガシー: Excel(既存システムをシミュレート)

  • 新規: "Redshift"内のCSV(クラウドOLAPをシミュレート)

  • 理由: データストア間の結合(JOIN)ロジックを早期に検証するため

直接クエリではなくMCP

  • データと推論の間にクリーンな抽象化を実現

  • 本番対応状態: 後日CSVをRedshiftに置き換え可能

  • エージェントは配管処理(plumbing)ではなく、推論に集中できる

テンプレート+動的フォールバック

  • 高速パス: 一般的な質問には定義済みクエリで対応

  • 柔軟なパス: エッジケースのロジックはCrewAIが生成

  • ソフト推論: 価格+機能のシグナルを組み合わせて、顧客が戻ってきた理由を説明

次のステップ

フェーズ1: データ ✅

  • モックデータの生成(レガシー900件、新規100件、競合カバレッジ)

フェーズ2: MCP ✅

  • データアクセスツール(GetRenewedCount、GetLeftCount など)

フェーズ3: CrewAI ✅

  • クエリルーター+分析エージェント

フェーズ4: テスト

  • サンプル質問を実行して精度を検証

  • エッジケースをテスト

フェーズ5: UI ✅

  • 経営者向けGradioインターフェース

将来の拡張

  • CSVを実際のAWS Redshiftに置き換える

  • 州レベルのダッシュボードを追加

  • レポートをPDF/Excelとしてエクスポート

  • 履歴トレンド分析を追加

  • FastAPIエンドポイントとしてデプロイ

トラブルシューティング

"Module not found" エラー

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

# Reinstall dependencies
uv sync

"Data not found" エラー

# Generate mock data
python -m demo_redshift_mcp.data_generator

CrewAIのエラー

  • ANTHROPIC_API_KEY が .env に設定されていることを確認してください

  • Claude 3.5 Sonnet(またはそれ以降)へのアクセスがあることを確認してください

開発

新しいクエリツールの追加

  1. DataLayer にメソッドを追加します(add_method(data_layer.py))

  2. InsuranceMCPTools でラップします(mcp_server.py)

  3. CrewAI の @tool ラッパーを作成します(crew_agents.py)

  4. analysis_task 内のルーティングロジックを更新します

ローカルでのテスト

from src.demo_redshift_mcp.data_layer import DataLayer

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

ライセンス

内部向けPOC - 適切なデータガバナンスなしの本番使用は不可。

F
license - not found
Not graded
quality - not tested
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • F
    license
    Not graded
    quality
    D
    maintenance
    Enables management of insurance claims, inspections, and contractors through interactive UI widgets and data tools. Users can view claim dashboards, update statuses, and query service provider information using natural language.
  • A
    license
    Not graded
    quality
    C
    maintenance
    Enables AI agents to securely interact with multiple databases (MySQL, PostgreSQL) via natural language queries, with cross-database querying and enterprise-grade security.
    15
    MIT
  • F
    license
    Not graded
    quality
    B
    maintenance
    Provides retrieval-augmented generation for insurance claims, enabling search, clause retrieval, and governed tool-calling over policy documents using local LLM (Ollama).
  • F
    license
    Not graded
    quality
    B
    maintenance
    Exposes a governed semantic layer built on dbt Core and DuckDB, enabling AI agents to query predefined metric definitions for a P&C insurance dataset. Prevents metric hallucination by restricting agents to governed tools and read-only data access.

View all related MCP servers

Related MCP Connectors

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/balu7771/demo-redshift-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server