n8n-ops-mcp 0.13.0 → 0.14.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.
- package/README.md +195 -77
- package/dist/cli.js +6263 -0
- package/dist/mcp-bin.js +5529 -0
- package/dist/mcp-server.js +1751 -761
- package/index.ts +30 -2
- package/openclaw.plugin.json +11 -2
- package/package.json +19 -8
- package/src/cli.ts +867 -0
- package/src/client.ts +153 -6
- package/src/config.ts +9 -0
- package/src/tools/activate.ts +13 -2
- package/src/tools/archive-workflow.ts +23 -4
- package/src/tools/audit-browser-bridge-usage.ts +42 -28
- package/src/tools/check-disabled-nodes.ts +194 -0
- package/src/tools/create-credential.ts +115 -0
- package/src/tools/create-tag.ts +13 -2
- package/src/tools/create-workflow.ts +88 -22
- package/src/tools/deactivate.ts +13 -2
- package/src/tools/delete-credential.ts +66 -0
- package/src/tools/diff-workflow.ts +196 -95
- package/src/tools/execution-stats.ts +33 -22
- package/src/tools/find-workflows-using-credential.ts +256 -0
- package/src/tools/find-workflows-using-node-type.ts +57 -43
- package/src/tools/get-credential-schema.ts +67 -0
- package/src/tools/list-credentials.ts +60 -0
- package/src/tools/list-schedules.ts +48 -39
- package/src/tools/list-webhooks.ts +52 -38
- package/src/tools/redact-credential.ts +16 -0
- package/src/tools/run-audit.ts +28 -16
- package/src/tools/scaffold-browser-bridge-node.ts +2 -2
- package/src/tools/search-executions.ts +96 -88
- package/src/tools/set-workflow-tags.ts +17 -2
- package/src/tools/trigger.ts +12 -1
package/README.md
CHANGED
|
@@ -1,21 +1,74 @@
|
|
|
1
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="docs/assets/n8nctrl-social-preview.jpg" alt="n8nctrl banner" width="900">
|
|
3
|
+
</p>
|
|
2
4
|
|
|
3
|
-
|
|
4
|
-
[](./LICENSE)
|
|
5
|
-
[](https://modelcontextprotocol.io)
|
|
5
|
+
<h1 align="center">n8nctrl</h1>
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
<p align="center">
|
|
8
|
+
<strong>Operator control CLI for n8n, with an MCP adapter for AI clients.</strong>
|
|
9
|
+
</p>
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+
<p align="center">
|
|
12
|
+
<a href="https://lidless.dev/n8n-ops-mcp"><strong>Website & docs → lidless.dev/n8n-ops-mcp</strong></a>
|
|
13
|
+
</p>
|
|
10
14
|
|
|
11
|
-
|
|
15
|
+
<p align="center">
|
|
16
|
+
<img src="https://shieldcn.dev/github/ci/lidless-labs/n8nctrl.svg?branch=main&workflow=ci.yml" alt="CI">
|
|
17
|
+
<img src="https://shieldcn.dev/npm/v/n8n-ops-mcp.svg" alt="npm version">
|
|
18
|
+
<img src="https://shieldcn.dev/github/license/lidless-labs/n8nctrl.svg" alt="license">
|
|
19
|
+
</p>
|
|
12
20
|
|
|
13
|
-
|
|
21
|
+
**n8nctrl is an operator control CLI for [n8n](https://n8n.io) workflow automation.** It lists, inspects, validates, audits, and reports on your n8n workflows and executions over the n8n Public API, so you can ask "what broke in my n8n today?" and act on the answer from a terminal, cron, CI, or an agent. Unlike catalog/docs tools that index n8n's node library for building flows, n8nctrl is built for operating the flows you already run: triage failed executions, find drift, scan for security risks, and inspect live schedules, webhooks, credentials metadata, and tags.
|
|
14
22
|
|
|
15
|
-
|
|
23
|
+
The MCP surface is the adapter layer: run `n8nctrl mcp` for stdio MCP, or keep using the back-compat `n8n-ops-mcp` binary in existing launchers. The same package also ships a first-class [OpenClaw](https://github.com/openclaw/openclaw) plugin. It works with Claude Desktop, Claude Code, Codex CLI, Cursor, Windsurf, or any other MCP host, with no hard dependency on a specific model or agent harness.
|
|
24
|
+
|
|
25
|
+
## What it does
|
|
26
|
+
|
|
27
|
+
n8nctrl connects operators and agents to a running n8n instance for **workflow automation ops**: it surfaces your n8n workflows, executions, schedules, webhooks, tags, and credentials over the n8n Public API. From the CLI, you get scriptable read/report commands for shells, cron, and CI. Through `n8nctrl mcp` or the compatibility `n8n-ops-mcp` bin, your agent gets native awareness of your n8n footprint, so it can answer "what's broken in my n8n?", trigger a workflow from chat, audit for security risks, or clean up old executions without leaving your client.
|
|
28
|
+
|
|
29
|
+
Read tools are always available. Write tools (create, save, archive, delete, trigger, retry, tag CRUD, pin data) are hidden unless `N8N_ENABLE_EDIT=true`, and credential writes sit behind a second gate. Destructive operations are confirm-gated and snapshot to a backup directory first. See the [Security model](#security-model).
|
|
30
|
+
|
|
31
|
+
## Install
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
npm install -g n8n-ops-mcp
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
The npm package name remains `n8n-ops-mcp` for compatibility. After a global install, use the standard CLI as `n8nctrl`. Existing `n8n-ops` and `n8n-ops-mcp` launchers remain supported as compatibility aliases.
|
|
38
|
+
|
|
39
|
+
For MCP launchers, you can still run it on demand via `npx -y n8n-ops-mcp` (no global install needed), which is what the MCP client config below does.
|
|
40
|
+
|
|
41
|
+
## Try it: MCP client config
|
|
42
|
+
|
|
43
|
+
Drop this into your MCP client config (Claude Desktop shown). The binary runs straight from npm via `npx`, so there is nothing to install first:
|
|
44
|
+
|
|
45
|
+
```json
|
|
46
|
+
{
|
|
47
|
+
"mcpServers": {
|
|
48
|
+
"n8n": {
|
|
49
|
+
"command": "npx",
|
|
50
|
+
"args": ["-y", "n8n-ops-mcp"],
|
|
51
|
+
"env": {
|
|
52
|
+
"N8N_BASE_URL": "https://n8n.example.com",
|
|
53
|
+
"N8N_API_KEY": "your-n8n-api-key"
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Generate the API key in n8n under **Settings → API**. Point `N8N_BASE_URL` at your n8n instance. That is the whole read-only setup. To unlock write tools, add `"N8N_ENABLE_EDIT": "true"` to `env`.
|
|
61
|
+
|
|
62
|
+
Then ask your agent:
|
|
63
|
+
|
|
64
|
+
> What n8n workflows broke today?
|
|
65
|
+
|
|
66
|
+
It calls `n8n_list_executions` with `status=error`, then `n8n_get_execution` on the failing run for the per-node log and raw error.
|
|
16
67
|
|
|
17
68
|
## Tools
|
|
18
69
|
|
|
70
|
+
40 tools across read-only ops, the workflow + execution lifecycle, tags, and credentials. Write tools (marked) are hidden unless `N8N_ENABLE_EDIT=true`; credential writes (marked ✓✓) need a second gate.
|
|
71
|
+
|
|
19
72
|
| Tool | Purpose | Write |
|
|
20
73
|
|---|---|---|
|
|
21
74
|
| `n8n_list_workflows` | List workflows, filter by `active` / `tags` / `name` | |
|
|
@@ -27,19 +80,23 @@ For a catalog/docs tool that indexes n8n's node library, see [n8n-mcp](https://w
|
|
|
27
80
|
| `n8n_validate_workflow` | Static checks: deprecated nodes, legacy Code-node API, orphans | |
|
|
28
81
|
| `n8n_diff_workflow` | Compare a workflow against a snapshot file or inline object - semantic diff (added/removed/modified nodes with field paths) | |
|
|
29
82
|
| `n8n_list_schedules` | List every schedule trigger across workflows with human-readable descriptions ("daily at 03:00", "cron: 0 */6 * * *") | |
|
|
30
|
-
| `
|
|
31
|
-
| `n8n_audit_browser_bridge_usage` | Find every workflow that calls the [`browser-bridge`](https://github.com/solomonneas/browser-bridge) CLI (Execute Command, Code, SSH nodes) | |
|
|
83
|
+
| `n8n_audit_browser_bridge_usage` | Find every workflow that calls the [`browser-bridge`](https://github.com/lidless-labs/browser-bridge) CLI (Execute Command, Code, SSH nodes) | |
|
|
32
84
|
| `n8n_scaffold_browser_bridge_node` | Generate a ready-to-paste n8n node that calls a `browser-bridge <platform> <action>` (no API call) | |
|
|
33
85
|
| `n8n_run_audit` | Run n8n's built-in security audit (credentials, database, nodes, filesystem, instance) | |
|
|
34
86
|
| `n8n_find_workflows_using_node_type` | Find every workflow using a given node type (e.g. `n8n-nodes-base.slack`), with `exact` or `contains` match | |
|
|
35
87
|
| `n8n_execution_stats` | Per-workflow stats over a recent window: counts, failure rate, avg + p95 runtime, last failure | |
|
|
36
88
|
| `n8n_list_tags` | List workflow tags with `id`, `name`, `createdAt`, `updatedAt` | |
|
|
37
89
|
| `n8n_get_workflow_tags` | Read the tags currently attached to a workflow | |
|
|
38
|
-
| `
|
|
39
|
-
| `
|
|
40
|
-
| `
|
|
90
|
+
| `n8n_list_credentials` | List credentials (metadata only - secrets never echoed; admin/owner key required) | |
|
|
91
|
+
| `n8n_get_credential_schema` | Fetch the JSON schema for a credential type (e.g. `freshdeskApi`) | |
|
|
92
|
+
| `n8n_find_workflows_using_credential` | Find every workflow node that references a credential by `id` (preferred) or `name` substring; rotation/blast-radius scanner | |
|
|
93
|
+
| `n8n_check_disabled_nodes` | Scan workflows for `disabled: true` nodes - common drift signals not surfaced in the n8n UI | |
|
|
94
|
+
| `n8n_trigger` | Run a workflow via webhook (reliable) or workflow-id (confirm-gated; executes arbitrary workflow nodes) | ✓ |
|
|
95
|
+
| `n8n_create_workflow` | Create a workflow (confirm-gated for writes; dry-run preview without confirm; accepts `n8n_get_workflow` output directly; optional project/folder target) | ✓ |
|
|
96
|
+
| `n8n_activate` | Enable a workflow's triggers (confirm-gated; arms arbitrary-code execution) | ✓ |
|
|
97
|
+
| `n8n_deactivate` | Disable a workflow's triggers (confirm-gated) | ✓ |
|
|
41
98
|
| `n8n_save_workflow` | Overwrite a workflow with auto-backup + validation + confirm gate | ✓ |
|
|
42
|
-
| `n8n_archive_workflow` | Soft-delete a workflow (reversible; preserves id) | ✓ |
|
|
99
|
+
| `n8n_archive_workflow` | Soft-delete a workflow (confirm-gated; reversible; preserves id) | ✓ |
|
|
43
100
|
| `n8n_unarchive_workflow` | Restore an archived workflow (does NOT reactivate) | ✓ |
|
|
44
101
|
| `n8n_delete_workflow` | Permanently delete a workflow (confirm-gated, snapshot-before-delete, restore via `n8n_create_workflow`) | ✓ |
|
|
45
102
|
| `n8n_cancel_execution` | Stop a running or waiting execution by id | ✓ |
|
|
@@ -48,10 +105,12 @@ For a catalog/docs tool that indexes n8n's node library, see [n8n-mcp](https://w
|
|
|
48
105
|
| `n8n_delete_executions` | Batch form of delete (client-side fan-out, confirm-gated, irreversible, max 50 ids) | ✓ |
|
|
49
106
|
| `n8n_pin_node_data` | Pin sample data to a node so downstream nodes use it during testing (confirm-gated, replace-or-merge) | ✓ |
|
|
50
107
|
| `n8n_unpin_node_data` | Clear pinned data on one node or the whole workflow (confirm-gated, idempotent) | ✓ |
|
|
51
|
-
| `n8n_create_tag` | Create a workflow tag (
|
|
52
|
-
| `n8n_delete_tag` | Permanently delete a tag (confirm-gated; cascades
|
|
53
|
-
| `n8n_set_workflow_tags` | Replace the tag set on a workflow (
|
|
108
|
+
| `n8n_create_tag` | Create a workflow tag (confirm-gated; reversible via `n8n_delete_tag`) | ✓ |
|
|
109
|
+
| `n8n_delete_tag` | Permanently delete a tag (confirm-gated; cascades - removes the tag from every workflow) | ✓ |
|
|
110
|
+
| `n8n_set_workflow_tags` | Replace the tag set on a workflow (confirm-gated; reversible by re-setting) | ✓ |
|
|
54
111
|
| `n8n_retry_executions` | Batch retry executions (confirm-gated, max 50 ids, AbortController on 5xx) | ✓ |
|
|
112
|
+
| `n8n_create_credential` | Create a credential (confirm-gated; **double-gated** behind `enableCredentialsWrite`; tool layer redacts `data` from every response branch) | ✓✓ |
|
|
113
|
+
| `n8n_delete_credential` | Permanently delete a credential (confirm-gated; **double-gated**; cascades - every workflow referencing it will fail) | ✓✓ |
|
|
55
114
|
|
|
56
115
|
Write tools are hidden unless `N8N_ENABLE_EDIT=true`.
|
|
57
116
|
|
|
@@ -72,25 +131,25 @@ Write tools are hidden unless `N8N_ENABLE_EDIT=true`.
|
|
|
72
131
|
|
|
73
132
|
**`n8n_validate_workflow`** - checks for deprecated node types (function → code), legacy Code-node API (`$node[]`, `items` global, `require()`), orphan nodes, disabled nodes, missing trigger. Returns issues with severity (error/warning/info) plus a summary count.
|
|
74
133
|
|
|
75
|
-
**`n8n_list_schedules`** - scans `n8n-nodes-base.scheduleTrigger` and the legacy `n8n-nodes-base.cron` nodes across workflows and decodes each interval rule into a human-readable string. Answers "what's running at 3am?" without clicking through the n8n UI. Supported rule fields: `seconds` / `minutes` / `hours` / `days` / `weeks` / `months` (with `triggerAtHour`, `triggerAtMinute`, `triggerAtDay`, `triggerAtDayOfMonth`) and raw `cronExpression`. One entry per interval
|
|
134
|
+
**`n8n_list_schedules`** - scans `n8n-nodes-base.scheduleTrigger` and the legacy `n8n-nodes-base.cron` nodes across workflows and decodes each interval rule into a human-readable string. Answers "what's running at 3am?" without clicking through the n8n UI. Supported rule fields: `seconds` / `minutes` / `hours` / `days` / `weeks` / `months` (with `triggerAtHour`, `triggerAtMinute`, `triggerAtDay`, `triggerAtDayOfMonth`) and raw `cronExpression`. One entry per interval - multi-interval rules emit multiple rows. Each row includes `workflowId`, `workflowName`, `active`, `nodeName`, `nodeType`, `schedule`, `field`, optional `cronExpression`, and the original `raw` rule for further inspection. Optional `workflowId` (single-workflow scan), `activeOnly` (default true - inactive schedules don't fire), `limit` (default 100, max 250).
|
|
76
135
|
|
|
77
|
-
**`n8n_diff_workflow`** - compare a workflow's current state against a snapshot. Pass `id` plus exactly one of `snapshotPath` (
|
|
136
|
+
**`n8n_diff_workflow`** - compare a workflow's current state against a snapshot. Pass `id` plus exactly one of `snapshotPath` or `snapshot` (inline object). `snapshotPath` is **confined to the configured `backupDir`** (default `~/.n8n-backups`): it may be given relative to that directory or as an absolute path inside it, but any path that resolves outside `backupDir` (including `..` traversal) is rejected before the file is read. This keeps the tool from being used as an arbitrary file-read primitive even though it is available without `enableEdit`. Snapshot accepts both shapes: the flat backup written by `n8n_save_workflow` / `n8n_delete_workflow`, and the nested `n8n_get_workflow(includeDefinition=true)` shape (graph data under `definition`). Returns `summary` (counts: added/removed/modified/nameChanged/connectionsChanged/settingsChanged) plus `diff` with per-node `fieldsChanged` paths (e.g. `parameters.command`, `parameters.url`, `disabled`). Node matching is two-pass: id first, then name fallback for any unmatched nodes - handles legacy/hand-edited snapshots. Cosmetic changes (`position`, `webhookId`) are suppressed by default; pass `ignoreCosmetic: false` to surface them. Per-node detail is capped at `maxModifiedDetails` (default 50, max 500); `summary.nodesModified` counter is uncapped and `diff.nodesModifiedTruncated: true` flags when detail was clipped. Read-only.
|
|
78
137
|
|
|
79
|
-
**`n8n_audit_browser_bridge_usage`** - scans every workflow for nodes that invoke the `browser-bridge` CLI. Inspects `command` (Execute Command + SSH nodes) and `jsCode` / `pythonCode` / `functionCode` (Code + legacy Function nodes). Heuristic: `\bbrowser-bridge\.[cm]?js` followed by two kebab-slug args; the bare bin form is intentionally not detected to avoid false positives from path mentions like `cd /opt/browser-bridge`. Returns one finding per `(workflowId, nodeName, platform, action)` plus a `summary` of platform×action counts. Optional `platform`, `action`, `activeOnly` (default false), `includeArchived` (default false), `maxWorkflows` (default 250, max 1000), `concurrency` (default 3, max 8). Read-only. Pairs with `n8n_scaffold_browser_bridge_node` when you need to add another call. Companion repo: [browser-bridge](https://github.com/
|
|
138
|
+
**`n8n_audit_browser_bridge_usage`** - scans every workflow for nodes that invoke the `browser-bridge` CLI. Inspects `command` (Execute Command + SSH nodes) and `jsCode` / `pythonCode` / `functionCode` (Code + legacy Function nodes). Heuristic: `\bbrowser-bridge\.[cm]?js` followed by two kebab-slug args; the bare bin form is intentionally not detected to avoid false positives from path mentions like `cd /opt/browser-bridge`. Returns one finding per `(workflowId, nodeName, platform, action)` plus a `summary` of platform×action counts. Optional `platform`, `action`, `activeOnly` (default false), `includeArchived` (default false), `maxWorkflows` (default 250, max 1000), `concurrency` (default 3, max 8). Read-only. Pairs with `n8n_scaffold_browser_bridge_node` when you need to add another call. Companion repo: [browser-bridge](https://github.com/lidless-labs/browser-bridge).
|
|
80
139
|
|
|
81
|
-
**`n8n_scaffold_browser_bridge_node`** - pure local generator (no n8n API call). Given `platform`, `action`, optional `input` JSON, and `mode: "code-node" | "execute-command"` (default `code-node`), emits a ready-to-paste n8n node JSON that mirrors `browser-bridge`'s `docs/n8n-usage.md` patterns. The Code node uses `spawnSync` with stdin JSON and surfaces `payload.exitCode` + `stderr` so downstream nodes can branch on `ok`. The Execute Command node uses a quoted `<<'JSON'` heredoc so the input passes through unmangled. Optional `bridgeDir
|
|
140
|
+
**`n8n_scaffold_browser_bridge_node`** - pure local generator (no n8n API call). Given `platform`, `action`, optional `input` JSON, and `mode: "code-node" | "execute-command"` (default `code-node`), emits a ready-to-paste n8n node JSON that mirrors `browser-bridge`'s `docs/n8n-usage.md` patterns. The Code node uses `spawnSync` with stdin JSON and surfaces `payload.exitCode` + `stderr` so downstream nodes can branch on `ok`. The Execute Command node uses a quoted `<<'JSON'` heredoc so the input passes through unmangled. Optional `bridgeDir`, `nodeName`, `position`. Platform/action are validated as kebab slugs - keeps them safe to interpolate into the shell command. Warns when `execute-command` is used with non-empty `input` (heredoc bakes the JSON in; no per-item upstream wiring).
|
|
82
141
|
|
|
83
|
-
**`n8n_trigger`** -
|
|
142
|
+
**`n8n_trigger`** - **write tool** (hidden unless `enableEdit`); requires `confirm: true`. Triggering runs the workflow's nodes (Code / Execute Command / HTTP, etc.) and POSTs to webhooks, all of which can have arbitrary real-world side effects, so it lives behind the same edit gate as the other write tools and refuses without `confirm: true`. `webhookPath` is validated client-side: it must resolve to a path under `/webhook`, `/webhook-test`, or `/form`, with no `..` traversal or scheme-relative `//host` form, so a confused agent cannot redirect the call off the base URL. Two modes:
|
|
84
143
|
- `mode: "webhook"` + `webhookPath` - POST (or GET/PUT/DELETE) to the configured base URL + path, with an optional JSON `payload`. This is the reliable path.
|
|
85
144
|
- `mode: "workflow"` + `workflowId` - attempts `POST /api/v1/workflows/:id/execute`. Pre-checks that the workflow is active and has a webhook/manual/form trigger. Most n8n builds don't expose this endpoint on the Public API and will 405; the tool surfaces a hint to switch to webhook mode.
|
|
86
145
|
|
|
87
|
-
**`n8n_create_workflow`** - `POST /workflows`.
|
|
146
|
+
**`n8n_create_workflow`** - `POST /workflows`. Creates from structured workflow JSON: `name`, `nodes`, `connections`, optional `settings` / `staticData`. Also accepts the full output of `n8n_get_workflow` (with `includeDefinition=true`) and backup snapshots directly. Strips read-only fields (`id`, `active`, `createdAt`, `updatedAt`, `isArchived`, `versionId`, `triggerCount`, `tags`, `shared`, `meta`, `pinData`) before POSTing - n8n enforces `additionalProperties: false` on the workflow schema and will 400 on any readOnly field. Runs `n8n_validate_workflow` on the proposed state as a pre-check; errors block, warnings pass through (pass `skipValidation: true` to bypass). Optional `dryRun:true` returns the cleaned POST body and validation issues without writing (no `confirm` needed for a dry run). Optional `projectId` and `folderId` are sent as create-target query params. Requires `confirm: true` to actually write - the tool accepts an arbitrary `nodes` graph that will live on the server, so an unconfirmed call (without `dryRun`) returns `ok: false` and never touches the API. The new workflow is created INACTIVE; call `n8n_activate` afterwards if you want triggers running. This is also the primary restore path for `n8n_delete_workflow` snapshots: read the backup file into `definition` and call this tool. The restored workflow gets a new id.
|
|
88
147
|
|
|
89
|
-
**`n8n_activate`** / **`n8n_deactivate`** - idempotent. Deactivating does not cancel running executions.
|
|
148
|
+
**`n8n_activate`** / **`n8n_deactivate`** - idempotent; both require `confirm: true`. Activating arms the workflow's triggers, so its nodes can start running automatically (effectively arming arbitrary-code execution); deactivating halts that automation. Deactivating does not cancel running executions.
|
|
90
149
|
|
|
91
150
|
**`n8n_save_workflow`** - before writing: fetches the current version, snapshots it to `backupDir` as `<id>-<timestamp>.json` (mode 0600), runs `validateWorkflow` on the proposed state, and aborts on error-severity issues (pass `skipValidation: true` to bypass). Requires `confirm: true` to actually PUT; calling with `confirm: false` returns `ok: false` and never touches the API (omitting `confirm` is rejected at the MCP schema layer). Response includes the backup path and a `restoreHint`.
|
|
92
151
|
|
|
93
|
-
**`n8n_archive_workflow`** - `POST /workflows/{id}/archive`. Soft-deletes a workflow: triggers stop firing, the workflow disappears from the default UI list, but the definition and execution history are preserved. Idempotent (archiving an already-archived workflow returns the current state).
|
|
152
|
+
**`n8n_archive_workflow`** - `POST /workflows/{id}/archive`. Soft-deletes a workflow: triggers stop firing, the workflow disappears from the default UI list, but the definition and execution history are preserved. Idempotent (archiving an already-archived workflow returns the current state). Requires `confirm: true` (it deactivates and soft-deletes the workflow); reversible via `n8n_unarchive_workflow`. Archiving deactivates as a side effect; the response surfaces `active: false` explicitly. Returns `ok: false` with `reason: "not_found"` on 404.
|
|
94
153
|
|
|
95
154
|
**`n8n_unarchive_workflow`** - `POST /workflows/{id}/unarchive`. Restores an archived workflow. Does NOT reactivate - triggers stay off until you call `n8n_activate` explicitly. Returns `ok: false` with `reason: "not_found"` on 404.
|
|
96
155
|
|
|
@@ -102,17 +161,17 @@ Write tools are hidden unless `N8N_ENABLE_EDIT=true`.
|
|
|
102
161
|
|
|
103
162
|
**`n8n_delete_execution`** - `DELETE /executions/{id}`. Permanently removes an execution record: logs, per-node run data, and error payloads are erased from n8n. Requires `confirm: true` to actually delete; calling with `confirm: false` returns `ok: false` and never touches the API (omitting `confirm` is rejected at the MCP schema layer). Returns `ok: false` with `reason: "not_found"` on 404; all other API errors rethrow. Not idempotent from an agent's perspective: the record is gone after the first successful call, so fetch `n8n_get_execution` first if you may need it later.
|
|
104
163
|
|
|
105
|
-
**`n8n_pin_node_data`** - pin sample data to a node so downstream nodes use it during testing/development without re-running the upstream node. Pairs naturally with `n8n_scaffold_browser_bridge_node`: scaffold a browser-bridge call, run it once, capture the output, pin it, then iterate on downstream nodes without re-spawning the browser. Inputs: `id`, `nodeName` (case-sensitive, must match an existing node), `data` (1-50 items; raw objects are auto-wrapped into `{json: <object>}`, items already shaped as `{json: ..., binary?: ...}` pass through unchanged), optional `merge: true` to append to existing pinned data instead of replacing (combined still capped at 50), `confirm: true`. Issues PUT `/workflows/{id}` with merged `pinData` plus the existing nodes/connections/settings/staticData (so the PUT does not blank them). Pinned data persists across executions until cleared
|
|
164
|
+
**`n8n_pin_node_data`** - pin sample data to a node so downstream nodes use it during testing/development without re-running the upstream node. Pairs naturally with `n8n_scaffold_browser_bridge_node`: scaffold a browser-bridge call, run it once, capture the output, pin it, then iterate on downstream nodes without re-spawning the browser. Inputs: `id`, `nodeName` (case-sensitive, must match an existing node), `data` (1-50 items; raw objects are auto-wrapped into `{json: <object>}`, items already shaped as `{json: ..., binary?: ...}` pass through unchanged), optional `merge: true` to append to existing pinned data instead of replacing (combined still capped at 50), `confirm: true`. Issues PUT `/workflows/{id}` with merged `pinData` plus the existing nodes/connections/settings/staticData (so the PUT does not blank them). Pinned data persists across executions until cleared - easy to forget; the response includes an `unpinHint`.
|
|
106
165
|
|
|
107
166
|
**`n8n_unpin_node_data`** - clear pinned data on one node (when `nodeName` is supplied) or the whole workflow (when omitted). Idempotent: clearing a node that wasn't pinned returns `ok: true` with `noop: true` and never touches the API. When clearing actually happens, the PUT includes the rest of the workflow body so other fields are not blanked. Requires `confirm: true`.
|
|
108
167
|
|
|
109
168
|
**`n8n_delete_executions`** - batch form. Client-side fan-out over `DELETE /executions/{id}` with bounded concurrency (default 3, max 10). Takes an `ids` array (deduped before fan-out, capped at 50), requires `confirm: true`. Response surfaces `requested`/`attempted`/`deleted`/`alreadyDeleted`/`failed`/`skipped`/`aborted` counters plus a `results: Array<{id, ok, reason?, message?}>` - order is completion order, not input order, so look up by id. 404 per id is treated as `already_deleted` (idempotent). A 5xx on any id aborts the batch via an `AbortController`: no new ids are claimed and any already-in-flight `fetch`es are cancelled client-side. Under concurrency N, up to N-1 deletes may have already reached the server before the 5xx is observed, so the batch is best-effort, not transactional - clear signal the server is sick; don't retry blindly. Per-id error messages are passed through the API-key redactor. Compose with `n8n_search_executions` to purge a known set of noisy runs in one call.
|
|
110
169
|
|
|
111
|
-
**`n8n_retry_executions`** - batch form of retry. Same fan-out shape as `n8n_delete_executions`: bounded concurrency (default 3, max 10), capped at 50 ids, `AbortController` on 5xx, results in completion order. **Differs in two ways:** 404 per id is `{ ok: false, reason: "not_found" }` (NOT idempotent
|
|
170
|
+
**`n8n_retry_executions`** - batch form of retry. Same fan-out shape as `n8n_delete_executions`: bounded concurrency (default 3, max 10), capped at 50 ids, `AbortController` on 5xx, results in completion order. **Differs in two ways:** 404 per id is `{ ok: false, reason: "not_found" }` (NOT idempotent - a missing execution is a real failure to surface), and each successful retry creates a NEW execution whose id is returned per row as `newExecutionId`. Counters: `requested`/`attempted`/`retried`/`notFound`/`failed`/`skipped`/`aborted`. Optional `loadWorkflow: true` retries every id against the currently saved workflow instead of the captured version. Confirm-gated - each retry runs the workflow again and may re-trigger side effects (HTTP calls, DB writes); verify the workflow is safe to re-run before confirming.
|
|
112
171
|
|
|
113
|
-
**`n8n_run_audit`** - `POST /audit`. Runs n8n's built-in security audit and returns one risk report per requested category: **credentials** (unused/abandoned), **database** (SQL-injection-prone expressions in query nodes), **nodes** (community/unofficial nodes), **filesystem** (host fs access from nodes), **instance** (insecure server settings). Each report has `risk`, `sections` (with `title`/`description`/`recommendation`/`location`). The tool also surfaces a flat `reports` array with per-report `sectionCount`/`locationCount` so an agent can decide what to drill into without reparsing the whole audit. Optional `categories` (omit for all five) and `daysAbandonedWorkflow` (n8n default 90). Read-only
|
|
172
|
+
**`n8n_run_audit`** - `POST /audit`. Runs n8n's built-in security audit and returns one risk report per requested category: **credentials** (unused/abandoned), **database** (SQL-injection-prone expressions in query nodes), **nodes** (community/unofficial nodes), **filesystem** (host fs access from nodes), **instance** (insecure server settings). Each report has `risk`, `sections` (with `title`/`description`/`recommendation`/`location`). The tool also surfaces a flat `reports` array with per-report `sectionCount`/`locationCount` so an agent can decide what to drill into without reparsing the whole audit. Optional `categories` (omit for all five) and `daysAbandonedWorkflow` (n8n default 90). Read-only - n8n only inspects, never mutates. **Requires the API user to be an instance admin or owner** (n8n's audit endpoint enforces this).
|
|
114
173
|
|
|
115
|
-
**`n8n_find_workflows_using_node_type`** - composed read-only scanner. Walks every workflow (paginated, capped at `maxWorkflows`, default 250 / max 1000) and emits one finding per node matching the requested type. `match: "exact"` (default) is full-string equality on `node.type`; `match: "contains"` is case-insensitive substring (handy for "all Slack nodes across base + community packages"). Optional `activeOnly` (default false), `includeArchived` (default false), `includeDisabledNodes` (default true
|
|
174
|
+
**`n8n_find_workflows_using_node_type`** - composed read-only scanner. Walks every workflow (paginated, capped at `maxWorkflows`, default 250 / max 1000) and emits one finding per node matching the requested type. `match: "exact"` (default) is full-string equality on `node.type`; `match: "contains"` is case-insensitive substring (handy for "all Slack nodes across base + community packages"). Optional `activeOnly` (default false), `includeArchived` (default false), `includeDisabledNodes` (default true - disabled nodes are common drift signals worth surfacing), `concurrency` (default 3, max 8). Returns per-node `findings` plus a per-workflow `summary` sorted by match count descending. Per-workflow fetch errors land in `fetchErrors` instead of failing the whole scan. Pairs with `n8n_audit_browser_bridge_usage` (which schedules drive my browser-bridge calls?) and `n8n_run_audit` (which deprecated nodes need replacing?).
|
|
116
175
|
|
|
117
176
|
**`n8n_execution_stats`** - composed read-only aggregator over `n8n_list_executions`. Per-workflow counts (total/success/error/canceled/running/waiting/other), failure rate (`error / (success + error + canceled)`), avg + p95 runtime over completed executions, and `lastFailureAt` / `lastSuccessAt`. Optional `workflowId` (single-workflow stats), `sinceHours` (default 24, max 168 = 7d), `maxExecutions` (default 1000, max 5000), `pageSize` (default 250). Pagination stops on the first execution older than the window OR at `maxExecutions`; `stoppedReason` is one of `"window"`, `"cap"`, `"exhausted"`. If `truncated: true`, increase `maxExecutions` or narrow `sinceHours`. The `totals` object includes the same counts + `failureRate` rolled across all workflows in the window. Useful for "which workflows are flaky?" and "what's running long?"
|
|
118
177
|
|
|
@@ -120,19 +179,25 @@ Write tools are hidden unless `N8N_ENABLE_EDIT=true`.
|
|
|
120
179
|
|
|
121
180
|
**`n8n_get_workflow_tags`** - `GET /workflows/{id}/tags`. Returns the array of tag objects currently attached. Pairs with `n8n_set_workflow_tags` for diffs and reattach flows.
|
|
122
181
|
|
|
123
|
-
**`n8n_create_tag`** - `POST /tags`.
|
|
182
|
+
**`n8n_create_tag`** - `POST /tags`. Requires `confirm: true` (consistent with the other mutating tag tools); reversible via `n8n_delete_tag`. The name is trimmed before send. Returns `ok: false` with `reason: "conflict"` on 409 (tag with this name already exists); use `n8n_list_tags` to find the existing id.
|
|
124
183
|
|
|
125
184
|
**`n8n_delete_tag`** - `DELETE /tags/{id}`. Confirm-gated. **Cascades**: n8n removes the tag from every workflow it was attached to. The workflows themselves are NOT deleted, only the tag association. Returns `ok: false` with `reason: "not_found"` on 404. To find affected workflows beforehand, use `n8n_list_workflows(tags=<name>)` or scan `n8n_get_workflow_tags`.
|
|
126
185
|
|
|
127
|
-
**`n8n_set_workflow_tags`** - `PUT /workflows/{id}/tags`. **REPLACES** the workflow's tag set (not append)
|
|
186
|
+
**`n8n_set_workflow_tags`** - `PUT /workflows/{id}/tags`. **REPLACES** the workflow's tag set (not append) - pass the full desired list. Empty `tagIds: []` clears all tags. Tag ids are deduped before send. Requires `confirm: true` (reversible by re-setting). Returns `ok: false` with `reason: "not_found"` on 404 (the workflow id OR one of the tag ids does not exist; verify both with `n8n_list_workflows` and `n8n_list_tags`).
|
|
128
187
|
|
|
129
|
-
|
|
188
|
+
**`n8n_list_credentials`** - `GET /credentials`. Returns metadata only - n8n's API explicitly excludes the `data` field (encrypted secrets) from list responses, and the tool layer strips `data` defensively in case of a future regression. Each row: `{id, name, type, createdAt, updatedAt, shared[]}`. Optional `limit` (default 100, max 250) and `cursor`. Requires the API key to belong to an instance owner or admin - non-admin keys get `ok: false, reason: "unauthorized"` with a clear hint.
|
|
130
189
|
|
|
131
|
-
|
|
190
|
+
**`n8n_get_credential_schema`** - `GET /credentials/schema/{credentialTypeName}`. Returns the raw JSON Schema describing the required `data` shape for a credential type (e.g. `freshdeskApi` → `{ apiKey, domain }` required). Use this **before** calling `n8n_create_credential` so you know what fields to populate. 404 returns `reason: "not_found"`; 401 returns `reason: "unauthorized"`.
|
|
132
191
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
192
|
+
**`n8n_find_workflows_using_credential`** - composed scanner (no direct n8n endpoint). Walks workflows and inspects every node's `credentials` field. Pass either `credentialId` (exact, preferred) or `credentialName` (case-insensitive substring fallback). Returns one finding per `(workflowId, nodeName, credentialType)` plus a per-workflow summary count. Same fan-out shape as `n8n_audit_browser_bridge_usage` (bounded concurrency, `fetchErrors` for per-workflow failures, `truncated` flag, `maxWorkflows` default 250). The answer to "I'm rotating Slack creds, where do I need to update?" - run this **before** `n8n_delete_credential` to see the blast radius.
|
|
193
|
+
|
|
194
|
+
**`n8n_check_disabled_nodes`** - composed scanner. Surfaces every node with `disabled: true` across recent workflows. One finding per `(workflowId, nodeName, nodeType)` plus per-workflow disabled count, sorted desc. Disabled nodes are common drift signals (frozen mid-debug, forgotten cleanup) and the n8n UI doesn't list them anywhere obvious. Same fan-out + filter shape as the other scanners.
|
|
195
|
+
|
|
196
|
+
**`n8n_create_credential`** - `POST /credentials`. **Double-gated**: requires both `enableEdit` AND `enableCredentialsWrite` (default false). Confirm-gated. `data` carries plaintext secrets to n8n; the tool layer **never** echoes `data` back, even on error - n8n 400s with body content are wrapped to a status-only error before surfacing, so secrets cannot leak via validation messages. Pre-call: use `n8n_get_credential_schema` to learn the required `data` shape. Post-call: response includes `id`, `name`, `type`, timestamps; no `data`. NOT idempotent - calling twice with the same name creates two credentials.
|
|
197
|
+
|
|
198
|
+
**`n8n_delete_credential`** - `DELETE /credentials/{id}`. **Double-gated** + confirm-gated. **Cascades**: every workflow referencing this credential will fail on its next run - call `n8n_find_workflows_using_credential` first to enumerate the blast radius. 404 returns `reason: "not_found"`. The deleted-credential payload echoed by n8n has `data` stripped at the tool layer regardless of upstream behavior.
|
|
199
|
+
|
|
200
|
+
</details>
|
|
136
201
|
|
|
137
202
|
## Configuration
|
|
138
203
|
|
|
@@ -140,13 +205,43 @@ Generate an API key in n8n under **Settings → API**, then set these env vars i
|
|
|
140
205
|
|
|
141
206
|
| Variable | Required | Default | Description |
|
|
142
207
|
|---|---|---|---|
|
|
143
|
-
| `N8N_BASE_URL` | yes | - | n8n base URL, e.g. `
|
|
208
|
+
| `N8N_BASE_URL` | yes | - | n8n base URL, e.g. `https://n8n.example.com` |
|
|
144
209
|
| `N8N_API_KEY` | yes | - | n8n Public API key (`X-N8N-API-KEY`) |
|
|
145
210
|
| `N8N_ENABLE_EDIT` | no | `false` | Expose write tools |
|
|
211
|
+
| `N8N_ENABLE_CREDENTIALS_WRITE` | no | `false` | Second gate (on top of `N8N_ENABLE_EDIT`) for `n8n_create_credential` and `n8n_delete_credential`. See [Security model](#security-model). |
|
|
146
212
|
| `N8N_BACKUP_DIR` | no | `~/.n8n-backups` | Where `n8n_save_workflow` writes pre-save snapshots |
|
|
147
213
|
| `N8N_MAX_EXECUTION_LOG_BYTES` | no | `65536` | Cap on inline execution log bytes |
|
|
148
214
|
| `N8N_REQUEST_TIMEOUT_MS` | no | `15000` | HTTP timeout for n8n API calls |
|
|
149
215
|
|
|
216
|
+
## CLI
|
|
217
|
+
|
|
218
|
+
`n8nctrl` is the standard read-only **operator control CLI** for shells, cron, and CI. It talks to the same n8n Public API as the MCP server and shares the same client core, so what the agent can read, you can read from a terminal. It exposes only the read/report tools - no create, save, archive, delete, cancel, retry, or trigger. The older `n8n-ops` bin remains a compatibility alias.
|
|
219
|
+
|
|
220
|
+
```bash
|
|
221
|
+
# installed globally, the standard bin is `n8nctrl`:
|
|
222
|
+
n8nctrl workflows list --active
|
|
223
|
+
n8nctrl workflows get <id> --full
|
|
224
|
+
n8nctrl workflows validate <id>
|
|
225
|
+
n8nctrl executions list --status error --since 24
|
|
226
|
+
n8nctrl executions search "ECONNREFUSED" --scope all
|
|
227
|
+
n8nctrl executions stats --since 48
|
|
228
|
+
n8nctrl webhooks list
|
|
229
|
+
n8nctrl schedules list
|
|
230
|
+
n8nctrl tags list
|
|
231
|
+
n8nctrl credentials find-usage <credentialId>
|
|
232
|
+
n8nctrl nodes find n8n-nodes-base.slack --contains
|
|
233
|
+
n8nctrl nodes check-disabled
|
|
234
|
+
n8nctrl audit run # exit 1 if the backend is unreachable (cron-friendly)
|
|
235
|
+
n8nctrl audit browser-bridge
|
|
236
|
+
n8nctrl --json tags list # raw JSON for piping
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
Run `n8nctrl help` for the full command and flag list. Configure with the same `N8N_BASE_URL` / `N8N_API_KEY` env vars as the MCP server (see the table above). Exit codes: `0` success, `1` runtime error (backend unreachable or a call failed), `2` usage error (unknown command/flag or bad value).
|
|
240
|
+
|
|
241
|
+
### Starting the MCP adapter
|
|
242
|
+
|
|
243
|
+
`n8nctrl mcp` starts the stdio MCP adapter. The `n8n-ops-mcp` bin remains supported for existing MCP client configs and package launchers. If a launcher referenced the built file path `dist/mcp-server.js` directly, point it at `dist/mcp-bin.js` (or `dist/cli.js mcp`); launchers that use the `n8n-ops-mcp` bin name need no change.
|
|
244
|
+
|
|
150
245
|
### Claude Desktop
|
|
151
246
|
|
|
152
247
|
Add to `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) or `%APPDATA%\Claude\claude_desktop_config.json` (Windows):
|
|
@@ -155,9 +250,10 @@ Add to `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS)
|
|
|
155
250
|
{
|
|
156
251
|
"mcpServers": {
|
|
157
252
|
"n8n": {
|
|
158
|
-
"command": "
|
|
253
|
+
"command": "npx",
|
|
254
|
+
"args": ["-y", "n8n-ops-mcp"],
|
|
159
255
|
"env": {
|
|
160
|
-
"N8N_BASE_URL": "
|
|
256
|
+
"N8N_BASE_URL": "https://n8n.example.com",
|
|
161
257
|
"N8N_API_KEY": "your-api-key-here"
|
|
162
258
|
}
|
|
163
259
|
}
|
|
@@ -169,9 +265,9 @@ Add to `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS)
|
|
|
169
265
|
|
|
170
266
|
```bash
|
|
171
267
|
claude mcp add n8n \
|
|
172
|
-
--env N8N_BASE_URL=
|
|
268
|
+
--env N8N_BASE_URL=https://n8n.example.com \
|
|
173
269
|
--env N8N_API_KEY=your-api-key-here \
|
|
174
|
-
-- n8n-ops-mcp
|
|
270
|
+
-- npx -y n8n-ops-mcp
|
|
175
271
|
```
|
|
176
272
|
|
|
177
273
|
Add `--scope user` to make it available from any directory instead of only the current project.
|
|
@@ -180,16 +276,16 @@ Add `--scope user` to make it available from any directory instead of only the c
|
|
|
180
276
|
|
|
181
277
|
```bash
|
|
182
278
|
codex mcp add n8n \
|
|
183
|
-
--env N8N_BASE_URL=
|
|
279
|
+
--env N8N_BASE_URL=https://n8n.example.com \
|
|
184
280
|
--env N8N_API_KEY=your-api-key-here \
|
|
185
|
-
-- n8n-ops-mcp
|
|
281
|
+
-- npx -y n8n-ops-mcp
|
|
186
282
|
```
|
|
187
283
|
|
|
188
284
|
Writes the entry to `~/.codex/config.toml` under `[mcp_servers.n8n]`. Verify with `codex mcp list`.
|
|
189
285
|
|
|
190
286
|
### Cursor / Windsurf / other MCP hosts
|
|
191
287
|
|
|
192
|
-
Any MCP-compatible client that accepts a stdio command + env will work. Point it at the `n8n-ops-mcp` binary with `N8N_BASE_URL` and `N8N_API_KEY` in the environment.
|
|
288
|
+
Any MCP-compatible client that accepts a stdio command + env will work. Point it at `npx -y n8n-ops-mcp` (or the globally installed `n8n-ops-mcp` binary) with `N8N_BASE_URL` and `N8N_API_KEY` in the environment.
|
|
193
289
|
|
|
194
290
|
<details>
|
|
195
291
|
<summary><b>Hermes Agent</b></summary>
|
|
@@ -199,9 +295,10 @@ Any MCP-compatible client that accepts a stdio command + env will work. Point it
|
|
|
199
295
|
```yaml
|
|
200
296
|
mcp_servers:
|
|
201
297
|
n8n:
|
|
202
|
-
command: "
|
|
298
|
+
command: "npx"
|
|
299
|
+
args: ["-y", "n8n-ops-mcp"]
|
|
203
300
|
env:
|
|
204
|
-
N8N_BASE_URL: "
|
|
301
|
+
N8N_BASE_URL: "https://n8n.example.com"
|
|
205
302
|
N8N_API_KEY: "your-api-key-here"
|
|
206
303
|
```
|
|
207
304
|
|
|
@@ -215,7 +312,7 @@ Then reload from inside a session:
|
|
|
215
312
|
|
|
216
313
|
### OpenClaw (first-class plugin)
|
|
217
314
|
|
|
218
|
-
|
|
315
|
+
n8nctrl ships as a first-class OpenClaw plugin through the `n8n-ops-mcp` package - not an MCP bridge - so it shares the gateway's process, auth profiles, and hooks.
|
|
219
316
|
|
|
220
317
|
```bash
|
|
221
318
|
openclaw plugins install clawhub:n8n-ops-mcp
|
|
@@ -230,7 +327,7 @@ Add the config block to `~/.openclaw/openclaw.json`:
|
|
|
230
327
|
"n8n": {
|
|
231
328
|
"enabled": true,
|
|
232
329
|
"config": {
|
|
233
|
-
"baseUrl": "
|
|
330
|
+
"baseUrl": "https://n8n.example.com",
|
|
234
331
|
"enableEdit": false
|
|
235
332
|
}
|
|
236
333
|
}
|
|
@@ -243,7 +340,7 @@ Put the API key in your OpenClaw workspace env:
|
|
|
243
340
|
|
|
244
341
|
```bash
|
|
245
342
|
# ~/.openclaw/workspace/.env
|
|
246
|
-
N8N_API_KEY=
|
|
343
|
+
N8N_API_KEY=your-api-key-here
|
|
247
344
|
```
|
|
248
345
|
|
|
249
346
|
Restart the gateway:
|
|
@@ -252,7 +349,7 @@ Restart the gateway:
|
|
|
252
349
|
systemctl --user restart openclaw-gateway
|
|
253
350
|
```
|
|
254
351
|
|
|
255
|
-
Config keys: `baseUrl`, `apiKey`, `apiKeyEnv`, `enableEdit`, `maxExecutionLogBytes`, `requestTimeoutMs`, `backupDir`. See [`openclaw.plugin.json`](./openclaw.plugin.json) for the full schema.
|
|
352
|
+
Config keys: `baseUrl`, `apiKey`, `apiKeyEnv`, `enableEdit`, `enableCredentialsWrite`, `maxExecutionLogBytes`, `requestTimeoutMs`, `backupDir`. See [`openclaw.plugin.json`](./openclaw.plugin.json) for the full schema and the [Security model](#security-model) for the two-gate write design.
|
|
256
353
|
|
|
257
354
|
<details>
|
|
258
355
|
<summary><b>OpenClaw - manual (non-ClawHub) install</b></summary>
|
|
@@ -270,7 +367,7 @@ If you want to point OpenClaw at a local clone instead of the registry:
|
|
|
270
367
|
"n8n": {
|
|
271
368
|
"enabled": true,
|
|
272
369
|
"config": {
|
|
273
|
-
"baseUrl": "
|
|
370
|
+
"baseUrl": "https://n8n.example.com",
|
|
274
371
|
"enableEdit": false
|
|
275
372
|
}
|
|
276
373
|
}
|
|
@@ -281,6 +378,23 @@ If you want to point OpenClaw at a local clone instead of the registry:
|
|
|
281
378
|
|
|
282
379
|
</details>
|
|
283
380
|
|
|
381
|
+
## Security model
|
|
382
|
+
|
|
383
|
+
Two flags gate write access, with deliberately different blast radii:
|
|
384
|
+
|
|
385
|
+
- **`enableEdit`** (default `false`) - exposes the workflow + execution lifecycle write tools (create/save/archive/delete workflows, activate/deactivate, **trigger**, cancel/retry/delete executions, pin/unpin node data, tag CRUD). `n8n_trigger` is gated here too: running a workflow executes arbitrary Code / Execute Command / HTTP nodes and POSTs to webhooks, so it is treated as a write. Mutating tools are confirm-gated (including `trigger`, `activate`, `deactivate`, `archive`, `create_workflow`, `create_tag`, and `set_workflow_tags`), and the destructive workflow ones snapshot to `backupDir` first. The read-only `n8n_diff_workflow` confines `snapshotPath` reads to `backupDir` so it cannot be turned into an arbitrary file-read primitive.
|
|
386
|
+
- **`enableCredentialsWrite`** (default `false`) - **second gate**, on top of `enableEdit`, required to expose `n8n_create_credential` and `n8n_delete_credential`. An agent that has been overprovisioned with `enableEdit` cannot inject or destroy credentials without this separate, deliberate config change.
|
|
387
|
+
|
|
388
|
+
Both flags must be true for credential writes to register. The credential **read** tools (`list-credentials`, `get-credential-schema`, `find-workflows-using-credential`) and the disabled-node scanner are always available regardless.
|
|
389
|
+
|
|
390
|
+
Why credentials get a second gate:
|
|
391
|
+
1. `create-credential` is the only tool in this package where agent input contains plaintext secrets. A prompt-injected or confused agent with `enableEdit` shouldn't be able to inject credentials.
|
|
392
|
+
2. `delete-credential` cascades - every workflow referencing the credential fails on its next run. The blast radius is wider than any single workflow operation.
|
|
393
|
+
|
|
394
|
+
Defense-in-depth on `data`:
|
|
395
|
+
- n8n's OpenAPI marks `data` as `writeOnly` - the API contract excludes it from every response. We trust but verify: **the tool layer strips `data` from every credential response before surfacing**, including success paths and the deleted-credential echo, so a future n8n regression can't leak secrets through us.
|
|
396
|
+
- On `create-credential` errors, the n8n response body (which can echo back fragments of submitted `data` on validation 400s) is replaced at the client layer with a status-only error message. The tool surfaces `status` + `path` only. Tests assert no portion of a forced-400 request body reaches the tool response.
|
|
397
|
+
|
|
284
398
|
## Example prompts
|
|
285
399
|
|
|
286
400
|
> What n8n workflows broke today?
|
|
@@ -291,9 +405,9 @@ Calls `n8n_list_executions` with `status=error`, then `n8n_get_execution` for th
|
|
|
291
405
|
|
|
292
406
|
Calls `n8n_search_executions` with `query: "ECONNREFUSED"`.
|
|
293
407
|
|
|
294
|
-
> Trigger the "nightly intel" workflow
|
|
408
|
+
> Trigger the "nightly intel" workflow *(requires `N8N_ENABLE_EDIT=true`)*
|
|
295
409
|
|
|
296
|
-
Calls `n8n_list_webhooks` to find the path, then `n8n_trigger` with `mode=webhook`.
|
|
410
|
+
Calls `n8n_list_webhooks` to find the path, then `n8n_trigger` with `mode=webhook` and `confirm: true`.
|
|
297
411
|
|
|
298
412
|
> What's running at 3am?
|
|
299
413
|
|
|
@@ -303,53 +417,53 @@ Calls `n8n_list_schedules`, then filters the result for any schedule whose descr
|
|
|
303
417
|
|
|
304
418
|
Calls `n8n_diff_workflow` with `id` and `snapshotPath` pointing to the backup file. Returns added/removed/modified nodes with parameter-level field paths.
|
|
305
419
|
|
|
306
|
-
>
|
|
307
|
-
|
|
308
|
-
Calls `n8n_audit_browser_bridge_usage` with `platform: "linktree"` to list every node (across all workflows) that invokes `browser-bridge linktree <action>`.
|
|
309
|
-
|
|
310
|
-
> Add a CoderLegion `scan-comments` step to a new workflow
|
|
420
|
+
> Audit my workflows for deprecated Code-node API usage
|
|
311
421
|
|
|
312
|
-
Calls `
|
|
422
|
+
Calls `n8n_list_workflows` then `n8n_validate_workflow` per id, filters for `code-node-old-node-ref` and `code-node-items-global` warnings.
|
|
313
423
|
|
|
314
|
-
>
|
|
424
|
+
> Which workflows are flaky this week?
|
|
315
425
|
|
|
316
|
-
Calls `
|
|
426
|
+
Calls `n8n_execution_stats` with `sinceHours: 168`, then sorts by `failureRate`.
|
|
317
427
|
|
|
318
|
-
>
|
|
428
|
+
> I'm rotating Slack credentials - where do I need to update?
|
|
319
429
|
|
|
320
|
-
Calls `
|
|
430
|
+
Calls `n8n_find_workflows_using_credential` with the credential id to enumerate the blast radius before you touch anything.
|
|
321
431
|
|
|
322
432
|
> Deactivate the "experimental-bot" workflow *(requires `N8N_ENABLE_EDIT=true`)*
|
|
323
433
|
|
|
324
|
-
Calls `n8n_list_workflows` with a name filter, then `n8n_deactivate` on the matching id.
|
|
434
|
+
Calls `n8n_list_workflows` with a name filter, then `n8n_deactivate` with `confirm: true` on the matching id.
|
|
325
435
|
|
|
326
436
|
> Kill the execution stuck on ECONNREFUSED *(requires `N8N_ENABLE_EDIT=true`)*
|
|
327
437
|
|
|
328
438
|
Calls `n8n_search_executions` with `query: "ECONNREFUSED"`, then `n8n_cancel_execution` on the match.
|
|
329
439
|
|
|
330
|
-
> Retry yesterday's failed "nightly intel" run against the current workflow *(requires `N8N_ENABLE_EDIT=true`)*
|
|
331
|
-
|
|
332
|
-
Calls `n8n_search_executions` to find the failed id, then `n8n_retry_execution` with `loadWorkflow: true`.
|
|
333
|
-
|
|
334
440
|
> Purge the noisy test-run execution logs from last week *(requires `N8N_ENABLE_EDIT=true`)*
|
|
335
441
|
|
|
336
442
|
Calls `n8n_search_executions` to find the ids, then `n8n_delete_executions` with `confirm: true` to purge up to 50 in one call. Deletion is irreversible.
|
|
337
443
|
|
|
338
444
|
> Archive the old "staging-bot" workflow - I might need it back someday *(requires `N8N_ENABLE_EDIT=true`)*
|
|
339
445
|
|
|
340
|
-
Calls `n8n_list_workflows` with a name filter, then `n8n_archive_workflow` on the match. Reversible via `n8n_unarchive_workflow` (you'll still need `n8n_activate` to turn triggers back on).
|
|
446
|
+
Calls `n8n_list_workflows` with a name filter, then `n8n_archive_workflow` with `confirm: true` on the match. Reversible via `n8n_unarchive_workflow` (you'll still need `n8n_activate` with `confirm: true` to turn triggers back on).
|
|
341
447
|
|
|
342
448
|
> Delete the abandoned "poc-scraper" workflow - it's been dead for months *(requires `N8N_ENABLE_EDIT=true`)*
|
|
343
449
|
|
|
344
450
|
Calls `n8n_list_workflows` to find the id, then `n8n_delete_workflow` with `confirm: true`. A snapshot lands in `backupDir` first; restore is one-call via `n8n_create_workflow` with the snapshot. Prefer `n8n_archive_workflow` if you want to preserve the original id.
|
|
345
451
|
|
|
346
|
-
|
|
452
|
+
## Why not the bigger n8n MCP projects?
|
|
347
453
|
|
|
348
|
-
|
|
454
|
+
n8nctrl is deliberately narrow. It is for **operating** the n8n you already run, not for authoring new flows from a node catalog.
|
|
349
455
|
|
|
350
|
-
|
|
456
|
+
- For a catalog/docs tool that indexes n8n's node library so an agent can scaffold new workflows from node metadata, see [n8n-mcp](https://www.npmjs.com/package/n8n-mcp). That is the right tool when you want the agent to know about every node type and its parameters.
|
|
457
|
+
- n8nctrl is the right tool when you want the agent or CLI to answer "what's broken, what changed, what's risky, what's scheduled" against your live instance and to act on it: triage failed executions, diff against backups, scan for security and credential blast radius, and edit workflows behind explicit, snapshotted write gates.
|
|
351
458
|
|
|
352
|
-
|
|
459
|
+
The two are complementary. One helps build; this one helps run.
|
|
460
|
+
|
|
461
|
+
## What n8nctrl is not
|
|
462
|
+
|
|
463
|
+
- **Not a node-catalog or workflow-authoring assistant.** It does not index n8n's node library or suggest node parameters. Use [n8n-mcp](https://www.npmjs.com/package/n8n-mcp) for that.
|
|
464
|
+
- **Not a replacement for the n8n UI or its REST API.** It is a thin, opinionated operator layer over the n8n Public API, focused on ops questions and safe writes.
|
|
465
|
+
- **Not a hosted service.** No daemon, no telemetry. It runs as a local stdio process (or an in-process OpenClaw plugin) and talks only to the n8n instance you configure.
|
|
466
|
+
- **Not a credential exfiltration path.** Credential reads return metadata only; credential writes are double-gated and `data` is stripped from every response branch. See the [Security model](#security-model).
|
|
353
467
|
|
|
354
468
|
## Development
|
|
355
469
|
|
|
@@ -365,16 +479,20 @@ npm start # node dist/mcp-server.js (post-build)
|
|
|
365
479
|
Or install from source:
|
|
366
480
|
|
|
367
481
|
```bash
|
|
368
|
-
git clone https://github.com/
|
|
369
|
-
cd
|
|
482
|
+
git clone https://github.com/lidless-labs/n8nctrl.git
|
|
483
|
+
cd n8nctrl
|
|
370
484
|
npm install
|
|
371
485
|
npm run build
|
|
372
486
|
```
|
|
373
487
|
|
|
488
|
+
## Contributing
|
|
489
|
+
|
|
490
|
+
Patches welcome. See [CONTRIBUTING.md](./CONTRIBUTING.md) for what lands easily, [SECURITY.md](./SECURITY.md) for how to report a vulnerability, and the [Code of Conduct](./CODE_OF_CONDUCT.md).
|
|
491
|
+
|
|
374
492
|
## Changelog
|
|
375
493
|
|
|
376
494
|
See [CHANGELOG.md](./CHANGELOG.md) for the full version history.
|
|
377
495
|
|
|
378
496
|
## License
|
|
379
497
|
|
|
380
|
-
MIT
|
|
498
|
+
MIT. See [LICENSE](./LICENSE).
|