@n8n/mcp-apps 0.2.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/README.md +27 -5
- package/dist/apps/workflow-preview.html +133 -133
- package/dist/build.tsbuildinfo +1 -1
- package/dist/server/apps/workflow-preview.d.ts +7 -1
- package/dist/server/apps/workflow-preview.js +38 -11
- package/dist/server/apps/workflow-preview.js.map +1 -1
- package/dist/server/constants.d.ts +2 -0
- package/dist/server/constants.js +8 -1
- package/dist/server/constants.js.map +1 -1
- package/dist/server/index.d.ts +2 -1
- package/dist/server/index.js +5 -1
- package/dist/server/index.js.map +1 -1
- package/dist/server/telemetry-config.d.ts +3 -0
- package/dist/server/telemetry-config.js +22 -0
- package/dist/server/telemetry-config.js.map +1 -0
- package/dist/telemetry-contract.d.ts +10 -0
- package/dist/telemetry-contract.js +6 -0
- package/dist/telemetry-contract.js.map +1 -0
- package/package.json +10 -6
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
|
|
22
|
-
|
|
23
|
-
|
|
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
|
-
|
|
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
|