ClassDash
README.md
# MCP Apps Student Dashboard for Google Antigravity (Python + HTML)
**ClassDash** is a Python MCP server whose tool returns an **interactive HTML dashboard** instead of a wall of JSON. It follows the open **MCP Apps** extension (**SEP-1865**, `io.modelcontextprotocol/ui`): the tool points at a `ui://` resource served as `text/html;profile=mcp-app`, and an MCP Apps host such as the **Google Antigravity App** renders it inline in chat. Text-only clients (Antigravity CLI and IDE, other agents) still get a clean plain-text summary.
The dashboard shows a class marks dataset: subject averages, pass rates, a marks histogram, grade distribution and the students below the pass mark. Change the subject or pass mark and the view calls an app-only tool to refresh itself.
Full tutorial: **https://getprojects.org/mcp-apps-antigravity-python/**

## Features
- **MCP Apps tool → inline UI**: `show_class_dashboard` declares `_meta.ui.resourceUri = "ui://classdash/dashboard.html"`.
- **Antigravity side panel and full page**: `open_class_dashboard_panel` adds `_meta["com.google.antigravity/ui"].entrypoints` (`aux_pane`, `global`).
- **App-only helper**: `get_subject_stats` has `visibility: ["app"]`, so the dashboard can call it but the agent does not see it.
- **Single-file view, no CDN**: plain HTML + JavaScript + SVG charts, written against the spec's JSON-RPC-over-`postMessage` protocol (`ui/initialize`, `ui/notifications/tool-result`, `tools/call`, `ui/notifications/size-changed`, `ui/message`, `ui/update-model-context`). Works under the default-deny CSP.
- **Host theme**: reads `hostContext.theme` and the standard CSS variables (light and dark).
- **Plain-text fallback** for clients that do not advertise MCP Apps support (`client_supports_apps`).
- **Safe by default**: read-only tools, datasets addressed by name only (no file paths), CSV validation (0–100 marks, unique rolls, size limits), student names drawn with `textContent` (no HTML injection).
- **Local preview host** (`classdash-mcp preview`): a tiny MCP Apps host in your browser with a live JSON-RPC log, so you can build and test without Antigravity.
- **Antigravity plugin layout**: `plugin.json`, `mcp_config.json` (`${PLUGIN_ROOT}`, `${PLUGIN_DATA}`), `assets/logo.svg`.
- **98 pytest tests** (93 core + 5 headless-Chromium tests of the real view) and GitHub Actions CI.
## Tech stack
| Part | Choice |
| --- | --- |
| Language | Python 3.10+ |
| MCP | Official MCP Python SDK `mcp>=2.3,<3` (`MCPServer`, `mcp.server.apps.Apps`) |
| UI | One HTML file, vanilla JS, inline SVG (no React, no CDN) |
| Data | CSV (`roll,name,<subject>...`), pure-Python statistics |
| Tests | pytest, pytest-asyncio, optional Playwright for the browser tests |
## Project structure
```text
MCP-Apps-Student-Dashboard-Antigravity-Python/
├── classdash_mcp/
│ ├── server.py # MCP server: Apps tools, ui:// resource, plain-text fallback
│ ├── datasets.py # safe CSV loading by dataset name
│ ├── stats.py # means, medians, pass rates, grades, histogram
│ ├── preview.py # local MCP Apps test host (HTTP + MCP client bridge)
│ ├── demo.py # text-only client demo
│ ├── __main__.py # CLI: serve | preview | demo
│ ├── ui/dashboard.html # the MCP App view (text/html;profile=mcp-app)
│ ├── ui/preview_host.html
│ └── data/*.csv # two synthetic sample classes
├── plugin.json # Antigravity plugin manifest
├── mcp_config.json # Antigravity plugin MCP server definition
├── scripts/run_server.py # stdio entry point used by mcp_config.json
├── assets/logo.svg
├── examples/ # custom-server config + a sample CSV
├── tests/ # 98 tests
└── .github/workflows/tests.yml
```
## Install and run
```bash
git clone https://github.com/GetProjectsIdea/MCP-Apps-Student-Dashboard-Antigravity-Python.git
cd MCP-Apps-Student-Dashboard-Antigravity-Python
python -m venv .venv && source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -e ".[dev]"
classdash-mcp demo # what a text-only MCP client sees
classdash-mcp preview # opens http://127.0.0.1:8765/ with the interactive view
pytest -q # 93 passed, 1 skipped (browser tests need Playwright)
```
Run the browser tests too:
```bash
pip install playwright && python -m playwright install chromium
pytest -q # 98 passed
```
Preview options: `?dataset=mca-sem2-sample&subject=Data%20Structures&pass_mark=50&theme=dark`.
## Use it in Google Antigravity
MCP Apps views render in the **Antigravity App**. The Antigravity CLI and IDE run the same tools as plain-text tools.
**Option A: install as a local plugin** (needs `python3` with `pip install "mcp>=2.3,<3"`):
```bash
agy plugin validate ./MCP-Apps-Student-Dashboard-Antigravity-Python
agy plugin install ./MCP-Apps-Student-Dashboard-Antigravity-Python
```
`mcp_config.json` starts `scripts/run_server.py` with `python3` and points `CLASSDASH_DATA` at the plugin's writable `${PLUGIN_DATA}` folder. On Windows, change `python3` to `python` or `py`.
**Option B: add it as a custom MCP server** in `~/.gemini/config/mcp_config.json` (global) or `<workspace>/.agents/mcp_config.json`:
```json
{
"mcpServers": {
"classdash": {
"command": "classdash-mcp",
"args": ["serve", "--data-dir", "/absolute/path/to/your/marks-csv-folder"]
}
}
}
```
Then ask: *"Show the class dashboard for cse-sem5-sample"*.
> We tested the server with the MCP Python SDK client over stdio and in-memory, and the view in Chromium through the bundled preview host, which implements the same SEP-1865 host protocol. We did not have the Antigravity App in our test environment, so try it there and open an issue if anything differs.
## Use your own class data
Put CSV files in a folder and pass `--data-dir` (or set `CLASSDASH_DATA`). The file name without `.csv` is the dataset name.
```csv
roll,name,DBMS,Operating Systems,Computer Networks
21CS001,Student One,78,64,71
21CS002,Student Two,35,52,AB
```
Marks must be 0–100. An empty cell, `AB` or `ABSENT` means absent. Rolls must be unique. Maximum 5,000 students, 20 subjects, 2 MB.
## Tools
| Tool | Visible to | UI | What it does |
| --- | --- | --- | --- |
| `show_class_dashboard` | agent + app | inline | Class overview + one subject, text + `structuredContent` |
| `open_class_dashboard_panel` | agent + app | side panel / full page | Same data, Antigravity `aux_pane` and `global` entrypoints |
| `get_subject_stats` | app only | (used by the view) | Refresh for a new dataset, subject or pass mark |
| `list_datasets` | agent | none | Datasets, subjects and student counts |
| `student_report` | agent | none | One student's marks, rank and backlogs |
## Sample output (text-only client)
```text
Class dashboard: cse-sem5-sample (48 students, pass mark 40)
Class average 62.75% | all subjects cleared: 33 (68.8%) | hardest subject: Theory of Computation
Per subject (mean / median / pass rate):
- DBMS: 67.98 / 69.0 / 97.9% (0 absent)
- Operating Systems: 61.41 / 61.5 / 88.6% (4 absent)
...
```




## Safe-use notes
- The sample datasets are **synthetic**. Real student marks are personal data: keep them on your machine, share dashboards only with people who are allowed to see them, and follow your college's data rules.
- All tools are read-only. The server never writes to your CSV files.
- The preview host binds to `127.0.0.1` only and is a development tool, not a production host.
## References
- Google Antigravity Blog, *Bringing MCP Apps to Antigravity* (24 Nov 2026): https://antigravity.google/blog/mcp-apps-in-antigravity/
- Antigravity docs, MCP Apps: https://antigravity.google/docs/mcp-apps/
- MCP Apps specification (SEP-1865, 2026-01-26): https://github.com/modelcontextprotocol/ext-apps/blob/main/specification/2026-01-26/apps.mdx
- MCP Python SDK `mcp.server.apps`: https://py.sdk.modelcontextprotocol.io/api/mcp/server/apps/
## License
MIT © 2026 Pardeep Patel. Part of [GetProjects.org](https://getprojects.org/) – make your own projects.
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues