@axonity-ai/mcp 0.1.0 → 0.2.2

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.
@@ -0,0 +1,128 @@
1
+ /**
2
+ * Trigger management — what makes a published workflow actually run.
3
+ *
4
+ * Three trigger kinds, all member-accessible despite living in `*_admin.py` on
5
+ * the backend. Note the asymmetry the routes impose: creating and listing are
6
+ * workflow-scoped, while rotate/update/delete address the trigger directly.
7
+ *
8
+ * Trigger deletes are HARD deletes — the row is removed, not soft-deleted, and
9
+ * there is no restore. Hence the `confirm` guard on each.
10
+ */
11
+ import { z } from "zod";
12
+ import { guard, jsonResult } from "./result.js";
13
+ /** A required literal — an agent cannot satisfy it by filling in a default. */
14
+ const CONFIRM = z
15
+ .literal(true)
16
+ .describe("Must be true. Destructive and irreversible — ask your human first.");
17
+ export function registerTriggerTools(server, client) {
18
+ // ---- Webhook triggers -------------------------------------------------
19
+ server.tool("list_webhook_triggers", "List a workflow's webhook triggers. Secrets are never returned — a " +
20
+ "trigger's token is shown only once, when it is created or rotated.", { workflowId: z.string().describe("The workflow's id.") }, async ({ workflowId }) => guard(async () => jsonResult(await client.get(`/api/v1/workflows/${workflowId}/webhook-triggers`))));
21
+ server.tool("create_webhook_trigger", "Create a webhook trigger on a workflow. Returns the trigger AND its " +
22
+ "plaintext token — shown ONCE and never retrievable again. Hand the token " +
23
+ "to your human immediately; do not store it in an entity field.", {
24
+ workflowId: z.string().describe("The workflow's id."),
25
+ triggerId: z
26
+ .string()
27
+ .describe("The id of the trigger node in the workflow document."),
28
+ expectedInputSchema: z
29
+ .record(z.unknown())
30
+ .optional()
31
+ .describe("JSON schema the incoming payload must match. Defaults to {}."),
32
+ }, async ({ workflowId, triggerId, expectedInputSchema }) => guard(async () => jsonResult(await client.post(`/api/v1/workflows/${workflowId}/webhook-triggers`, {
33
+ triggerId,
34
+ ...(expectedInputSchema ? { expectedInputSchema } : {}),
35
+ }))));
36
+ server.tool("rotate_webhook_trigger", "Rotate a webhook trigger's token. Returns the new plaintext token ONCE. " +
37
+ "The old token keeps working for a short grace period so callers can be " +
38
+ "migrated.", {
39
+ webhookId: z.string().describe("The webhook trigger's id."),
40
+ confirm: CONFIRM,
41
+ }, async ({ webhookId }) => guard(async () => jsonResult(await client.post(`/api/v1/webhook-triggers/${webhookId}/rotate`))));
42
+ server.tool("delete_webhook_trigger", "Delete a webhook trigger. HARD delete — the row is removed and cannot be " +
43
+ "restored, and any caller using its token starts failing immediately.", {
44
+ webhookId: z.string().describe("The webhook trigger's id."),
45
+ confirm: CONFIRM,
46
+ }, async ({ webhookId }) => guard(async () => {
47
+ await client.del(`/api/v1/webhook-triggers/${webhookId}`);
48
+ return jsonResult({ deleted: true, webhookId });
49
+ }));
50
+ // ---- Cron schedules ---------------------------------------------------
51
+ server.tool("list_cron_schedules", "List a workflow's cron schedules, with their next and last fire times.", { workflowId: z.string().describe("The workflow's id.") }, async ({ workflowId }) => guard(async () => jsonResult(await client.get(`/api/v1/workflows/${workflowId}/cron-schedules`))));
52
+ server.tool("create_cron_schedule", "Schedule a workflow to run on a cron expression.", {
53
+ workflowId: z.string().describe("The workflow's id."),
54
+ triggerId: z
55
+ .string()
56
+ .describe("The id of the trigger node in the workflow document."),
57
+ cronExpr: z
58
+ .string()
59
+ .describe('The cron expression, e.g. "0 9 * * 1-5" for weekdays at 09:00.'),
60
+ timezone: z
61
+ .string()
62
+ .optional()
63
+ .describe('IANA timezone, e.g. "Europe/Brussels". Defaults to UTC.'),
64
+ enabled: z.boolean().optional().describe("Defaults to true."),
65
+ }, async ({ workflowId, triggerId, cronExpr, timezone, enabled }) => guard(async () => jsonResult(await client.post(`/api/v1/workflows/${workflowId}/cron-schedules`, {
66
+ triggerId,
67
+ cronExpr,
68
+ ...(timezone ? { timezone } : {}),
69
+ ...(enabled === undefined ? {} : { enabled }),
70
+ }))));
71
+ server.tool("delete_cron_schedule", "Delete a cron schedule. HARD delete — the row is removed and cannot be " +
72
+ "restored. The workflow stops running on this schedule immediately.", {
73
+ scheduleId: z.string().describe("The cron schedule's id."),
74
+ confirm: CONFIRM,
75
+ }, async ({ scheduleId }) => guard(async () => {
76
+ await client.del(`/api/v1/cron-schedules/${scheduleId}`);
77
+ return jsonResult({ deleted: true, scheduleId });
78
+ }));
79
+ // ---- Conditional triggers ---------------------------------------------
80
+ server.tool("list_conditional_triggers", "List a workflow's conditional triggers — an agent evaluates a condition " +
81
+ "on an interval and starts the workflow when it holds.", { workflowId: z.string().describe("The workflow's id.") }, async ({ workflowId }) => guard(async () => jsonResult(await client.get(`/api/v1/workflows/${workflowId}/conditional-triggers`))));
82
+ server.tool("create_conditional_trigger", "Create a conditional trigger on a workflow: an agent checks `conditionText` " +
83
+ "every `repeatIntervalMinutes` and fires the workflow when it is met.", {
84
+ workflowId: z.string().describe("The workflow's id."),
85
+ triggerId: z
86
+ .string()
87
+ .describe("The id of the trigger node in the workflow document."),
88
+ agentId: z.string().describe("The agent that evaluates the condition."),
89
+ conditionText: z
90
+ .string()
91
+ .min(1)
92
+ .max(2000)
93
+ .describe("The condition, in plain language."),
94
+ repeatIntervalMinutes: z
95
+ .number()
96
+ .int()
97
+ .min(5)
98
+ .max(10080)
99
+ .describe("How often to re-check, in minutes (5 to 10080)."),
100
+ enabled: z.boolean().optional().describe("Defaults to true."),
101
+ }, async ({ workflowId, triggerId, agentId, conditionText, repeatIntervalMinutes, enabled }) => guard(async () => jsonResult(await client.post(`/api/v1/workflows/${workflowId}/conditional-triggers`, {
102
+ triggerId,
103
+ agentId,
104
+ conditionText,
105
+ repeatIntervalMinutes,
106
+ ...(enabled === undefined ? {} : { enabled }),
107
+ }))));
108
+ server.tool("update_conditional_trigger", "Change a conditional trigger's condition, interval, agent, or enabled flag. " +
109
+ "Send only what you are changing.", {
110
+ triggerId: z.string().describe("The conditional trigger's id."),
111
+ conditionText: z.string().min(1).max(2000).optional(),
112
+ repeatIntervalMinutes: z.number().int().min(5).max(10080).optional(),
113
+ agentId: z.string().optional(),
114
+ enabled: z.boolean().optional(),
115
+ }, async ({ triggerId, ...fields }) => guard(async () => {
116
+ const body = Object.fromEntries(Object.entries(fields).filter(([, v]) => v !== undefined));
117
+ return jsonResult(await client.patch(`/api/v1/conditional-triggers/${triggerId}`, body));
118
+ }));
119
+ server.tool("delete_conditional_trigger", "Delete a conditional trigger. HARD delete — the row is removed and cannot " +
120
+ "be restored.", {
121
+ triggerId: z.string().describe("The conditional trigger's id."),
122
+ confirm: CONFIRM,
123
+ }, async ({ triggerId }) => guard(async () => {
124
+ await client.del(`/api/v1/conditional-triggers/${triggerId}`);
125
+ return jsonResult({ deleted: true, triggerId });
126
+ }));
127
+ }
128
+ //# sourceMappingURL=triggers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"triggers.js","sourceRoot":"","sources":["../../src/tools/triggers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEhD,+EAA+E;AAC/E,MAAM,OAAO,GAAG,CAAC;KACd,OAAO,CAAC,IAAI,CAAC;KACb,QAAQ,CAAC,oEAAoE,CAAC,CAAC;AAElF,MAAM,UAAU,oBAAoB,CAClC,MAAiB,EACjB,MAAqB;IAErB,0EAA0E;IAE1E,MAAM,CAAC,IAAI,CACT,uBAAuB,EACvB,qEAAqE;QACnE,oEAAoE,EACtE,EAAE,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,oBAAoB,CAAC,EAAE,EACzD,KAAK,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE,CACvB,KAAK,CAAC,KAAK,IAAI,EAAE,CACf,UAAU,CAAC,MAAM,MAAM,CAAC,GAAG,CAAC,qBAAqB,UAAU,mBAAmB,CAAC,CAAC,CACjF,CACJ,CAAC;IAEF,MAAM,CAAC,IAAI,CACT,wBAAwB,EACxB,sEAA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AC,GAAG,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,QAAQ,EAAE;QACpE,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QAC9B,OAAO,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;KAChC,EACD,KAAK,EAAE,EAAE,SAAS,EAAE,GAAG,MAAM,EAAE,EAAE,EAAE,CACjC,KAAK,CAAC,KAAK,IAAI,EAAE;QACf,MAAM,IAAI,GAAG,MAAM,CAAC,WAAW,CAC7B,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,SAAS,CAAC,CAC1D,CAAC;QACF,OAAO,UAAU,CACf,MAAM,MAAM,CAAC,KAAK,CAAC,gCAAgC,SAAS,EAAE,EAAE,IAAI,CAAC,CACtE,CAAC;IACJ,CAAC,CAAC,CACL,CAAC;IAEF,MAAM,CAAC,IAAI,CACT,4BAA4B,EAC5B,4EAA4E;QAC1E,cAAc,EAChB;QACE,SAAS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,+BAA+B,CAAC;QAC/D,OAAO,EAAE,OAAO;KACjB,EACD,KAAK,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,CACtB,KAAK,CAAC,KAAK,IAAI,EAAE;QACf,MAAM,MAAM,CAAC,GAAG,CAAC,gCAAgC,SAAS,EAAE,CAAC,CAAC;QAC9D,OAAO,UAAU,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,CAAC;IAClD,CAAC,CAAC,CACL,CAAC;AACJ,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Validation and inspection verbs — check work before requesting publish.
3
+ *
4
+ * All four routes are stateless: they take a document or a code fragment and
5
+ * return a verdict without touching stored state. That makes them safe to call
6
+ * as often as the agent likes, and they are the cheapest way to close the
7
+ * authoring loop (draft → validate → fix → request_publish).
8
+ */
9
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
10
+ import type { AxonityClient } from "../client.js";
11
+ export declare function registerValidationTools(server: McpServer, client: AxonityClient): void;
12
+ export declare function registerApprovalTools(server: McpServer, client: AxonityClient): void;
13
+ export declare function registerExecutionTools(server: McpServer, client: AxonityClient): void;
@@ -0,0 +1,116 @@
1
+ /**
2
+ * Validation and inspection verbs — check work before requesting publish.
3
+ *
4
+ * All four routes are stateless: they take a document or a code fragment and
5
+ * return a verdict without touching stored state. That makes them safe to call
6
+ * as often as the agent likes, and they are the cheapest way to close the
7
+ * authoring loop (draft → validate → fix → request_publish).
8
+ */
9
+ import { z } from "zod";
10
+ import { guard, jsonResult } from "./result.js";
11
+ export function registerValidationTools(server, client) {
12
+ server.tool("validate_workflow", "Check a workflow document for structural and schema problems. Returns " +
13
+ "`launchable` plus an `issues` list (each with code, message, severity, " +
14
+ "stepIds, edgeIds). STATELESS: it validates the document you pass, does " +
15
+ "not read or write the stored workflow, so read-only service tokens can call it. " +
16
+ "It does NOT verify that referenced agents or tools exist. Call it after " +
17
+ "apply_workflow_mutations " +
18
+ "and before request_publish_workflow.", {
19
+ document: z
20
+ .record(z.unknown())
21
+ .describe("The workflow document to validate (as returned by read_workflow)."),
22
+ }, async ({ document }) => guard(async () => jsonResult(await client.post("/api/v1/workflows/validate", { document }))));
23
+ server.tool("analyze_workflow_reachable_outputs", "List the outputs a given step can read — i.e. what upstream steps make " +
24
+ "available to it. Use it to bind a step's inputs to real upstream outputs " +
25
+ "instead of guessing field names. Stateless, and safe for read-only service tokens.", {
26
+ document: z.record(z.unknown()).describe("The workflow document."),
27
+ stepId: z.string().describe("The step whose reachable inputs you want."),
28
+ }, async ({ document, stepId }) => guard(async () => jsonResult(await client.post("/api/v1/workflows/reachable-outputs", { document, stepId }))));
29
+ server.tool("validate_tool_code", "Check Python tool code for syntax errors and banned patterns before " +
30
+ "saving it on a tool. Returns `valid` plus `errors` (line, column, " +
31
+ "message, severity, functionName). Stateless and safe for read-only service " +
32
+ "tokens.", {
33
+ imports: z
34
+ .string()
35
+ .optional()
36
+ .describe("The import block, as one string. Defaults to empty."),
37
+ functions: z
38
+ .array(z.object({
39
+ name: z.string().describe("Function name."),
40
+ code: z.string().describe("Full function source."),
41
+ }))
42
+ .describe("The functions to check (max 20)."),
43
+ classes: z
44
+ .array(z.object({
45
+ name: z.string().describe("Class name."),
46
+ code: z.string().describe("Full class source."),
47
+ }))
48
+ .optional()
49
+ .describe("Optional classes to check (max 20)."),
50
+ }, async ({ imports, functions, classes }) => guard(async () => jsonResult(await client.post("/api/v1/tools/validate-code", {
51
+ imports: imports ?? "",
52
+ functions,
53
+ ...(classes ? { classes } : {}),
54
+ }))));
55
+ server.tool("format_tool_code", "Format Python tool code with Black and return the formatted source. " +
56
+ "Stateless and safe for read-only service tokens — it does not save anything.", { code: z.string().describe("The Python source to format.") }, async ({ code }) => guard(async () => jsonResult(await client.post("/api/v1/tools/format-code", { code }))));
57
+ }
58
+ export function registerApprovalTools(server, client) {
59
+ server.tool("list_publish_approvals", "List this tenant's publish approvals and their status — how you find out " +
60
+ "whether a request_publish_* was approved or rejected. Optionally filter " +
61
+ "by status, and page through with limit/offset. Approving and rejecting " +
62
+ "are human-only actions in Axonity; no tool can do them.", {
63
+ status: z
64
+ .enum(["pending", "approved", "rejected"])
65
+ .optional()
66
+ .describe("Filter by status. Omit for all."),
67
+ limit: z.number().int().min(1).max(200).optional().describe("Default 50."),
68
+ offset: z.number().int().min(0).optional().describe("Default 0."),
69
+ }, async ({ status, limit, offset }) => guard(async () => jsonResult(await client.get("/api/v1/publish-approvals", { status, limit, offset }))));
70
+ server.tool("get_publish_approval", "Read one publish approval by id — lets you poll a specific request rather " +
71
+ "than re-fetching the whole list.", { approvalId: z.string().describe("The approval's id, from request_publish_* or list_publish_approvals.") }, async ({ approvalId }) => guard(async () => jsonResult(await client.get(`/api/v1/publish-approvals/${approvalId}`))));
72
+ }
73
+ export function registerExecutionTools(server, client) {
74
+ server.tool("execute_tool", "Run tool code directly, without saving it — the way to test a tool you're " +
75
+ "authoring before create_tool/update_tool. Returns stdout/stderr, the " +
76
+ "result, and a typed errorType (timeout/memory/import/runtime/validation) " +
77
+ "on failure. Pass toolId to run against an already-saved tool's context.", {
78
+ imports: z.string().optional().describe("The import block. Defaults to empty."),
79
+ functions: z
80
+ .array(z.object({ name: z.string(), code: z.string() }))
81
+ .describe("The functions to run (max 20)."),
82
+ classes: z
83
+ .array(z.object({ name: z.string(), code: z.string() }))
84
+ .optional()
85
+ .describe("Optional classes (max 20)."),
86
+ inputParams: z
87
+ .record(z.unknown())
88
+ .optional()
89
+ .describe("Parameters passed into the entry-point function."),
90
+ timeout: z.number().int().min(1).max(120).optional().describe("Seconds. Default 30."),
91
+ toolId: z.string().optional().describe("An existing tool id to run in context of."),
92
+ }, async ({ imports, functions, classes, inputParams, timeout, toolId }) => guard(async () => jsonResult(await client.post("/api/v1/tools/execute", {
93
+ imports: imports ?? "",
94
+ functions,
95
+ ...(classes ? { classes } : {}),
96
+ ...(inputParams ? { inputParams } : {}),
97
+ ...(timeout ? { timeout } : {}),
98
+ ...(toolId ? { toolId } : {}),
99
+ }))));
100
+ server.tool("execute_stored_connector", "Test-run an ALREADY-SAVED connector by its tool id — the backend loads its " +
101
+ "stored authConfig and decrypts the real secret server-side; nothing " +
102
+ "credential-shaped ever passes through this tool or through you. Takes " +
103
+ "only input parameters, nothing else — there is no way to point this at a " +
104
+ "URL or auth config of your choosing (that admin-only, body-supplied form " +
105
+ "exists on the backend precisely so a client like this one can never reach " +
106
+ "it, since it would otherwise let a caller exfiltrate a decrypted secret).", {
107
+ toolId: z.string().describe("The connector's tool id — must already be saved."),
108
+ inputParams: z
109
+ .record(z.unknown())
110
+ .optional()
111
+ .describe("Parameters for the connector call."),
112
+ }, async ({ toolId, inputParams }) => guard(async () => jsonResult(await client.post(`/api/v1/tools/${toolId}/execute-connector`, {
113
+ ...(inputParams ? { inputParams } : {}),
114
+ }))));
115
+ }
116
+ //# sourceMappingURL=validation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.js","sourceRoot":"","sources":["../../src/tools/validation.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEhD,MAAM,UAAU,uBAAuB,CACrC,MAAiB,EACjB,MAAqB;IAErB,MAAM,CAAC,IAAI,CACT,mBAAmB,EACnB,wEAAwE;QACtE,yEAAyE;QACzE,yEAAyE;QACzE,kFAAkF;QAClF,0EAA0E;QAC1E,2BAA2B;QAC3B,sCAAsC,EACxC;QACE,QAAQ,EAAE,CAAC;aACR,MAAM,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC;aACnB,QAAQ,CAAC,mEAAmE,CAAC;KACjF,EACD,KAAK,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,CACrB,KAAK,CAAC,KAAK,IAAI,EAAE,CACf,UAAU,CAAC,MAAM,MAAM,CAAC,IAAI,CAAC,4BAA4B,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC,CAC1E,CACJ,CAAC;IAEF,MAAM,CAAC,IAAI,CACT,oCAAoC,EACpC,yEAAyE;QACvE,2EAA2E;QAC3E,oFAAoF,EACtF;QACE,QAAQ,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,CAAC,wBAAwB,CAAC;QAClE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,2CAA2C,CAAC;KACzE,EACD,KAAK,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,CAC7B,KAAK,CAAC,KAAK,IAAI,EAAE,CACf,UAAU,CACR,MAAM,MAAM,CAAC,IAAI,CAAC,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I,CAAC,iBAAiB,MAAM,oBAAoB,EAAE;QAC7D,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACxC,CAAC,CACH,CACF,CACJ,CAAC;AACJ,CAAC"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Version history, rollback, and version-level delete/restore.
3
+ *
4
+ * Two different identifiers appear in these routes and confusing them silently
5
+ * 404s:
6
+ * - `version` — an INTEGER checkpoint number (1, 2, 3 …), used to read one.
7
+ * - `versionId` — the UUID of the version row, used to restore/delete it.
8
+ *
9
+ * There are also two unrelated things both called "restore" here:
10
+ * - `restore_<entity>_version` — roll the DRAFT back to an old,
11
+ * still-live version. Takes `expectedVersion` in the body.
12
+ * - `restore_deleted_<entity>_version` — undo a DELETED version row coming
13
+ * back into history. No body — a restore must never lose to a stale-version
14
+ * guard.
15
+ *
16
+ * The published snapshot also lives in two places depending on the entity
17
+ * family: `/{id}/published` for workflow/agent/tool/flow, `/{id}/versions/published`
18
+ * for the memory entities (including output_schema and prompt_snippet, which
19
+ * gained full versioning alongside them). `publishedPath` selects the right one.
20
+ *
21
+ * Only entities that actually expose `/versions*` get these verbs.
22
+ */
23
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
24
+ import type { AxonityClient } from "../client.js";
25
+ export interface VersionedEntity {
26
+ /** Tool noun, e.g. "workflow". */
27
+ singular: string;
28
+ /** REST collection path, e.g. "/api/v1/workflows". */
29
+ basePath: string;
30
+ /**
31
+ * Where the published snapshot lives.
32
+ * `"entity"` → `/{id}/published` (workflow, agent, tool)
33
+ * `"versions"` → `/{id}/versions/published` (skill, policy, reference_doc, persona)
34
+ */
35
+ publishedPath: "entity" | "versions";
36
+ }
37
+ export declare function registerVersionTools(server: McpServer, client: AxonityClient, { singular, basePath, publishedPath }: VersionedEntity): void;
@@ -0,0 +1,93 @@
1
+ /**
2
+ * Version history, rollback, and version-level delete/restore.
3
+ *
4
+ * Two different identifiers appear in these routes and confusing them silently
5
+ * 404s:
6
+ * - `version` — an INTEGER checkpoint number (1, 2, 3 …), used to read one.
7
+ * - `versionId` — the UUID of the version row, used to restore/delete it.
8
+ *
9
+ * There are also two unrelated things both called "restore" here:
10
+ * - `restore_<entity>_version` — roll the DRAFT back to an old,
11
+ * still-live version. Takes `expectedVersion` in the body.
12
+ * - `restore_deleted_<entity>_version` — undo a DELETED version row coming
13
+ * back into history. No body — a restore must never lose to a stale-version
14
+ * guard.
15
+ *
16
+ * The published snapshot also lives in two places depending on the entity
17
+ * family: `/{id}/published` for workflow/agent/tool/flow, `/{id}/versions/published`
18
+ * for the memory entities (including output_schema and prompt_snippet, which
19
+ * gained full versioning alongside them). `publishedPath` selects the right one.
20
+ *
21
+ * Only entities that actually expose `/versions*` get these verbs.
22
+ */
23
+ import { z } from "zod";
24
+ import { guard, jsonResult } from "./result.js";
25
+ /** A required literal — an agent cannot satisfy it by filling in a default. */
26
+ const CONFIRM = z
27
+ .literal(true)
28
+ .describe("Must be true. Acknowledges you understand this is destructive.");
29
+ export function registerVersionTools(server, client, { singular, basePath, publishedPath }) {
30
+ server.tool(`list_${singular}_versions`, `List a ${singular}'s version history — checkpoints (every save) and major ` +
31
+ `versions (named releases). Use this to find the versionId you need for ` +
32
+ `restore_${singular}_version.`, {
33
+ id: z.string().describe(`The ${singular}'s id.`),
34
+ type: z
35
+ .enum(["checkpoint", "major", "all"])
36
+ .optional()
37
+ .describe("Which kind to list. Defaults to all."),
38
+ limit: z.number().int().min(1).max(200).optional().describe("Default 50."),
39
+ offset: z.number().int().min(0).optional().describe("Default 0."),
40
+ }, async ({ id, type, limit, offset }) => guard(async () => jsonResult(await client.get(`${basePath}/${id}/versions`, { type, limit, offset }))));
41
+ server.tool(`read_${singular}_version`, `Read one historical version of a ${singular} by its CHECKPOINT NUMBER (an ` +
42
+ `integer like 3, from the \`version\` field in list_${singular}_versions) — ` +
43
+ `not by its versionId. Use it to diff two versions before rolling back.`, {
44
+ id: z.string().describe(`The ${singular}'s id.`),
45
+ version: z
46
+ .number()
47
+ .int()
48
+ .describe("The integer checkpoint number, e.g. 3."),
49
+ }, async ({ id, version }) => guard(async () => jsonResult(await client.get(`${basePath}/${id}/versions/${version}`))));
50
+ server.tool(`restore_${singular}_version`, `Roll a ${singular}'s DRAFT back to an earlier version. Takes the versionId ` +
51
+ `(a UUID from list_${singular}_versions), NOT the checkpoint number. The ` +
52
+ `current draft is snapshotted first, so this is itself undoable. It ` +
53
+ `changes only the draft — what is live stays live until a human approves a ` +
54
+ `new publish.`, {
55
+ id: z.string().describe(`The ${singular}'s id.`),
56
+ versionId: z.string().describe("The version row's UUID."),
57
+ expectedVersion: z
58
+ .number()
59
+ .int()
60
+ .describe("The draft version you last read — 409 if stale."),
61
+ }, async ({ id, versionId, expectedVersion }) => guard(async () => jsonResult(await client.post(`${basePath}/${id}/versions/${versionId}/restore`, {
62
+ expectedVersion,
63
+ }))));
64
+ server.tool(`delete_${singular}_version`, `Permanently remove one entry from a ${singular}'s version history. The ` +
65
+ `working draft and the currently published version are protected and ` +
66
+ `cannot be targeted this way. Recoverable with ` +
67
+ `restore_deleted_${singular}_version until it is purged for good.`, {
68
+ id: z.string().describe(`The ${singular}'s id.`),
69
+ versionId: z.string().describe("The version row's UUID (not the checkpoint number)."),
70
+ confirm: CONFIRM,
71
+ }, async ({ id, versionId }) => guard(async () => {
72
+ await client.del(`${basePath}/${id}/versions/${versionId}`);
73
+ return jsonResult({ deleted: true, id, versionId });
74
+ }));
75
+ server.tool(`list_deleted_${singular}_versions`, `List a ${singular}'s deleted version rows — restore candidates for ` +
76
+ `restore_deleted_${singular}_version. Deleted version numbers stay ` +
77
+ `reserved (not reused), so gaps in the numbering are expected, not corruption.`, { id: z.string().describe(`The ${singular}'s id.`) }, async ({ id }) => guard(async () => jsonResult(await client.get(`${basePath}/${id}/versions/deleted`))));
78
+ server.tool(`restore_deleted_${singular}_version`, `Undo delete_${singular}_version — bring a removed version row back into ` +
79
+ `history. This does NOT change the current draft (unlike ` +
80
+ `restore_${singular}_version); it only makes the row visible/restorable ` +
81
+ `again. Takes no version check.`, {
82
+ id: z.string().describe(`The ${singular}'s id.`),
83
+ versionId: z
84
+ .string()
85
+ .describe(`The version row's UUID, from list_deleted_${singular}_versions.`),
86
+ }, async ({ id, versionId }) => guard(async () => jsonResult(await client.post(`${basePath}/${id}/versions/${versionId}/restore-deleted`))));
87
+ server.tool(`read_${singular}_published`, `Read the LIVE published version of a ${singular} — what the runtime ` +
88
+ `actually uses, as opposed to the draft that read_${singular} returns. ` +
89
+ `Diff the two to see what a pending publish would change.`, { id: z.string().describe(`The ${singular}'s id.`) }, async ({ id }) => guard(async () => jsonResult(await client.get(publishedPath === "entity"
90
+ ? `${basePath}/${id}/published`
91
+ : `${basePath}/${id}/versions/published`))));
92
+ }
93
+ //# sourceMappingURL=versions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"versions.js","sourceRoot":"","sources":["../../src/tools/versions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEhD,+EAA+E;AAC/E,MAAM,OAAO,GAAG,CAAC;KACd,OAAO,CAAC,IAAI,CAAC;KACb,QAAQ,CAAC,gEAAgE,CAAC,CAAC;AAe9E,MAAM,UAAU,oBAAoB,CAClC,MAAiB,EACjB,MAAqB,EACrB,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAa,EAAmB;IAEtD,MAAM,CAAC,IAAI,CACT,QAAQ,QAAQ,WAAW,EAC3B,UAAU,QAAQ,0DAA0D;QAC1E,yEAAyE;QACzE,WAAW,QAAQ,WAAW,EAChC;QACE,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,OAAO,QAAQ,QAAQ,CAAC;QAChD,IAAI,EAAE,CAAC;a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C,OAAO,QAAQ,QAAQ,CAAC,EAAE,EACpD,KAAK,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CACf,KAAK,CAAC,KAAK,IAAI,EAAE,CACf,UAAU,CACR,MAAM,MAAM,CAAC,GAAG,CACd,aAAa,KAAK,QAAQ;QACxB,CAAC,CAAC,GAAG,QAAQ,IAAI,EAAE,YAAY;QAC/B,CAAC,CAAC,GAAG,QAAQ,IAAI,EAAE,qBAAqB,CAC3C,CACF,CACF,CACJ,CAAC;AACJ,CAAC"}
@@ -5,7 +5,29 @@
5
5
  * backend-authoritative model the Studio uses), never by replacing the whole
6
6
  * document. The backend applies and validates the commands and returns the new
7
7
  * authoritative document + version.
8
+ *
9
+ * The backend route applies exactly ONE mutation per call — `POST
10
+ * /workflows/{id}/mutations` takes `{ type, payload, expectedVersion }` and there
11
+ * is no batch route. This tool keeps a batch-shaped signature (an agent thinks in
12
+ * whole edits, not round-trips) and sequences the calls itself, threading the
13
+ * version returned by call N into call N+1.
14
+ *
15
+ * Because the sequence is not a transaction, a failure at index k leaves the
16
+ * mutations before it applied. The error says how many landed and which one
17
+ * failed so the caller can re-read and resume rather than blindly retry — a
18
+ * retry from the top would re-apply the successful prefix.
8
19
  */
9
20
  import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
10
21
  import type { AxonityClient } from "../client.js";
22
+ /**
23
+ * Split one command into the `{ type, payload }` pair the backend expects.
24
+ *
25
+ * Accepts both the explicit form (`{ type, payload: {...} }`) and the flat form
26
+ * (`{ type, ...args }`), because an agent writing these by hand produces either
27
+ * and the difference is not meaningful to it.
28
+ */
29
+ export declare function toMutationBody(mutation: Record<string, unknown>, index: number): {
30
+ type: string;
31
+ payload: Record<string, unknown>;
32
+ };
11
33
  export declare function registerWorkflowMutations(server: McpServer, client: AxonityClient): void;
