Skip to main content
Glama
README.md
# ferment-mcp

Mead, cider and homebrew fermentation math as an MCP server: ABV from original and final gravity (standard and Hall
formulas, refractometer correction), SG / Brix / Plato conversion with hydrometer temperature correction, how much
honey per gallon a mead needs for a target gravity, priming sugar for bottle carbonation, and backsweetening sugar
with the CO2 it would make in the bottle. Five read-only tools, no sign-in, nothing stored.

It is the calculator of the **[Ferment](https://zhukovskyi.space/apps/ferment/)** fermentation tracker app by Dre
Dev, ported from Dart to Python and checked against the app's own test values. The ABV calculator also runs in the
browser: [mead ABV calculator](https://zhukovskyi.space/calculators/brewing/mead-abv-calculator.html).

- App: [zhukovskyi.space/apps/ferment](https://zhukovskyi.space/apps/ferment/)
- Server: `https://mcp.zhukovskyi.space/ferment/mcp` (streamable HTTP)

## Tools

| Tool | Gives |
|---|---|
| `calculate_abv_from_gravity` | ABV by (OG − FG) × 131.25 and by Hall's formula, apparent attenuation, OG/FG in SG and Brix, the BJCP mead class (dry / semi-sweet / sweet, hydromel / standard / sack); hydrometer readings in SG, Brix or Plato, or two refractometer Brix readings corrected for alcohol (Terrill) |
| `convert_gravity_reading` | SG ↔ °Brix ↔ °Plato, gravity points and potential ABV, and a hydrometer reading corrected to 60 °F or 68 °F calibration |
| `calculate_honey_for_target_gravity` | Honey (or table / corn sugar) for a target original gravity from water or juice, the water to dilute a must that is too strong, or the gravity a given amount of honey gives |
| `calculate_priming_sugar` | Table sugar, corn sugar or honey to bottle-carbonate to 1.5–3+ volumes of CO2, total and per bottle (grams, ounces, teaspoons), from the warmest temperature after fermentation |
| `calculate_backsweetening_sugar` | Honey or sugar to sweeten a finished cider or mead to a target gravity, the CO2 it makes if the yeast is alive, and the verdict: don't bottle unless the yeast is stopped |

Volumes in litres or US gallons, temperatures in °C or °F, masses in g, kg, oz and lb. 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/ferment/mcp`, no authentication.

**Local (stdio):**

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

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

Ask, for example: *"My mead started at 1.110 and is at 1.004 now, what's the ABV?"* or
*"How much honey for 5 gallons of mead at 1.100?"*

## Method

- Brix / Plato → SG by the Lyons equation, SG → Plato by the ASBC polynomial (Brewer's Friend).
- ABV = (OG − FG) × 131.25 (Brewer's Friend); alternate = 76.08 × (OG − FG) ÷ (1.775 − OG) × (FG ÷ 0.794)
  (Michael L. Hall, *Zymurgy*, Summer 1995). Mead classes: BJCP Mead Guidelines.
- Hydrometer temperature correction: CG = MG × f(Tr) ÷ f(Tc), Brewer's Friend's cubic in °F.
- Refractometer: OG from Brix ÷ WCF (1.04 default); FG by Sean Terrill's cubic fit (2011), fitted on beer.
- Sugar: points = PPG × lb ÷ US gal; honey 35 (Ken Schramm, *The Compleat Meadmaker*), table sugar 46, corn sugar 42
  (Craft Beer & Brewing). Dilution: gravity points × volume stay the same.
- Priming: (target − residual CO2) × 1.977 g/L ÷ CO2 per gram of sugar × litres; residual CO2 = 3.0378 −
  0.050062·T + 0.00026555·T² (°F, *Zymurgy* 1995, matches BYO's chart); CO2 per gram by Gay-Lussac's equation
  (sucrose 0.514, dextrose monohydrate 0.444, honey with 82 % sugars per USDA 0.401).
- Backsweetening: the same points math, and CO2 volumes = grams × CO2 per gram ÷ litres ÷ 1.977; bottle ratings
  (beer 3, Belgian 500 ml 4, 750 ml 5.5 volumes) as the sellers state them.
- Checked against the app's tests (`test/calc_test.dart`, `test/ideas10_backsweeten_test.dart`): 1.110 → 1.000 is
  14.44 % (Hall 15.85 %); 12 °Bx = 1.0484; 1.050 at 100 °F reads 1.0561 at 60 °F; Terrill 12 → 6 °Bx = 1.0114;
  1.369 kg of honey for a 1.100 mead in 4 L; 119 g of table sugar for 5 gal at 2.5 volumes and 68 °F; 495 g of table
  sugar or 650 g of honey to take 19 L from 1.000 to 1.010. And the site's worked example: 1.100 → 1.010 is 11.8 %
  (Hall 12.9 %). See `tests/test_server.py`.
- Not here (in the Ferment app): the batch journal and "done when the gravity holds for 3 days", step-feeding
  counted in the ABV, TOSNA mead nutrients, sulfite (Campden) doses, salt for sauerkraut.

All results are estimates from published formulas: honey varies, refractometer corrections were fitted on beer, and
a hydrometer reading after mixing is the check. Sugar in a sealed bottle with live yeast makes gas: prime only a
drink whose gravity has held for 3 days, and stop the yeast (sorbate with sulfite, or pasteurising) before
backsweetening.

## 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 `/ferment`.

## Licence

MIT for the code. Formulas as published by the sources named above. Made by Andrii Zhukovskyi
([Dre Dev](https://zhukovskyi.space/)).