|
| 1 | +# Example: Budget Allocator App |
| 2 | + |
| 3 | +An interactive budget allocation tool demonstrating real-time data visualization with MCP Apps. |
| 4 | + |
| 5 | +## Features |
| 6 | + |
| 7 | +- **Interactive Sliders**: Adjust budget allocation across 5 categories (Marketing, Engineering, Operations, Sales, R&D) |
| 8 | +- **Donut Chart**: Real-time visualization of allocation distribution using Chart.js |
| 9 | +- **Sparkline Trends**: 24-month historical allocation data per category |
| 10 | +- **Percentile Badges**: Compare your allocation vs. industry benchmarks |
| 11 | +- **Stage Selector**: Switch between Seed, Series A, Series B, and Growth benchmarks |
| 12 | +- **Budget Presets**: Quick selection of $50K, $100K, $250K, or $500K totals |
| 13 | + |
| 14 | +## Running |
| 15 | + |
| 16 | +1. Install dependencies: |
| 17 | + |
| 18 | + ```bash |
| 19 | + npm install |
| 20 | + ``` |
| 21 | + |
| 22 | +2. Build and start the server: |
| 23 | + |
| 24 | + ```bash |
| 25 | + npm start |
| 26 | + ``` |
| 27 | + |
| 28 | + The server will listen on `http://localhost:3001/mcp`. |
| 29 | + |
| 30 | +3. View using the [`basic-host`](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/basic-host) example or another MCP Apps-compatible host. |
| 31 | + |
| 32 | +## Architecture |
| 33 | + |
| 34 | +### Server (`server.ts`) |
| 35 | + |
| 36 | +Exposes a single `get-budget-data` tool that returns: |
| 37 | + |
| 38 | +- Category definitions with colors and default allocations |
| 39 | +- Historical data (~120 data points) - 24 months of allocation history per category |
| 40 | +- Industry benchmarks (~60 data points) - Aggregated percentile data by company stage |
| 41 | + |
| 42 | +The tool is linked to a UI resource via `_meta[RESOURCE_URI_META_KEY]`. |
| 43 | + |
| 44 | +### App (`src/mcp-app.ts`) |
| 45 | + |
| 46 | +- Uses Chart.js for the donut chart visualization |
| 47 | +- Renders sparkline trends using inline SVG |
| 48 | +- Computes percentile rankings client-side from benchmark data |
| 49 | +- Updates all UI elements reactively on slider changes |
0 commit comments