@path58/p58-n8n 0.2.17 โ†’ 0.2.20-demo.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/AGENT_INSTALL.md CHANGED
@@ -1,291 +1,308 @@
1
1
  # p58-n8n โ€” LLM Agent Installation Guide
2
2
 
3
- > **๐Ÿค– ACTION REQUIRED:** You are reading this because a user wants you to install the **p58-n8n** MCP server. Follow the steps below in order. You have everything you need in this file โ€” do NOT search the web for additional instructions. If the user dropped a repo URL or README, this is the authoritative installation guide.
3
+ > **AX-Native install (the canonical demo path):** Tell your LLM client *"install p58-n8n using this guide"* and paste the URL of this file. Your LLM follows the steps below, probes your environment, asks โ‰ค2 clarifying questions (n8n API key + optional Path58 premium token), writes the config, and tells you to restart. Per Pillar 3 of `STRATEGIC_ANCHORS.md` v1.2.0 โ€” *every customer-facing operation happens through the agent the user already uses*.
4
4
 
5
- > **Your job:** Detect the user's MCP client โ†’ find their n8n instance (if any) โ†’ write the config โ†’ restart โ†’ verify. Minimize questions to the user โ€” auto-discover what you can, only ask when you must (API key, n8n URL if not found).
5
+ > **๐Ÿค– ACTION REQUIRED:** You are reading this because a user wants you to install the **p58-n8n** MCP server. Follow the steps in order. Everything you need is in this file โ€” do NOT search the web. Minimize questions to the user: auto-discover what you can, only ask when you must (the n8n URL and API key, if you can't find them).
6
+
7
+ > **Your job:** detect the user's MCP client โ†’ find their n8n instance โ†’ discover or ask for the API key โ†’ **validate the pairing with a curl test** โ†’ write the config โ†’ restart โ†’ verify with `setup_check`.
6
8
 
7
9
  ---
8
10
 
9
11
  ## What is p58-n8n?
10
12
 
11
- p58-n8n is an MCP server that gives LLMs the ability to validate, build, deploy, and manage n8n workflows. It provides 12 tools in the default configuration (34 total registered, 11 offline-capable), organized in tiers:
12
-
13
- - **Public/basic (offline-capable):** planning, node and operation discovery, credential schema discovery, and public-safe validation work immediately from bundled catalog assets
14
- - **Public/basic + n8n:** build, deploy, test, workflow CRUD, and credential CRUD work against the user's own n8n instance
15
- - **Friends & Family Full (optional):** an allowlisted `P58_USER_EMAIL` plus `P58_DATABASE_URL` unlocks deeper private Path58 intelligence without changing the MCP tool list
13
+ p58-n8n is an MCP server that lets an LLM discover, validate, build, deploy, and test n8n workflows. It registers **18 tools** โ€” 14 core + 4 credential-management.<sup>[[1]](#sources)</sup>
16
14
 
17
- ## Runtime Modes
15
+ There are **two independent dimensions** to how it runs:
18
16
 
19
- Use this mental model when installing:
17
+ | Dimension | What it controls | How to enable |
18
+ |---|---|---|
19
+ | **Catalog tier** | How much node intelligence the agent gets | **Free** (default): offline discovery index bundled in npm โ€” node/operation/credential **names + metadata** (1,603 nodes, 14,805 operations, 679 credential types).<sup>[[2]](#sources)</sup> **Premium**: the **enriched** catalog (parameter schemas, connection rules, config examples) via `P58_ACCESS_TOKEN`.<sup>[[3]](#sources)</sup> |
20
+ | **n8n engine** | Whether the agent can build/deploy/test/manage credentials on a real n8n | Set `N8N_API_URL` + `N8N_API_KEY` to the user's own n8n.<sup>[[4]](#sources)</sup> |
20
21
 
21
- - **Public Local:** no Path58 DB env vars. Uses the local public bundle that ships in npm.
22
- - **Connected:** the user's own n8n is configured, and `P58_DATABASE_URL` may also be present, but private intelligence is still locked.
23
- - **Friends & Family Full:** `P58_DATABASE_URL` plus allowlisted `P58_USER_EMAIL` unlock the private Path58 layer.
22
+ These are orthogonal: premium catalog works with or without n8n connected, and n8n operations work on the free catalog too (with shallower validation).
24
23
 
25
- The public npm package does not include raw Path58 `parameters` or `connections`.
24
+ > **Premium token โ‰  n8n engine.** `P58_ACCESS_TOKEN` unlocks *knowledge about* n8n (the enriched catalog); it does **not** connect to the user's n8n. Building, testing, deploying, and credential CRUD require `N8N_API_URL` + `N8N_API_KEY`.<sup>[[3]](#sources)</sup>
26
25
 
27
26
  ---
28
27
 
29
- ## Installation Decision Tree
28
+ ## Fresh install โ€” zero-config quick start (`.mcpb` extension only)
30
29
 
31
- ```
32
- Does the user have n8n running?
33
- โ”œโ”€โ”€ YES โ†’ Public/basic full journey (N8N_API_URL + N8N_API_KEY)
34
- โ”‚ Plan, build, validate, deploy, test, and manage workflows
35
- โ”‚
36
- โ””โ”€โ”€ NO / DON'T KNOW โ†’ Public Local install (no env vars)
37
- Planning, discovery, credential schema lookup,
38
- and public-safe validation work immediately
39
-
40
- Does the user also have Friends & Family access?
41
- โ””โ”€โ”€ YES โ†’ Add P58_DATABASE_URL + allowlisted P58_USER_EMAIL
42
- to unlock private Path58 intelligence
43
- ```
30
+ If a user is installing `.mcpb` for the first time and wants instant free-tier access without entering any credentials:
44
31
 
45
- ---
32
+ 1. Drag `p58-n8n.mcpb` into Claude Desktop โ†’ Extensions
33
+ 2. Click **Configure**
34
+ 3. Leave **all 7 fields blank**
35
+ 4. Click **Save**
36
+ 5. Restart Claude Desktop
46
37
 
47
- ## Step 1: Detect the MCP Client
38
+ The free tier activates immediately:
39
+ - 1,603 node-name catalog (offline)
40
+ - 14,805 operation-name index
41
+ - 679 credential type lookups
42
+ - L1-L3 validation (offline)
43
+ - Discovery + `get_node_info` (names + metadata)
48
44
 
49
- Determine which AI client the user is using. Check for config files in this order:
45
+ This is enough to **browse, validate, and plan workflows** without n8n connectivity or premium credentials. The recipient experiences value immediately.
50
46
 
51
- | Client | Config File Path | OS |
52
- |--------|-----------------|-----|
53
- | **Claude Desktop** | `~/Library/Application Support/Claude/claude_desktop_config.json` | macOS |
54
- | **Claude Desktop** | `%APPDATA%\Claude\claude_desktop_config.json` | Windows |
55
- | **Claude Desktop** | `~/.config/Claude/claude_desktop_config.json` | Linux |
56
- | **Claude Code** | Use `claude mcp add` CLI command | All |
57
- | **Cursor** | `~/.cursor/mcp.json` | All |
58
- | **Gemini CLI** | `~/.gemini/settings.json` or `~/.gemini/antigravity/mcp_config.json` | All |
59
- | **VS Code (Copilot)** | `.vscode/mcp.json` in workspace | All |
60
-
61
- **Detection method:** Check if these files exist. If multiple exist, ask the user which client they want to configure.
47
+ To upgrade later (premium catalog + n8n build/deploy/test), the agent guides the user through adding `P58_ACCESS_TOKEN`, `N8N_API_URL`, and `N8N_API_KEY` via the Configure form OR via the `jq` extraction in the next section.
62
48
 
63
49
  ---
64
50
 
65
- ## Step 2: Find the User's n8n Instance
51
+ ## Upgrading from a manual MCP config
66
52
 
67
- Try these methods in order:
53
+ If you already have p58-n8n configured manually in `claude_desktop_config.json` (or another MCP client's config file) and want to install the `.mcpb` extension instead, you can extract all 7 config values in one terminal command:
68
54
 
69
- ### Method A: Check environment variables
55
+ **macOS / Claude Desktop:**
70
56
  ```bash
71
- echo $N8N_API_URL
72
- echo $N8N_API_BASE_URL
73
- echo $N8N_HOST
57
+ jq '.mcpServers["p58-n8n"].env' ~/Library/Application\ Support/Claude/claude_desktop_config.json
74
58
  ```
75
59
 
76
- ### Method B: Probe common localhost ports
60
+ **Cursor (~/.cursor/mcp.json), VS Code (.vscode/mcp.json), Windsurf, or any JSON-based client:**
77
61
  ```bash
78
- # Standard n8n port
79
- curl -s -o /dev/null -w "%{http_code}" http://localhost:5678/api/v1/workflows 2>/dev/null
80
- # Returns 401 = n8n is running (auth required) โœ…
81
- # Returns 000 = n8n is not running at this address โŒ
62
+ jq '.mcpServers["p58-n8n"].env' <your-config-file>
82
63
  ```
83
64
 
84
- ### Method C: Check Docker containers
65
+ **Codex (TOML config):**
85
66
  ```bash
86
- docker ps --filter "name=n8n" --format "{{.Ports}}" 2>/dev/null
87
- # Example output: 0.0.0.0:5678->5678/tcp โ†’ n8n at localhost:5678
67
+ # Codex uses TOML; manually read ~/.codex/config.toml
68
+ cat ~/.codex/config.toml | grep -A 10 "p58-n8n"
69
+ ```
70
+
71
+ The output is a JSON object with all 7 values:
72
+ ```json
73
+ {
74
+ "P58_ACCESS_TOKEN": "...",
75
+ "N8N_API_URL": "https://your-n8n/api/v1",
76
+ "N8N_API_KEY": "eyJ...",
77
+ "N8N_USER_EMAIL": "you@example.com",
78
+ "N8N_USER_PASSWORD": "...",
79
+ "CF_ACCESS_CLIENT_ID": "...",
80
+ "CF_ACCESS_CLIENT_SECRET": "..."
81
+ }
88
82
  ```
89
83
 
90
- ### Method D: Check running processes
84
+ Open Claude Desktop โ†’ Extensions โ†’ p58-n8n โ†’ **Configure**, then copy each value from the JSON output into the matching form field. Total: ~30 seconds vs hunting through multiple sources. Fields you don't have / don't need can be left blank โ€” only `N8N_API_URL` + `N8N_API_KEY` + `P58_ACCESS_TOKEN` are needed for the standard demo path.
85
+
86
+ > **Coming soon (post-demo per `REQ-2026-06-02-mcpb-config-autofill.md`):** a single "bulk paste" Configure field that accepts the whole JSON blob in one paste, eliminating the field-by-field copy. Tracked for 0.3.0+.
87
+
88
+ ---
89
+
90
+ ## Step 1: Detect the MCP client
91
+
92
+ > **Verification status:** This guide covers MCP clients that follow the standard MCP protocol. Only **Claude Desktop** (manual JSON config + `.mcpb` extension install) and **Claude Code** (CLI / VS Code extension / terminal) are end-to-end verified by p58-n8n's Phase C install matrix (RAG-4.97.6.1). Cursor / VS Code Copilot / Windsurf / Codex / Antigravity / Gemini CLI paths are documented based on each client's published MCP integration spec; their install paths are expected to work but have not been QA'd by us. Multi-client QA matrix queued post-demo via `REQ-2026-06-02-multi-client-install-qa.md`. Please report any client-specific issues via GitHub Issues.
93
+
94
+ Check for these config files (if several exist, ask which client to configure):
95
+
96
+ | Client | Config file | OS |
97
+ |--------|-------------|-----|
98
+ | **Claude Desktop** | `~/Library/Application Support/Claude/claude_desktop_config.json` | macOS |
99
+ | **Claude Desktop** | `%APPDATA%\Claude\claude_desktop_config.json` | Windows |
100
+ | **Claude Desktop** | `~/.config/Claude/claude_desktop_config.json` | Linux |
101
+ | **Claude Code** | `claude mcp add` CLI | All |
102
+ | **VS Code** | `.vscode/mcp.json` (uses `"servers"` key, not `"mcpServers"`) | All |
103
+ | **Cursor** | `~/.cursor/mcp.json` | All |
104
+ | **Windsurf** | `~/.codeium/windsurf/mcp_config.json` | All |
105
+ | **Codex (OpenAI)** | `~/.codex/config.toml` (**TOML**, not JSON) | All |
106
+ | **Antigravity (Google)** | `~/.gemini/antigravity/mcp_config.json` (needs global install + full paths) | All |
107
+
108
+ ---
109
+
110
+ ## Step 2: Find the user's n8n instance
111
+
112
+ The catalog tools work without n8n, but build/deploy/test need it. Try, in order:
113
+
91
114
  ```bash
115
+ # A. Environment variables
116
+ echo "$N8N_API_URL"; echo "$N8N_API_BASE_URL"; echo "$N8N_HOST"
117
+ # B. Probe the standard local port (401 = n8n running + auth required โœ… ; 000 = nothing there)
118
+ curl -s -o /dev/null -w "%{http_code}" http://localhost:5678/api/v1/workflows
119
+ # C. Docker
120
+ docker ps --filter "name=n8n" --format "{{.Ports}}"
121
+ # D. Running processes
92
122
  ps aux | grep -i n8n | grep -v grep
93
123
  ```
94
124
 
95
- ### Method E: Ask the user
96
- If none of the above work, ask: "What is the URL of your n8n instance? (e.g., http://localhost:5678 or https://n8n.example.com)"
125
+ If none work, ask: *"What's the URL of your n8n instance? (e.g. `http://localhost:5678` or `https://n8n.example.com`)"*
97
126
 
98
- **IMPORTANT:** The API URL must include the `/api/v1` suffix. Example: `http://localhost:5678/api/v1`
127
+ > The API URL must include the `/api/v1` suffix, e.g. `http://localhost:5678/api/v1`. `N8N_API_BASE_URL` is accepted as a fallback for `N8N_API_URL`.<sup>[[4]](#sources)</sup>
99
128
 
100
129
  ---
101
130
 
102
- ## Step 3: Get the n8n API Key
131
+ ## Step 3: Get the credentials
132
+
133
+ ### 3a โ€” Premium token (`P58_ACCESS_TOKEN`)
134
+
135
+ If the user was given a `P58_ACCESS_TOKEN` (demo / premium users), use it โ€” it unlocks the enriched catalog. If they don't have one, skip it: the free bundled index still works.
103
136
 
104
- The API key cannot be auto-discovered. The user must provide it or create one.
137
+ ### 3b โ€” n8n API key โ€” **search before asking** (G1)
105
138
 
106
- **Instructions to give the user:**
107
- 1. Open n8n in your browser (the URL from Step 2, without `/api/v1`)
108
- 2. Go to **Settings โ†’ API Keys** (or **Settings โ†’ n8n API**)
109
- 3. Click **Create an API key**
110
- 4. Copy the key โ€” it starts with `eyJ...` (JWT format)
111
- 5. Share it with me so I can add it to your config
139
+ The key can't be auto-*extracted* from n8n (n8n stores it as a hash; the plaintext JWT exists only where the user saved it), but it can often be **found**. Search local artifacts BEFORE asking the user:<sup>[[5]](#sources)</sup>
112
140
 
113
- **If the user can't find API Keys in Settings:** They may be on n8n Community Edition < 0.225.0 or n8n Cloud with API disabled. API key management requires admin access.
141
+ ```bash
142
+ # 1. Project / CWD .env files
143
+ grep -rl "N8N_API_KEY" . --include=".env*" 2>/dev/null
144
+ # 2. Sibling MCP configs (the user may have pasted it once already)
145
+ # ~/Library/Application Support/Claude/claude_desktop_config.json
146
+ # ~/.cursor/mcp.json ยท .vscode/mcp.json ยท ~/.codex/config.toml
147
+ # 3. Secret managers
148
+ op item list 2>/dev/null | grep -i n8n # 1Password
149
+ security find-generic-password -s n8n 2>/dev/null # macOS Keychain
150
+ # 4. Docker
151
+ docker inspect <n8n-container> --format '{{json .Config.Env}}'
152
+ ```
153
+
154
+ Only if all are dry, ask the user to mint one: **n8n โ†’ Settings โ†’ API โ†’ Create API Key** (it starts with `eyJโ€ฆ`, JWT format).
155
+
156
+ ### 3c โ€” Optional: session auth for `test_credential` and run-and-verify
157
+
158
+ Some n8n versions gate two things behind a logged-in session (not just the API key): reading credential **secrets** (`test_credential`), and **executing** a workflow via REST โ€” which `test_workflow`'s verification step uses. **Optional** โ€” build/deploy/activate and the workflow's own execution all work on URL + API key alone. To enable clean run-and-verify + `test_credential`, set `N8N_USER_EMAIL` + `N8N_USER_PASSWORD` (the user's n8n web-UI login).<sup>[[4]](#sources)</sup>
159
+
160
+ > โš ๏ธ **Known false-negative when absent.** On a session-auth-gated n8n without these set, `test_workflow` can report **"โŒ TEST FAILED โ€ฆ N8N_USER_EMAIL/PASSWORD required"** even though the workflow **actually ran and delivered** (the deployed workflow executes server-side on API-key alone). If you see this, check the channel โ€” the result likely arrived. Setting the optional login removes the false-negative. (Tracked: `INC-2026-06-02-test-workflow-clone-verify-false-negative-session-auth`.)
114
161
 
115
162
  ---
116
163
 
117
- ## Step 3b: Get n8n Login Credentials (Optional โ€” for credential testing)
164
+ ## Step 4: Validate the (URL, key) pairing โ€” **before writing any config** (G3/G4)
118
165
 
119
- Some tools (`test_credential`, credential health checks) need REST session auth to access credential secrets. This requires the user's n8n login email and password.
166
+ A valid-looking key against the wrong instance fails *silently* after install. Pair-test first:<sup>[[5]](#sources)</sup>
120
167
 
121
- **When to ask:** If the user wants credential management features (testing, health audits), ask:
122
- > "To enable credential testing, I'll also need your n8n login email and password. These are the same credentials you use to log into the n8n web UI. Want to add them now?"
168
+ ```bash
169
+ curl -s -o /dev/null -w "%{http_code}" "$N8N_API_URL/workflows?limit=1" -H "X-N8N-API-KEY: $KEY" -L
170
+ ```
123
171
 
124
- **If the user declines:** Tier 2-7 tools still work โ€” only `test_credential` will prompt for credentials per-call.
172
+ | Result | Meaning | Action |
173
+ |---|---|---|
174
+ | `200` | Correct pair | โœ… Write the config |
175
+ | `401 {"message":"invalid signature"}` | Valid JWT, **wrong instance** (e.g. prod key vs local n8n) | Re-pair โ€” try another URL/key combination |
176
+ | `401 {"message":"unauthorized"}` | Wrong/expired key | Mint a fresh key (Step 3b) |
177
+ | `302` โ†’ `*.cloudflareaccess.com` | n8n is **behind Cloudflare Access** | Optional CF branch โ†“ โ€” **most users skip this** |
125
178
 
126
- **Security notes:**
127
- - These credentials are stored in the MCP config file alongside the API key (same security model)
128
- - The MCP server never logs credentials โ€” they are only used to obtain a session cookie from n8n
129
- - The session cookie is ephemeral and not persisted to disk
130
- - If the user is uncomfortable storing their password in the config, they can omit it and provide credentials per-call when using `test_credential`
179
+ > **Never assume one key โ†” one URL.** If a user has both a local dev n8n and a remote one, the wrong pairing returns `invalid signature`. Pair-test to confirm.<sup>[[5]](#sources)</sup>
131
180
 
132
- **Advanced: Use a credential manager instead of plaintext:**
181
+ ### Optional Cloudflare-Access branch (only if you saw a `302`)
133
182
 
134
- If the user has 1Password CLI installed, they can reference secrets dynamically:
135
- ```json
136
- {
137
- "mcpServers": {
138
- "p58-n8n": {
139
- "command": "sh",
140
- "args": ["-c", "N8N_API_KEY=$(op read 'op://Vault/n8n/api-key') N8N_USER_EMAIL=$(op read 'op://Vault/n8n/email') N8N_USER_PASSWORD=$(op read 'op://Vault/n8n/password') N8N_API_URL=http://localhost:5678/api/v1 npx -y @path58/p58-n8n"]
141
- }
142
- }
143
- }
183
+ **Most n8n instances are not behind Cloudflare Access โ€” skip this unless Step 4 returned a `302` to a `cloudflareaccess.com` login page.** If it did, the instance needs a CF Access **service token**. p58-n8n supports `CF_ACCESS_CLIENT_ID` + `CF_ACCESS_CLIENT_SECRET`, which it sends as `CF-Access-Client-Id` / `CF-Access-Client-Secret` headers.<sup>[[6]](#sources)</sup> Re-test with them:
184
+
185
+ ```bash
186
+ curl -s -o /dev/null -w "%{http_code}" "$N8N_API_URL/workflows?limit=1" \
187
+ -H "X-N8N-API-KEY: $KEY" \
188
+ -H "CF-Access-Client-Id: $CF_ID" -H "CF-Access-Client-Secret: $CF_SECRET"
189
+ # 200 โ†’ add CF_ACCESS_CLIENT_ID / CF_ACCESS_CLIENT_SECRET to the MCP env in Step 5
144
190
  ```
145
- This way no secrets are stored in the config file โ€” they're fetched from 1Password at startup with biometric approval.
191
+
192
+ Full walkthrough: [`docs/mcp-install-cloudflare-access-runbook.md`](docs/mcp-install-cloudflare-access-runbook.md).
146
193
 
147
194
  ---
148
195
 
149
- ## Step 4: Write the Configuration
196
+ ## Step 5: Write the configuration
150
197
 
151
- ### For Claude Desktop / Cursor / Gemini CLI / VS Code (JSON config)
198
+ Add p58-n8n inside the existing `mcpServers` object โ€” **do not overwrite other servers.** Include only the env vars you actually have.
152
199
 
153
- Read the existing config file, then add p58-n8n inside the `mcpServers` object. Do NOT overwrite existing MCP servers.
200
+ ### Claude Desktop / Cursor / Windsurf / VS Code (JSON)
154
201
 
155
- **Full config (with n8n):**
156
202
  ```json
157
203
  {
158
204
  "mcpServers": {
159
205
  "p58-n8n": {
160
206
  "command": "npx",
161
- "args": ["-y", "@path58/p58-n8n"],
207
+ "args": ["-y", "@path58/p58-n8n@demo"],
162
208
  "env": {
163
- "N8N_API_URL": "http://localhost:5678/api/v1",
164
- "N8N_API_KEY": "<paste-api-key-here>",
165
- "N8N_USER_EMAIL": "<n8n-login-email>",
166
- "N8N_USER_PASSWORD": "<n8n-login-password>"
209
+ "N8N_API_URL": "https://YOUR-n8n-host/api/v1",
210
+ "N8N_API_KEY": "<n8n-api-key>",
211
+ "P58_ACCESS_TOKEN": "<premium-token-if-you-have-one>"
167
212
  }
168
213
  }
169
214
  }
170
215
  }
171
216
  ```
172
217
 
173
- **Minimal config (validation only, no n8n needed):**
174
- ```json
175
- {
176
- "mcpServers": {
177
- "p58-n8n": {
178
- "command": "npx",
179
- "args": ["-y", "@path58/p58-n8n"]
180
- }
181
- }
182
- }
218
+ - **Free, no n8n:** keep only `command`/`args` (catalog discovery works offline).
219
+ - **Optional `test_credential`:** add `N8N_USER_EMAIL` + `N8N_USER_PASSWORD`.
220
+ - **Optional CF Access (only if Step 4 said so):** add `CF_ACCESS_CLIENT_ID` + `CF_ACCESS_CLIENT_SECRET`.
221
+ - **VS Code only:** top-level key is `"servers"`, and add `"type": "stdio"`.
222
+
223
+ ### Claude Code (CLI)
224
+
225
+ ```bash
226
+ claude mcp add p58-n8n \
227
+ -e N8N_API_URL=https://YOUR-n8n-host/api/v1 \
228
+ -e N8N_API_KEY=<n8n-api-key> \
229
+ -e P58_ACCESS_TOKEN=<premium-token-if-you-have-one> \
230
+ -- npx -y @path58/p58-n8n@demo
183
231
  ```
184
232
 
185
- **Friends & Family Full (optional private layer):**
233
+ ### Avoid plaintext secrets (optional, G7)
234
+
235
+ To keep secrets out of `~/.claude.json` / config files, wrap them with a secret manager at launch:
236
+
186
237
  ```json
187
238
  {
188
239
  "mcpServers": {
189
240
  "p58-n8n": {
190
- "command": "npx",
191
- "args": ["-y", "@path58/p58-n8n"],
192
- "env": {
193
- "N8N_API_URL": "http://localhost:5678/api/v1",
194
- "N8N_API_KEY": "<paste-api-key-here>",
195
- "P58_DATABASE_URL": "<friend-and-family-db-url>",
196
- "P58_USER_EMAIL": "friend@example.com"
197
- }
241
+ "command": "sh",
242
+ "args": ["-c", "N8N_API_KEY=$(op read 'op://Vault/n8n/api-key') P58_ACCESS_TOKEN=$(op read 'op://Vault/p58/access-token') N8N_API_URL=https://YOUR-n8n-host/api/v1 npx -y @path58/p58-n8n@demo"]
198
243
  }
199
244
  }
200
245
  }
201
246
  ```
202
247
 
203
- ### For Claude Code (CLI)
204
-
205
- **Full config:**
206
- ```bash
207
- claude mcp add p58-n8n \
208
- -e N8N_API_URL=http://localhost:5678/api/v1 \
209
- -e N8N_API_KEY=<paste-api-key-here> \
210
- -e N8N_USER_EMAIL=<n8n-login-email> \
211
- -e N8N_USER_PASSWORD=<n8n-login-password> \
212
- -- npx -y @path58/p58-n8n
213
- ```
214
-
215
- **Minimal config:**
216
- ```bash
217
- claude mcp add p58-n8n -- npx -y @path58/p58-n8n
218
- ```
219
-
220
- **Friends & Family Full (optional private layer):**
221
- ```bash
222
- claude mcp add p58-n8n \
223
- -e N8N_API_URL=http://localhost:5678/api/v1 \
224
- -e N8N_API_KEY=<paste-api-key-here> \
225
- -e P58_DATABASE_URL=<friend-and-family-db-url> \
226
- -e P58_USER_EMAIL=friend@example.com \
227
- -- npx -y @path58/p58-n8n
228
- ```
248
+ The same pattern works for `CF_ACCESS_CLIENT_ID` / `CF_ACCESS_CLIENT_SECRET`. Note: env changes only take effect after a restart (Step 6).
229
249
 
230
250
  ---
231
251
 
232
- ## Step 5: Restart the Client
252
+ ## Step 6: Restart the client (G6)
233
253
 
234
- The MCP server config is only read at startup. After writing the config:
254
+ The MCP server reads its env **only at startup** โ€” a running process keeps showing the old state until the session restarts.
235
255
 
236
- | Client | Restart Method |
237
- |--------|---------------|
238
- | **Claude Desktop** | Quit completely (Cmd+Q on macOS), then reopen |
256
+ | Client | Restart |
257
+ |--------|---------|
258
+ | **Claude Desktop** | Fully quit (Cmd+Q on macOS โ€” closing the window is not enough), reopen |
239
259
  | **Claude Code** | Exit and restart the CLI session |
240
- | **Cursor** | Restart Cursor (Cmd+Shift+P โ†’ Reload Window) |
241
- | **Gemini CLI** | Exit and restart the CLI session, or use the MCP refresh command |
242
-
243
- **CRITICAL:** On macOS, closing the window is NOT enough for Claude Desktop. The user must Cmd+Q to fully quit.
260
+ | **Cursor / Windsurf / VS Code** | Reload window / restart |
261
+ | **Codex / Antigravity** | Restart the app |
244
262
 
245
263
  ---
246
264
 
247
- ## Step 6: Verify Installation
265
+ ## Step 7: Verify โ€” **after** restart
248
266
 
249
- After restart, run these verification steps:
267
+ Validate the pairing with curl **before** restart (Step 4); confirm the running server **after** restart with `setup_check`.<sup>[[5]](#sources)</sup>
250
268
 
251
- ### Check 1: Tool availability
252
- Ask: "List n8n nodes for sending email"
253
- - **Expected:** The LLM calls `list_nodes` and returns results
254
- - **If tools not visible:** Config file has syntax error or wrong path
269
+ Ask the agent: **"Run `setup_check`."** A healthy connected result shows:
270
+ - `access_mode: "premium"` (if a token is set) or `"free"`,
271
+ - `n8n_configured: true` + `workflow_engine_connected: true`,
272
+ - a `credential_count`, and `issues: []`.
255
273
 
256
- ### Check 2: n8n connectivity (if configured)
257
- Ask: "Check n8n server health"
258
- - **Expected:** `connected: true` with server version
259
- - **If `connected: false`:** Check N8N_API_URL โ€” is n8n actually running at that address?
260
- - **If `Authentication failed`:** Check N8N_API_KEY โ€” is it valid?
261
-
262
- ### Check 3: Full pipeline (if n8n connected)
263
- Ask: "List my n8n credentials"
264
- - **Expected:** Returns list of configured credentials
265
- - **If error:** API key may be expired or n8n needs restart
274
+ If `n8n_configured` is false, the API key/URL pairing is wrong โ€” re-run Step 4.
266
275
 
267
276
  ---
268
277
 
269
- ## Environment Variables Reference
278
+ ## Step 8: Offer the first workflow โ€” opportunistic, best-effort, narrated
279
+
280
+ Don't hand the user a bare "hello world." Immediately after a healthy `setup_check`, proactively build them a **personalized first automation** that pulls live data and delivers a result to a channel they'll actually see. Behavior:
270
281
 
271
- | Variable | Required? | Description | How to find |
272
- |----------|-----------|-------------|-------------|
273
- | `N8N_API_URL` | For Tier 2-7 tools | n8n instance API URL | See Step 2 above |
274
- | `N8N_API_KEY` | For Tier 2-7 tools | n8n API authentication key | n8n โ†’ Settings โ†’ API Keys |
275
- | `N8N_USER_EMAIL` | For `test_credential` | n8n login email (REST session auth) | Same email you use to log into n8n UI |
276
- | `N8N_USER_PASSWORD` | For `test_credential` | n8n login password (REST session auth) | Same password you use to log into n8n UI |
277
- | `P58_DATABASE_URL` | Optional | Friends & Family private intelligence connection | Provided directly by Path58 |
278
- | `P58_USER_EMAIL` | Optional with `P58_DATABASE_URL` | Allowlist identity for unlocking private intelligence | Must match the allowlisted email |
282
+ 1. **Discover.** `setup_check` + `list_credentials` โ†’ what credentials exist.
283
+ 2. **Harvest reusable runtime params (when available).** If a `list_workflows` / `discover_runtime_params` capability is present, scan the user's **existing** workflows for proven resource-locators (Slack channel IDs, Telegram chat IDs, recipient emails, sheet IDs) and **reuse one** โ€” zero-friction, lands where they already work, and makes Telegram viable (chat-id harvested, not asked). *Not yet shippable on the 18-tool surface โ€” `list_workflows` isn't registered; tracked in `REQ-2026-06-02-harvest-runtime-params-from-existing-workflows`. Until then, ask once for the one irreducible value (their email, or a Slack channel).*
284
+ 3. **Pick the lowest-friction channel present:** email โ†’ Slack โ†’ *never* Telegram cold.
285
+ 4. **Narrate the plan first (mitigate surprise).** Tell the user, in the chat, what you found and what you're about to build, and that it's a **best-effort** first run you'll self-heal if needed โ€” e.g. *"You've got Slack + OpenWeatherMap connected. I'll build a webhook โ†’ live weather โ†’ Slack welcome. Best-effort first run โ€” if n8n flags anything I'll fix it and re-run."*
286
+ 5. **Build defensively:** **webhook trigger** (runs via public URL โ€” no n8n login needed), **explicit** values (channel, message, city โ€” never payload-dependent defaults), credentials wired **by ID**, version-stable nodes (Webhook/OpenWeatherMap/Slack/Gmail/Code/HTTP) over volatile AI/LangChain nodes for the *first* run.
287
+ 6. **Build โ†’ `test_workflow` โ†’ self-heal.** On a config gap, read the exact `failed_node`/`recovery_hint` and `partial_update_workflow` it (e.g. Slack missing `channelId`/`text`), then re-test.
288
+ 7. **Report honestly.** โœ… if verified; if it delivered but the verify pass was blocked by missing session auth (Step 3c), say so โ€” *"it ran and the message should have arrived; I just couldn't run my verification pass without your n8n login."* **Never** say "failed" when the result actually landed (see the 3c false-negative note).
289
+ 8. **Personalize.** Address the user by name (harvest from `setup_check`'s n8n project owner when present) and add a short warm welcome.
279
290
 
280
- > **Note:** `N8N_API_BASE_URL` is accepted as a fallback for `N8N_API_URL`. If neither is set, defaults to `http://localhost:5678/api/v1`.
291
+ ---
281
292
 
282
- ### Variables NOT needed for standard installation
293
+ ## Environment variables
283
294
 
284
- | Variable | Purpose | Who needs it |
285
- |----------|---------|-------------|
286
- | `P58_DATABASE_URL` | Extended catalog enrichment | Path58 internal / advanced users only |
287
- | `NODE_ENV` | Logger behavior | Not needed (server handles this) |
288
- | `NO_COLOR` | Disable ANSI colors | Not needed (server strips automatically since v0.2.2) |
295
+ | Variable | Required? | Purpose |
296
+ |----------|-----------|---------|
297
+ | `N8N_API_URL` | For build/deploy/test/credential tools | n8n API URL (include `/api/v1`); `N8N_API_BASE_URL` is a fallback |
298
+ | `N8N_API_KEY` | For build/deploy/test/credential tools | n8n API key (Settings โ†’ API) |
299
+ | `P58_ACCESS_TOKEN` | For the enriched (premium) catalog | Path58 premium token; unlocks parameter/connection schemas |
300
+ | `N8N_USER_EMAIL` | Optional โ€” `test_credential` + clean run-and-verify | n8n web-UI login email (session auth). Workflows still run without it. |
301
+ | `N8N_USER_PASSWORD` | Optional โ€” `test_credential` + clean run-and-verify | n8n web-UI login password |
302
+ | `CF_ACCESS_CLIENT_ID` | Only if n8n is behind Cloudflare Access | CF Access service-token id |
303
+ | `CF_ACCESS_CLIENT_SECRET` | Only if n8n is behind Cloudflare Access | CF Access service-token secret |
304
+
305
+ > Without any env vars, the catalog discovery tools work from the bundled index.<sup>[[2]](#sources)</sup> `P58_DATABASE_URL` (direct-DB "dev" mode) is for Path58 internal use and is **not** part of customer installation.<sup>[[3]](#sources)</sup>
289
306
 
290
307
  ---
291
308
 
@@ -293,27 +310,24 @@ Ask: "List my n8n credentials"
293
310
 
294
311
  | Symptom | Cause | Fix |
295
312
  |---------|-------|-----|
296
- | Tools not appearing | Config syntax error | Validate JSON (check trailing commas, unclosed braces) |
297
- | Tools not appearing | Wrong config file path | Verify OS-specific path from Step 1 |
298
- | "npx: command not found" | Node.js not installed | Install from https://nodejs.org/ |
299
- | "Authentication failed" on deploy tools | N8N_API_KEY missing or invalid | Add API key to config, restart client |
300
- | "Connection refused" on server_health | n8n not running at configured URL | Start n8n or fix N8N_API_URL |
301
- | `test_credential` returns `NEEDS_N8N_LOGIN` | Session auth vars not set | Add `N8N_USER_EMAIL` and `N8N_USER_PASSWORD` to config (Step 3b) |
302
- | All tools timeout | Firewall blocking localhost | Check firewall / VPN settings |
303
- | Server shows "failed" status | ANSI color issue (pre-v0.2.2) | Update to latest version: `npx -y @path58/p58-n8n@latest` |
313
+ | Tools not appearing | Config syntax error or wrong path | Validate JSON; verify the OS-specific path (Step 1) |
314
+ | `"npx: command not found"` | Node.js not installed / not on PATH | Install Node 18+ from nodejs.org; on desktop apps use full path `/opt/homebrew/bin/npx` |
315
+ | `setup_check` โ†’ `n8n_configured: false` | Wrong URL/key pairing | Re-run the Step 4 pair-test |
316
+ | `401 invalid signature` | Valid key, wrong instance | Re-pair (Step 4) |
317
+ | `302` to cloudflareaccess.com | n8n behind Cloudflare Access | Add CF service token (Step 4 branch) |
318
+ | New env not taking effect | Process not restarted | Fully quit + reopen (Step 6) |
304
319
 
305
320
  ---
306
321
 
307
- ## Post-Install: What the User Can Do
308
-
309
- Once installed, the user can ask their AI assistant to:
322
+ ## Sources
310
323
 
311
- - **"Validate this n8n workflow JSON"** โ€” Tier 1, works immediately
312
- - **"What parameters does the Slack node need?"** โ€” Tier 1, works immediately
313
- - **"Build me a workflow that sends Slack when Gmail receives an email"** โ€” Tier 2+, needs n8n
314
- - **"List my n8n credentials"** โ€” Tier 2+, needs n8n
315
- - **"Deploy and test this workflow"** โ€” Tier 2+, needs n8n
324
+ 1. **18 tools** โ€” `src/mcp/tools/index.ts` `TOOL_ENTRIES` (14 core + 4 credential-management; the RAG-4.97.2 locked set).
325
+ 2. **Bundled catalog counts** โ€” `src/data/public-catalog/manifest.json` (`bundle_type: public-basic`, names/metadata only): 1,603 nodes / 14,805 operations / 679 credential types.
326
+ 3. **Tier model** โ€” `src/mcp/runtime/access-mode.ts`: `P58_ACCESS_TOKEN` โ†’ `premium` (enriched proxy catalog); `P58_DATABASE_URL` โ†’ `dev` (internal); neither โ†’ `free` (bundled index). Premium proxy serves catalog knowledge, not the n8n engine.
327
+ 4. **n8n engine env vars** โ€” `src/config/env.schema.ts` (`N8N_API_BASE_URL`/`N8N_API_KEY`/`N8N_USER_EMAIL`/`N8N_USER_PASSWORD`); live `setup_check` confirms `N8N_API_URL` resolution.
328
+ 5. **Search-first discovery + validation loop** โ€” field report `MCP_INSTALL_FIELD_REPORT_2026-06-01` ยง6 (key discovery) and ยง7 (pair-test matrix); curl results observed in a live install session.
329
+ 6. **Cloudflare Access headers** โ€” `src/shared/n8n-api-adapter.ts` injects `CF-Access-Client-Id` / `CF-Access-Client-Secret` from `CF_ACCESS_CLIENT_ID` / `CF_ACCESS_CLIENT_SECRET`.
316
330
 
317
331
  ---
318
332
 
319
- **Package:** `@path58/p58-n8n` | **npm:** https://www.npmjs.com/package/@path58/p58-n8n | **Version:** 0.2.15+
333
+ **Package:** `@path58/p58-n8n` ยท **npm:** https://www.npmjs.com/package/@path58/p58-n8n ยท **Version:** 0.2.20-demo.2
package/CHANGELOG.md CHANGED
@@ -5,6 +5,56 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.2.20-demo.2] - 2026-06-02
9
+
10
+ ### Changed
11
+
12
+ - **Customer-doc reconciliation (RAG-4.97.6.1)** โ€” `README.md`, `AGENT_INSTALL.md`, `docs/GET-STARTED-IN-5-MIN.md`, and `docs/INSTALLATION.md` rewritten so every numeric/factual claim traces to a primary source (bibliographies added to each). Corrected: catalog counts (1,545โ†’**1,603** nodes / 12,619โ†’**14,805** operations / 679 credential types); tool count (now **18** registered โ€” 14 core + 4 credential-management); removed references to unregistered tools (`plan_workflow`, `list_workflows`, `validate_workflow`, `server_health`); license narrative ("BSL 1.1 โ†’ MIT on 2028-03-28"); launch stage ("pre-softlaunch").
13
+ - **Honest tiered catalog framing** โ€” docs now distinguish the **free** offline discovery index (node/operation/credential names + metadata) from the **premium** enriched catalog (parameter/connection schemas via `P58_ACCESS_TOKEN`), and the orthogonal n8n-engine dimension (`N8N_API_URL` + `N8N_API_KEY`). Legacy "Friends & Family Full" / `P58_DATABASE_URL` content removed from customer docs (dev mode is Path58-internal).
14
+ - **CI/tests badge** โ€” switched from a hardcoded count to a dynamic GitHub-Actions status badge.
15
+
16
+ ### Fixed
17
+
18
+ - **Deploy env-precedence (demo-critical)** โ€” `build_workflow`/`test_workflow` resolved the n8n target from `N8N_API_BASE_URL` (โ†’ `localhost:5678` default) in 6 places with no `N8N_API_URL` fallback, so a recipient who set only `N8N_API_URL` (as the docs instruct) and ran a remote n8n would silently deploy to localhost. All 6 now fall back through `N8N_API_URL`. Verified e2e against the live VPS via the MCP protocol.
19
+
20
+ ### Added
21
+
22
+ - **One-click `.mcpb` Desktop Extension** (`p58-n8n.mcpb`) โ€” install in Claude Desktop (Settings โ†’ Extensions) with a config form; no JSON editing, no terminal. Self-contained (carries its runtime deps). Build/validate process: `operations` runbook `mcpb-build-and-validate-runbook.md`; manifest source `mcpb/manifest.json`.
23
+ - **Optional session-auth config** (`N8N_USER_EMAIL` / `N8N_USER_PASSWORD`) โ€” enables `test_credential` and clean run-and-verify on n8n versions that gate REST execution behind a login. Workflows build/deploy/run without it; documented as optional throughout.
24
+ - **Opportunistic first-workflow recipe** โ€” `GET-STARTED` + `AGENT_INSTALL` now guide the agent to inspect the user's credentials and build a personalized, best-effort first automation (datasource โ†’ optional AI โ†’ lowest-friction channel), narrate the plan in chat, self-heal config gaps via `partial_update_workflow`, and report honestly.
25
+ - **`docs/mcp-install-cloudflare-access-runbook.md`** โ€” optional runbook for installing against an n8n behind Cloudflare Access (`CF_ACCESS_CLIENT_ID` / `CF_ACCESS_CLIENT_SECRET` service token).
26
+ - **`AGENT_INSTALL.md`** now folds search-first API-key discovery, a pre-write validation-loop matrix, the premium-vs-engine boundary callout, the restart-then-verify discipline, and a Step 8 opportunistic first-workflow playbook.
27
+ - **`docs/GET-STARTED-IN-5-MIN.md`** and the CF-Access runbook now ship in the npm tarball (`package.json` `files[]`).
28
+
29
+ ### Known issues
30
+
31
+ - **`test_workflow` clone-verify false-negative on session-auth-gated n8n** โ€” when the optional n8n login is absent, `test_workflow` may report "TEST FAILED โ€ฆ N8N_USER_EMAIL/PASSWORD required" even though the workflow ran and delivered (its execution succeeds server-side on API-key alone). Set the optional login for a clean confirmation. Tracked in `INC-2026-06-02-test-workflow-clone-verify-false-negative-session-auth`.
32
+
33
+ ## [0.2.20-demo.1] - 2026-05-31
34
+
35
+ ### Added
36
+
37
+ - **Demo build of the v5 bundle** โ€” published to the npm `demo` dist-tag (`npm install @path58/p58-n8n@demo`). Includes the premium catalog proxy (`activate_premium`, `P58_ACCESS_TOKEN` โ†’ enriched catalog via the Path58 VPS REST proxy; see the Unreleased section below for the underlying RAG-4.63 work).
38
+
39
+ ### Fixed
40
+
41
+ - **Install-blocker: private dependency** โ€” `@tsvika58/shared-utilities` (a GitHub-Packages-private dep) moved to `devDependencies` and bundled into `dist/`, so `npm install @path58/p58-n8n` no longer requires private-registry auth.
42
+ - **`SERVER_VERSION` injection** โ€” the server now reports its version from `package.json` (`setup_check.server_version` matches the installed version).
43
+
44
+ ### Note
45
+
46
+ - The bare `latest` tag (`0.2.17`) is deprecated to steer users to `@demo` for the current demo build.
47
+
48
+ ## [0.2.18] - 2026-05-12
49
+
50
+ ### Added
51
+
52
+ - **node-fixer-registry** (RAG-4.84.8e) โ€” `NodeFixer` interface + `applyAllNodeFixers` dispatch in `src/autofix/suggestion-fixers/node-fixer-registry.ts`. Single-call replaces all per-node inlined calls in `build-workflow.ts`. Duplicate-registration guard enforced at startup.
53
+ - **emailSend.fromEmail BuildGap** (RAG-4.84.8e / S001) โ€” `email-from-credential-fixer.ts`: detects emailSend nodes with `toEmail` set but `fromEmail` absent; emits `missing_email_from_address` build gap with SMTP credential guidance.
54
+ - **Postgres $N โ†’ inline rewrite** (RAG-4.84.8e / S008) โ€” `postgres-inline-params-fixer.ts`: rewrites `$N` placeholder queries to n8n inline expressions (`={{ $json.paramN }}`), strips `queryParams`, emits `legacy_postgres_query_params` informational gap.
55
+ - **aggregate.fieldsToInclude CSV** (RAG-4.84.8e / S006) โ€” `aggregate-fields-csv-fixer.ts`: converts `{fields: [...]}` object form to CSV string expected by n8n aggregate node.
56
+ - **MERGE_NWAY_TOPOLOGY_REWRITE gotcha** (RAG-4.84.8e / S015) โ€” migration `20260511_01_gotcha_merge_nway_topology.sql` adds MERGE_NWAY_TOPOLOGY_REWRITE knowledge to the catalog gotcha table.
57
+
8
58
  ## [Unreleased]
9
59
 
10
60
  ### Added