Content
# Level 2 Multi-Agent MCP Project
### CrewAI + MCP Server + Streamlit Data Analytics Platform
A complete **Level 2 Multi-Agent AI System** built using **CrewAI**, **Model Context Protocol (MCP)**, **Ollama**, and **Streamlit**.
The application allows multiple AI agents to collaborate on CSV datasets through an MCP server that exposes reusable analytical tools.
---
# Project Overview
This project demonstrates a real-world implementation of a **multi-agent architecture** where:
- A **Supervisor Agent** coordinates the workflow.
- A **Data Analyst Agent** performs profiling, SQL queries, KPI analysis, and data quality checks.
- A **Data Scientist Agent** performs machine learning and predictive analytics.
- All analytical capabilities are exposed through an **MCP Server**.
- Users interact with the system through a **Streamlit** web application.
The project follows the Level 2 assignment specification for:
- CrewAI
- Multi-Agent Systems
- MCP Server
- Function Tools
- Local LLM (Ollama)
- Streamlit UI
---
# System Architecture
```
User
│
▼
Streamlit Interface
│
▼
Supervisor Agent
(CrewAI Manager)
/ \
/ \
▼ ▼
Data Analyst Agent Data Scientist Agent
│ │
└──────────┬───────┘
▼
MCP Server
│
┌────────────┼─────────────┐
│ │ │
CSV Profile KPI Tools ML Tools
SQL Tools Data Quality Report Tools
```
---
# Features
## Multi-Agent Workflow
- Supervisor Agent
- Data Analyst Agent
- Data Scientist Agent
- Sequential CrewAI execution
- Automatic task delegation
---
## MCP Server
The MCP server exposes reusable analytical tools including:
- CSV Profiling
- SQL Queries
- KPI Calculations
- Data Quality Checks
- Machine Learning
- Report Generation
---
## Streamlit Interface
- Upload CSV files
- Natural language prompts
- Agent execution timeline
- Live execution logs
- Final report generation
---
## AI Features
- CSV profiling
- Missing value analysis
- Duplicate detection
- Statistical summaries
- SQL-like querying
- KPI calculations
- Regression
- Classification
- Clustering
- Automatic reporting
---
# Folder Structure
```
level_2_multi_agent_mcp_project/
│
├── app.py
├── requirements.txt
├── README.md
│
├── config/
│ ├── agents.yaml
│ └── tasks.yaml
│
├── agents/
│ ├── supervisor_agent.py
│ ├── data_analyst_agent.py
│ └── data_scientist_agent.py
│
├── function_tools/
│ ├── supervisor_tools.py
│ ├── analyst_tools.py
│ └── scientist_tools.py
│
├── mcp_server/
│ ├── server.py
│ ├── tools/
│ │ ├── csv_profile_tools.py
│ │ ├── sql_tools.py
│ │ ├── data_quality_tools.py
│ │ ├── kpi_tools.py
│ │ ├── ml_tools.py
│ │ └── report_tools.py
│ │
│ └── sample_data/
│ ├── events_sample.csv
│ ├── transactions_sample.csv
│ └── customers_sample.csv
│
├── tests/
│ ├── test_supervisor_tools.py
│ ├── test_analyst_tools.py
│ ├── test_scientist_tools.py
│ └── test_mcp_tools.py
│
└── docs/
├── architecture.md
├── mcp_tool_catalog.md
└── demo_script.md
```
---
# Technology Stack
| Component | Technology |
|------------|------------|
| Programming Language | Python 3.12 |
| Multi-Agent Framework | CrewAI |
| Local LLM | Ollama |
| LLM Model | Llama3 |
| MCP | Model Context Protocol |
| UI | Streamlit |
| Data Processing | Pandas |
| Machine Learning | Scikit-learn |
| SQL Engine | SQLite |
| Charts | Matplotlib |
---
# MCP Tools
## 1. CSV Profile Tool
Functions
- Load CSV
- Dataset Shape
- Column Names
- Data Types
- Missing Values
- Duplicate Rows
- Summary Statistics
- Memory Usage
- Dataset Preview
- Complete Dataset Profile
---
## 2. SQL Tool
Functions
- Load CSV into SQLite
- Execute SQL Queries
- Return Results
- Export Query Output
---
## 3. Data Quality Tool
Functions
- Missing Value Detection
- Duplicate Detection
- Outlier Detection
- Invalid Data Detection
- Data Quality Score
---
## 4. KPI Tool
Functions
- Sum
- Average
- Median
- Minimum
- Maximum
- Standard Deviation
- Variance
- Count
- Percentiles
- Group-wise KPIs
---
## 5. Machine Learning Tool
Functions
- Regression
- Classification
- Clustering
- Train/Test Split
- Prediction
- Model Evaluation
---
## 6. Report Tool
Functions
- Markdown Reports
- HTML Reports
- Text Reports
- Export Analysis Summary
---
# Agent Responsibilities
## Supervisor Agent
Responsibilities
- Understand user prompt
- Plan workflow
- Delegate tasks
- Combine outputs
- Generate final response
---
## Data Analyst Agent
Responsibilities
- Profile datasets
- Run SQL analysis
- Compute KPIs
- Perform data quality checks
---
## Data Scientist Agent
Responsibilities
- Build ML models
- Predict outcomes
- Evaluate models
- Generate insights
---
# Installation
## Clone Repository
```bash
git clone <repository-url>
cd level_2_multi_agent_mcp_project
```
---
## Create Virtual Environment
Windows
```bash
python -m venv .venv
```
Activate
```bash
.venv\Scripts\activate
```
Linux / Mac
```bash
python3 -m venv .venv
source .venv/bin/activate
```
---
## Install Dependencies
```bash
pip install -r requirements.txt
```
---
# Install Ollama
Download:
https://ollama.com/download
---
Pull Llama3
```bash
ollama pull llama3
```
Start Ollama
```bash
ollama serve
```
---
# Run Application
```bash
streamlit run app.py
```
The application will open automatically in your browser.
---
# Sample Datasets
The project includes three sample datasets.
## customers_sample.csv
Contains:
- Customer IDs
- Gender
- Age
- Income
- Region
---
## transactions_sample.csv
Contains:
- Transaction IDs
- Customer IDs
- Amount
- Product
- Date
---
## events_sample.csv
Contains:
- Event IDs
- Timestamp
- User Actions
- Event Types
---
# Example Prompts
Example 1
```
Profile the customers_sample.csv dataset.
```
---
Example 2
```
Find missing values and duplicates in the transactions dataset.
```
---
Example 3
```
Calculate revenue KPIs by product category.
```
---
Example 4
```
Run a regression model to predict sales.
```
---
Example 5
```
Generate a complete analytical report.
```
---
# Running Tests
Run all tests
```bash
pytest
```
Run specific tests
```bash
pytest tests/test_supervisor_tools.py
```
```bash
pytest tests/test_analyst_tools.py
```
```bash
pytest tests/test_scientist_tools.py
```
```bash
pytest tests/test_mcp_tools.py
```
---
# Documentation
Additional documentation is available in the `docs/` directory:
- `architecture.md` – System architecture and workflow.
- `mcp_tool_catalog.md` – Details of all MCP tools.
- `demo_script.md` – Suggested demonstration script.
---
# Expected Workflow
1. User uploads one or more CSV files.
2. User enters an analysis prompt.
3. Supervisor Agent interprets the request.
4. Tasks are delegated to Analyst and Scientist agents.
5. Agents invoke MCP tools as needed.
6. Results are aggregated.
7. A final report is generated and displayed.
---
# Learning Outcomes
This project demonstrates:
- Multi-Agent AI systems
- CrewAI orchestration
- Model Context Protocol (MCP)
- Function tool integration
- Local LLM deployment with Ollama
- Data analytics pipelines
- Machine learning workflows
- Streamlit application development
- Automated reporting
---
# Future Enhancements
- Support additional file formats (Excel, JSON, Parquet)
- Interactive data visualizations
- Natural language SQL generation
- Real-time streaming analytics
- Vector database integration
- Retrieval-Augmented Generation (RAG)
- Multi-user authentication
- Cloud deployment
---
# Author
**Twinkle Pradhan**
Level 2 Multi-Agent MCP Project
CrewAI • MCP • Ollama • Streamlit