@statelyai/mcp 0.3.1 → 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/LICENSE +18 -7
- package/README.md +61 -5
- package/dist/index.cjs +520 -30
- package/dist/index.d.cts +166 -1
- package/dist/index.d.mts +166 -1
- package/dist/index.mjs +515 -31
- package/package.json +5 -4
package/LICENSE
CHANGED
|
@@ -1,10 +1,21 @@
|
|
|
1
|
-
|
|
1
|
+
MIT License
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Copyright (c) 2026 Stately Software, Inc.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
9
11
|
|
|
10
|
-
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
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
|
-
|
|
426
|
-
|
|
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
|
-
|
|
450
|
-
|
|
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
|
|