@n8n/mcp-apps 0.1.0 → 0.3.0

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/LICENSE_EE.md ADDED
@@ -0,0 +1,27 @@
1
+ # The n8n Enterprise License (the “Enterprise License”)
2
+
3
+ Copyright (c) 2022-present n8n GmbH.
4
+
5
+ With regard to the n8n Software:
6
+
7
+ This software and associated documentation files (the "Software") may only be used in production, if
8
+ you (and any entity that you represent) hold a valid n8n Enterprise license corresponding to your
9
+ usage. Subject to the foregoing sentence, you are free to modify this Software and publish patches
10
+ to the Software. You agree that n8n and/or its licensors (as applicable) retain all right, title and
11
+ interest in and to all such modifications and/or patches, and all such modifications and/or patches
12
+ may only be used, copied, modified, displayed, distributed, or otherwise exploited with a valid n8n
13
+ Enterprise license for the corresponding usage. Notwithstanding the foregoing, you may copy and
14
+ modify the Software for development and testing purposes, without requiring a subscription. You
15
+ agree that n8n and/or its licensors (as applicable) retain all right, title and interest in and to
16
+ all such modifications. You are not granted any other rights beyond what is expressly stated herein.
17
+ Subject to the foregoing, it is forbidden to copy, merge, publish, distribute, sublicense, and/or
18
+ sell the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT
21
+ NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
22
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES
23
+ OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
24
+ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25
+
26
+ For all third party components incorporated into the n8n Software, those components are licensed
27
+ under the original license provided by the owner of the applicable component.
package/README.md CHANGED
@@ -18,9 +18,11 @@ helpers used by `packages/cli` to register them as MCP resources and tools.
18
18
  the host context the MCP client provides at runtime.
19
19
 
20
20
  Today the package ships a single app, `workflow-preview`, which is rendered
21
- after the `create_workflow_from_code` MCP tool returns and gives the user a
22
- button to open the freshly created workflow in n8n. New apps can be added
23
- alongside it (see [Adding a new app](#adding-a-new-app)).
21
+ after the `create_workflow_from_code` MCP tool returns. It loads the sanitized
22
+ workflow graph through the existing `get_workflow_details` MCP tool, renders the
23
+ existing n8n demo canvas in an iframe, and keeps a button to open the freshly
24
+ created workflow in n8n. New apps can be added alongside it (see
25
+ [Adding a new app](#adding-a-new-app)).
24
26
 
25
27
  ## Package layout
26
28
 
@@ -33,7 +35,15 @@ src/
33
35
  main.ts # mounts App with i18n
34
36
  index.html # entry HTML (built into dist/apps/<app>.html)
35
37
  tokens.scss # design tokens / global styles
36
- url.ts # defense-in-depth URL validation
38
+ types.ts # workflow preview data types
39
+ type-guards.ts # workflow preview data guards
40
+ composables/
41
+ use-workflow-preview.ts # workflow preview state and host tool handling
42
+ utils/
43
+ url.ts # defense-in-depth URL validation
44
+ components/ # reusable MCP app Vue components
45
+ workflow-preview/ # workflow-preview-specific reusable components
46
+ composables/ # reusable MCP host/runtime composables
37
47
  i18n/ # vue-i18n setup + host locale resolution
38
48
  locales/ # flat-key locale files (en.json, …)
39
49
  server/ # consumed by packages/cli
@@ -42,6 +52,7 @@ src/
42
52
  register-mcp-app-tool.ts
43
53
  resource-loader.ts # lazy reads built HTML from dist/apps
44
54
  index.ts # public entry: @n8n/mcp-apps/server
55
+ utils/ # framework-agnostic client helpers
45
56
  ```
46
57
 
47
58
  `apps-manifest.ts` is the canonical registry of MCP apps. Both the Vite
@@ -63,14 +74,25 @@ Each app:
63
74
  through `onhostcontextchanged` and reflects it on the document.
64
75
  - Reads the originating tool's `structuredContent` via `ontoolresult` to
65
76
  populate its own state.
77
+ - Calls `app.callServerTool(...)` when it needs fresh n8n data from the MCP
78
+ server. The workflow preview uses this to call `get_workflow_details` with
79
+ the created workflow ID.
66
80
  - Calls `app.openLink({ url })` to ask the host to navigate — never opens
67
81
  links itself.
68
82
 
69
83
  URL handling is locked down by `isAllowedWorkflowUrl` in
70
- `src/apps/workflow-preview/url.ts`: only `http(s)://` URLs with a non-empty
84
+ `src/apps/workflow-preview/utils/url.ts`: only `http(s)://` URLs with a non-empty
71
85
  host are accepted, both when reading the tool result and right before calling
72
86
  `openLink`. This is defense in depth on top of the host's own validation.
73
87
 
88
+ The workflow preview iframe uses a server-provided `previewUrl` when available.
89
+ Otherwise it uses the existing n8n preview service because instance routes are
90
+ commonly blocked or unreachable from MCP hosts. The resource metadata declares
91
+ broad `frameDomains` for `http` and `https` so hosts that enforce MCP Apps CSP
92
+ can load instance-specific or configured preview URLs. The framed n8n server's
93
+ own frame policy still applies, so the app falls back to the open-workflow
94
+ button when the preview cannot load.
95
+
74
96
  ## Internationalization
75
97
 
76
98
  Locale files live under `src/locales/` and use flat, namespaced keys