An MCP (Model Context Protocol) server that exposes customer analytics and churn prediction capabilities to AI assistants like Claude Desktop. The server provides tools for data visualisation, correlation analysis, flexible querying, and machine learning predictions.
This project demonstrates how to build an MCP server that bridges AI assistants with data analysis and machine learning capabilities. It includes:
When Claude Desktop connects to this server, it can automatically call these tools to answer questions about customer behaviour, generate insights, and predict churn risk.
telco-mcp-server/
├── data/
│ ├── telco_customer_churn.csv # Original dataset
│ └── clean_data.csv # Cleaned dataset for the server
├── html_export/
│ └── Telco Customer Churn MCP Server.ipynb # HTML export of the jupyter notebook
├── notebooks/
│ └── Telco Customer Churn MCP Server.ipynb # Main notebook
├── src/
│ └── server.py # MCP server implementation
├── start_server.bat # Batch script to launch the server
├── environment.yml # Conda environment specification
└── README.md
Clone the repository
git clone <repository-url>
cd telco-mcp-server
Create the conda environment
conda env create -f environment.yml
conda activate mcp-analyst_py311
Run the notebook to generate clean data
Open notebooks/Telco Customer Churn MCP Server.ipynb and run all cells to create data/clean_data.csv.
Edit the src/server.py file to set the correct path to clean_data.csv.
Configure Claude Desktop
Edit your Claude Desktop configuration file:
Location: %APPDATA%\Claude\claude_desktop_config.json
Add this entry to the mcpServers section:
{
"mcpServers": {
"telco-analyst": {
"command": "cmd.exe",
"args": [
"/c",
"C:\\path\\to\\telco-mcp-server\\start_server.bat"
]
}
}
}
Replace C:\\path\\to\\telco-mcp-server with the actual path to your project folder.
Restart Claude Desktop
The MCP server will start automatically when Claude Desktop launches.
Once configured, open Claude Desktop and ask questions that trigger the tools:
| Query Type | Example |
|---|---|
| Distribution plotting | “Show me the distribution of MonthlyCharges” |
| Correlation analysis | “What’s the correlation between tenure and churn?” |
| Data filtering | “Show me senior citizens paying over £70 per month” |
| Churn prediction | “Predict churn risk for a customer with: Female, not a senior citizen, tenure of 3 months, fibre optic internet, month-to-month contract, monthly charges £85” |
Claude will automatically call the appropriate MCP tools and return results with visualisations, data summaries, or predictions.
Generates distribution visualisations for any column in the dataset. Automatically selects bar charts for categorical data or histograms for numerical data.
Creates a heatmap showing Pearson correlations between all numerical features, useful for understanding relationships between variables like tenure, charges, and churn.
Filters the dataset using pandas query syntax. Supports complex conditions like "SeniorCitizen == 'Yes' and MonthlyCharges > 70".
Predicts churn probability for a customer based on 19 input features. Returns:
A telecommunications dataset containing 7,043 customers with 21 features covering:
Source: Kaggle - Telco Customer Churn
This project is for educational purposes.