mcp
v0.35.0Reusable Stately MCP server for XState machine tooling.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
list_machines list_machines
List candidate machine sources in the workspace.
| Parameter | Type | Description |
|---|---|---|
glob | string |
get_machine get_machine
Read a machine source from the workspace and return it.
| Parameter | Type | Description |
|---|---|---|
path * | string | |
includeSourceText | boolean |
visualize_machines Visualize machines
Visualize several models in one temporary workspace without saving hosted models. Reuse the returned workspaceId and stable machineIds for subsequent additions, updates and retries. Background additions preserve selection. selectedMachineId explicitly opens a model. Source conversion is structural, not executable verification.
| Parameter | Type | Description |
|---|---|---|
models * | array | |
autoColor | boolean | Fill in missing semantic colors. Omit it to use the default (true, unless the repository disables generated colors). Pass false only when the user or repository settings ask for no colors. |
selectedMachineId | string | |
workspaceId | string |
read_visualization_workspace Read visualization workspace
Reopen a temporary visualization collection. Hosted apps can recover a result in bounded chunks by supplying offset. Does not save hosted models.
| Parameter | Type | Description |
|---|---|---|
workspaceId * | string | |
offset | integer |
update_visualization_workspace Update visualization workspace
Persist temporary draft edits and selection with optimistic concurrency. Never writes hosted models.
| Parameter | Type | Description |
|---|---|---|
expectedVersion * | integer | |
workspaceId * | string | |
drafts | Object mapping machineIds to canonical XGraph drafts, or null to clear a draft. Validated by the workspace update schema. | |
selectedMachineId | string |
validate_machine Validate machine structure
Deterministically validate machine syntax and graph structure. This does not typecheck or execute XState source; use simulate_machine and generate_graph_paths to verify runtime behavior.
| Parameter | Type | Description |
|---|---|---|
format | string | |
machine | ||
source | object |
convert_machine Convert machine
Convert XState, JSON machine configs, SCXML, XGraph, Mermaid, or D2 input to XState, SCXML, XGraph, Mermaid, or D2 through the Stately API. Returns content and warnings without saving a machine.
| Parameter | Type | Description |
|---|---|---|
to * | string | |
format | string | |
machine | ||
source | object |
diff_machines Diff machines
Compute a semantic diff between two machine documents through the Stately API.
| Parameter | Type | Description |
|---|---|---|
base * | object | |
compare * | object | |
includePatches | boolean |
apply_machine_patches Apply machine patches
Create a non-mutating behavioral proposal by applying semantic machine patches in memory through the Stately API. Returns the updated document, the structured patches, and a concise behavioral summary; it never writes files or invokes Git. Use graph entity IDs: top-level XState states commonly use <machine-id>.<state-key> (for example job.running). Use camelCase operations such as createTransition, not snake_case names.
review_machine_implementation Review machine implementation
Deterministically review an agent-edited machine against a non-mutating semantic patch proposal. Reports validation issues plus missing, extra, or divergent behavior and returns a portable Markdown review artifact with before/after Mermaid graphs. It never writes files or invokes Git.
generate_graph_paths Generate graph paths
Generate shortest or simple paths through the Stately API. XState source must be complete executable source (including imports) because it runs natively in an isolated sandbox. max sets page size (default 5, maximum 1000); pass nextCursor as cursor with the same input to retrieve more. Pagination distinguishes complete bounded generation from budget exhaustion; it does not establish application coverage.
| Parameter | Type | Description |
|---|---|---|
cursor | string | |
format | string | |
graph | object | |
kind | string | |
machine | ||
max | integer | |
source | object |
simulate_machine Simulate machine
Simulate a machine through events. XState source runs in an isolated sandbox. SCXML defaults to structural mode; executionMode="native" opts into sandboxed XState v6 execution. advanceTimeMs runs virtual timers after the supplied events. Returns execution metadata and optional completion output.
| Parameter | Type | Description |
|---|---|---|
events * | array | |
advanceTimeMs | number | |
executionMode | string | |
format | string | |
machine | ||
source | object |
check_machine Check machine
Check a native statechart (XGraph or XState config) against a rules file, or against the rules on its requirements' acceptance criteria when rules is omitted, with the bounded native explicit-state checker: never, initially, eventually, eventually-always, leads-to, no-dead-ends and reachable rules over hierarchical and parallel states and bounded context. Returns per-rule verdicts with native counterexample traces and a graph carrying the check report; save it with save_stately_check_result. Undecidable results are not-checked. Runs on the hosted API with bounded time and state limits; for TLA…
| Parameter | Type | Description |
|---|---|---|
format | string | |
limits | object | |
machine | ||
rules | object | Native rules file. Omit to use each acceptance criterion's rule from the machine's data.statelySpec (ids <requirement>/<criterion>), with context domains from its context schema. |
source | object |
export_machine_image Export machine image
Export a machine as a browser-free PNG or SVG image. Returns PNG as an image content block, or SVG markup as text. Supports XState, JSON, XGraph, SCXML, Mermaid, D2, and Digraph sources.
| Parameter | Type | Description |
|---|---|---|
autoColor | boolean | Fill in missing semantic colors. Omit it to use the default (true, unless the repository disables generated colors). Pass false only when the user or repository settings ask for no colors. |
direction | string | |
format | string | |
imageFormat | string | |
layout | boolean | |
machine | ||
root | ||
source | object |
visualize_machine Visualize machine
Generate a Stately diagram for a described flow by supplying an XState JSON config. Rendering is browser-free. Visualize XState source text (the default for strings), JSON machine configs, SCXML, XGraph, Mermaid, or D2. Returns a View in Stately link; hosts that support MCP Apps also render an interactive hierarchy graph inline, and auto presentation includes PNG and Unicode text fallbacks. Omit presentation by default. Use unicode or ascii only when the user asks for a text diagram. Optionally select a root view, request multiple parent views, or recompute PNG layout.
| Parameter | Type | Description |
|---|---|---|
autoColor | boolean | Fill in missing semantic colors. Omit it to use the default (true, unless the repository disables generated colors). Pass false only when the user or repository settings ask for no colors. |
direction | string | |
focus | boolean | |
format | string | |
layout | boolean | |
machine | ||
machineId | string | |
name | string | |
parentNodeIds | array | |
presentation | string | Defaults to auto (interactive data, PNG, and Unicode text). Leave it unset unless the user asks for a text diagram; ascii and unicode skip the PNG. |
root | ||
source | object | |
workspaceId | string |
extract_machines_from_code Extract machines from code
Deterministically extract canonical XState machine configs from JavaScript or TypeScript source. XState 5/6 syntax is inferred unless explicitly provided.
| Parameter | Type | Description |
|---|---|---|
code * | string | |
xstateVersion | Optional XState major-version override. Omit to infer from source syntax. |
report_visualization_rendered Report visualization rendered
Record that the interactive visualization rendered successfully.
visualize_stately_machine Visualize hosted Stately machine
Fetch and visualize one hosted Stately machine. Returns a View in Stately link; hosts that support MCP Apps also render an interactive hierarchy graph inline, with directly viewable PNG fallbacks and optional root, parent, or layout controls.
| Parameter | Type | Description |
|---|---|---|
machineId * | string | |
direction | string | |
layout | boolean | |
parentNodeIds | array | |
root |
list_stately_projects List Stately projects
List the hosted Stately projects the caller can access. Hosted resources only; use list_machines for workspace files.
get_stately_project Get Stately project
Read one hosted Stately project, including its current project version id and machine ids.
| Parameter | Type | Description |
|---|---|---|
projectId * | string | Stately project id (`projectId`, never a project version id). |
list_stately_project_machines List Stately project machines
List the machines belonging to a hosted Stately project.
| Parameter | Type | Description |
|---|---|---|
projectId * | string | Stately project id (`projectId`, never a project version id). |
get_stately_machine Get Stately machine
Read one hosted Stately machine, including its definition.
| Parameter | Type | Description |
|---|---|---|
machineId * | string | Stately machine id (`machineId`). |