wasp-mcp-server

v0.5.2
wasp-mcp-server Checked 3 days ago Published 4 months ago

MCP server that places and wires Wasp discrete-aggregation components on a live Grasshopper canvas (bridge: GH_MCP_Wasp / wasp-mcp-bridge on Yak, TCP…

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

gh_add_component Gh Add Component

Add a stock Grasshopper component to the canvas. Use for built-in components (e.g. "Number Slider", "Panel", "Mesh", "Geometry", "Construct Plane"). For Wasp components use gh_add_wasp_component instead.

ParameterTypeDescription
component_type *stringGrasshopper component name (e.g. "Number Slider").
x *numberCanvas x coordinate.
y *numberCanvas y coordinate.
solvePass false to suppress the automatic recompute (v0.3 bridge batching); finish the batch with gh_expire + gh_wait_idle.

gh_add_wasp_component Gh Add Wasp Component

Add a Wasp component (from an installed .ghuser UserObject) to the canvas. The name is resolved against the local Wasp registry with fuzzy matching: "Basic Part", "basic_part" and "stochastic" all work. Use list_wasp_components to see what is available.

ParameterTypeDescription
name *stringWasp component name or registry key (fuzzy matched).
x *numberCanvas x coordinate.
y *numberCanvas y coordinate.
solvePass false to suppress the automatic recompute (v0.3 bridge batching); finish the batch with gh_expire + gh_wait_idle.

gh_connect Gh Connect

Connect a source component output to a target component input. Params are resolved by name OR nickname, case-insensitively. For components with a single implicit output (Panel, Number Slider) simply omit source_param (optionally pass source_index=0).

ParameterTypeDescription
source_id *stringInstance guid of the source component.
target_id *stringInstance guid of the target component.
solvePass false to suppress the automatic recompute (v0.3 bridge batching); finish the batch with gh_expire + gh_wait_idle.
source_indexOptional explicit output index (overrides name).
source_paramOutput param name/nickname (omit to use index or the component's single output).
target_indexOptional explicit input index (overrides name).
target_paramInput param name/nickname (omit to use index or the component's single input).

gh_set_slider Gh Set Slider

Set a Number Slider's value (and optionally its min/max range).

ParameterTypeDescription
component_id *stringInstance guid of the Number Slider.
value *numberNew slider value.
maximumOptional new upper bound.
minimumOptional new lower bound.
solvePass false to suppress the automatic recompute (v0.3 bridge batching); finish the batch with gh_expire + gh_wait_idle.

gh_set_panel Gh Set Panel

Set the text of a Panel component. Multi-line content (e.g. Wasp rule grammars, one rule per line) is passed with "\n" newlines. On a v0.3+ bridge each line becomes a SEPARATE data item by default (split_lines=true); pass split_lines=false to emit the whole text as one item (v0.1 behavior). Pre-v0.3 bridges ignore the flag and always emit one item.

ParameterTypeDescription
component_id *stringInstance guid of the Panel.
text *stringPanel text content.
solvePass false to suppress the automatic recompute (v0.3 bridge batching); finish the batch with gh_expire + gh_wait_idle.
split_linesOne data item per line (default true on v0.3 bridges).

gh_set_geometry_ref Gh Set Geometry Ref

Reference Rhino document geometry into a canvas param component. Points a Geometry/Mesh/Brep parameter component at existing Rhino objects by their document GUIDs.

ParameterTypeDescription
component_id *stringInstance guid of the param component on the canvas.
object_ids *Rhino object GUID strings to reference (JSON array; a JSON-encoded string is also accepted).
solvePass false to suppress the automatic recompute (v0.3 bridge batching); finish the batch with gh_expire + gh_wait_idle.

gh_set_plane_values Gh Set Plane Values

Set persistent plane data directly on a floating Plane param (v0.2 bridge). Removes the need for the three-panels-into-Construct-Plane workaround: place a "Plane" param with gh_add_component, then set its planes here. On a v0.1 bridge this returns an unknown-command error — use the Construct Plane path instead (create_wasp_part does this automatically).

ParameterTypeDescription
component_id *stringInstance guid of the Plane param component.
planes *Planes (JSON array; a JSON-encoded string is also accepted), each either {"origin":[x,y,z], "xAxis":[x,y,z], "yAxis":[x,y,z]} or a flat 9-float list [ox,oy,oz, xx,xy,xz, yx,yy,yz]. xAxis/yAxis must be…
solvePass false to suppress the automatic recompute (v0.3 bridge batching); finish the batch with gh_expire + gh_wait_idle.

gh_set_toggle Gh Set Toggle

Set a Boolean Toggle component's value (v0.2 bridge).

ParameterTypeDescription
component_id *stringInstance guid of the Boolean Toggle.
value *booleanNew toggle state (true/false).
solvePass false to suppress the automatic recompute (v0.3 bridge batching); finish the batch with gh_expire + gh_wait_idle.

gh_delete Gh Delete

Delete components from the Grasshopper canvas (v0.2 bridge). The WaspMCP bridge component itself is never deleted; its entry comes back with {"deleted": false, "error": "cannot delete bridge"}.

ParameterTypeDescription
component_ids *Instance guids of the components to remove (JSON array; a JSON-encoded string is also accepted).

gh_group Gh Group

Group canvas components under a labeled GH_Group (v0.4 bridge). Purely visual — grouping never triggers a recompute. An id already in another group is fine (Grasshopper supports nested/overlapping groups). Ids that don't exist get per-id error entries in "results" while the rest are still grouped.

ParameterTypeDescription
ids *Instance guids of the components to group (JSON array; a JSON-encoded string is also accepted).
name *stringGroup label shown on the canvas (e.g. "AGGREGATION").
colorOptional group color as [r,g,b] or [r,g,b,a] with channels 0-255, order RGBA (alpha LAST; defaults to 150, Grasshopper's own group transparency, when omitted). JSON-encoded string also accepted.

gh_scribble Gh Scribble

Place a text scribble (canvas note) on the Grasshopper canvas (v0.4 bridge). Use for explainer notes above groups: what a stage does and why it exists. Purely visual — never triggers a recompute. Multi-line text uses "\n".

ParameterTypeDescription
text *stringNote text.
x *numberCanvas x of the scribble pivot (top-left).
y *numberCanvas y of the scribble pivot.
sizenumberFont size in points (default 14).

gh_workflow_note Gh Workflow Note

Place a workflow-level overview note: title + wrapped paragraphs (v0.4). The 'what is this whole graph doing' paragraph that individual stage explainers don't cover. Place it at the TOP-LEFT of the workflow's canvas zone, above everything. Text is wrapped to ~width chars per line with paragraph breaks preserved, so long descriptions stay in a tidy column instead of sprawling over components. Write it for someone opening the file cold: what the workflow produces, what drives it, where to look.

ParameterTypeDescription
text *stringOverview body; may be long, use "\n" for paragraph breaks.
title *stringShort workflow title (rendered UPPERCASE with a separator).
x *numberCanvas x of the note's top-left.
y *numberCanvas y of the note's top-left.
widthintegerWrap column in characters (default 64).

gh_set_nickname Gh Set Nickname

Rename a component/param instance on the canvas (v0.4 bridge). Use to make generated workflows legible: name sliders after their role ("part count", "random seed") instead of leaving bare numbers. A pure rename never recomputes the solution; the bridge only refreshes the component's layout and repaints.

ParameterTypeDescription
component_id *stringInstance guid of the component to rename.
nickname *stringNew display name.

gh_get_output Gh Get Output

Read the output data of a component after the solution has computed. Meshes come back as {"vertices": [[x,y,z]...], "faces": [[a,b,c(,d)]...]}, planes as {"origin","xAxis","yAxis"}, transforms as 16-float row-major arrays, primitives as-is. If the result has "truncated": true, raise max_items or bake instead. Returns error "solution_running" if the GH solution is still computing — retry after a moment.

ParameterTypeDescription
component_id *stringInstance guid of the component.
param *stringOutput param name or nickname.
max_itemsintegerTruncation limit for returned items.

gh_canvas_state Gh Canvas State

Snapshot the whole Grasshopper canvas. Returns all components (id, name, nickname, position, runtime error/warning messages), all connections, and the solution state ("idle" or "running"). Use to drift-check after a sequence of edits or to diagnose red/orange components.

gh_expire Gh Expire

Expire components and schedule a recompute of the GH solution.

ParameterTypeDescription
component_idsInstance guids to expire (JSON array; a JSON-encoded string is also accepted); omit to recompute the entire document.

gh_wait_idle Gh Wait Idle

Block until the Grasshopper solution is idle (v0.3 bridge). Replaces client-side sleep/retry loops after gh_expire or any batch of edits. The bridge polls the solution state every ~100 ms on its TCP thread (never occupying the UI thread) and answers once two consecutive reads are idle.

ParameterTypeDescription
timeout_msintegerMax wait in milliseconds (default 30000, bridge caps at 120000).

gh_bake Gh Bake

Bake a component output's geometry into the Rhino document.

ParameterTypeDescription
component_id *stringInstance guid of the component.
param *stringOutput param name or nickname to bake.
layerTarget Rhino layer (e.g. "WASP::AGG"); bridge default if None.

gh_clear Gh Clear

Clear the current Grasshopper document (removes all components).

gh_save Gh Save

Save the current Grasshopper document to a .gh file.

ParameterTypeDescription
path *stringAbsolute destination path for the .gh file.

gh_capture_viewport Gh Capture Viewport

Capture a Rhino viewport to an image (v0.5 bridge). Returns the PNG as MCP image content (rendered inline by any MCP client), NOT base64 text. Use to see what an aggregation or generated geometry actually looks like.

ParameterTypeDescription
heightOutput height in px (bridge clamps to 1080).
viewportNamed viewport (e.g. "Perspective", "Top"); default the active viewport.
widthOutput width in px (bridge clamps to 1920).
zoom_extentsbooleanZoom to the scene extents before capturing. The camera is NOT restored afterwards — manage it yourself if you need a fixed view.

gh_capture_canvas Gh Capture Canvas

Capture the Grasshopper canvas to an image (v0.5 bridge). Returns the PNG as MCP image content. Use to inspect canvas organization (groups, scribbles, layout) — e.g. after expand_template.

ParameterTypeDescription
regionOptional canvas rectangle [x, y, w, h] in canvas coordinates (JSON array; a JSON-encoded string is also accepted) — pass a zone rect from a macro/expansion result to frame one workflow. Omit for the…
zoomOutput scale factor (bridge clamps total pixels to 4 MP).

gh_list_component_types Gh List Component Types

List installed Grasshopper component types (v0.3 bridge). Enumerates Grasshopper's ComponentServer proxies — every component from every installed plugin, not just Wasp. Use gh_component_schema for the full input/output signature of one type.

ParameterTypeDescription
categoryCase-insensitive substring matched against the component category (e.g. "Wasp", "Mesh").
filterCase-insensitive substring matched against name, nickname and description (e.g. "mesh").
limitintegerMax entries returned (default 100; "total" reports the full match count).

gh_component_schema Gh Component Schema

Describe a Grasshopper component type's full signature (v0.3 bridge). The bridge instantiates the component IN MEMORY (never on the canvas), reads its params, and discards it. Accepts a component name (exact then substring match) or a component GUID from gh_list_component_types.

ParameterTypeDescription
name *stringComponent type name (e.g. "Mesh Box") or GUID.

list_wasp_components List Wasp Components

List all Wasp components installed on this machine. Each entry has: key (use with gh_add_wasp_component and macros), filename, path, category (part/connection/rule/aggregation/field/ disco/util, guessed from the name), and cached inputs/outputs docs when the component has been placed at least once this session.

ParameterTypeDescription
categoryOptional filter (e.g. "aggregation").

refresh_registry Refresh Registry

Rescan %APPDATA%/Grasshopper/UserObjects for Wasp_*.ghuser files. Use after installing or updating Wasp UserObjects while the server is running.

list_templates List Templates

Enumerate the stage templates the expander can build (v0.5). Templates are mined-and-abstracted corpus subgraphs with typed SLOTS (see docs/generation-principles.md): the same paneling stage accepts a box, a loft, or a referenced surface. Sources: server/knowledge arch_patterns.json (architectural corpus) and wasp_patterns.json (Wasp corpus). No bridge round-trip.

expand_template Expand Template

Expand a stage template into a live canvas subgraph (v0.5). Binds the template's slots, places the body (stock components BY GUID from corpus dump evidence, Wasp components via the registry), wires the exact recorded param names, batches everything with solve:false + one final recompute, and applies the v0.4 organization conventions (INPUTS group with role-nicknamed sliders, stage group, explainer scribble). ALL binding problems (unknown slots, unbound required slots, kind mismatches) are reported as one typed error BEFORE anything is placed.

ParameterTypeDescription
template_id *stringTemplate id from list_templates (e.g. "arch.attractor_scale_grid").
bindingsSlot bindings (JSON object; a JSON-encoded string is also accepted). Driver slots take numbers ("count": 120) or "a To b" domain text; geometry/wasp slots take a component id string, {"component_id":…
xnumberCanvas x of the expansion zone's origin (drivers column).
ynumberCanvas y of the expansion zone's origin.

create_wasp_part Create Wasp Part

Create a Wasp Basic Part wired to referenced Rhino geometry. Places Basic Part + a Mesh param referencing the given Rhino objects + a name panel, and (optionally) Connection From Plane fed either by explicit planes or by referenced planar geometry. NOTE: connection-plane Z axes (xAxis × yAxis) must point OUTWARD from the part volume, or every placement collides with the host part.

ParameterTypeDescription
geometry_object_ids *Rhino GUIDs of the part's mesh geometry (JSON array; a JSON-encoded string is also accepted).
name *stringPart name (fed into the part's NAME input).
connection_object_idsAlternative to planes — Rhino GUIDs of planar geometry to derive connections from.
connection_planesOptional connection planes (JSON array; a JSON-encoded string is also accepted), each either {"origin":[x,y,z], "xAxis":[x,y,z], "yAxis":[x,y,z]} or a flat 9-float list [ox,oy,oz, xx,xy,xz, yx,yy,yz].
xnumberCanvas x for the part component.
ynumberCanvas y for the part component.

define_rules Define Rules

Create Wasp aggregation rules from a text grammar. Places Rule From Text fed by the grammar (one rule per line) and wires the given part components into it. Wasp rule syntax here is "PART|conn_PART|conn", e.g. "P|1_P|0": connection 1 of an existing part named P hosts connection 0 of a new part P (pipe between part name and connection index, underscore between the existing-part half and the new-part half). Rules are directional — write both directions if you want both. Wasp has two OTHER rule languages this macro rejects: "TYPE>TYPE" connection-type grammars (e.g. "END>END") belong in Rules…

ParameterTypeDescription
grammar_text *stringRule grammar, one rule per line ("\n" separated), e.g. "P|1_P|0\nP|2_P|0".
parts_component_ids *part_id values from create_wasp_part (JSON array; a JSON-encoded string is also accepted).
xnumberCanvas x for the rules component.
ynumberCanvas y for the rules component.

run_aggregation Run Aggregation

Place and run a Wasp aggregation. Places the aggregation component (stochastic / field / graph), wires the parts and rules into it (batched, no intermediate solves on a v0.3 bridge), pulses RESET automatically so the aggregation initializes from complete inputs (corpus files use a Button; the auto-wired Boolean Toggle produces the same False→True→False edge), then recomputes and waits for the solution to settle. Mode differences (real Wasp component signatures): - "stochastic": N count slider + optional seed slider. - "field": N slider, NO seed; REQUIRES field_component_id wired into…

ParameterTypeDescription
count *integerNumber of parts to aggregate (N slider; ignored for graph).
part_ids *part_id values from create_wasp_part (JSON array; a JSON-encoded string is also accepted).
rule_id *stringrules_component_id from define_rules (stochastic/field) or a panel id with graph rules (graph).
catalog_component_idOptional Wasp Parts Catalog component id; its CAT output is wired into the aggregation's CAT input for stock/proportion control. LIM=False (default) = NUM values are proportional probabilities; LIM=Tr…
field_component_idComponent whose FIELD output drives a field-mode aggregation (required when mode="field").
global_constraint_idsOptional Wasp global-constraint components (Plane Constraint / Mesh Constraint ids; JSON array, a JSON-encoded string is also accepted). Their constraint outputs (PC / GC) are wired into the aggregati…
modestring"stochastic" (default), "field", or "graph".
seedOptional random seed (stochastic mode only).
xnumberCanvas x for the aggregation component.
ynumberCanvas y for the aggregation component.

get_aggregation Get Aggregation

Extract results from a computed Wasp aggregation. out="meshes": Get Part Geometry downstream, returns serialized meshes. out="transforms": Deconstruct Part downstream, returns part transforms. out="bake": bakes the aggregated geometry into the Rhino document. Idempotent: an extractor of the right type already wired to this aggregation is reused instead of placing a duplicate ("reused_extractor" in the result says which happened).

ParameterTypeDescription
aggregation_id *stringaggregation_id from run_aggregation.
layerRhino layer for out="bake" (default "WASP::AGG").
max_itemsintegerTruncation limit when returning data.
outstring"meshes" (default), "transforms", or "bake".

reset_aggregation Reset Aggregation

Reset a Wasp aggregation via its RESET input (v0.2 bridge required). Wires a Boolean Toggle onto the aggregation's RESET input if none is connected yet, then pulses it false -> true -> false with a solution expiry after each step (Wasp's own examples use a Button on RESET; the toggle pulse produces the same edge). Use after changing rules/parts/ seed to force the aggregation to recompute from scratch.

ParameterTypeDescription
aggregation_id *stringaggregation_id from run_aggregation (or the instance guid of any Wasp aggregation component on the canvas).