@statelyai/mcp 0.4.0 → 0.4.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 +12 -12
- package/dist/index.cjs +11 -2
- package/dist/index.d.cts +3 -3
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +11 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -83,11 +83,11 @@ Mermaid.
|
|
|
83
83
|
<!-- create_state_machine registration from src/server.ts and convert/visualize response contracts -->
|
|
84
84
|
|
|
85
85
|
Creates a new XState v5 machine from a natural-language request. The connected
|
|
86
|
-
agent authors the XState source, then Stately
|
|
87
|
-
|
|
88
|
-
diagram usually makes generated behavior easier to verify. Set
|
|
89
|
-
to `false` only for code-only requests, clients that cannot
|
|
90
|
-
machines where a diagram adds no useful information.
|
|
86
|
+
agent authors the XState source, then Stately validates and returns that source
|
|
87
|
+
without rewriting it. Visualization defaults on and returns native PNG image
|
|
88
|
+
blocks because a diagram usually makes generated behavior easier to verify. Set
|
|
89
|
+
`visualization` to `false` only for code-only requests, clients that cannot
|
|
90
|
+
display images, or machines where a diagram adds no useful information.
|
|
91
91
|
|
|
92
92
|
<details>
|
|
93
93
|
<summary>Summary: create and visualize a machine</summary>
|
|
@@ -98,7 +98,7 @@ Make a state machine representing an order checkout flow.
|
|
|
98
98
|
|
|
99
99
|
The agent calls Stately with complete XState v5 source. Omit `visualization` to
|
|
100
100
|
render PNG diagrams, customize it with `direction` or `parentNodeIds`, or set it
|
|
101
|
-
to `false` to return only the
|
|
101
|
+
to `false` to return only the validated, authored XState source.
|
|
102
102
|
|
|
103
103
|
</details>
|
|
104
104
|
|
|
@@ -455,12 +455,12 @@ These tools read hosted Stately projects and machines through the server-owned
|
|
|
455
455
|
`/api/v1` resource contract. They are separate from the workspace tools
|
|
456
456
|
(`list_machines`, `get_machine`), which read local files.
|
|
457
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.
|
|
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
464
|
|
|
465
465
|
Inputs take a `projectId` or `machineId`, never a project version id.
|
|
466
466
|
|
package/dist/index.cjs
CHANGED
|
@@ -516,6 +516,10 @@ const xstateMachineResultSchema = zod.z.object({
|
|
|
516
516
|
content: zod.z.string(),
|
|
517
517
|
warnings: zod.z.array(zod.z.string())
|
|
518
518
|
});
|
|
519
|
+
const xstateConversionCheckSchema = zod.z.object({
|
|
520
|
+
format: zod.z.literal("xgraph"),
|
|
521
|
+
warnings: zod.z.array(zod.z.string())
|
|
522
|
+
});
|
|
519
523
|
const visualizationMetadataSchema = zod.z.object({
|
|
520
524
|
parentNodeId: zod.z.string(),
|
|
521
525
|
parentNodeLabel: zod.z.string(),
|
|
@@ -711,13 +715,18 @@ function registerStatelyMcpTools(server, options = {}) {
|
|
|
711
715
|
},
|
|
712
716
|
outputSchema: createMachineOutputSchema
|
|
713
717
|
}, async (input) => {
|
|
714
|
-
const
|
|
718
|
+
const conversion = xstateConversionCheckSchema.parse(await callApi(options, "/v1/convert", {
|
|
715
719
|
source: {
|
|
716
720
|
format: "xstate",
|
|
717
721
|
content: input.xstateCode
|
|
718
722
|
},
|
|
719
|
-
target: { format: "
|
|
723
|
+
target: { format: "xgraph" }
|
|
720
724
|
}));
|
|
725
|
+
const machine = {
|
|
726
|
+
format: "xstate",
|
|
727
|
+
content: input.xstateCode,
|
|
728
|
+
warnings: conversion.warnings
|
|
729
|
+
};
|
|
721
730
|
return {
|
|
722
731
|
machine,
|
|
723
732
|
visualizations: input.visualization === false ? [] : await callApi(options, "/v1/visualize", {
|
package/dist/index.d.cts
CHANGED
|
@@ -145,7 +145,7 @@ type StatelyMcpServerOptions = {
|
|
|
145
145
|
apiBaseUrl?: string | URL;
|
|
146
146
|
apiHeaders?: HeadersInit | (() => HeadersInit | Promise<HeadersInit>);
|
|
147
147
|
credentialProvider?: () => StatelyCredential | undefined | Promise<StatelyCredential | undefined>;
|
|
148
|
-
authMode?:
|
|
148
|
+
authMode?: "auto" | "none" | "bearer";
|
|
149
149
|
anonymousGraphPathLimit?: number;
|
|
150
150
|
/**
|
|
151
151
|
* Port used by the hosted resource tools (`list_stately_projects` etc.).
|
|
@@ -162,10 +162,10 @@ type StatelyMcpServerOptions = {
|
|
|
162
162
|
onToolCall?: StatelyMcpToolCallObserver;
|
|
163
163
|
};
|
|
164
164
|
type StatelyCredential = {
|
|
165
|
-
type:
|
|
165
|
+
type: "api_key";
|
|
166
166
|
token: string;
|
|
167
167
|
} | {
|
|
168
|
-
type:
|
|
168
|
+
type: "oauth";
|
|
169
169
|
accessToken: string;
|
|
170
170
|
refreshToken?: string;
|
|
171
171
|
expiresAt?: number;
|
package/dist/index.d.mts
CHANGED
|
@@ -145,7 +145,7 @@ type StatelyMcpServerOptions = {
|
|
|
145
145
|
apiBaseUrl?: string | URL;
|
|
146
146
|
apiHeaders?: HeadersInit | (() => HeadersInit | Promise<HeadersInit>);
|
|
147
147
|
credentialProvider?: () => StatelyCredential | undefined | Promise<StatelyCredential | undefined>;
|
|
148
|
-
authMode?:
|
|
148
|
+
authMode?: "auto" | "none" | "bearer";
|
|
149
149
|
anonymousGraphPathLimit?: number;
|
|
150
150
|
/**
|
|
151
151
|
* Port used by the hosted resource tools (`list_stately_projects` etc.).
|
|
@@ -162,10 +162,10 @@ type StatelyMcpServerOptions = {
|
|
|
162
162
|
onToolCall?: StatelyMcpToolCallObserver;
|
|
163
163
|
};
|
|
164
164
|
type StatelyCredential = {
|
|
165
|
-
type:
|
|
165
|
+
type: "api_key";
|
|
166
166
|
token: string;
|
|
167
167
|
} | {
|
|
168
|
-
type:
|
|
168
|
+
type: "oauth";
|
|
169
169
|
accessToken: string;
|
|
170
170
|
refreshToken?: string;
|
|
171
171
|
expiresAt?: number;
|
package/dist/index.mjs
CHANGED
|
@@ -515,6 +515,10 @@ const xstateMachineResultSchema = z.object({
|
|
|
515
515
|
content: z.string(),
|
|
516
516
|
warnings: z.array(z.string())
|
|
517
517
|
});
|
|
518
|
+
const xstateConversionCheckSchema = z.object({
|
|
519
|
+
format: z.literal("xgraph"),
|
|
520
|
+
warnings: z.array(z.string())
|
|
521
|
+
});
|
|
518
522
|
const visualizationMetadataSchema = z.object({
|
|
519
523
|
parentNodeId: z.string(),
|
|
520
524
|
parentNodeLabel: z.string(),
|
|
@@ -710,13 +714,18 @@ function registerStatelyMcpTools(server, options = {}) {
|
|
|
710
714
|
},
|
|
711
715
|
outputSchema: createMachineOutputSchema
|
|
712
716
|
}, async (input) => {
|
|
713
|
-
const
|
|
717
|
+
const conversion = xstateConversionCheckSchema.parse(await callApi(options, "/v1/convert", {
|
|
714
718
|
source: {
|
|
715
719
|
format: "xstate",
|
|
716
720
|
content: input.xstateCode
|
|
717
721
|
},
|
|
718
|
-
target: { format: "
|
|
722
|
+
target: { format: "xgraph" }
|
|
719
723
|
}));
|
|
724
|
+
const machine = {
|
|
725
|
+
format: "xstate",
|
|
726
|
+
content: input.xstateCode,
|
|
727
|
+
warnings: conversion.warnings
|
|
728
|
+
};
|
|
720
729
|
return {
|
|
721
730
|
machine,
|
|
722
731
|
visualizations: input.visualization === false ? [] : await callApi(options, "/v1/visualize", {
|