Create and visualize state machines from descriptions using the VSCXML MCP tools.
Guided workflow for designing, testing, and generating SCXML state machines.
When the user asks to:
Call scxml_status first to check which backends are running:
Clarify requirements -- Ask about states, events, data variables, and target language if not specified.
Create the SCXML using scxml_create:
<send>, <cancel>, <assign>: use structured action objects:
{"onEntry": [{"type": "send", "event": "timer", "delay": "500ms", "id": "t1"}],
"onExit": [{"type": "cancel", "sendid": "t1"}]}
Validate using scxml_validate:
Inspect using scxml_inspect:
Push to editor (if connected) using editor_push_scxml:
editor_auto_layouteditor_add_image:
filePath for large images (editor reads from disk, avoids base64 in MCP)name for display in structure panelvisibleWhen for state-dependent visibilityattachedTo to nest under a parent stateeditor_add_noteeditor_highlight using presets: "error" (red), "success" (green), "warning" (yellow), "info" (blue)Simulate:
scxml_sim_start(source="editor", connectEditor=true) — fetches from editor, auto-reconnects for live highlights<send delay="..."/> for internal events, use scxml_sim_timed_scenario (NOT scxml_sim_scenario). Timed mode lets internal timer events fire between external events.enabledEvents per step so you know which events are validscxml_sim_send(event, invokeId="childId") to send events directly to a specific invoked child machine.Save the trace using embedTrace parameter on scenario tools (saves a round-trip):
{"events": [...], "embedTrace": {"name": "sim-demo", "description": "Full cycle"}}
Or separately: scxml_trace_embed(name="...", target="both")
Iterate based on the user's feedback:
editor_add_state(parentId="parentId", id="myState", label="My State") to add child stateseditor_add_transition(source, target, event="go", cond="x > 0") for transitionseditor_set_property for targeted edits (NOT full push_scxml)editor_set_image_property to modify existing images (position, visibility, z-order)editor_clone_state to duplicate compound states (remaps IDs, initial, label)editor_remove_element to delete states or transitionseditor_get_scxml(includeTraces=false) to inspect without trace bloateditor_save_file to save progress to diskGenerate code using scxml_generate_project:
tracingMode: "full" to enable trace recording in generated codebuildCommand and runCommandaction_execute entriesExport for sharing and documentation:
editor_export_svg -- full diagram as parseable SVG (include in README, docs)editor_export_png -- high-res image for presentationseditor_export_player_html -- interactive HTML demo anyone can open in a browserCompare traces using scxml_compare_traces:
normalize: true for cross-runtime comparison (maps type aliases, filters verbosity)mode: "state-sequence" -- compares only state enters/exitsmode: "structural" -- ignores loop repetition counts (e.g., 3 blinks vs 5 blinks = match)expectedName/actualName to compare embedded traces by name (saves tokens)<send delay="..."/> events + external sends of the same event = processed twiceeditor_get_scxml to get current content — don't assume the last pushed version is currenttarget="both" on scxml_trace_embed to sync traces to the editor before savingeditor_add_state(parentId=...), editor_set_property, editor_clone_state, editor_remove_element over editor_push_scxml for targeted editseditor_add_state(parentId="parent", id="child", label="Child") to build nested structures