Skip to main content
Glama
poolpro-mcp

poolpro-mcp

README.md
# poolpro-mcp

Pool chemistry as an MCP server: how much liquid chlorine, bleach, cal-hypo, dichlor, trichlor, muriatic acid, dry
acid, soda ash, borax, baking soda, calcium chloride, stabilizer (CYA) and pool salt to add after a water test, for the
strength on your own label and in the order to add them; the free chlorine level your CYA needs (TFP's FC/CYA chart,
SLAM / shock level included); the CSI and LSI water balance; and pool volume in gallons or litres from its shape. Four
read-only tools, no sign-in, nothing stored.

It is the calculator of the **[PoolPro](https://zhukovskyi.space/apps/poolpro/)** app by Dre Dev, ported from Dart to
Python and checked against the app's own test values (which the app checks against TFP Pool Math). The same
calculator runs free in the browser:
[pool chemical calculator](https://zhukovskyi.space/calculators/pool/pool-chemical-calculator.html).

- App: [Google Play](https://play.google.com/store/apps/details?id=com.andrii.poolchem) ·
  [App Store](https://apps.apple.com/app/id6834753626) ·
  [zhukovskyi.space/apps/poolpro](https://zhukovskyi.space/apps/poolpro/)
- Server: `https://mcp.zhukovskyi.space/poolpro/mcp` (streamable HTTP)

## Tools

| Tool | Gives |
|---|---|
| `plan_pool_chemical_doses` | From a test (FC, CC, pH, TA, CH, CYA, salt, borates, temperature) and the pool volume: each dose in the order to add it, amount in mL / g and fl oz / oz (with a rounded "how much" in gal, lb, L or kg), side effects (pH after baking soda, TA after acid, CYA from dichlor and trichlor, CH from cal-hypo), advice (SLAM, replace water, raise SWG output), levels against TFP or pool-store ranges, CSI and LSI before and after |
| `calculate_pool_water_balance` | Calcite Saturation Index (CSI, TFP / Chem Geek) and Langelier Saturation Index (LSI, Carrier) with carbonate alkalinity corrected for CYA and borates; corrosive, balanced or scaling |
| `get_pool_chlorine_targets` | Minimum, target and SLAM free chlorine for a CYA level, for liquid chlorine, tablets or a salt water generator; ideal and acceptable pH, TA, CH and CYA ranges |
| `calculate_pool_volume` | Gallons and litres of a rectangle, round or oval pool from length, width and shallow / deep end depths, in feet or metres |

US units (gallons, °F, fl oz, oz, lb) or metric (litres, °C, mL, g, kg). Trouble Free Pool (TFP) levels by default, or
pool-store / health-code levels. All tools: `readOnlyHint: true`, `destructiveHint: false`, `openWorldHint: false`.

## Connect

**Claude (claude.ai, Desktop), ChatGPT (developer mode), Cursor, VS Code** — add a remote MCP server with the URL
`https://mcp.zhukovskyi.space/poolpro/mcp`, no authentication.

**Local (stdio):**

```bash
git clone https://github.com/andronaft/poolpro-mcp && cd poolpro-mcp
python3 -m venv .venv && .venv/bin/pip install -r requirements.txt
```

```json
{ "mcpServers": { "poolpro": { "command": "/path/to/poolpro-mcp/.venv/bin/python",
                               "args": ["/path/to/poolpro-mcp/server.py", "--stdio"] } } }
```

Ask, for example: *"15,000 gallon pool, FC 2, pH 8.0, TA 80, CYA 40, CH 350. What do I add, with 10 % liquid chlorine
and 31.45 % muriatic acid?"* or *"How much chlorine should I keep at CYA 70 with a salt water generator?"*

## Method

- Dose = ppm × litres ÷ 1000 grams of the pure chemical, divided by the label strength. Liquid chlorine by trade
  percent (12.5 % = 125 g Cl2 per litre); bleach by weight percent with density 1.0174 + 0.01·% (TFP Pool Math's
  bleach formula); muriatic acid by molarity with CRC Handbook densities (14.5 % acid needs 2.34 times the volume of
  31.45 %, not 2.17); calcium chloride by its label (77 % flake, 94 % anhydrous). An old jug of liquid chlorine is
  dosed for what is left: half-life 180 days at 25 °C, 48 days at 35 °C (PHTA liquid chlorine fact sheet, 2020).
- pH and TA: the water is modelled as carbonate, cyanurate, borate and water alkalinity (pK 6.3 / 10.2 / 6.83 /
  9.11), so acid, soda ash and borax follow the pool's own TA, CYA and borates. TA is dosed first and the pH dose is
  worked out on the water the baking soda leaves; acid then lowers TA.
- Chlorine targets: TFP "The Free Chlorine and Cyanuric Acid Relationship" (CYA rounded up to the next 10; above 100
  the 100 row is scaled). Ranges: TFP "What Are My Ideal Pool Levels?", or Maryland Department of Health "Water
  Balance Parameters", ANSI/APSP/ICC-11 and Hayward AquaRite for pool-store levels. Plaster gets calcium only when it
  is under 250 ppm or the CSI after the other doses would stay under −0.3.
- CSI: Chem Geek's approximation as TFP Pool Math computes it (TFP thread 19688). LSI: Carrier's formula, TDS 1,000 ppm
  or the salt reading if higher. Volume: TFP Pool Math's shapes, times the average depth.
- Checked against (from the app's `test/dose_reference_2026_11_21_test.dart`, Pool Math on 2026-11-21): FC 2 → 7 in
  10,000 gal = 51 fl oz of 12.5 %, 64 of 10 %, 104 of 6 % bleach, 7.3 oz trichlor, 12 oz dichlor, 10 oz cal-hypo 65 %;
  pH 8.0 → 7.5 at TA 60 ≈ 8.9 fl oz of 31.45 % acid; TA 40 → 60 = 44.8 oz baking soda; CH 200 → 300 = 157.5 oz of
  94 % calcium chloride; CYA 20 → 40 = 27 oz; salt 2,000 → 3,200 ppm = 100 lb; 50,000 L metric pool; and
  `test/chem_test.dart`'s CSI 0.078 / LSI −0.01 and FC/CYA chart rows. See `tests/test_server.py`.
- Not here: the app's pool log, volume check from past doses, SLAM program tracking and prices.

Doses are estimates from average chemistry: add in portions, let the pump circulate, and retest. Pool chemicals are
hazardous: never mix chlorine and acid (chlorine gas), add one chemical at a time, always chemical into water, wear
gloves and eye protection, and follow the label.

## Run and test

```bash
pip install -r requirements.txt
python server.py                  # http://127.0.0.1:8000/mcp
python server.py --stdio
python -m unittest discover tests   # 13 tests
```

Hosted with the other Dre Dev MCP servers in one process; `build_app()` is mounted at `/poolpro`.

## Licence

MIT for the code. Levels and charts: Trouble Free Pool's published tables, cited above. Made by Andrii Zhukovskyi
([Dre Dev](https://zhukovskyi.space/)).