Skip to content

Save Bridge

Guy Friley edited this page Nov 6, 2026 · 1 revision

Save Bridge

bridge/timberborn_mcp.py is an MCP server that reads .timber saves and answers questions about a colony: districts, food and water, power, logistics, construction, and which workplaces are actually producing. Stdlib Python only, nothing to install. It never writes to a save.

Verified against game version 1.1.2.4, Folktails, on a 256x256 map.

Install

python3 bridge/timberborn_mcp.py --selftest | less        # every report, no client needed
claude mcp add timberborn -s user -- python3 "$PWD/bridge/timberborn_mcp.py"

For the Claude desktop app, add the same command to its MCP server settings. Local MCP servers configured there are also reachable from cloud sessions linked to this Mac.

Saves are read from ~/Documents/Timberborn or the platform save folder. Set TIMBERBORN_DIR to override.

Tools

Tool What it answers
list_saves Which saves exist, newest first
overview Cycle, weather, population, districts, drought record
district_report Population, housing, open jobs, needs, goods flow per district
food_water_report Stock, real production and consumption rates, days of buffer, drought exposure
water_report Stored volume, contamination, sources, floodgates, dams
power_report Generators, transmission, and which buildings actually ran short
logistics_report Hauling posts, storage allocation, workplaces far from storage, import and export policy
workplace_report Every workplace ranked by yesterday's productivity
construction_report Unfinished builds, materials delivered, builder staffing
find_buildings Locate anything by template or name
good_history Day-by-day stock, production and consumption for one good
raw Walk the save's singleton JSON by dotted path

Every tool takes an optional save (name, partial name, or path) and settlement. With neither, the most recently modified save is used, so after an autosave you just ask again.

What is exact and what is not

Exact, read straight from the save:

  • Population, ages, assigned district, jobs and homes
  • Desired versus assigned workers per building
  • Need satisfaction per beaver
  • Per-district and settlement-wide production, consumption, stock and capacity per good, sampled daily by the game itself, about 500 days of history
  • Workplace productivity: work done versus work possible, hour by hour
  • Water depth and contamination per map column, water source strength, floodgate heights
  • Drought and badtide history

Approximate, and labelled as such in the output:

  • District of a building. The game decides district membership by path connectivity, which the save does not store. Buildings with assigned workers or dwellers are attributed exactly, because citizens carry their district. Everything else falls back to the nearest district center.
  • Distances. Manhattan on the grid with height weighted double, not walked path length.
  • Power. The save does not contain the power network or per-building demand, so there is no grid-level balance. Generator counts are exact; horsepower figures are nominal wiki ratings. The productivity table is the real evidence of a starved building.
  • Housing capacity. Derived from the save as the most dwellers ever seen in that building type, floored by a small table in tb_specs.py.

The numbers worth asking for

  • Days of buffer = stock divided by mean daily consumption over the last ten days.
  • Drought exposure = daily water use times the worst recent drought length, against stored water.
  • Workplace productivity = work performed divided by work possible during working hours, per building, per hour. Low values mean missing workers, missing inputs, no power, or a full output inventory. It is the single best signal that a building is sick and needs no spec data.

What that surfaced in the colony the bridge was built on: 61 days of water buffer against a worst-case 4-day drought, with 96 storage buildings allocated to water; sunflower seeds down to 1.7 days in one district while the other sat on 1,900; and gear running net negative with four workshops idle.

Layout

timberborn_mcp.py   MCP server (stdio JSON-RPC, no dependencies)
tb_save.py          zip and JSON loading, entity indexing, map decoding
tb_reports.py       the reports
tb_specs.py         the handful of constants the save does not contain

Save format notes, confirmed empirically against entity coordinates:

terrain voxel  index = z*X*Y + y*X + x            value 0/1
water column   index = level*X*Y + y*X + x        "depth:contamination:?:floorZ:prevDepth"

Adding a report

Reports live in tb_reports.py and return markdown-ish text meant to be read by a model. Register the function and its argument schema in timberborn_mcp.py. Anything the save does not contain goes in tb_specs.py, marked nominal, and the report should say so wherever it uses it.

Clone this wiki locally