ChurnCue
Production-oriented customer-retention intelligence that uses deterministic machine learning to predict churn and generate prioritized rescue reports, governed through MCP tools.
README
<div align="center"> <img src="assets/brand/churncue-mark.svg" alt="ChurnCue logo" width="112" />
ChurnCue
Know who may leave. Understand the signal. Protect the renewal.
Production-oriented customer-retention intelligence for Archestra, powered by deterministic machine learning over MCP.
Quickstart · Architecture · Archestra setup · App prompt · Demo script </div>
<img src="assets/brand/churncue-hero.png" alt="ChurnCue customer-retention intelligence pipeline" width="100%" />
The Monday-morning problem
Customer-success teams repeatedly need to answer five questions before renewal risk becomes lost revenue:
- Which customers are likely to cancel?
- Who became riskier this week?
- Which observed signals explain the change?
- How much recurring revenue is exposed?
- What action should the team take next?
ChurnCue converts anonymous customer-health records into a prioritized, evidence-backed rescue queue. It keeps model calculations in deterministic Python services and keeps outbound Slack notifications behind explicit human approval.
Why ChurnCue
| Capability | What it delivers |
|---|---|
| Deterministic ML | All metrics and probabilities come from scikit-learn—not the LLM. |
| Weekly movement | Compares current probability with prior risk and identifies newly-at-risk accounts. |
| Revenue prioritization | Quantifies probability-weighted monthly and annual revenue exposure. |
| Evidence, not guesswork | Returns stable reason codes from observed product, payment, support, login, renewal, and satisfaction signals. |
| Governed operations | Generates a Slack-ready preview but never sends an external message. |
| Production boundaries | Validated input limits, PII rejection, safe artifact resolution, structured logs, health checks, and non-root containers. |
System architecture
<div align="center"> <img src="docs/assets/churncue-end-to-end-handwritten.png" alt="Handwritten end-to-end ChurnCue architecture showing the Archestra, MCP gateway, dataset, experiment, and scoring flow" width="100%" /> <p><em>Customer records stay inside ChurnCue while compact identifiers move safely between MCP tools.</em></p> </div>
flowchart LR
Demo[Anonymous demo CSV]
subgraph Archestra[Archestra]
App[ChurnCue App]
Orchestrator[MCP Orchestrator]
Approval{Human approval}
end
subgraph Service[ChurnCue MCP]
Load[Load + store dataset]
Profile[Profile + validate]
Train[Train + compare]
Score[Score + explain]
Report[Rescue report]
Runtime[(Dataset + score-run state)]
end
Demo --> Load
App --> Orchestrator --> Load
Load -->|dataset_id| Profile --> Train --> Score
Score -->|score_run_id| Report
Load --> Runtime
Score --> Runtime
Train --> Metadata[(SQLite metadata)]
Train --> Artifacts[(joblib artifacts)]
Report --> Approval
Approval -->|approved only| Slack[Slack MCP]
Archestra is the authenticated application interface and MCP orchestrator. ChurnCue MCP stores demo rows internally and exposes only compact dataset and score-run identifiers to the model. Slack MCP receives only messages that a human approves.
Governed rescue workflow
<div align="center"> <img src="docs/assets/churncue-governed-rescue-workflow.png" alt="Block diagram showing a customer-success manager asking ChurnCue who may leave, with Archestra governing tool access, ChurnCue MCP running the machine-learning pipeline, the model explaining verified results, and a prioritized rescue report returning to the manager" width="100%" /> <p><em>ML predicts, MCP connects, the model explains, and Archestra controls the complete workflow.</em></p> </div>
The block diagram follows a real customer-success request: “Which customers are most likely to leave this week, and whom should we contact first?”
- The manager asks the business question in Archestra.
- The Archestra agent selects only the approved ChurnCue tools. Access controls, guardrails, and activity logs govern the interaction.
- ChurnCue MCP exposes the prediction workflow through eight bounded tools.
- The deterministic machine-learning pipeline trains, scores, and ranks customers, returning verified scores and compact identifiers.
- The model explains those tool-produced results without inventing calculations.
- Archestra presents a prioritized rescue report so the manager knows whom to contact first.
Weekly review flow
Load demo → dataset_id → Profile quality → Train 3 models → experiment_id
→ Score customers → score_run_id → Compare risk → Rescue report
→ Preview Slack message → Human approval → Slack MCP sends
Quickstart
Run locally
git clone https://github.com/Bhaktabahadurthapa/ChurnCue.git
cd ChurnCue
python3.12 -m venv .venv
source .venv/bin/activate
pip install -e '.[dev]'
python scripts/generate_demo_data.py
churncue
Verify the service:
curl http://localhost:8000/health
npx -y @modelcontextprotocol/inspector
Connect the Inspector to http://localhost:8000/mcp with Streamable HTTP.
Run with Docker
docker compose up --build -d
docker compose ps
curl http://localhost:8000/health
Stop the service with docker compose down. SQLite metadata and model artifacts remain in named volumes.
Connect to Archestra
Register a remote Streamable HTTP server in Archestra's Private MCP Registry:
Name: ChurnCue
URL: http://host.docker.internal:8000/mcp
Linux-hosted Archestra containers may need host.docker.internal:host-gateway. Assign all eight tools to the app, then paste the ready-to-use application prompt into Archestra Chat.
MCP tool surface
| Tool | Responsibility | Key output |
|---|---|---|
health_check |
Runtime readiness | Name, version, transport, timestamp |
load_demo_dataset |
Store bounded anonymous demo data | Dataset ID, count, compact summary |
profile_dataset |
Schema and quality analysis | Types, missing values, duplicates, summaries |
train_models |
Reproducible model evaluation | Metrics, confusion matrices, recommended model |
score_customers |
Score a dataset by ID | Score-run ID, totals, top-risk preview |
compare_weekly_risk |
Compare a score run by ID | Movement totals and top-change preview |
explain_risk |
Deterministic reason codes | Evidence and non-causality statement |
generate_rescue_report |
Operational prioritization | Totals, priority queue, Slack-ready preview |
Recommended call order:
load_demo_dataset → dataset_id → profile_dataset + train_models
dataset_id + experiment_id → score_customers → score_run_id
score_run_id → compare_weekly_risk + explain_risk + generate_rescue_report
Machine-learning pipeline
| Stage | Implementation |
|---|---|
| Validation | Binary target, both classes, minimum sample size, bounded scalar records |
| Leakage control | Drops customer_id, target, and prediction-derived fields |
| Missing values | Median imputation for numeric; most-frequent imputation for categorical |
| Encoding | Standard scaling and unknown-safe one-hot encoding |
| Evaluation | Fixed 80/20 stratified split with random state 42 |
| Models | Logistic Regression, Random Forest, Gradient Boosting |
| Metrics | Accuracy, precision, recall, F1, ROC-AUC, confusion matrix |
| Selection | Highest ROC-AUC with F1 as the tie-breaker |
| Persistence | Complete pipeline in joblib; immutable experiment metadata in SQLite |
The included dataset contains 50 reproducible synthetic customers and no real personal data.
Configuration
All runtime variables use the CHURNCUE_ prefix. Safe defaults are documented in .env.example.
| Variable | Default | Purpose |
|---|---|---|
CHURNCUE_HOST |
0.0.0.0 |
Container listener address |
CHURNCUE_PORT |
8000 |
MCP and health port |
CHURNCUE_DATABASE_PATH |
data/churncue.db |
Experiment metadata database |
CHURNCUE_ARTIFACT_DIR |
data/artifacts |
Trusted model artifact directory |
CHURNCUE_DEMO_DATA_PATH |
data/demo/customer_churn_demo.csv |
Packaged demo source |
CHURNCUE_MAX_INPUT_ROWS |
5000 |
Maximum MCP input records |
CHURNCUE_MAX_DEMO_ROWS |
50 |
Maximum records stored in one demo dataset |
CHURNCUE_MAX_STRING_LENGTH |
200 |
Scalar string boundary |
CHURNCUE_RANDOM_STATE |
42 |
Reproducible ML seed |
CHURNCUE_PUBLISHED_PORT |
8000 |
Optional Compose host-port override |
No API keys or customer credentials belong in this repository.
Security and privacy
- Anonymous
CUST-*identifiers only; common PII fields are rejected at the MCP boundary. - Dataset and score rows stay inside the ChurnCue process; MCP calls use opaque identifiers.
- Row, field, string, probability, and schema limits defend resource boundaries.
- Experiment IDs resolve only to service-created artifacts below the configured directory.
- The service performs no arbitrary code execution, arbitrary path reads, browser fetches, or outbound messages.
- Containers run as UID/GID
10001, drop Linux capabilities, and enableno-new-privileges. - Production deployments should terminate authenticated TLS at Archestra or a trusted gateway.
Review SECURITY.md before production use or vulnerability reporting.
Repository layout
.
├── assets/brand/ # Repository identity and hero artwork
├── data/demo/ # Reproducible anonymous dataset
├── data/artifacts/ # Runtime model pipelines (ignored)
├── docs/ # Archestra, architecture, and demo guides
├── scripts/ # Demo-data generation
├── src/churncue/ # MCP server and deterministic business logic
├── tests/ # Core behavior and boundary coverage
├── Dockerfile
├── docker-compose.yml
└── pyproject.toml
Engineering quality
ruff check .
ruff format --check .
pytest
The test configuration enforces at least 80% core coverage. CI runs linting, formatting, tests, package installation, and a container build on every pull request.
Documentation
| Guide | Audience |
|---|---|
| Architecture | Engineers and security reviewers |
| Archestra setup | Operators connecting MCP services |
| Archestra app prompt | App builders generating the interface |
| Three-minute demo | Hackathon presenters |
| Contributing | Contributors and maintainers |
| Security | Vulnerability reporters and operators |
Demo and screenshots
The repository includes the complete sub-three-minute demo runbook. Add the final public video URL and Archestra screenshots here after recording; no mock browser results are presented as real product output.
Known limitations
- Synthetic training data demonstrates the workflow; it is not a production churn policy.
- Threshold reason codes are operational signals, not causal or SHAP explanations.
- SQLite and local artifacts target a single service instance.
- Risk thresholds are fixed product rules and should be calibrated before production use.
- Authentication, authorization, TLS, Sheets access, and Slack delivery are external deployment responsibilities.
Roadmap
- Time-aware evaluation, probability calibration, and drift monitoring
- Managed metadata storage and object-backed model artifacts
- Tenant-aware authorization and intervention audit events
- Feedback-driven retraining and intervention outcome measurement
- Published container releases with signed provenance and SBOMs
Contributing and license
Contributions are welcome. Read CONTRIBUTING.md, follow the Code of Conduct, and use the issue templates for reproducible reports.
ChurnCue is available under the MIT License.
<div align="center"> Built for the Archestra Apps Hackathon with Python, scikit-learn, FastMCP, and human judgment. </div>
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。