Customer Retention & LTV Intelligence MCP
Core Problem
Brands scale campaigns that look profitable on first purchase but destroy long-term unit economics.
What This Server Provides
This folder contains a production-minded MCP server scaffold with typed JSON tool responses, connector health metadata, OAuth-oriented configuration, rate-limit guards, stable error envelopes, and deterministic demo data until live vendor integrations are attached.
This server has received a production pass. It now includes local customer economics models for acquisition-channel LTV, gross-profit payback, churn-risk segmentation, repurchase cohorts, lifecycle flow performance, safe winback staging, and best-segment discovery.
Connectors
- Shopify Admin API via OAuth scope
read_customers; env prefixSHOPIFY - Klaviyo API via OAuth scope
profiles:read; env prefixKLAVIYO - Postscript API via OAuth scope
sms.read; env prefixPOSTSCRIPT - Yotpo Loyalty API via OAuth scope
loyalty.read; env prefixYOTPO - Google Ads API via OAuth scope
adwords.readonly; env prefixGOOGLE_ADS - Meta Ads API via OAuth scope
ads_read; env prefixMETA_ADS
MCP Tools
get_ltv_by_channel- LTV by acquisition source over a configurable window.get_churn_risk_segment- Customers most likely to lapse.get_repurchase_rate_by_channel- Cohort repurchase rates by source.get_email_flow_performance- Revenue per recipient and drop-off.trigger_winback_campaign- Safely queue a win-back flow action.get_best_performing_segments- Highest-LTV customer profiles and traits.
Current Local Capabilities
- Calculates LTV, gross-profit LTV, LTV:CAC, profit after CAC, and repurchase rate by channel.
- Finds high, medium, and low churn-risk lifecycle segments.
- Computes repurchase rate and revenue per customer for monthly cohorts.
- Reports email flow open, click, order, and revenue-per-recipient metrics.
- Stages winback campaigns for approval instead of sending automatically.
- Blocks low-risk customers from winback campaigns through a policy guardrail.
- Identifies best customer traits for acquisition and retention planning.
Test
python -m pytest .\tests -q -p no:cacheprovider
Partial Platform Support
Customers only need to connect the retention platforms they actually use. Missing Shopify, Klaviyo, Postscript, Yotpo, Google Ads, or Meta Ads credentials do not prevent the server from starting or running local intelligence tools.
Use get_live_connector_status to see configured connectors. Use test_shopify_retention_connection and test_klaviyo_connection for read-only live smoke checks when those platforms are connected.
Running Locally
powershell
python -m venv .venv
.\.venv\Scripts\pip install -e .
.\.venv\Scripts\python -m customer_retention_ltv_mcp.server
Claude Desktop Config
json
{
"mcpServers": {
"customer-retention-ltv": {
"command": "python",
"args": ["-m", "customer_retention_ltv_mcp.server"],
"cwd": "D:\CUSTOMS\EARNALL\MCP Servers\04-customer-retention-ltv"
}
}
}
Production Checklist
- Create OAuth 2.1 apps for each connector and set *_CLIENT_ID plus *_CLIENT_SECRET.
- Store refresh tokens in a secrets manager, never in repo files.
- Replace deterministic demo rows in server.py with API adapter calls.
- Persist raw snapshots and normalized warehouse tables for trend analysis.
- Add integration tests with recorded fixtures for every connector.
- Validate every tool in MCP Inspector before publishing.
- Deploy with a /health route through FastMCP streamable HTTP on Railway or Render.
Metadata
Release files for customer-retention-ltv-mcp 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| customer_retention_ltv_mcp-0.1.1.tar.gz | 17.6 kB | Without provenance | Details for customer_retention_ltv_mcp-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| customer_retention_ltv_mcp-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for customer_retention_ltv_mcp-0.1.1-py3-none-any.whl |
Total release size: 35.5 kB
Release files / customer_retention_ltv_mcp-0.1.1.tar.gz
| Download URL | customer_retention_ltv_mcp-0.1.1.tar.gz |
|---|---|
| Size | 17.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8b8cd19faf643cdfb945455afc221239aec3d66b55781443d66b1bb81d753833
|
|
BLAKE2b-256 checksum How to use checksums |
232cf8481159753cb5609be917801c3f7e0e906143fb44d78c532c92f5cb84ce
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.5
|
Release files / customer_retention_ltv_mcp-0.1.1-py3-none-any.whl
| Download URL | customer_retention_ltv_mcp-0.1.1-py3-none-any.whl |
|---|---|
| Size | 17.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f808c068d4176e886f8725c2ef9efc63a971ba27a7beeea9f9cebff2cb785a72
|
|
BLAKE2b-256 checksum How to use checksums |
4b6b3b25ca467806fe8419a1db1ab9b5e68d021c66101bc106f74b80793159fa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.5
|
Security for customer-retention-ltv-mcp 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.