@statelyai/mcp 0.8.7 → 0.9.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -13,11 +13,10 @@ own Stately deployment.
13
13
  the [hosted resource tools](#hosted-resource-tools) that read your Stately
14
14
  projects.
15
15
 
16
- **Both require a Stately credential.** Only `list_machines` and `get_machine`
17
- run entirely on your machine; every other tool sends the machine to Stately's
18
- HTTP API, which rejects unauthenticated calls with `Missing authentication.`
19
- Running locally changes *where the process lives*, not *whether you need an
20
- account*.
16
+ **Both use Stately credentials by default.** Only `list_machines` and
17
+ `get_machine` run entirely on your machine; every other tool calls the
18
+ configured HTTP API. Stately's hosted API rejects unauthenticated calls with
19
+ `Missing authentication.` A self-hosted API can define its own auth policy.
21
20
 
22
21
  ### Local (stdio)
23
22
 
@@ -294,6 +293,20 @@ createMachine({
294
293
  Applies semantic patches to a machine and returns the updated document. Use
295
294
  `to` to choose the returned format.
296
295
 
296
+ Patches use semantic graph operations. For example:
297
+
298
+ ```json
299
+ {
300
+ "op": "createTransition",
301
+ "sourceId": "player.playing",
302
+ "targetId": "player.paused",
303
+ "eventType": "STOP"
304
+ }
305
+ ```
306
+
307
+ Use graph entity IDs; top-level states commonly use `<machine-id>.<state-key>`. Use
308
+ camelCase operation names such as `createTransition`, not snake_case names.
309
+
297
310
  <details>
298
311
  <summary>Summary: update a machine</summary>
299
312
 
@@ -328,6 +341,8 @@ converted to structural XGraph first.
328
341
  ```text
329
342
  Use Stately to find up to five shortest paths through this machine:
330
343
 
344
+ import { createMachine } from 'xstate';
345
+
331
346
  createMachine({
332
347
  id: 'player',
333
348
  initial: 'paused',
@@ -356,6 +371,8 @@ normalization explicitly.
356
371
  ```text
357
372
  Use Stately to simulate PLAY followed by STOP on this machine:
358
373
 
374
+ import { createMachine } from 'xstate';
375
+
359
376
  createMachine({
360
377
  id: 'player',
361
378
  initial: 'paused',
@@ -374,7 +391,9 @@ createMachine({
374
391
  <!-- visualize_machine registration from src/server.ts and visualize response contract -->
375
392
 
376
393
  MCP Apps hosts render an interactive, read-only graph with hierarchy drill-in,
377
- breadcrumbs, selection utilities, pan/zoom, and viewport keyboard shortcuts.
394
+ breadcrumbs, select/pan/structural-simulation controls, selection utilities,
395
+ zoom, viewport recovery, keyboard shortcuts, and a host-mediated link to the
396
+ same graph in Stately. It starts in pan mode; AI controls remain hidden.
378
397
  Pass XState source text (the default for strings), a JSON machine config, SCXML,
379
398
  XGraph, Mermaid, or D2; the server converts it once to canonical XGraph before
380
399
  rendering the app and PNG fallbacks.
@@ -477,7 +496,7 @@ are deliberately absent.
477
496
  <summary>Summary: list the machines in a hosted project</summary>
478
497
 
479
498
  ```text
480
- Use Stately to list the machines in project project-id.
499
+ Use Stately to list the machines in the project with ID `project-id`.
481
500
  ```
482
501
 
483
502
  ```json
@@ -492,7 +511,7 @@ open-world.
492
511
 
493
512
  ## Tool-call observation
494
513
 
495
- <!-- onToolCall option and event types from src/server.ts and src/toolCallObserver.ts -->
514
+ <!-- onToolCall and clientId options from src/server.ts and event types from src/toolCallObserver.ts -->
496
515
 
497
516
  Hosts can pass `onToolCall` to `registerStatelyMcpTools` or
498
517
  `createStatelyMcpServer`. It receives a content-free completion event with the
@@ -501,6 +520,10 @@ machine source, and results are never included. Input and output validation
501
520
  failures are reported as errors. Configure the observer before registering any
502
521
  other tools on the same `McpServer`.
503
522
 
523
+ Set `clientId` to label this server's HTTP analysis calls for channel-level
524
+ telemetry. It defaults to `stately-mcp/embedded`; the stdio binary uses
525
+ `stately-mcp/stdio`. The label carries no user or machine content.
526
+
504
527
  The observer is absent by default. Its failures do not affect tool results, and
505
528
  its promises are not awaited; serverless hosts should schedule delivery with
506
529
  their platform lifecycle primitive.