SOLARPUNK banco cervecero

API y MCP

REST v1 / MCP

Las mismas cuentas de las herramientas, por HTTP: cálculos sin registro y, con tu token, tus recetas, lotes y simulaciones. También como servidor MCP para Claude y otros agentes.

Cálculos sin cuenta

POST /api/v1/calc/<nombre> con un JSON; responde números con la unidad en el nombre del campo (…C, …L, …G, …Pct). El listado con el JSON Schema de cada entrada está en /api/v1/calc.

curl -s https://www.solarpunkbrewing.com/api/v1/calc/ibu \
  -H "Content-Type: application/json" \
  -d '{"hops":[{"alphaPct":10,"amountG":30,"timeMin":60},
       {"alphaPct":6,"amountG":50,"timeMin":20,"use":"whirlpool","whirlpoolTempC":80}],
       "boilGravity":1.05,"volumeL":22,"formula":"tinseth"}'
  • og — Original gravity, FG and ABV

    Estimate OG from a grain bill (efficiency applies only to mashed items), FG from apparent attenuation, and ABV. Units: kg, L, %, SG.

  • ibu — Bitterness (IBU)

    IBU from a hop schedule with Tinseth or Rager; whirlpool additions scale by hop-stand temperature; dry hop adds 0. Units: g, %, min, °C, L.

  • color — Beer color (Morey)

    Beer color from the grain bill with the Morey equation. Units: kg, EBC, L; returns SRM, EBC and a hex swatch.

  • mash — Strike water and infusion

    Strike water temperature for a single infusion (Palmer, 0.41 grain heat constant) and optionally the boiling-water infusion for a next step. Units: kg, L/kg, °C, L.

  • water — Water salts

    Ion profile after salt additions, residual alkalinity (ppm as CaCO3), SO4:Cl ratio and ion balance. Ions in ppm; salts in g: gypsum, calciumChloride, epsom, sodiumChloride, bakingSoda, chalk, slakedLime.

  • carbonation — Priming sugar and keg pressure

    Priming sugar mass for bottles and the equivalent keg regulator pressure for a target CO2 volume. Units: vols, °C, L, g, PSI, bar.

  • dilution — Dilution or boil-off to target gravity

    Water to add or volume to boil off to bring wort to a target gravity (gravity points conserved). Units: SG, L.

  • pitch — Yeast pitch rate

    Cells needed (billions) for a wort; rate in million cells/mL/°P (ale 0.75, lager 1.5). Optionally dry yeast grams at ~6e9 cells/g.

  • brewday — Brew day simulation (summary)

    Minute-by-minute brew day on a reference equipment profile (vevor-hjeb-35a, generic-biab-40, three-vessel-50, solarpunk-plant-100-120); returns the summary (OG, IBU, volumes L, times min, energy kWh) and warnings.

  • fermentation — Fermentation simulation (summary)

    Hour-by-hour fermentation kinetics; returns FG, ABV %, attenuation %, days to terminal gravity and ester/fusel risk. Units: SG, L, billion cells, °C, days.

  • kombucha — Kombucha F1/F2 simulation (summary)

    Kombucha first (open) and second (bottle) fermentation: final pH, ABV % (0.5 % check), acetic g/L, residual sugar g/L and CO2 volumes.

  • caffeine — Caffeine dosing

    Pure caffeine (g) and stock solution (mL) for a target mg/L, mg per serving with EFSA/EU warnings; optionally the mass of a natural source (yerba-mate, guarana, cafe-arabica, cafe-robusta, te-negro, te-verde) for the same target.

  • pasteurization — Pasteurization units

    Pasteurization units (PU, 60 °C reference, z = 6.94 °C) of a bath profile (ramp, hold, cool) and the bottle pressure at the hold temperature. Units: °C, min, vols, bar.

Tus datos (con token)

El asistente de cocción público carga tus recetas y lotes, avisa por voz o Discord y registra tus confirmaciones si activás la sincronización. MCP: recipe_timeline prepara el plan y batch_assistant consulta el seguimiento. Los avisos requieren mantener el asistente en ejecución en tu equipo.

