demo-redshift-mcp
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 executivesRelated MCP server: Database MCP Server
セットアップ
1. 依存関係のインストール
# Install using uv (recommended)
uv sync
# OR using pip
pip install -r requirements.txt2. 環境セットアップ
cp .env.example .env
# Edit .env and add your ANTHROPIC_API_KEY3. モックデータの生成
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)
"経営者向けサンプル質問
「新製品に更新した顧客は何人ですか?」
返答: 件数+移行成功率
「競合他社へ流出した顧客は何人ですか?」
返答: 件数+ステータス別の内訳(ACTIVE/EXPIRED/CANCELLED)
「競合他社から戻ってきた顧客は何人ですか?その理由は?」
返答: 復帰件数+理由(価格、機能など)
「移行の全体サマリーはどうなっていますか?」
返答: 全セグメントの総合分析
「カリフォルニアの顧客について教えてください」
返答: 州別の指標
「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_generatorCrewAIのエラー
ANTHROPIC_API_KEY が .env に設定されていることを確認してください
Claude 3.5 Sonnet(またはそれ以降)へのアクセスがあることを確認してください
開発
新しいクエリツールの追加
DataLayerにメソッドを追加します(add_method(data_layer.py))InsuranceMCPToolsでラップします(mcp_server.py)CrewAI の @tool ラッパーを作成します(crew_agents.py)
analysis_task内のルーティングロジックを更新します
ローカルでのテスト
from src.demo_redshift_mcp.data_layer import DataLayer
data = DataLayer()
result = data.customers_renewed()
print(result)ライセンス
内部向けPOC - 適切なデータガバナンスなしの本番使用は不可。
This server cannot be installed
Maintenance
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
- FlicenseNot gradedqualityDmaintenanceEnables 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.
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to securely interact with multiple databases (MySQL, PostgreSQL) via natural language queries, with cross-database querying and enterprise-grade security.15MIT
- FlicenseNot gradedqualityBmaintenanceProvides retrieval-augmented generation for insurance claims, enabling search, clause retrieval, and governed tool-calling over policy documents using local LLM (Ollama).
- FlicenseNot gradedqualityBmaintenanceExposes 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.
Related MCP Connectors
Create and manage AI agents that collaborate and solve problems through natural language interacti…
Real SEC, 13F, insider, congress & macro data your AI agent can cite. Hosted MCP, 24 tools.
Analytical memory for AI agents: a real Postgres queried in plain English over MCP. One command.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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