Levain
by andronaft
README.md
# levain-mcp
Sourdough baker's percentage math as an MCP server: grams of flour, water, starter and salt for a loaf or a batch from
your hydration and percentages, the true hydration with the starter's own flour and water counted, baker's
percentages and scaling of a bread recipe written in grams, starter feeding amounts for a ratio like 1:2:2 or 1:5:5,
a levain build in one to three feeds, and the water temperature for a desired dough temperature. Five read-only
tools, no sign-in, nothing stored.
It is the calculator of the **[Levain](https://zhukovskyi.space/apps/levain/)** sourdough starter app by Dre Dev,
ported from Dart to Python and checked against the app's own test values. The same calculator runs in the browser:
[baker's percentage calculator](https://zhukovskyi.space/calculators/bread/bakers-percentage-calculator.html).
- App: [zhukovskyi.space/apps/levain](https://zhukovskyi.space/apps/levain/)
- Server: `https://mcp.zhukovskyi.space/levain/mcp` (streamable HTTP)
## Tools
| Tool | Gives |
|---|---|
| `calculate_sourdough_dough` | Flour, water, starter and salt for a dough weight (loaves × loaf weight) or a flour weight; true hydration; option to count the starter in the hydration (total formula); flour blend split (whole wheat, rye, spelt) and add-ins, with the water of soakers and porridge counted |
| `scale_bread_recipe` | Baker's percentages of a recipe in grams or ounces, its overall hydration and salt with the starter or poolish counted, prefermented flour, and the recipe scaled to a new dough weight, flour weight or factor |
| `feed_sourdough_starter` | Flour and water for a feed at a ratio (keep 20 g at 1:2:2 → 40 g + 40 g), or how much to keep for a wanted amount; starter hydration and typical time to peak |
| `build_levain` | Ripe starter, flour and water to build the levain a recipe needs plus extra for the jar, in 1–3 builds with nothing left over; ratio water set for a stiff or wet starter |
| `calculate_dough_water_temperature` | Water temperature for a desired dough temperature (DDT) from room, flour and levain temperature and mixer friction, in °C or °F |
Weights in g, kg, oz or 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/levain/mcp`, no authentication.
**Local (stdio):**
```bash
git clone https://github.com/andronaft/levain-mcp && cd levain-mcp
python3 -m venv .venv && .venv/bin/pip install -r requirements.txt
```
```json
{ "mcpServers": { "levain": { "command": "/path/to/levain-mcp/.venv/bin/python",
"args": ["/path/to/levain-mcp/server.py", "--stdio"] } } }
```
Ask, for example: *"Two 900 g sourdough loaves at 78 % hydration, 20 % starter, 2 % salt, 30 % whole wheat: how
many grams of each?"* or *"I need 180 g of levain tomorrow morning and only have 10 g of starter. How do I build
it?"*
## Method
- Baker's percentages: every ingredient is a share of the flour weight, flour = 100 %
([King Arthur Baking, Baker's percentage](https://www.kingarthurbaking.com/pro/reference/bakers-percentage);
[Wikipedia, Baker percentage](https://en.wikipedia.org/wiki/Baker_percentage) for the total-formula method).
- Sizing by dough weight: with bowl flour F, fractions h, st, s, add-ins inc (their water incW) and
a = st ÷ (1 + starter hydration): W = F × (1 + h + st + s + inc − incW), or, with the starter counted,
W = F × ((1 + a)(1 + h + s) + inc − incW).
- True hydration = (water + starter water + add-in water) ÷ (flour + starter flour). With the starter counted, the
water to add is reduced by the starter's water; if the starter alone holds more, nothing is added and a warning
says how much wetter the dough comes out.
- Starter feeds and the levain build: ratio starter : flour : water by weight; a build in n feeds starts from
(needed + extra) ÷ ((s + f + w) ÷ s)ⁿ, each feed taking everything the one before made (The Fresh Loaf's worked
example: 6 g + 11 + 11, then + 22 + 22, then + 44 + 44 for 160 g). Peak times: King Arthur Baking's warm-kitchen
test ([Sourdough feeding ratios](https://www.kingarthurbaking.com/blog/2025/03/13/sourdough-feeding-ratios)):
about 5 h at 1:1:1, 8 h at 1:2:2, 12 h at 1:4:4 and bigger, a straight line in between.
- Water temperature: water = DDT × 4 − (levain + flour + room + friction), The Perfect Loaf's *The Importance of
Dough Temperature in Baking*; friction 0 by hand.
- Checked against (see `tests/test_server.py`): one 900 g loaf → 456.85 g flour; 1000 g flour at 75 / 20 / 2 % →
77.27 % true hydration; the starter counted for 2 × 950 g → exactly 75 %; King Arthur Baking's French bread resized
to 150 lb (89.15 lb flour) and its poolish counted into a 65 % overall formula; keep 20 g at 1:5:5 → 100 g + 100 g;
200 g levain + 10 g at 1:2:2 → 42 g starter; 25 °C dough in a 22 °C kitchen → 34 °C water (77 °F / 72 °F → 92 °F).
Fermentation and peak times are estimates for a warm kitchen (about 26 °C / 78 °F) and an active starter: a cooler
kitchen or a starter from the fridge is slower, and the dough, not the clock, decides when it is ready.
## 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 # 15 tests
```
Hosted with the other Dre Dev MCP servers in one process; `build_app()` is mounted at `/levain`.
## Licence
MIT. Made by Andrii Zhukovskyi ([Dre Dev](https://zhukovskyi.space/)).
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues