n8n-ops-mcp 0.14.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 CHANGED
@@ -1,35 +1,74 @@
1
1
  <p align="center">
2
- <img src="docs/assets/n8n-ops-mcp-banner.jpg" alt="n8n-ops-mcp banner">
2
+ <img src="docs/assets/n8nctrl-social-preview.jpg" alt="n8nctrl banner" width="900">
3
3
  </p>
4
4
 
5
- <h1 align="center">n8n-ops-mcp</h1>
5
+ <h1 align="center">n8nctrl</h1>
6
6
 
7
7
  <p align="center">
8
- <strong>Ops-focused n8n tools for MCP-compatible agents and OpenClaw plugins.</strong>
8
+ <strong>Operator control CLI for n8n, with an MCP adapter for AI clients.</strong>
9
9
  </p>
10
10
 
11
11
  <p align="center">
12
- <a href="https://www.npmjs.com/package/n8n-ops-mcp"><img src="https://img.shields.io/npm/v/n8n-ops-mcp?style=for-the-badge&logo=npm&logoColor=white" alt="npm version"></a>
13
- <img src="https://img.shields.io/badge/Node.js-%3E%3D20-339933?style=for-the-badge&logo=nodedotjs&logoColor=white" alt="Node.js >=20">
14
- <img src="https://img.shields.io/badge/TypeScript-5.5-3178C6?style=for-the-badge&logo=typescript&logoColor=white" alt="TypeScript 5.5">
15
- <img src="https://img.shields.io/badge/MCP-compatible-2563eb?style=for-the-badge" alt="MCP compatible">
16
- <img src="https://img.shields.io/badge/OpenClaw-plugin-ef4444?style=for-the-badge" alt="OpenClaw plugin">
17
- <img src="https://img.shields.io/badge/n8n-ops-ff6d5a?style=for-the-badge" alt="n8n ops">
18
- <img src="https://img.shields.io/npm/l/n8n-ops-mcp?style=for-the-badge" alt="license">
12
+ <a href="https://lidless.dev/n8n-ops-mcp"><strong>Website &amp; docs &rarr; lidless.dev/n8n-ops-mcp</strong></a>
19
13
  </p>
20
14
 
21
- Ops-focused n8n tools for any MCP-compatible client. List, inspect, trigger, validate, manage tags, run security audits, and safely edit n8n workflows - with auto-backup and confirm gates on destructive writes.
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>
20
+
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.
22
+
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
+ ```
22
59
 
23
- Built for [OpenClaw](https://github.com/openclaw/openclaw) as a first-class plugin, exposed as an MCP server for everyone else. Works with Claude Desktop, Claude Code, Codex CLI, Hermes Agent, Cursor, Windsurf, or any other MCP host. No hard dependency on a specific model or agent harness.
60
+ Generate the API key in n8n under **Settings &rarr; 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`.
24
61
 
25
- ## Why
62
+ Then ask your agent:
26
63
 
27
- Your agent has no native awareness of your n8n footprint. With this package, it can answer "what's broken in my n8n?", trigger workflows from chat, or clean up old executions without you leaving your client.
64
+ > What n8n workflows broke today?
28
65
 
29
- For a catalog/docs tool that indexes n8n's node library, see [n8n-mcp](https://www.npmjs.com/package/n8n-mcp). This one is ops-focused - list, trigger, validate, edit.
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.
30
67
 
31
68
  ## Tools
32
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
+
33
72
  | Tool | Purpose | Write |
34
73
  |---|---|---|
35
74
  | `n8n_list_workflows` | List workflows, filter by `active` / `tags` / `name` | |
@@ -41,8 +80,7 @@ For a catalog/docs tool that indexes n8n's node library, see [n8n-mcp](https://w
41
80
  | `n8n_validate_workflow` | Static checks: deprecated nodes, legacy Code-node API, orphans | |
42
81
  | `n8n_diff_workflow` | Compare a workflow against a snapshot file or inline object - semantic diff (added/removed/modified nodes with field paths) | |
43
82
  | `n8n_list_schedules` | List every schedule trigger across workflows with human-readable descriptions ("daily at 03:00", "cron: 0 */6 * * *") | |