Creá un token en Mi cuenta (entrando con Discord) y mandalo como Authorization: Bearer spb_…. Se muestra una sola vez y se puede revocar cuando quieras. Cada usuario solo ve sus propios datos.

  • GET /api/v1/me

    Tu usuario.

  • GET · POST /api/v1/recipes

    Listar (id, name, style, updatedAt) y crear recetas ({ name, style, data }).

  • GET · PUT · DELETE /api/v1/recipes/<id>

    Leer, actualizar o borrar una receta.

  • GET /api/v1/recipes/<id>/timeline

    Descargar pasos para el asistente: adiciones cronometradas, confirmaciones y seguimiento de fermentación.

  • GET /api/v1/batches/<id>/assistant

    Plan y seguimiento del lote según mediciones y dry hop confirmado. No programa mensajes por sí solo.

  • GET · POST /api/v1/batches

    Listar (sin planned/actual) y crear lotes ({ name, recipeId?, status, planned, actual, notes }).

  • GET · PATCH · DELETE /api/v1/batches/<id>

    Lote con sus últimos 500 eventos; cambiar estado o valores reales; borrar.

  • POST /api/v1/batches/<id>/events

    Medición o nota: { kind: measurement|note|addition|step, at?, data: { sg, tempC, ph, note } }.

  • GET · POST /api/v1/simulations

    Listar (sin input; summary solo si es chico) y guardar simulaciones ({ kind, name, input, summary }).

  • GET · DELETE /api/v1/simulations/<id>

    Leer o borrar una simulación.

TOKEN=spb_...   # creado en Mi cuenta
curl -s https://www.solarpunkbrewing.com/api/v1/batches -H "Authorization: Bearer $TOKEN"
curl -s https://www.solarpunkbrewing.com/api/v1/batches/<id>/events \
  -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
  -d '{"kind":"measurement","data":{"sg":1.012,"tempC":19,"ph":4.4,"note":"día 5"}}'

Servidor MCP

URL: https://www.solarpunkbrewing.com/mcp (Streamable HTTP, sin sesión). Sin token expone las calculadoras (calc_og, calc_ibu, calc_water, calc_brewday…). Con tu token suma recipes_list, recipe_create, recipe_update, batches_list, batch_create, batch_add_event, batch_update_status, simulations_list, simulation_get y simulation_save.

Claude Code

claude mcp add --transport http solarpunk https://www.solarpunkbrewing.com/mcp \
  --header "Authorization: Bearer spb_..."

Claude Desktop

Un conector personalizado (Settings → Connectors) con la URL de arriba alcanza para las calculadoras, pero no permite mandar el token. Para tus datos, en claude_desktop_config.json usá el puente mcp-remote:

{
  "mcpServers": {
    "solarpunk": {
      "command": "npx",
      "args": ["-y", "mcp-remote", "https://www.solarpunkbrewing.com/mcp",
               "--header", "Authorization:${AUTH_HEADER}"],
      "env": { "AUTH_HEADER": "Bearer spb_..." }
    }
  }
}

Otros clientes MCP

Cualquier cliente con transporte HTTP «streamable» sirve (Cursor, VS Code, Windsurf, el SDK oficial): URL https://www.solarpunkbrewing.com/mcp y el encabezado Authorization: Bearer spb_…. Los clientes que solo hablan stdio pueden usar npx mcp-remote.

Reglas

  • JSON de hasta 160 KB por pedido; cada receta, plan, entrada o resumen de simulación hasta 64 KB y cada evento de lote hasta 4 KB.
  • Límites por cuenta: 200 recetas, 200 lotes, 500 eventos por lote y 200 simulaciones. Al llegar al tope la API responde 409 { "error": "quota", "limit": … }: borrá algo para sumar más.
  • Los listados devuelven resúmenes; pedí cada receta, lote o simulación por su id para tener los datos completos.
  • Unidades métricas: litros, kg, gramos, °C; densidad como SG (1,050).
  • Los tokens se guardan solo como hash SHA-256. Si uno se filtra, revocalo en Mi cuenta.
  • Los resultados son estimaciones para planificar: medí siempre.
Cómo se calcula

Los cálculos usan brew-core, la misma biblioteca abierta (MIT) de las herramientas. Los granos necesitan mashed: true para que se aplique la eficiencia (es el valor por defecto para grano y adjuntos); azúcares y extractos se suman enteros.