mcp

v0.35.0
@statelyai/mcp Checked 19 hours ago Published 8 hours ago

Reusable 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.

ParameterTypeDescription
globstring

get_machine get_machine

Read a machine source from the workspace and return it.

ParameterTypeDescription
path *string
includeSourceTextboolean

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.

ParameterTypeDescription
models *array
autoColorbooleanFill 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.
selectedMachineIdstring
workspaceIdstring

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.

ParameterTypeDescription
workspaceId *string
offsetinteger

update_visualization_workspace Update visualization workspace

Persist temporary draft edits and selection with optimistic concurrency. Never writes hosted models.

ParameterTypeDescription
expectedVersion *integer
workspaceId *string
draftsObject mapping machineIds to canonical XGraph drafts, or null to clear a draft. Validated by the workspace update schema.
selectedMachineIdstring

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.

ParameterTypeDescription
formatstring
machine
sourceobject

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.

ParameterTypeDescription
to *string
formatstring
machine
sourceobject

diff_machines Diff machines

Compute a semantic diff between two machine documents through the Stately API.

ParameterTypeDescription
base *object
compare *object
includePatchesboolean

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.

ParameterTypeDescription
cursorstring
formatstring
graphobject
kindstring
machine
maxinteger
sourceobject

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.

ParameterTypeDescription
events *array
advanceTimeMsnumber
executionModestring
formatstring
machine
sourceobject

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…

ParameterTypeDescription
formatstring
limitsobject
machine
rulesobjectNative 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.
sourceobject

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.

ParameterTypeDescription
autoColorbooleanFill 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.
directionstring
formatstring
imageFormatstring
layoutboolean
machine
root
sourceobject

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.

ParameterTypeDescription
autoColorbooleanFill 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.
directionstring
focusboolean
formatstring
layoutboolean
machine
machineIdstring
namestring
parentNodeIdsarray
presentationstringDefaults 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
sourceobject
workspaceIdstring

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.

ParameterTypeDescription
code *string
xstateVersionOptional 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.

ParameterTypeDescription
machineId *string
directionstring
layoutboolean
parentNodeIdsarray
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.

ParameterTypeDescription
projectId *stringStately 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.

ParameterTypeDescription
projectId *stringStately project id (`projectId`, never a project version id).

get_stately_machine Get Stately machine

Read one hosted Stately machine, including its definition.

ParameterTypeDescription
machineId *stringStately machine id (`machineId`).