Spaces:
Sleeping
Sleeping
| title: MCP | |
| emoji: 📈 | |
| colorFrom: green | |
| colorTo: pink | |
| sdk: gradio | |
| sdk_version: 5.27.0 | |
| app_file: app.py | |
| pinned: false | |
| short_description: MCP Data Analyst Duo | |
| # MCP: Data Analyst Duo | |
| A lightweight two-agent pipeline using the **Model Context Protocol (MCP)** to load a CSV, compute statistics & correlations, interpret results with simple rule-based insights, and assemble a Markdown report—all powered by a Gradio interface. | |
| --- | |
| ## Features | |
| - **ComputeAgent** | |
| - Loads any publicly-accessible CSV into a pandas DataFrame | |
| - Computes descriptive statistics (count, mean, std, min, quartiles, max) | |
| - Computes a Pearson correlation matrix for all numeric columns | |
| - **InterpretAgent** | |
| - Acknowledges each compute result | |
| - Picks top 3 columns by range and top 3 strongest correlations | |
| - Formats human-readable insights and a concise summary | |
| - Assembles a final Markdown report combining preview, metrics, and insights | |
| - **Gradio UI** | |
| 1. **Input:** Paste your CSV URL | |
| 2. **Outputs (in order):** | |
| - First five rows preview | |
| - JSON statistics | |
| - JSON correlation matrix | |
| - ComputeAgent message history | |
| - InterpretAgent message history | |
| - Final Markdown report | |
| --- | |
| ## Architecture | |
| 1. **MCPMessage** | |
| - Typed messages (`request_*`, `*_result`, `ack`, `*_interpretation`, `report_result`) | |
| - Ensures strict request–response semantics | |
| 2. **ComputeAgent** | |
| - Handlers for `request_data_load`, `request_statistics`, `request_correlation` | |
| - Emits `data_load_result`, `statistics_result`, `correlation_result` | |
| 3. **InterpretAgent** | |
| - Receives compute results, replies with `ack` | |
| - Runs `interpret_statistics` & `interpret_correlation` tools | |
| - Emits `statistics_interpretation`, `correlation_interpretation` | |
| - On `request_report`, emits `report_result` with assembled Markdown | |
| --- | |
| ## Usage | |
| 1. Clone or fork this Space. | |
| 2. Ensure your CSV is publicly accessible (e.g., hosted on GitHub, S3, etc.). | |
| 3. In the Gradio UI, paste the CSV URL and click **Run**. | |
| 4. Inspect each output panel—preview, raw metrics, histories, then read the final report summary. | |