Skip to content

Commit 79fa100

Browse files
Add scenario-modeler-server example
Demo MCP App for SaaS financial planning with: - Interactive sliders for MRR, growth, churn, margin, and costs - 12-month projection charts (MRR, Gross Profit, Net Profit) - 5 pre-built scenario templates (Bootstrapped, VC Rocketship, etc.) - Template comparison overlay for strategy analysis - Light/dark theme support 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent f81d17f commit 79fa100

File tree

17 files changed

+1743
-0
lines changed

17 files changed

+1743
-0
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Example: SaaS Scenario Modeler
2+
3+
A React-based demo MCP App that lets users adjust SaaS business parameters and see real-time 12-month projections of revenue, costs, and profitability with comparison against pre-built scenario templates.
4+
5+
## Features
6+
7+
- **Interactive Parameters**: 5 sliders for Starting MRR, Growth Rate, Churn Rate, Gross Margin, and Fixed Costs
8+
- **12-Month Projections**: Line chart showing MRR, Gross Profit, and Net Profit over time
9+
- **Scenario Templates**: 5 pre-built business strategies (Bootstrapped, VC Rocketship, Cash Cow, Turnaround, Efficient Growth)
10+
- **Template Comparison**: Overlay dashed lines to compare your scenario against any template
11+
- **Summary Metrics**: Key metrics including Ending MRR, Total Revenue, Total Profit, and break-even month
12+
- **Theme Support**: Adapts to light/dark mode preferences
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-scenario-data` tool that returns:
37+
38+
- 5 pre-built scenario templates with parameters, projections, and summaries
39+
- Default input values for the sliders
40+
- Optionally computes custom projections when `customInputs` are provided
41+
42+
The tool is linked to a UI resource via `_meta[RESOURCE_URI_META_KEY]`.
43+
44+
### App (`src/`)
45+
46+
- Built with React for reactive slider updates and derived state management
47+
- Uses Chart.js for the line chart visualization
48+
- All projection calculations run client-side for instant slider feedback
49+
- Components: `SliderRow`, `MetricCard`, `ProjectionChart`
50+
- Template comparison shown as dashed overlay lines on the chart
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6+
<title>SaaS Scenario Modeler</title>
7+
</head>
8+
<body>
9+
<div id="root"></div>
10+
<script type="module" src="./src/mcp-app.tsx"></script>
11+
</body>
12+
</html>
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"name": "scenario-modeler-server",
3+
"version": "1.0.0",
4+
"private": true,
5+
"type": "module",
6+
"scripts": {
7+
"build": "INPUT=mcp-app.html vite build",
8+
"watch": "INPUT=mcp-app.html vite build --watch",
9+
"serve": "bun server.ts",
10+
"start": "NODE_ENV=development npm run build && npm run serve",
11+
"dev": "NODE_ENV=development concurrently 'npm run watch' 'npm run serve'"
12+
},
13+
"dependencies": {
14+
"@modelcontextprotocol/ext-apps": "../..",
15+
"@modelcontextprotocol/sdk": "^1.22.0",
16+
"chart.js": "^4.4.0",
17+
"react": "^19.2.0",
18+
"react-dom": "^19.2.0",
19+
"zod": "^3.25.0"
20+
},
21+
"devDependencies": {
22+
"@types/cors": "^2.8.19",
23+
"@types/express": "^5.0.0",
24+
"@types/node": "^22.0.0",
25+
"@types/react": "^19.2.2",
26+
"@types/react-dom": "^19.2.2",
27+
"@vitejs/plugin-react": "^4.3.4",
28+
"concurrently": "^9.2.1",
29+
"cors": "^2.8.5",
30+
"express": "^5.1.0",
31+
"typescript": "^5.9.3",
32+
"vite": "^6.0.0",
33+
"vite-plugin-singlefile": "^2.3.0"
34+
}
35+
}

0 commit comments

Comments
 (0)