@@ -5,41 +5,113 @@
5
5
  * backend-authoritative model the Studio uses), never by replacing the whole
6
6
  * document. The backend applies and validates the commands and returns the new
7
7
  * authoritative document + version.
8
+ *
9
+ * The backend route applies exactly ONE mutation per call — `POST
10
+ * /workflows/{id}/mutations` takes `{ type, payload, expectedVersion }` and there
11
+ * is no batch route. This tool keeps a batch-shaped signature (an agent thinks in
12
+ * whole edits, not round-trips) and sequences the calls itself, threading the
13
+ * version returned by call N into call N+1.
14
+ *
15
+ * Because the sequence is not a transaction, a failure at index k leaves the
16
+ * mutations before it applied. The error says how many landed and which one
17
+ * failed so the caller can re-read and resume rather than blindly retry — a
18
+ * retry from the top would re-apply the successful prefix.
8
19
  */
9
20
  import { z } from "zod";
10
21
  import { AxonityApiError } from "../errors.js";
22
+ import { guard, jsonResult } from "./result.js";
23
+ /**
24
+ * Split one command into the `{ type, payload }` pair the backend expects.
25
+ *
26
+ * Accepts both the explicit form (`{ type, payload: {...} }`) and the flat form
27
+ * (`{ type, ...args }`), because an agent writing these by hand produces either
28
+ * and the difference is not meaningful to it.
29
+ */
30
+ export function toMutationBody(mutation, index) {
31
+ const { type, payload, ...rest } = mutation;
32
+ if (typeof type !== "string" || type.length === 0) {
33
+ throw new Error(`mutations[${index}] is missing a \`type\` (e.g. "add_step", "add_edge").`);
34
+ }
35
+ if (payload !== undefined) {
36
+ if (typeof payload !== "object" || payload === null || Array.isArray(payload)) {
37
+ throw new Error(`mutations[${index}].payload must be a JSON object.`);
38
+ }
39
+ return { type, payload: payload };
40
+ }
41
+ return { type, payload: rest };
42
+ }
43
+ /** Compose the error for a mutation that failed part-way through a sequence. */
44
+ function sequenceError(index, total, type, version, cause) {
45
+ const reason = cause instanceof AxonityApiError || cause instanceof Error
46
+ ? cause.message
47
+ : String(cause);
48
+ const applied = index;
49
+ const summary = JSON.stringify({ appliedCount: applied, failedIndex: index, failedType: type, currentVersion: version }, null, 2);
50
+ return new Error(`Mutation ${index + 1} of ${total} (\`${type}\`) failed: ${reason}\n\n` +
51
+ `${applied} of ${total} mutations were already applied and were NOT rolled back — ` +
52
+ `this sequence is not a transaction. Do not retry the whole list: re-read the ` +
53
+ `workflow, confirm which edits landed, and resume from index ${index}.\n\n` +
54
+ summary);
55
+ }
11
56
  export function registerWorkflowMutations(server, client) {
12
57
  server.tool("apply_workflow_mutations", "Apply structural mutation commands to a workflow draft (add/remove steps, " +
13
58
  "connect edges, set conditions). Read the workflow first for its version. " +
14
- "Returns the new authoritative document + version. On a 409 conflict, " +
15
- "re-read and retry.", {
59
+ "Commands are applied IN ORDER, one backend call each, with the version " +
60
+ "threaded automatically — pass the version you read, not one per command. " +
61
+ "Returns the new authoritative document, version, and validation state. " +
62
+ "Not transactional: if command N fails, commands before it stay applied and " +
63
+ "the error reports how many landed. On a 409 conflict, re-read and retry. " +
64
+ 'Each command is `{ "type": "add_step", "payload": { … } }`; the flat form ' +
65
+ '`{ "type": "add_step", … }` is accepted too. Valid types: update_workflow, ' +
66
+ "add_trigger, update_trigger, remove_trigger, update_trigger_operator, " +
67
+ "group_triggers, ungroup_triggers, move_trigger, add_step, add_loop, " +
68
+ "update_step, remove_step, move_step, add_edge, update_edge, remove_edge, " +
69
+ "convert_to_loop, setup_loop_decision, advanced_edit.", {
16
70
  id: z.string().describe("The workflow's id."),
17
71
  expectedVersion: z
18
72
  .number()
19
73
  .int()
20
- .describe("The version you last read — rejected with 409 if stale."),
74
+ .describe("The version you last read. Only the FIRST command uses it; later " +
75
+ "commands use the version returned by the previous one."),
21
76
  mutations: z
22
77
  .array(z.record(z.unknown()))
23
- .describe("A list of mutation commands, each a JSON object with a command name " +
24
- "and its arguments (camelCase)."),
25
- }, async ({ id, expectedVersion, mutations }) => {
26
- try {
27
- const data = await client.post(`/api/v1/workflows/${id}/mutations`, {
28
- expectedVersion,
29
- mutations,
30
- });
31
- return {
32
- content: [{ type: "text", text: JSON.stringify(data, null, 2) }],
33
- };
34
- }
35
- catch (err) {
36
- const message = err instanceof AxonityApiError
37
- ? err.message
38
- : err instanceof Error
39
- ? err.message
40
- : String(err);
41
- return { content: [{ type: "text", text: message }], isError: true };
78
+ .min(1)
79
+ .describe("Mutation commands to apply in order, each a JSON object with a " +
80
+ "`type` and its arguments (camelCase), either nested under " +
81
+ "`payload` or inline."),
82
+ }, async ({ id, expectedVersion, mutations }) => guard(async () => {
83
+ // Reject the whole batch on a malformed command before applying any of
84
+ // it — a shape error is the agent's mistake, not a partial failure.
85
+ const bodies = mutations.map((m, i) => toMutationBody(m, i));
86
+ let version = expectedVersion;
87
+ let last;
88
+ for (const [index, body] of bodies.entries()) {
89
+ try {
90
+ last = await client.post(`/api/v1/workflows/${id}/mutations`, { type: body.type, payload: body.payload, expectedVersion: version });
91
+ }
92
+ catch (cause) {
93
+ throw sequenceError(index, bodies.length, body.type, version, cause);
94
+ }
95
+ version = last.version;
42
96
  }
43
- });
97
+ return jsonResult({ ...last, appliedCount: bodies.length });
98
+ }));
99
+ server.tool("replace_workflow_document", "Replace the ENTIRE workflow document in one atomic call. Read the workflow first to " +
100
+ "get the current version, then call this again only after rereading on a stale " +
101
+ "`409`.\n" +
102
+ "Unlike `apply_workflow_mutations`, this is a single PUT request and treats the " +
103
+ "payload as the complete editable document.", {
104
+ id: z.string().describe("The workflow's id."),
105
+ expectedVersion: z
106
+ .number()
107
+ .int()
108
+ .describe("The version you read before replacing the document."),
109
+ document: z
110
+ .record(z.unknown())
111
+ .describe("The complete workflow document object to persist."),
112
+ }, async ({ id, expectedVersion, document }) => guard(async () => jsonResult(await client.put(`/api/v1/workflows/${id}`, {
113
+ expectedVersion,
114
+ document,
115
+ }))));
44
116
  }
45
117
  //# sourceMappingURL=workflowMutations.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"workflowMutations.js","sourceRoot":"","sources":["../../src/tools/workflowMutations.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAE/C,MAAM,UAAU,yBAAyB,CACvC,MAAiB,EACjB,MAAqB;IAErB,MAAM,CAAC,IAAI,CACT,0BAA0B,EAC1B,4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C,KAAK,CAAC,KAAK,IAAI,EAAE,CACf,UAAU,CACR,MAAM,MAAM,CAAC,GAAG,CAAC,qBAAqB,EAAE,EAAE,EAAE;QAC1C,eAAe;QACf,QAAQ;KACT,CAAC,CACH,CACF,CACJ,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axonity-ai/mcp",
3
- "version": "0.1.0",
3
+ "version": "0.2.2",
4
4
  "description": "Model Context Protocol server for Axonity Flow — lets an external agent (e.g. Claude Code) read, draft, and update workflows, agents and tools in an Axonity tenant.",
5
5
  "license": "MIT",
6
6
  "repository": {