@statelyai/mcp 0.9.3 → 0.9.5

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
@@ -254,7 +254,10 @@ createMachine({
254
254
 
255
255
  Compares two machine documents structurally instead of comparing their source
256
256
  text. It returns a summary and semantic diff; set `includePatches` to request
257
- applicable patches.
257
+ applicable patches. `hasChanges` also covers supported non-structural changes;
258
+ the node and edge counts remain structural. Generated patches preserve ordered
259
+ actions/invokes and guarded transition priority, including explicit
260
+ null/default resets and action parameter clearing.
258
261
 
259
262
  <details>
260
263
  <summary>Summary: compare two machine versions</summary>
@@ -306,6 +309,13 @@ Patches use semantic graph operations. For example:
306
309
 
307
310
  Use graph entity IDs; top-level states commonly use `<machine-id>.<state-key>`. Use
308
311
  camelCase operation names such as `createTransition`, not snake_case names.
312
+ State patches preserve initial input, output, timeout, and route; transition
313
+ patches preserve input and matches; invoke patches preserve metadata, input, and
314
+ output; implementation patches preserve code; schema patches preserve context,
315
+ event, input, and output schemas. Use `null` to clear these optional fields,
316
+ schemas, or machine context.
317
+ Schema-valid sparse XGraphs may omit effect/tag arrays; create patches initialize
318
+ those collections when needed.
309
319
 
310
320
  <details>
311
321
  <summary>Summary: update a machine</summary>
@@ -520,6 +530,37 @@ machine source, and results are never included. Input and output validation
520
530
  failures are reported as errors. Configure the observer before registering any
521
531
  other tools on the same `McpServer`.
522
532
 
533
+ ### Error codes
534
+
535
+ <!-- allowlist from src/server.ts (upstreamErrorCodes) and @statelyai/api-contract/errors -->
536
+
537
+ Tool errors carry a `code` from a closed set. An upstream `code` is only
538
+ preserved when it is one of these values; anything else falls back to the
539
+ default for the HTTP status class, so clients never see an invented code.
540
+
541
+ | Code | Meaning |
542
+ | --- | --- |
543
+ | `bad_request` | Malformed request, and the default for unmapped 4xx statuses. |
544
+ | `unauthenticated` | Missing or rejected credentials (HTTP 401). |
545
+ | `forbidden` | Authenticated but not allowed (HTTP 403). |
546
+ | `not_found` | No such project, machine, or route (HTTP 404). |
547
+ | `conflict` | Version or state conflict (HTTP 409). |
548
+ | `payload_too_large` | Upstream rejected the request size (HTTP 413). |
549
+ | `rate_limited` | Too many requests (HTTP 429). |
550
+ | `capability_disabled` | The operation is not enabled on this deployment. |
551
+ | `upstream_error` | Server-side HTTP failure, and the default for 5xx statuses. |
552
+ | `internal_error` | Unhandled failure inside a tool handler. |
553
+ | `upstream_timeout` | The Stately API did not answer within `apiTimeoutMs`. |
554
+ | `invalid_input` | Local input validation failed before any API call. |
555
+ | `input_too_large` | Input exceeded `maxSourceBytes` before any API call. |
556
+
557
+ Migration: 4xx responses that previously surfaced an unrecognized upstream code
558
+ verbatim (or `upstream_error` from a proxy) now report the status-class default
559
+ listed above. `upstream_error` remains reserved for 5xx responses.
560
+
561
+ On HTTP 429 the upstream `Retry-After` header is appended to the error message,
562
+ for example `Too many requests. Retry after 30 seconds.`
563
+
523
564
  Set `clientId` to label this server's HTTP analysis calls for channel-level
524
565
  telemetry. It defaults to `stately-mcp/embedded`; the stdio binary uses
525
566
  `stately-mcp/stdio`. The label carries no user or machine content.
@@ -530,11 +571,23 @@ their platform lifecycle primitive.
530
571
 
531
572
  ## Self-hosting
532
573
 
533
- <!-- self-host MCP endpoint from ../editor/src/app/api/[transport]/route.ts and ../editor/src/lib/auth/oauthProtectedResource.ts -->
574
+ <!-- self-host MCP endpoint from ../editor/src/app/api/[transport]/route.ts and ../editor/src/lib/auth/oauthProtectedResource.ts; deployment canary from package.json and scripts/canary.mjs -->
534
575
 
535
576
  Self-host Stately Studio, then replace the hosted URL above with your
536
577
  deployment's `/api/mcp` endpoint, for example
537
578
  `https://studio.example.com/api/mcp`.
538
579
 
580
+ After deployment, run the protocol and MCP App canary with a read-only bearer
581
+ credential:
582
+
583
+ ```bash
584
+ STATELY_MCP_CANARY_URL=https://studio.example.com/api/mcp \
585
+ STATELY_MCP_CANARY_TOKEN=... pnpm verify:mcp:canary
586
+ ```
587
+
588
+ It verifies tool discovery, fetches and hashes the advertised app template,
589
+ and runs a minimal visualization. The scheduled production workflow uses the
590
+ `STATELY_MCP_CANARY_TOKEN` repository secret.
591
+
539
592
  For enterprise self-hosting options, [see pricing and contact
540
593
  us](https://stately.ai/pricing).