Skip to main content
Glama
README.md
# grasshopper-revit-mcp

**Text or images in, a verified Grasshopper definition out, then variants in the same design language, then native Revit elements.** An MCP server and agent skills for Claude Code, Claude Desktop and Cursor, for Rhino 8 and Rhino.Inside.Revit. Brand name inside the WiseStack family: **WiseGH**.

![Three families and their variants, built and checked by the agent in Grasshopper](examples/all_families.png)

*Live run on Rhino 8.18, 3 and 4 Dec 2026. Back row: twisting-tower family after Gensler's Shanghai Tower. Middle: diagrid-tower family after Foster + Partners and Arup's 30 St Mary Axe. Front: segmented-twist family after Santiago Calatrava's Turning Torso. Each original sits on the left with three variants the agent built inside its design language. Every published number checked in Rhino. Massing only.*

## Why this exists

Agents can already place Grasshopper components. What breaks in real use:

- **They wire by hand and drift.** LLMs placing components one by one get worse as graphs grow (Text2VP, 2024). Wrong components appear silently when lookups fall back to fuzzy matches.
- **"Done" when it isn't.** A solve with no red components is not a correct model.
- **Guesses become design.** Nobody can tell which numbers came from a source and which were invented.
- **Variants wander off.** "Make variations" produces anything, not the same building's language.
- **The Revit leg duplicates.** Rhino.Inside.Revit components saved without tracking create new elements on every solve.

## How it works

```
sources / photos ──► family spec ──► rules gate ──► compile ──► gh_apply (atomic) ──► checks ──► sweep ──► bake ──► variants ──► Revit
                     every value      person          fixed code   validate all first    asserts vs   every knob   WISE::      in family     exchange file
                     has a basis      approves        -> GhJSON    one undo, one solve   oracle       at its edges  layers      and scored    + Dynamo, read back
```

1. **Rules first.** A family spec (JSON) gives every parameter a value, a basis (`measured` with a source, `inferred` with how, `assumed` needing approval, `unknown` blocking), a range, and for knobs a band. Invariants (plan type, twist direction, taper law) never vary: they are the design language.
2. **Compiled, not hand-wired.** Fixed code turns the spec into a definition in **wise.ghjson**, a profile of [GhJSON 1.0](https://github.com/architects-toolkit/ghjson-spec): typed sliders, a Python 3 script component for the family logic, native components downstream (Boundary Surfaces, Extrude, Loft, Area).
3. **Atomic apply.** Every component and wire is resolved before anything touches the canvas. One bad name and nothing is added; every error is reported at once. Exact names only.
4. **Measured in Rhino.** Plates closed and planar, floor count, top level, corner rotation measured from the geometry, top scale from areas, and every plate's area against a pure-Python oracle (the same functions run in the script component and offline).
5. **Sweep.** Every knob at both ends of its band must still build.
6. **Variants in the family.** Seeded Latin hypercube inside the bands, scored for novelty and silhouette similarity, Pareto front, a person picks.
7. **Revit.** Native levels, floors (not structural) and DirectShape massing, built by Revit's own Dynamo from an exchange file. No Rhino inside Revit, no licence check, nothing online. Every element is tagged, a rerun replaces instead of duplicating, and the read-back checks counts, elevations and areas in Revit. See [revit/README.md](revit/README.md). *Live run in Revit 2026 through Dynamo, 4 Dec 2026: all three PASS, and a second run replaced every element without duplicating (table below).*

## In Revit, as measured (live, 4 Dec 2026)

Revit 2026, Dynamo, CPython 3 node, new project from the Construction template. No Rhino in Revit.

| Family | Levels | Native floors | Massing (DirectShapes) | Worst floor area vs exchange | Level error | Rerun |
|---|---|---|---|---|---|---|
| Turning Torso | 54 | 54 (45 housing + 9 recessed), 0 structural | 9 cube skins, core, 90 spine members | 1.000007 | 0.0 m | 57 replaced, 54 levels reused, same counts |
| 30 St Mary Axe | 41 | 41, 0 structural | skin, 720 diagrid members | 0.999946 | 0.0 m | 43 replaced, 41 levels reused |
| Shanghai Tower | 128 | 128, 0 structural | skin | 0.999950 | 0.0 m | 129 replaced, 128 levels reused |

Since 0.4.1 every floor is on a `WISE slab <mm> mm` type at the family's slab thickness (Torso 270 and 900 mm, the others 300 mm, every floor within 0.0 mm), and the massing is smooth Revit geometry: the Shanghai skin is one loft through all 128 floor profiles, the Torso skins nine lofts, and all 810 diagrid and spine members round extrusions, with nothing falling back to triangles. Build times inside Revit: 1.1 s, 2.2 s and 5.4 s. Reports: `examples/<name>/revit/*.revit_report_*.json`.

## Floor plan to walkthrough: Villa Savoye (live, 5 Dec 2026)

![Villa Savoye, built in Revit by revit_plan.py and rendered in D5 Render](examples/villa_savoye/savoye_d5_arrival.jpg)

A second way in: a floor plan written as data (`wise.revit-plan`), built as native Revit elements, then synced to D5 Render with its cameras for a walkthrough. The worked example is Le Corbusier's Villa Savoye (`grmcp/plan.py`, `examples/villa_savoye/villa_savoye.plan.json`): 25 pilotis on a 4.75 m grid, a ramp in 4 flights, a spiral stair from ground to roof, strip windows, the hanging garden, the roof solarium and 9 cameras along the promenade. Every assumed value carries a note saying so.

| Built in Revit 2026 (one Dynamo run, 6.5 s, verdict PASS, 0 failures) | Count |
|---|---|
| Walls (line and arc) / wall openings | 26 / 4 |
| Curtain walls (strip glazing embedded in walls, free glass walls) | 6 |
| Floors / ramp flights as sloped floors (9.46°) | 7 / 4 |
| Columns (round pilotis) / parapets | 25 / 6 |
| Spiral stairs (native, StairsEditScope) | 2 |
| Doors / rooms / perspective cameras / plan views | 7 / 10 / 9 / 3 |

Read back from Revit: salon 85.27 m² (published about 84 m²). Entrance hall 163 m² against about 60 m² published, because the plan has no walls for the service rooms behind the hall, so Revit counts them as hall. Report: `examples/villa_savoye/villa_savoye.plan.revit_report_030032.json`.

![The Revit 3D view, category by category: pilotis, slabs and ramps, walls, then glass, stairs and doors](examples/villa_savoye/savoye_revit_buildup.jpg)

Run it: open `revit/wise_revit_run.dyn` in Dynamo (Revit 2026, CPython 3), set Repo to this folder, Module `revit_plan` and Arguments `{"plan": "examples/villa_savoye/villa_savoye.plan.json", "mode": "build", "n": 1}` (change `n` to force a rerun; `mode` can be `dry`, `build` or `remove`; `"live": 0.4` pauses between steps so a screen recording shows the house going up). Every element is tagged `wise:savoye:<kind>:<id>` in Comments and replaced on rerun. `revit/revit_shots.py` exports the 9 camera views as PNGs, `revit/revit_probe_types.py` lists the types a template offers. Then D5 Sync for Revit (0.4.8 or later for Revit 2026): Start D5, then Sync Cameras, and each Revit camera arrives as a D5 scene.

Six things broke on the way to the clean run. Each is written up in [revit/LESSONS.md](revit/LESSONS.md) with the fix.

## Three demos, as measured

Each family's definition is saved on its own, written by Grasshopper itself: [Shanghai](examples/shanghai/shanghai_family.gh), [30 St Mary Axe](examples/gherkin/gherkin_family.gh), [Turning Torso](examples/turning_torso/turning_torso_family.gh) (plus `.ghx` for diffs). Read back independently: 16, 26 and 27 objects.

### Turning Torso (segmented-twist family)

![Segmented twist family and three variants](examples/turning_torso_and_variants.png)

| Check | Source | Expected | Grasshopper, measured in Rhino |
|---|---|---|---|
| Levels | HSB: 9 cubes of 5 floors plus the conical slab level, 54 counting those | 54 | 45 housing plates + 9 recessed gap levels |
| Top occupied floor | CTBUH 178.8 m | ±0.5% | 178.61 m |
| Twist | HSB, Wikipedia: 90°, about 1.6° per floor, clockwise | -88.3° across housing floors 1 to 53 | -88.30° (measured from the point of each plate) |
| Floor plate | NCC, HSB: about 400 m² per floor | 400 to 560 m² gross | 432 m² |
| Core | Calatrava: 10.6 m inside, walls 2.5 m to 0.4 m | | lofted, tapering |
| Spine | Calatrava: one steel spine, braced to every cube | 90 members | 90 members, piped |
| Plate areas vs oracle | pure Python | within 0.1% | worst floor 1.0000000 |
| Sweep, 7 knobs × 2 band edges | | all build | 14 of 14 (after fixing the side band, below) |
| Variants | 12 sampled, seed 7 | in family | 3 built: 8, 10 and 9 cubes, 75° to 80° of twist |

The first live run failed its sweep: at the bottom of the side band (17 m) the 15.6 m core left less than 1 m to the facade, so the script refused to build. The band now starts at 18 m, and `family_check` builds every knob at both band edges offline, so a band that can't build is caught before Grasshopper is opened. Assumed and labelled: wall bulge, gap recess, spine offset, member size. Inferred: floor-to-floor 3.37 m (178.8 m ÷ 53), crown 11.4 m (to reach 190 m), plate side and point length.

### 30 St Mary Axe (diagrid-tower family)

![Diagrid family and three variants](examples/gherkin_and_variants.png)

| Check | Source | Expected | Grasshopper, measured in Rhino |
|---|---|---|---|
| Floors | New Steel Construction (NSC), CTBUH | 41 plates (levels 0 to 40) | 41 closed planar plates |
| Top occupied floor | NSC 167.1 m | ±0.5% | 167.10 m |
| Widest floor | NSC 56.15 m at level 17 | ±0.5%, level 17 | 56.15 m at level 17 |
| Lightwell twist | NSC 5° per floor | -200° over 40 floors | -200.2° (measured from the lightwell apexes) |
| Diameter at level 38 | Mele et al. 30 m | | 30.0 m (q_above fitted to it) |
| Diagrid | NSC: nodes every 2 storeys; 18 per ring (WikiArquitectura) | 720 members | 720 members, piped |
| Plate areas vs oracle | pure Python | within 0.1% | worst floor 1.0000000 |
| Sweep, 8 knobs × 2 band edges | | all build | 16 of 16, 0 errors |
| Variants | 12 sampled, seed 7 | in family | 3 built: 7, 5 and 6 lightwells, 15 to 22 nodes per ring |

Assumed and labelled: lightwell width and depth, profile curvature below the widest floor, lens size, slab and member sizes. Inferred: ground storey 5.25 m (167.1 m − 39 × 4.15 m), base 49 m and top 26.5 m diameters from secondary sources. Family spec: [families/gherkin.family.json](families/gherkin.family.json). Report: [examples/gherkin/report_20261203.json](examples/gherkin/report_20261203.json).

### Shanghai Tower (twisting-tower family)

![Twisting family and three variants](examples/shanghai_tower_and_variants.png)

| Check | Source | Expected | Grasshopper, measured in Rhino |
|---|---|---|---|
| Floors | CTBUH | 128 | 128 closed planar plates, 1 path |
| Top level | CTBUH highest occupied floor 583.4 m | ±1% | 583.44 m |
| Total twist | Gensler 2010: about 120°, linear | ±1% | 120.0° (measured from the plate corners) |
| Top scale | Gensler 2010: about 55% reduction | 0.45 ±2% | 0.450 (from areas) |
| Runtime errors | | 0 | 0 errors, 0 warnings |
| Plate areas vs oracle | pure Python | within 0.1% | worst floor 1.0000000 |
| Sweep, 6 knobs × 2 band edges | | all build | 12 of 12, 128 plates each, 0 errors |
| Variants | 12 sampled, seed 7 | in family | 12 in family, 3 picked and built: v04, v09, v12 |

Assumed and labelled as such (not published): base size, side-arc radius, corner radius, taper curvature, slab thickness. The rules gate lists them for a person to approve. Full report: [examples/shanghai/report_20261203.json](examples/shanghai/report_20261203.json). Family spec: [families/shanghai_tower.family.json](families/shanghai_tower.family.json).

![The definition the agent built](examples/shanghai_canvas.png)

## Install

You need Windows or macOS, Rhino 8 (not Safe Mode, so Grasshopper loads) and Python 3.9+. No packages.

| Step | Do |
|---|---|
| 1 | `git clone https://github.com/gideon-wise/grasshopper-revit-mcp` (keep the path free of spaces) |
| 2 | In Rhino 8: `_-RunPythonScript <repo>\rhino\start_listener.py` (127.0.0.1:9656, token shared with [WiseRhino MCP](https://github.com/gideon-wise/wise-rhino-mcp) in `~/.wise-rhino/token`) |
| 3 | Claude Code: `claude mcp add grasshopper-revit -- python <repo>/server/gh_revit_mcp.py`. Claude Desktop or Cursor: see `mcp.json` |
| 4 | Check: `python server/gh_revit_mcp.py --check` |
| 5 | Try the demos without an AI app: open an empty metres file in Rhino 8, run `_-RunPythonScript <repo>\rhino\run_tower_demo.py`, `..\run_gherkin_demo.py` and `..\run_torso_demo.py`, then `..\save_all_3dm.py` for one picture and a new .3dm. Reports land in `examples/<name>/out/report.json` |
| 6 | Revit (no Rhino needed in Revit): `python revit/make_exchanges.py`, then open `revit/wise_revit_build.dyn` in Dynamo, Mode `dry`, then `build`. See [revit/README.md](revit/README.md) |
| 7 | Floor plan to Revit: see [Floor plan to walkthrough](#floor-plan-to-walkthrough-villa-savoye-live-5-dec-2026) |

Offline tests (no Rhino, no Revit): `python -m unittest discover tests` (39 tests, including the Revit build against a stand-in Revit API and the Villa Savoye plan checks).

## Tools

| Family (offline) | Grasshopper (in Rhino) |
|---|---|
| `family_check`: rules gate | `gh_status`, `gh_result` (a timeout is not a failure) |
| `family_metrics`: the oracle numbers | `gh_find_component`, `gh_describe_component`: exact names only |
| `family_compile`: spec to wise.ghjson | `gh_new_document`, `gh_apply`: atomic build, one undo, one solve |
| `family_variants`: sample, score, shortlist | `gh_solve`, `gh_messages`, `gh_outputs`: errors and tree shapes |
| `family_revit_exchange`: levels, floor outlines and massing for Revit |
| `plan_check`, `plan_drawing`, `plan_example`: floor plan specs for revit_plan.py |
| `ghjson_validate`: before the canvas | `gh_set_slider`, `gh_measure_plates`, `gh_bake` (tagged, replaces its own) |
| | `gh_save_copy` (never overwrites), `gh_capture_canvas`, `gh_capture_view` |

Skills (`skills/`): `grasshopper-revit` (router), `gh-author`, `image-to-family`, `family-variants`, `verify-family`, `gh-to-revit`.

## What it can't do yet

- **Revit massing is DirectShape.** Skins, cores and members are smooth Revit solids (lofts through the floor profiles, round members), but they schedule as Mass and Generic Models, not as walls or curtain walls, and carry no facade panels yet. The optional Rhino.Inside.Revit route (`rhino/revit_push.py`) is written but not run: on Revit 2026 with Rhino below 8.21 it needs Rhino.Inside.Revit v1.32 RC3, and starting Rhino inside Revit runs Rhino's licence check.
- **Three families.** The compiler knows twisting towers, diagrid towers and segmented twists. Others (setback towers, shells, stadium bowls) need their own geometry module and compile function, about 150 lines each.
- **Images are read by the agent, not by code.** Measuring twist and taper from photos is a skill (method and rules), not a tool yet.
- **Similarity is blunt.** Silhouette IoU scored all twelve tower variants 0.89 to 0.97. An image-embedding score on clay renders comes next.
- **Massing only.** No Shanghai notch, inner cylinders or podium; no Gherkin core, glazing pattern or base; no Torso balconies, windows or conical slab profile (modelled flat). Captures are proof views, not presentation renders.
- **Plans are typed in, not read from drawings.** The Villa Savoye spec was written from published dimensions. Reading a PDF or DWG plan into a spec is a skill for later. Rooms behind the hall are missing, furniture is left out, and the `live` pause option is written but not yet run in Revit.
- **GH2 and Rhino 9** not tested. Grasshopper 1 on Rhino 8.18 is.

## Built on

Ported or adapted from MIT and CC0 projects: LAMCP, Cordyceps, Hyperceps, McNeel RhinoAI, rhinomcp, GhJSON, Rhino.Inside.Revit, rvt-mcp (Apache-2.0, design only). Details in [NOTICE.md](NOTICE.md). Research and design: [docs/DESIGN.md](docs/DESIGN.md).

Part of the WiseStack family: [WiseStack](https://github.com/gideon-wise/wisestack) (verification-first agent workflows for Rhino) and [WiseRhino MCP](https://github.com/gideon-wise/wise-rhino-mcp) (offline Rhino bridge).

Recreating a named building here is an educational massing study after published descriptions, not the architects' design data. No logos, drawings or renders of theirs are included.

MIT licence.

TDQS

B3/5.0

Scored across 24 tools

Disambiguation4/5

Tools are grouped by clear domain prefixes (gh_, family_, plan_, ghjson_) and mostly target distinct resources. A few boundaries require reading descriptions to separate: gh_solve vs gh_messages, gh_capture_canvas vs gh_capture_view, and family_metrics vs gh_measure_plates (same floor-plate concepts, different backends) could cause momentary misselection, but descriptions disambiguate.

Naming Consistency4/5

Consistent snake_case with a domain-prefix convention (gh_*, family_*, plan_*, ghjson_validate) applied throughout. Minor verb/noun mix within prefixes (family_check vs family_metrics, plan_check vs plan_drawing) is still predictable and readable.

Tool Count3/5

24 tools is at the heavy end and crosses into the 'feels heavy' band, spread across four sub-domains (Grasshopper control, family specs, plan specs, capture). Each tool is largely non-redundant and earns a place given the breadth, but the surface is large enough to burden an agent's selection.

Completeness4/5

Grasshopper control and family lifecycle (check, metrics, compile, variants, Revit exchange) are thoroughly covered, and the gh_ pipeline (status, find, describe, apply, solve, outputs, bake, save) has no dead ends. The plan side is thinner—only check, drawing, and example, with construction deferred to an external Dynamo script—leaving a mild gap.

Maintenance

ActivityMaintained
ResponsivenessNo recent community issues