Skip to main content
Glama

Insurance Customer Migration Analysis POC

一个生产级的概念验证,演示客户迁移分析,使用:

  • Data Layer:模拟旧系统(Excel)与新产品(CSV)及竞品数据

  • MCP Server:暴露给 CrewAI 代理的数据访问工具

  • CrewAI:查询路由器 + 分析代理,用于多步推理

  • Gradio UI:面向高管的友好自然语言界面

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

Related MCP server: Database MCP Server

设置

1. 依赖

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 - 竞品历史记录

运行应用

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. “How many customers renewed into the new product?”

    • 返回:续保到新产品 + 迁移成功比例

  2. “How many customers left update and went to competitors?”

    • 返回:数量 + 按 status 分层(ACTIVE/EXPIRED/CANCELLED)

  3. “How many came back from competitors and why?”

    • 返回:返回数量 + 原因(价格、功能等)

  4. “What's the overall migration summary?”

    • 返回:全面的迁移总结和客户细分分析

  5. “Tell me about customers in California”

    • 返回:特定州参数

  6. “Who adopted the CONNECTED feature?”

    • 返回:功能采用情况分解

项目结构

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、CSV、Cassandra

  • “Redshift” 中的 CSV(数据源分层与竞品分析)

MCP Over Direct Queries

  • 数据与推理之间干净的分隔

  • 生产级:以后可改挂 Redshift,而非硬写查询

  • 代理聚焦于推理,不触碰底层连接

模板 + 动态回退

  • 快速路径:预定义常用查询

  • 灵活路径:CrewAI 为边缘 case 动态创建推理逻辑

  • 软推理:结合价格 + 功能介绍客户为什么回归

后续步骤

第一阶段:数据 ✅

  • 模拟数据(900 legacy + 100 new + 竞品覆盖)

第二阶段:MCP ✅

  • 数据访问工具(GetRenewedCount、GetLeftCount 等)

第三阶段:CrewAI ✅

  • 查询路由 + 分析代理

第四阶段:测试

  • 运行示例查询并验证结果准确性

  • 覆盖边界 case

第五阶段:UI ✅

  • Gradio 管理界面

未来增强

  • 用实际 AWS Redshift 替换 CSV

  • 增加州级漏斗

  • 导出 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 错误

  • 确保 .env 中已设置 ANTHROPIC_API_KEY

  • 确认你有 Claude 3.5 Sonnet(或更高版本)访问权限

开发

添加新查询工具

  1. 在 DataLayer(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