@statelyai/mcp 0.3.2 → 0.4.0

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
@@ -420,10 +420,11 @@ createMachine({
420
420
 
421
421
  ## `extract_machines_from_code`
422
422
 
423
- <!-- extract_machines_from_code registration from src/server.ts -->
423
+ <!-- extract_machines_from_code registration from src/server.ts, API route from packages/editor/src/app/api/v1/code/extract-machines/route.ts, and parser from packages/graph-tools/src/xstateSource.ts -->
424
424
 
425
- Parses XState source code and returns the extracted machine as an XGraph
426
- document.
425
+ Statically extracts every XState machine config from JavaScript or TypeScript.
426
+ The parser infers XState v5 or v6 structurally; pass `xstateVersion` only to
427
+ override inference. It does not execute source or require a resource provider.
427
428
 
428
429
  <details>
429
430
  <summary>Summary: extract a machine from TypeScript</summary>
@@ -446,8 +447,63 @@ export const player = createMachine({
446
447
 
447
448
  </details>
448
449
 
449
- All Stately MCP tools are registered as read-only, non-destructive, idempotent,
450
- and closed-world.
450
+ ## Hosted resource tools
451
+
452
+ <!-- resource tool registrations from src/resourceTools.ts -->
453
+
454
+ These tools read hosted Stately projects and machines through the server-owned
455
+ `/api/v1` resource contract. They are separate from the workspace tools
456
+ (`list_machines`, `get_machine`), which read local files.
457
+
458
+ | Tool | Reads |
459
+ | ------------------------------- | ---------------------------------------------------------------------- |
460
+ | `list_stately_projects` | The hosted projects the caller can access. |
461
+ | `get_stately_project` | One project, with its current project version id and machine ids. |
462
+ | `list_stately_project_machines` | The machines in a project. |
463
+ | `get_stately_machine` | One machine, with its definition. |
464
+
465
+ Inputs take a `projectId` or `machineId`, never a project version id.
466
+
467
+ Every call needs a credential: the MCP host supplies it and the bearer token is
468
+ forwarded to the resource provider. Calls without one fail with
469
+ `unauthenticated`, and deployments with no resource provider fail with
470
+ `capability_disabled`. Errors use the canonical resource envelope,
471
+ `{ error: { code, message, issues?, retryable? } }`.
472
+
473
+ These tools are read-only by policy. Create, update, and delete resource tools
474
+ are deliberately absent.
475
+
476
+ <details>
477
+ <summary>Summary: list the machines in a hosted project</summary>
478
+
479
+ ```text
480
+ Use Stately to list the machines in project project-id.
481
+ ```
482
+
483
+ ```json
484
+ { "machines": [{ "machineId": "machine-id", "name": "checkout" }] }
485
+ ```
486
+
487
+ </details>
488
+
489
+ All Stately MCP tools are registered as read-only, non-destructive, and
490
+ idempotent. Machine tools are closed-world; the hosted resource tools are
491
+ open-world.
492
+
493
+ ## Tool-call observation
494
+
495
+ <!-- onToolCall option and event types from src/server.ts and src/toolCallObserver.ts -->
496
+
497
+ Hosts can pass `onToolCall` to `registerStatelyMcpTools` or
498
+ `createStatelyMcpServer`. It receives a content-free completion event with the
499
+ tool name, outcome, duration, and stable error code when available. Arguments,
500
+ machine source, and results are never included. Input and output validation
501
+ failures are reported as errors. Configure the observer before registering any
502
+ other tools on the same `McpServer`.
503
+
504
+ The observer is absent by default. Its failures do not affect tool results, and
505
+ its promises are not awaited; serverless hosts should schedule delivery with
506
+ their platform lifecycle primitive.
451
507
 
452
508
  ## Self-hosting
453
509