ventsim-mcp
# ventsim-mcp
An [MCP](https://modelcontextprotocol.io) server that lets AI assistants read and inspect
**Ventsim** mine ventilation models (`.vsm` files).
It works on the model file itself, so Ventsim does not need to be running. It does **not**
run the ventilation simulation; it reads the geometry, fans and the results Ventsim saved in
the file.
> Unofficial. Not affiliated with or endorsed by Howden / Chasm Consulting. "Ventsim" is
> their trademark. The `.vsm` format is undocumented; it was read from files saved by
> Ventsim DESIGN 6 and may change between versions.
## Tools
| Tool | What it does |
|---|---|
| `model_summary` | Title, Ventsim version, airway and fan counts, total length, depth range |
| `list_airways` | Filter by name/notes or minimum velocity, sort by any field (airflow, length, pressure...) |
| `get_airway` | Every column of one airway |
| `list_fans` | Fan airways with fan model name, duty airflow, fan pressure, power |
| `velocity_check` | Airways above a maximum (or below a minimum) air velocity |
| `fan_summary` | Fans by model with total `Fan Power` as stored in the file (kW) |
| `compare_models` | Diff two saved versions: added/removed airways, airflow and pressure changes |
| `check_flow_balance` | Airflow mass balance at every junction (finds un-simulated or broken networks) |
| `what_if` | Experimental: re-solve the network after scaling airway resistance or switching fans off, report airflow changes |
| `export_csv` | Airways to CSV, any columns |
| `edit_airways` | Experimental: write a **copy** with changed Notes / Group / Branch Name |
All values are in the SI units Ventsim stores internally (m, m3/s, Pa, kW).
## Install
```
pip install git+https://github.com/agenticeram/ventsim-mcp
```
Claude Desktop / Claude Code config:
```json
{ "mcpServers": { "ventsim": { "command": "ventsim-mcp" } } }
```
Then ask, for example: *"Open C:\models\mine.vsm and list the 10 airways with the highest velocity."*
## File format notes
A `.vsm` is a gzip-compressed, CRLF-separated, tab-delimited text file. The airway table starts
at a header line beginning `MAIN<TAB>Unique No`, which names all ~288 columns; the parser uses
those names, never fixed positions. Reading and writing is byte-exact when nothing is edited. A `.txt` export of the same file (uncompressed) is read too.
The CSV/NBC/XLSX exports are headerless or derived dumps of the same tables and are not supported; use the `.vsm`/`.txt`.
## What-if solver (experimental)
`what_if` solves node pressures for the airways of the simulated stage, balancing mass
flow (air expands as it warms) with `dP = R*Q|Q| - Ps(Q) - NVP` on every airway. What it
reads from the file:
- **Stage**: `Stage` is a bit mask and an airway that differs between stages is stored once
per stage, on top of each other. The stage whose saved airflow balances is used.
- **Junctions**: airway ends closer than 5 cm are one node.
- **Resistance**: the effective value from the saved pressure drop (includes fittings,
dampers, orifices); scaling in `what_if` multiplies it. Closed airways carry no air.
- **Fans**: density-corrected curves, static or total pressure as the saved results show,
speed by the affinity laws, curve calibrated through the saved duty point. A fan whose
saved pressure drop is resistance only is treated as stopped.
- **Boundaries**: portals and dead ends are held at the pressure that reproduces the saved
flow; natural ventilation pressure stays at its saved value.
Because resistances, fan duty points and boundaries are taken from the saved state, the
fit below is largely a consistency check that the network was read correctly, not an
independent accuracy figure (total absolute flow error / total flow,
`python bench/fit.py <folder>`):
| Ventsim DESIGN 6 example | Airways solved | Error |
|---|---|---|
| CoalMine | 3,403 | 0.58 % |
| Fire2 | 151 | 0.85 % |
| HVACDemo | 55 | 0.70 % |
| without_ducting | 408 | 0.16 % |
| diamondmine | 1,057 | 0.07 % |
| Blue_sky | 531 | 0.05 % |
| InclinedHeatMine, Tutorial2, HVACDemoB, NatVent, Fire | | < 0.05 % |
| DemoMine, DevSolids, RealMine, RealMine 2, CoalMine2, Tutorial1, HVACDemoA, Heat Strategies | | < 0.01 % |
**Independent check.** `Fire` and `Fire2` are the same network with two airway
resistances changed. Predicting Fire2 from Fire plus those two changes
(`python bench/predict.py Fire.vsm Fire2.vsm`) reproduces 96.9 % of the airflow change
Ventsim computed; the remaining error is 0.03 % of total flow.
Heat, density and fire effects are not re-evaluated after a change. Treat results as an
estimate and confirm in Ventsim.
## Limits
- Read-only on results: simulation, heat and fire modelling stay in Ventsim.
- Editing is limited to text fields; geometry edits would leave results stale.
- Tested on the 20 example models shipped with Ventsim DESIGN 6 (up to 6,700 airways). Other versions untested.
## Development
```
pip install -e ".[test]"
pytest
```
MIT licence.
TDQS
Scored across 11 tools
Each tool targets a clearly distinct granularity or operation: summaries vs. listings vs. single records, diagnostic checks (flow balance, velocity), lifecycle operations (compare, what-if, export, edit). The summary/list split for fans (fan_summary, list_fans) and airways (model_summary, list_airways, get_airway) is well delineated by the descriptions.
All names are snake_case and readable, but the convention is mixed: most are verb-first (list_airways, get_airway, check_flow_balance, compare_models, export_csv, edit_airways), while several are noun-first (model_summary, fan_summary, velocity_check) and one is a phrase (what_if). This goes beyond minor deviation, though the pattern is still interpretable.
11 tools is well within the ideal 3–15 range and each tool maps to a distinct, valuable function for a ventilation-model analysis server: summarisation, listing, diagnostics, comparison, what-if, export and editing. No tool feels redundant or padding.
The analysis surface is fairly comprehensive—summaries, airway/fan inspection, mass-balance and velocity checks, model comparison, what-if solving, CSV export, and limited text-field editing. Gaps remain: no node/junction-level inspection, no editing of geometry or ventilation parameters, and no simulation execution (deferred to Ventsim), but these are reasonable boundaries for a read/analysis companion.