44
- | `n8n_trigger` | Run a workflow via webhook (reliable) or workflow-id | |
45
- | `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) | |
46
84
  | `n8n_scaffold_browser_bridge_node` | Generate a ready-to-paste n8n node that calls a `browser-bridge <platform> <action>` (no API call) | |
47
85
  | `n8n_run_audit` | Run n8n's built-in security audit (credentials, database, nodes, filesystem, instance) | |
48
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 | |
@@ -53,11 +91,12 @@ For a catalog/docs tool that indexes n8n's node library, see [n8n-mcp](https://w
53
91
  | `n8n_get_credential_schema` | Fetch the JSON schema for a credential type (e.g. `freshdeskApi`) | |
54
92
  | `n8n_find_workflows_using_credential` | Find every workflow node that references a credential by `id` (preferred) or `name` substring; rotation/blast-radius scanner | |
55
93
  | `n8n_check_disabled_nodes` | Scan workflows for `disabled: true` nodes - common drift signals not surfaced in the n8n UI | |
56
- | `n8n_create_workflow` | Create a workflow (accepts `n8n_get_workflow` output directly; primary restore path) | ✓ |
57
- | `n8n_activate` | Enable a workflow's triggers | ✓ |
58
- | `n8n_deactivate` | Disable a workflow's triggers | ✓ |
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) | ✓ |
59
98
  | `n8n_save_workflow` | Overwrite a workflow with auto-backup + validation + confirm gate | ✓ |
60
- | `n8n_archive_workflow` | Soft-delete a workflow (reversible; preserves id) | ✓ |
99
+ | `n8n_archive_workflow` | Soft-delete a workflow (confirm-gated; reversible; preserves id) | ✓ |
61
100
  | `n8n_unarchive_workflow` | Restore an archived workflow (does NOT reactivate) | ✓ |
62
101
  | `n8n_delete_workflow` | Permanently delete a workflow (confirm-gated, snapshot-before-delete, restore via `n8n_create_workflow`) | ✓ |
63
102
  | `n8n_cancel_execution` | Stop a running or waiting execution by id | ✓ |
@@ -66,9 +105,9 @@ For a catalog/docs tool that indexes n8n's node library, see [n8n-mcp](https://w
66
105
  | `n8n_delete_executions` | Batch form of delete (client-side fan-out, confirm-gated, irreversible, max 50 ids) | ✓ |
67
106
  | `n8n_pin_node_data` | Pin sample data to a node so downstream nodes use it during testing (confirm-gated, replace-or-merge) | ✓ |
68
107
  | `n8n_unpin_node_data` | Clear pinned data on one node or the whole workflow (confirm-gated, idempotent) | ✓ |
69
- | `n8n_create_tag` | Create a workflow tag (no confirm; reversible via `n8n_delete_tag`) | ✓ |
108
+ | `n8n_create_tag` | Create a workflow tag (confirm-gated; reversible via `n8n_delete_tag`) | ✓ |
70
109
  | `n8n_delete_tag` | Permanently delete a tag (confirm-gated; cascades - removes the tag from every workflow) | ✓ |
71
- | `n8n_set_workflow_tags` | Replace the tag set on a workflow (no confirm; reversible by re-setting) | ✓ |
110
+ | `n8n_set_workflow_tags` | Replace the tag set on a workflow (confirm-gated; reversible by re-setting) | ✓ |
72
111
  | `n8n_retry_executions` | Batch retry executions (confirm-gated, max 50 ids, AbortController on 5xx) | ✓ |
73
112
  | `n8n_create_credential` | Create a credential (confirm-gated; **double-gated** behind `enableCredentialsWrite`; tool layer redacts `data` from every response branch) | ✓✓ |
74
113
  | `n8n_delete_credential` | Permanently delete a credential (confirm-gated; **double-gated**; cascades - every workflow referencing it will fail) | ✓✓ |
@@ -94,23 +133,23 @@ Write tools are hidden unless `N8N_ENABLE_EDIT=true`.
94
133
 
95
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).
96
135
 
97
- **`n8n_diff_workflow`** - compare a workflow's current state against a snapshot. Pass `id` plus exactly one of `snapshotPath` (absolute path; `~` resolved) or `snapshot` (inline object). 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.
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.
98
137
 
99
- **`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/solomonneas/browser-bridge).
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).
100
139
 
101
- **`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` (default `/home/clawdbot/.openclaw/workspace/pipeline/work/browser-bridge`), `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).
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).
102
141
 
103
- **`n8n_trigger`** - two modes:
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:
104
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.
105
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.
106
145
 
107
- **`n8n_create_workflow`** - `POST /workflows`. Accepts the full output of `n8n_get_workflow` (with `includeDefinition=true`) 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). No confirm gate - creation is non-destructive. The new workflow is created INACTIVE; call `n8n_activate` afterwards if you want triggers running. This is 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.
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.
108
147
 
109
- **`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.
110
149
 
111
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`.
112
151
 
113
- **`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). No confirm gate - this is the safe cleanup path. Archiving deactivates as a side effect; the response surfaces `active: false` explicitly. Returns `ok: false` with `reason: "not_found"` on 404.
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.
114
153
 
115
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.
116
155
 
@@ -140,11 +179,11 @@ Write tools are hidden unless `N8N_ENABLE_EDIT=true`.
140
179
 
141
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.
142
181
 
143
- **`n8n_create_tag`** - `POST /tags`. No confirm gate - creating a tag is reversible via `n8n_delete_tag` and harmless on its own. 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.
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.
144
183
 
145
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`.
146
185
 
147
- **`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. No confirm gate (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`).
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`).
148
187
 
149
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.
150
189
 
@@ -160,36 +199,13 @@ Write tools are hidden unless `N8N_ENABLE_EDIT=true`.
160
199
 
161
200
  </details>
162
201
 
163
- ## Security model
164
-
165
- Two flags gate write access, with deliberately different blast radii:
166
-
167
- - **`enableEdit`** (default `false`) - exposes the workflow + execution lifecycle write tools (create/save/archive/delete workflows, cancel/retry/delete executions, pin/unpin node data, tag CRUD). Destructive tools are confirm-gated and the destructive workflow ones snapshot to `backupDir` first.
168
- - **`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.
169
-
170
- 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.
171
-
172
- Why credentials get a second gate:
173
- 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.
174
- 2. `delete-credential` cascades - every workflow referencing the credential fails on its next run. The blast radius is wider than any single workflow operation.
175
-
176
- Defense-in-depth on `data`:
177
- - 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.
178
- - 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.
179
-
180
- ## Install
181
-
182
- ```bash
183
- npm install -g n8n-ops-mcp
184
- ```
185
-
186
202
  ## Configuration
187
203
 
188
204
  Generate an API key in n8n under **Settings → API**, then set these env vars in your MCP client config:
189
205
 
190
206
  | Variable | Required | Default | Description |
191
207
  |---|---|---|---|
192
- | `N8N_BASE_URL` | yes | - | n8n base URL, e.g. `http://localhost:5678` |
208
+ | `N8N_BASE_URL` | yes | - | n8n base URL, e.g. `https://n8n.example.com` |
193
209
  | `N8N_API_KEY` | yes | - | n8n Public API key (`X-N8N-API-KEY`) |
194
210
  | `N8N_ENABLE_EDIT` | no | `false` | Expose write tools |
195
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). |
@@ -197,6 +213,35 @@ Generate an API key in n8n under **Settings → API**, then set these env vars i
197
213
  | `N8N_MAX_EXECUTION_LOG_BYTES` | no | `65536` | Cap on inline execution log bytes |
198
214
  | `N8N_REQUEST_TIMEOUT_MS` | no | `15000` | HTTP timeout for n8n API calls |
199
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
+
200
245
  ### Claude Desktop
201
246
 
202
247
  Add to `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) or `%APPDATA%\Claude\claude_desktop_config.json` (Windows):
@@ -205,9 +250,10 @@ Add to `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS)
205
250
  {
206
251
  "mcpServers": {
207
252
  "n8n": {
208
- "command": "n8n-ops-mcp",
253
+ "command": "npx",
254
+ "args": ["-y", "n8n-ops-mcp"],
209
255
  "env": {
210
- "N8N_BASE_URL": "http://localhost:5678",
256
+ "N8N_BASE_URL": "https://n8n.example.com",
211
257
  "N8N_API_KEY": "your-api-key-here"
212
258
  }
213
259
  }
@@ -219,9 +265,9 @@ Add to `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS)
219
265
 
220
266
  ```bash
221
267
  claude mcp add n8n \
222
- --env N8N_BASE_URL=http://localhost:5678 \
268
+ --env N8N_BASE_URL=https://n8n.example.com \
223
269
  --env N8N_API_KEY=your-api-key-here \
224
- -- n8n-ops-mcp
270
+ -- npx -y n8n-ops-mcp
225
271
  ```
226
272
 
227
273
  Add `--scope user` to make it available from any directory instead of only the current project.
@@ -230,16 +276,16 @@ Add `--scope user` to make it available from any directory instead of only the c
230
276
 
231
277
  ```bash
232
278
  codex mcp add n8n \
233
- --env N8N_BASE_URL=http://localhost:5678 \
279
+ --env N8N_BASE_URL=https://n8n.example.com \
234
280
  --env N8N_API_KEY=your-api-key-here \
235
- -- n8n-ops-mcp
281
+ -- npx -y n8n-ops-mcp
236
282
  ```
237
283
 
238
284
  Writes the entry to `~/.codex/config.toml` under `[mcp_servers.n8n]`. Verify with `codex mcp list`.
239
285
 
240
286
  ### Cursor / Windsurf / other MCP hosts
241
287
 
242
- 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.
243
289
 
244
290
  <details>
245
291
  <summary><b>Hermes Agent</b></summary>
@@ -249,9 +295,10 @@ Any MCP-compatible client that accepts a stdio command + env will work. Point it
249
295
  ```yaml
250
296
  mcp_servers:
251
297
  n8n:
252
- command: "n8n-ops-mcp"
298
+ command: "npx"
299
+ args: ["-y", "n8n-ops-mcp"]
253
300
  env:
254
- N8N_BASE_URL: "http://localhost:5678"
301
+ N8N_BASE_URL: "https://n8n.example.com"
255
302
  N8N_API_KEY: "your-api-key-here"
256
303
  ```
257
304
 
@@ -265,7 +312,7 @@ Then reload from inside a session:
265
312
 
266
313
  ### OpenClaw (first-class plugin)
267
314
 
268
- n8n-ops-mcp was built for OpenClaw and ships as a first-class plugin - not an MCP bridge - so it shares the gateway's process, auth profiles, and hooks.
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.
269
316
 
270
317
  ```bash
271
318
  openclaw plugins install clawhub:n8n-ops-mcp
@@ -280,7 +327,7 @@ Add the config block to `~/.openclaw/openclaw.json`:
280
327
  "n8n": {
281
328
  "enabled": true,
282
329
  "config": {
283
- "baseUrl": "http://your-n8n-host:5678",
330
+ "baseUrl": "https://n8n.example.com",
284
331
  "enableEdit": false
285
332
  }
286
333
  }
@@ -293,7 +340,7 @@ Put the API key in your OpenClaw workspace env:
293
340
 
294
341
  ```bash
295
342
  # ~/.openclaw/workspace/.env
296
- N8N_API_KEY=eyJhbGciOi...
343
+ N8N_API_KEY=your-api-key-here
297
344
  ```
298
345
 
299
346
  Restart the gateway:
@@ -320,7 +367,7 @@ If you want to point OpenClaw at a local clone instead of the registry:
320
367
  "n8n": {
321
368
  "enabled": true,
322
369
  "config": {
323
- "baseUrl": "http://your-n8n-host:5678",
370
+ "baseUrl": "https://n8n.example.com",
324
371
  "enableEdit": false
325
372
  }
326
373
  }
@@ -331,6 +378,23 @@ If you want to point OpenClaw at a local clone instead of the registry:
331
378
 
332
379
  </details>
333
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
+
334
398
  ## Example prompts
335
399
 
336
400
  > What n8n workflows broke today?
@@ -341,9 +405,9 @@ Calls `n8n_list_executions` with `status=error`, then `n8n_get_execution` for th
341
405
 
342
406
  Calls `n8n_search_executions` with `query: "ECONNREFUSED"`.
343
407
 
344
- > Trigger the "nightly intel" workflow
408
+ > Trigger the "nightly intel" workflow *(requires `N8N_ENABLE_EDIT=true`)*
345
409
 
346
- 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`.
347
411
 
348
412
  > What's running at 3am?
349
413
 
@@ -353,53 +417,53 @@ Calls `n8n_list_schedules`, then filters the result for any schedule whose descr
353
417
 
354
418
  Calls `n8n_diff_workflow` with `id` and `snapshotPath` pointing to the backup file. Returns added/removed/modified nodes with parameter-level field paths.
355
419
 
356
- > Where am I calling Linktree sync from?
357
-
358
- Calls `n8n_audit_browser_bridge_usage` with `platform: "linktree"` to list every node (across all workflows) that invokes `browser-bridge linktree <action>`.
359
-
360
- > Add a CoderLegion `scan-comments` step to a new workflow
420
+ > Audit my workflows for deprecated Code-node API usage
361
421
 
362
- Calls `n8n_scaffold_browser_bridge_node` with `platform: "coderlegion"`, `action: "scan-comments"`, `input: {limit: 5}` to get a Code node JSON, then pastes it into n8n.
422
+ Calls `n8n_list_workflows` then `n8n_validate_workflow` per id, filters for `code-node-old-node-ref` and `code-node-items-global` warnings.
363
423
 
364
- > Pin a sample browser-bridge response on the "BB call" node so I can iterate on downstream parsing without re-spawning the browser *(requires `N8N_ENABLE_EDIT=true`)*
424
+ > Which workflows are flaky this week?
365
425
 
366
- Calls `n8n_get_execution` to grab the most recent successful output of the node, then `n8n_pin_node_data` with `nodeName: "BB call"`, `data: <captured items>`, `confirm: true`. Clear later via `n8n_unpin_node_data`.
426
+ Calls `n8n_execution_stats` with `sinceHours: 168`, then sorts by `failureRate`.
367
427
 
368
- > Audit my workflows for deprecated Code-node API usage
428
+ > I'm rotating Slack credentials - where do I need to update?
369
429
 
370
- Calls `n8n_list_workflows` then `n8n_validate_workflow` per id, filters for `code-node-old-node-ref` and `code-node-items-global` warnings.
430
+ Calls `n8n_find_workflows_using_credential` with the credential id to enumerate the blast radius before you touch anything.
371
431
 
372
432
  > Deactivate the "experimental-bot" workflow *(requires `N8N_ENABLE_EDIT=true`)*
373
433
 
374
- 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.
375
435
 
376
436
  > Kill the execution stuck on ECONNREFUSED *(requires `N8N_ENABLE_EDIT=true`)*
377
437
 
378
438
  Calls `n8n_search_executions` with `query: "ECONNREFUSED"`, then `n8n_cancel_execution` on the match.
379
439
 
380
- > Retry yesterday's failed "nightly intel" run against the current workflow *(requires `N8N_ENABLE_EDIT=true`)*
381
-
382
- Calls `n8n_search_executions` to find the failed id, then `n8n_retry_execution` with `loadWorkflow: true`.
383
-
384
440
  > Purge the noisy test-run execution logs from last week *(requires `N8N_ENABLE_EDIT=true`)*
385
441
 
386
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.
387
443
 
388
444
  > Archive the old "staging-bot" workflow - I might need it back someday *(requires `N8N_ENABLE_EDIT=true`)*
389
445
 
390
- 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).
391
447
 
392
448
  > Delete the abandoned "poc-scraper" workflow - it's been dead for months *(requires `N8N_ENABLE_EDIT=true`)*
393
449
 
394
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.
395
451
 
396
- > Restore the workflow I accidentally deleted yesterday - backup is at `~/.n8n-backups/wf-42-DELETED-2026-04-22_15-00-00.json` *(requires `N8N_ENABLE_EDIT=true`)*
452
+ ## Why not the bigger n8n MCP projects?
453
+
454
+ n8nctrl is deliberately narrow. It is for **operating** the n8n you already run, not for authoring new flows from a node catalog.
455
+
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.
397
458
 
398
- Reads the backup file, calls `n8n_create_workflow` with `definition=<backup contents>`. Read-only fields are stripped automatically; the restored workflow gets a new id and starts inactive. Call `n8n_activate` on the new id to re-enable triggers.
459
+ The two are complementary. One helps build; this one helps run.
399
460
 
400
- > Clone workflow "intel-nightly" to "intel-nightly-staging" for testing *(requires `N8N_ENABLE_EDIT=true`)*
461
+ ## What n8nctrl is not
401
462
 
402
- Calls `n8n_get_workflow` with `includeDefinition=true`, changes `name` to "intel-nightly-staging" in the definition, then `n8n_create_workflow`. The new workflow is a full copy, inactive, with a fresh id.
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).
403
467
 
404
468
  ## Development
405
469
 
@@ -415,16 +479,20 @@ npm start # node dist/mcp-server.js (post-build)
415
479
  Or install from source:
416
480
 
417
481
  ```bash
418
- git clone https://github.com/solomonneas/n8n-ops-mcp.git
419
- cd n8n-ops-mcp
482
+ git clone https://github.com/lidless-labs/n8nctrl.git
483
+ cd n8nctrl
420
484
  npm install
421
485
  npm run build
422
486
  ```
423
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
+
424
492
  ## Changelog
425
493
 
426
494
  See [CHANGELOG.md](./CHANGELOG.md) for the full version history.
427
495
 
428
496
  ## License
429
497
 
430
- MIT
498
+ MIT. See [LICENSE](./LICENSE).