mountly-mcp 0.0.0 → 3.1.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.
Files changed (100) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +258 -20
  3. package/dist/artifact/index.d.ts +49 -0
  4. package/dist/artifact/index.js +21 -0
  5. package/dist/artifact/index.js.map +1 -0
  6. package/dist/bridge/iframe-entry.d.ts +1 -0
  7. package/dist/bridge/iframe-entry.js +251 -209
  8. package/dist/bridge/index.d.ts +17 -12
  9. package/dist/bridge/index.js +2 -2
  10. package/dist/build/emit-html.d.ts +30 -0
  11. package/dist/build/emit-meta.d.ts +17 -0
  12. package/dist/build/index.d.ts +32 -47
  13. package/dist/build/index.js +9 -135
  14. package/dist/build/index.js.map +1 -1
  15. package/dist/chunk-33DMFKKD.js +111 -0
  16. package/dist/chunk-33DMFKKD.js.map +1 -0
  17. package/dist/chunk-4HC3OWAQ.js +185 -0
  18. package/dist/chunk-4HC3OWAQ.js.map +1 -0
  19. package/dist/chunk-4WAKOYMK.js +196 -0
  20. package/dist/chunk-4WAKOYMK.js.map +1 -0
  21. package/dist/chunk-5EHNJCMF.js +58 -0
  22. package/dist/chunk-5EHNJCMF.js.map +1 -0
  23. package/dist/chunk-6QHKKFO3.js +30 -0
  24. package/dist/chunk-6QHKKFO3.js.map +1 -0
  25. package/dist/chunk-DKK26TRS.js +199 -0
  26. package/dist/chunk-DKK26TRS.js.map +1 -0
  27. package/dist/{chunk-A64ZILAS.js → chunk-DQLQOMDM.js} +2 -1
  28. package/dist/{chunk-A64ZILAS.js.map → chunk-DQLQOMDM.js.map} +1 -1
  29. package/dist/chunk-KRAS266U.js +260 -0
  30. package/dist/chunk-KRAS266U.js.map +1 -0
  31. package/dist/chunk-NLQDVNZP.js +115 -0
  32. package/dist/chunk-NLQDVNZP.js.map +1 -0
  33. package/dist/chunk-SNWNF2XI.js +171 -0
  34. package/dist/chunk-SNWNF2XI.js.map +1 -0
  35. package/dist/chunk-UECZA34Q.js +52 -0
  36. package/dist/chunk-UECZA34Q.js.map +1 -0
  37. package/dist/chunk-YJA4H6IB.js +13 -0
  38. package/dist/chunk-YJA4H6IB.js.map +1 -0
  39. package/dist/cli.d.ts +2 -0
  40. package/dist/cli.js +286 -0
  41. package/dist/cli.js.map +1 -0
  42. package/dist/connect-server-7L4HGKKL.js +7 -0
  43. package/dist/connect-server-7L4HGKKL.js.map +1 -0
  44. package/dist/dev/connect-server.d.ts +13 -0
  45. package/dist/dev/host-entry.d.ts +13 -0
  46. package/dist/dev/host-entry.js +18330 -0
  47. package/dist/dev/index.d.ts +45 -0
  48. package/dist/dev/index.js +14 -0
  49. package/dist/dev/index.js.map +1 -0
  50. package/dist/dev/sandbox-entry.d.ts +7 -0
  51. package/dist/dev/sandbox-entry.js +80 -0
  52. package/dist/html.d.ts +4 -0
  53. package/dist/index.d.ts +6 -26
  54. package/dist/index.js +8 -3
  55. package/dist/json-render/app.d.ts +22 -0
  56. package/dist/json-render/app.js +10 -0
  57. package/dist/json-render/app.js.map +1 -0
  58. package/dist/json-render/index.d.ts +10 -0
  59. package/dist/json-render/index.js +119 -0
  60. package/dist/json-render/index.js.map +1 -0
  61. package/dist/json-render/mcp.d.ts +49 -0
  62. package/dist/json-render/mcp.js +11 -0
  63. package/dist/json-render/mcp.js.map +1 -0
  64. package/dist/json-render/server.d.ts +72 -0
  65. package/dist/json-render/server.js +98 -0
  66. package/dist/json-render/server.js.map +1 -0
  67. package/dist/json-render/spec-stream.d.ts +26 -0
  68. package/dist/json-render/use-spec-stream.d.ts +26 -0
  69. package/dist/json-render/widget.d.ts +59 -0
  70. package/dist/react/context.d.ts +14 -0
  71. package/dist/react/create-widget.d.ts +11 -0
  72. package/dist/react/hooks.d.ts +46 -0
  73. package/dist/react/index.d.ts +3 -0
  74. package/dist/react/index.js +35 -0
  75. package/dist/react/index.js.map +1 -0
  76. package/dist/sandbox/index.d.ts +16 -0
  77. package/dist/sandbox/index.js +8 -0
  78. package/dist/sandbox/index.js.map +1 -0
  79. package/dist/schema.d.ts +20 -0
  80. package/dist/server/index.d.ts +73 -0
  81. package/dist/server/index.js +235 -0
  82. package/dist/server/index.js.map +1 -0
  83. package/dist/svelte/index.d.ts +35 -0
  84. package/dist/svelte/index.js +9 -0
  85. package/dist/svelte/index.js.map +1 -0
  86. package/dist/testing/index.d.ts +27 -0
  87. package/dist/testing/index.js +312 -0
  88. package/dist/testing/index.js.map +1 -0
  89. package/dist/testing/render-artifact.d.ts +35 -0
  90. package/dist/types.d.ts +55 -0
  91. package/dist/vite/index.d.ts +23 -0
  92. package/dist/vite/index.js +211 -0
  93. package/dist/vite/index.js.map +1 -0
  94. package/dist/vue/index.d.ts +56 -0
  95. package/dist/vue/index.js +89 -0
  96. package/dist/vue/index.js.map +1 -0
  97. package/package.json +166 -20
  98. package/dist/chunk-BUGGLMNA.js +0 -132
  99. package/dist/chunk-BUGGLMNA.js.map +0 -1
  100. package/dist/types-B9JAWm4W.d.ts +0 -62
@@ -0,0 +1,211 @@
1
+ import {
2
+ MCP_APP_MANIFEST_FILE,
3
+ writeMcpAppManifest
4
+ } from "../chunk-DKK26TRS.js";
5
+ import {
6
+ buildMcpResourceFromSource
7
+ } from "../chunk-4WAKOYMK.js";
8
+ import "../chunk-DQLQOMDM.js";
9
+ import "../chunk-YJA4H6IB.js";
10
+
11
+ // src/vite/index.ts
12
+ import { rm } from "fs/promises";
13
+ import { basename, isAbsolute, join, resolve } from "path";
14
+ function isCollection(options) {
15
+ return "apps" in options;
16
+ }
17
+ function safeBuildName(name, index) {
18
+ const safe = name.replace(/[^a-zA-Z0-9_-]/g, "_");
19
+ return `mountly_mcp_${index}_${safe || "app"}`;
20
+ }
21
+ function outputPath(root, outDir, app) {
22
+ if (!app.output) return join(outDir, `${basename(app.name)}.html`);
23
+ return isAbsolute(app.output) ? app.output : resolve(root, app.output);
24
+ }
25
+ function mountlyMcpWidget(options) {
26
+ const configuredApps = isCollection(options) ? [...options.apps] : [options];
27
+ const selectedForDev = process.env.MOUNTLY_MCP_SELECTED_APP;
28
+ const apps = selectedForDev ? configuredApps.filter((app) => app.name === selectedForDev) : configuredApps;
29
+ const manifestOption = isCollection(options) ? options.manifest : void 0;
30
+ if (apps.length === 0) throw new Error("mountly-mcp: apps must contain at least one View");
31
+ const names = /* @__PURE__ */ new Set();
32
+ const uris = /* @__PURE__ */ new Set();
33
+ for (const app of apps) {
34
+ if (!app.uri.startsWith("ui://")) {
35
+ throw new Error(
36
+ `mountly-mcp: UI resource uri must use the 'ui://' scheme (received '${app.uri}')`
37
+ );
38
+ }
39
+ if (names.has(app.name)) throw new Error(`mountly-mcp: duplicate app name '${app.name}'`);
40
+ if (uris.has(app.uri)) throw new Error(`mountly-mcp: duplicate app uri '${app.uri}'`);
41
+ names.add(app.name);
42
+ uris.add(app.uri);
43
+ }
44
+ const environments = apps.map((app, index) => ({
45
+ app,
46
+ name: safeBuildName(app.name, index),
47
+ jsFile: `widget-${index}-${basename(app.name)}.js`,
48
+ cssFile: `widget-${index}-${basename(app.name)}.css`
49
+ }));
50
+ const byEnvironment = new Map(environments.map((environment) => [environment.name, environment]));
51
+ const emitted = /* @__PURE__ */ new Map();
52
+ const artifacts = /* @__PURE__ */ new Map();
53
+ let root = process.cwd();
54
+ let outDir = resolve(root, "dist");
55
+ let manifestWritten = false;
56
+ function currentEnvironment(context) {
57
+ const name = context.environment?.name;
58
+ return (name ? byEnvironment.get(name) : void 0) ?? (environments.length === 1 ? environments[0] : void 0);
59
+ }
60
+ const plugin = {
61
+ name: "mountly-mcp-widget",
62
+ api: {
63
+ // The CLI consumes this documented plugin interface instead of scraping
64
+ // Vite's resolved build settings.
65
+ mountlyMcp: { apps: configuredApps, manifest: manifestOption }
66
+ },
67
+ // After Vite core plugins: css-post writes the stylesheet in its own
68
+ // closeBundle, and this plugin has to see the file to inline it.
69
+ enforce: "post",
70
+ // Only meaningful during `vite build`; a dev server has no bundle to emit.
71
+ apply: "build",
72
+ config(_config, env) {
73
+ const first = environments[0];
74
+ if (!first) throw new Error("mountly-mcp: configure at least one app");
75
+ return {
76
+ // Vite's lib mode leaves `process.env.NODE_ENV` for a consuming bundler
77
+ // to replace. There isn't one — the bundle is inlined into HTML and run
78
+ // in a sandboxed iframe, where `process` is undefined and React and Vue
79
+ // throw on their first environment check.
80
+ define: { "process.env.NODE_ENV": JSON.stringify(env.mode) },
81
+ // Legacy `vite build` builds one environment. Preserve that zero-config
82
+ // path for single-View projects; multi-View projects use
83
+ // `mountly-mcp build`, which drives the environments below.
84
+ build: {
85
+ lib: {
86
+ entry: first.app.entry,
87
+ // IIFE so the bundle inlines into a single <script> with no import
88
+ // graph left to resolve inside the sandboxed iframe.
89
+ formats: ["iife"],
90
+ name: "__mountlyMcpEntry0",
91
+ fileName: () => first.jsFile,
92
+ // Named explicitly: otherwise a lib build derives the stylesheet
93
+ // name from package.json and fails outright when there isn't one.
94
+ cssFileName: first.cssFile.replace(/\.css$/, "")
95
+ },
96
+ // One stylesheet to inline; per-chunk CSS would strand imports.
97
+ cssCodeSplit: false
98
+ },
99
+ builder: {
100
+ sharedPlugins: true,
101
+ async buildApp(builder) {
102
+ for (const environment of environments) {
103
+ const target = builder.environments[environment.name];
104
+ if (!target)
105
+ throw new Error(`mountly-mcp: missing Vite environment '${environment.name}'`);
106
+ await builder.build(target);
107
+ }
108
+ }
109
+ },
110
+ environments: Object.fromEntries(
111
+ environments.map((environment, index) => [
112
+ environment.name,
113
+ {
114
+ // A custom environment defaults to a server consumer, which
115
+ // externalizes node_modules — React and Vue would become bare
116
+ // globals and the view would die on `vue is not defined`. A
117
+ // `ui://` resource has no import graph at runtime, so everything
118
+ // must be bundled in.
119
+ consumer: "client",
120
+ resolve: { noExternal: true },
121
+ build: {
122
+ emptyOutDir: index === 0,
123
+ lib: {
124
+ entry: environment.app.entry,
125
+ formats: ["iife"],
126
+ name: `__mountlyMcpEntry${index}`,
127
+ fileName: () => environment.jsFile,
128
+ cssFileName: environment.cssFile.replace(/\.css$/, "")
129
+ },
130
+ cssCodeSplit: false
131
+ }
132
+ }
133
+ ])
134
+ )
135
+ };
136
+ },
137
+ configResolved(config) {
138
+ root = config.root;
139
+ outDir = resolve(config.root, config.build.outDir);
140
+ },
141
+ buildStart() {
142
+ const name = this.environment?.name;
143
+ if (apps.length > 1 && !byEnvironment.has(String(name))) {
144
+ this.error(
145
+ "mountly-mcp: multi-View builds require 'mountly-mcp build' (or 'vite build --app') so Vite builds every environment"
146
+ );
147
+ }
148
+ },
149
+ generateBundle: {
150
+ order: "post",
151
+ handler(_outputOptions, bundle) {
152
+ const environment = currentEnvironment(this);
153
+ if (!environment) return;
154
+ const chunk = bundle[environment.jsFile] ?? Object.values(bundle).find((item) => item.type === "chunk" && item.isEntry);
155
+ const cssAsset = bundle[environment.cssFile] ?? Object.values(bundle).find(
156
+ (item) => item.type === "asset" && item.fileName.endsWith(".css")
157
+ );
158
+ emitted.set(environment.name, {
159
+ js: chunk && "code" in chunk ? chunk.code : void 0,
160
+ css: cssAsset && "source" in cssAsset ? cssAsset.source.toString() : void 0,
161
+ jsFile: chunk?.fileName,
162
+ cssFile: cssAsset?.fileName,
163
+ names: Object.keys(bundle)
164
+ });
165
+ }
166
+ },
167
+ async closeBundle() {
168
+ const environment = currentEnvironment(this);
169
+ if (!environment || artifacts.has(environment.name)) return;
170
+ const source = emitted.get(environment.name);
171
+ if (source?.js === void 0) {
172
+ this.error(
173
+ `mountly-mcp: the build emitted no ${environment.jsFile} for '${environment.app.entry}'. Emitted: ${source?.names.join(", ") || "nothing"}`
174
+ );
175
+ return;
176
+ }
177
+ const {
178
+ entry: _entry,
179
+ output: _output,
180
+ cleanIntermediate = true,
181
+ ...resourceOptions
182
+ } = environment.app;
183
+ const result = await buildMcpResourceFromSource({
184
+ ...resourceOptions,
185
+ js: source.js,
186
+ css: source.css,
187
+ output: outputPath(root, outDir, environment.app)
188
+ });
189
+ artifacts.set(environment.name, result.artifact);
190
+ if (cleanIntermediate) {
191
+ if (source.jsFile) await rm(join(outDir, source.jsFile), { force: true });
192
+ if (source.cssFile) await rm(join(outDir, source.cssFile), { force: true });
193
+ }
194
+ this.info?.(`mountly-mcp: ${environment.app.uri} \u2192 ${result.htmlPath}`);
195
+ if (!manifestWritten && artifacts.size === environments.length && manifestOption !== false) {
196
+ manifestWritten = true;
197
+ const path = manifestOption ? isAbsolute(manifestOption) ? manifestOption : resolve(root, manifestOption) : join(outDir, MCP_APP_MANIFEST_FILE);
198
+ await writeMcpAppManifest(
199
+ path,
200
+ environments.map((item) => artifacts.get(item.name))
201
+ );
202
+ this.info?.(`mountly-mcp: manifest \u2192 ${path}`);
203
+ }
204
+ }
205
+ };
206
+ return plugin;
207
+ }
208
+ export {
209
+ mountlyMcpWidget
210
+ };
211
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/vite/index.ts"],"sourcesContent":["import { rm } from \"node:fs/promises\";\nimport { basename, isAbsolute, join, resolve } from \"node:path\";\nimport type { BuildEnvironment, Plugin, UserConfig } from \"vite\";\nimport { MCP_APP_MANIFEST_FILE, writeMcpAppManifest } from \"../artifact/index.js\";\nimport type { McpAppArtifact } from \"../artifact/index.js\";\nimport { buildMcpResourceFromSource } from \"../build/index.js\";\nimport type { BuildSelfContainedOptions } from \"../build/index.js\";\n\nexport interface MountlyMcpWidgetOptions extends Omit<\n BuildSelfContainedOptions,\n \"entry\" | \"output\" | \"cssEntry\"\n> {\n entry: string;\n output?: string;\n cleanIntermediate?: boolean;\n}\n\nexport interface MountlyMcpWidgetsOptions {\n apps: ReadonlyArray<MountlyMcpWidgetOptions>;\n /** Defaults to `<outDir>/mountly-mcp.manifest.json`; false disables it. */\n manifest?: string | false;\n}\n\nexport type MountlyMcpViteOptions = MountlyMcpWidgetOptions | MountlyMcpWidgetsOptions;\n\nexport interface MountlyMcpViteApi {\n apps: ReadonlyArray<MountlyMcpWidgetOptions>;\n manifest?: string | false;\n}\n\nfunction isCollection(options: MountlyMcpViteOptions): options is MountlyMcpWidgetsOptions {\n return \"apps\" in options;\n}\n\nfunction safeBuildName(name: string, index: number): string {\n const safe = name.replace(/[^a-zA-Z0-9_-]/g, \"_\");\n return `mountly_mcp_${index}_${safe || \"app\"}`;\n}\n\nfunction outputPath(root: string, outDir: string, app: MountlyMcpWidgetOptions): string {\n if (!app.output) return join(outDir, `${basename(app.name)}.html`);\n return isAbsolute(app.output) ? app.output : resolve(root, app.output);\n}\n\n/**\n * Build one or many independent MCP Apps Views. Each View is a Vite build\n * environment, so frameworks and CSS remain isolated while callers configure\n * the collection once.\n */\nexport function mountlyMcpWidget(options: MountlyMcpViteOptions): Plugin {\n const configuredApps = isCollection(options) ? [...options.apps] : [options];\n const selectedForDev = process.env.MOUNTLY_MCP_SELECTED_APP;\n const apps = selectedForDev\n ? configuredApps.filter((app) => app.name === selectedForDev)\n : configuredApps;\n const manifestOption = isCollection(options) ? options.manifest : undefined;\n if (apps.length === 0) throw new Error(\"mountly-mcp: apps must contain at least one View\");\n\n const names = new Set<string>();\n const uris = new Set<string>();\n for (const app of apps) {\n if (!app.uri.startsWith(\"ui://\")) {\n throw new Error(\n `mountly-mcp: UI resource uri must use the 'ui://' scheme (received '${app.uri}')`,\n );\n }\n if (names.has(app.name)) throw new Error(`mountly-mcp: duplicate app name '${app.name}'`);\n if (uris.has(app.uri)) throw new Error(`mountly-mcp: duplicate app uri '${app.uri}'`);\n names.add(app.name);\n uris.add(app.uri);\n }\n\n const environments = apps.map((app, index) => ({\n app,\n name: safeBuildName(app.name, index),\n jsFile: `widget-${index}-${basename(app.name)}.js`,\n cssFile: `widget-${index}-${basename(app.name)}.css`,\n }));\n const byEnvironment = new Map(environments.map((environment) => [environment.name, environment]));\n const emitted = new Map<\n string,\n { js?: string; css?: string; jsFile?: string; cssFile?: string; names: string[] }\n >();\n const artifacts = new Map<string, McpAppArtifact>();\n let root = process.cwd();\n let outDir = resolve(root, \"dist\");\n let manifestWritten = false;\n\n function currentEnvironment(context: unknown) {\n const name = (context as { environment?: { name?: string } }).environment?.name;\n return (\n (name ? byEnvironment.get(name) : undefined) ??\n (environments.length === 1 ? environments[0] : undefined)\n );\n }\n\n const plugin: Plugin = {\n name: \"mountly-mcp-widget\",\n api: {\n // The CLI consumes this documented plugin interface instead of scraping\n // Vite's resolved build settings.\n mountlyMcp: { apps: configuredApps, manifest: manifestOption } satisfies MountlyMcpViteApi,\n },\n // After Vite core plugins: css-post writes the stylesheet in its own\n // closeBundle, and this plugin has to see the file to inline it.\n enforce: \"post\",\n // Only meaningful during `vite build`; a dev server has no bundle to emit.\n apply: \"build\",\n\n config(_config, env): UserConfig {\n const first = environments[0];\n if (!first) throw new Error(\"mountly-mcp: configure at least one app\");\n return {\n // Vite's lib mode leaves `process.env.NODE_ENV` for a consuming bundler\n // to replace. There isn't one — the bundle is inlined into HTML and run\n // in a sandboxed iframe, where `process` is undefined and React and Vue\n // throw on their first environment check.\n define: { \"process.env.NODE_ENV\": JSON.stringify(env.mode) },\n // Legacy `vite build` builds one environment. Preserve that zero-config\n // path for single-View projects; multi-View projects use\n // `mountly-mcp build`, which drives the environments below.\n build: {\n lib: {\n entry: first.app.entry,\n // IIFE so the bundle inlines into a single <script> with no import\n // graph left to resolve inside the sandboxed iframe.\n formats: [\"iife\"] as const,\n name: \"__mountlyMcpEntry0\",\n fileName: () => first.jsFile,\n // Named explicitly: otherwise a lib build derives the stylesheet\n // name from package.json and fails outright when there isn't one.\n cssFileName: first.cssFile.replace(/\\.css$/, \"\"),\n },\n // One stylesheet to inline; per-chunk CSS would strand imports.\n cssCodeSplit: false,\n },\n builder: {\n sharedPlugins: true,\n async buildApp(builder) {\n for (const environment of environments) {\n const target = builder.environments[environment.name] as BuildEnvironment | undefined;\n if (!target)\n throw new Error(`mountly-mcp: missing Vite environment '${environment.name}'`);\n await builder.build(target);\n }\n },\n },\n environments: Object.fromEntries(\n environments.map((environment, index) => [\n environment.name,\n {\n // A custom environment defaults to a server consumer, which\n // externalizes node_modules — React and Vue would become bare\n // globals and the view would die on `vue is not defined`. A\n // `ui://` resource has no import graph at runtime, so everything\n // must be bundled in.\n consumer: \"client\" as const,\n resolve: { noExternal: true as const },\n build: {\n emptyOutDir: index === 0,\n lib: {\n entry: environment.app.entry,\n formats: [\"iife\"] as const,\n name: `__mountlyMcpEntry${index}`,\n fileName: () => environment.jsFile,\n cssFileName: environment.cssFile.replace(/\\.css$/, \"\"),\n },\n cssCodeSplit: false,\n },\n },\n ]),\n ),\n };\n },\n\n configResolved(config) {\n root = config.root;\n outDir = resolve(config.root, config.build.outDir);\n },\n\n buildStart() {\n const name = (this as { environment?: { name?: string } }).environment?.name;\n if (apps.length > 1 && !byEnvironment.has(String(name))) {\n this.error(\n \"mountly-mcp: multi-View builds require 'mountly-mcp build' (or 'vite build --app') so Vite builds every environment\",\n );\n }\n },\n\n generateBundle: {\n order: \"post\",\n handler(_outputOptions, bundle) {\n const environment = currentEnvironment(this);\n if (!environment) return;\n const chunk =\n bundle[environment.jsFile] ??\n Object.values(bundle).find((item) => item.type === \"chunk\" && item.isEntry);\n const cssAsset =\n bundle[environment.cssFile] ??\n Object.values(bundle).find(\n (item) => item.type === \"asset\" && item.fileName.endsWith(\".css\"),\n );\n emitted.set(environment.name, {\n js: chunk && \"code\" in chunk ? chunk.code : undefined,\n css: cssAsset && \"source\" in cssAsset ? cssAsset.source.toString() : undefined,\n jsFile: chunk?.fileName,\n cssFile: cssAsset?.fileName,\n names: Object.keys(bundle),\n });\n },\n },\n\n async closeBundle() {\n const environment = currentEnvironment(this);\n if (!environment || artifacts.has(environment.name)) return;\n const source = emitted.get(environment.name);\n if (source?.js === undefined) {\n this.error(\n `mountly-mcp: the build emitted no ${environment.jsFile} for '${environment.app.entry}'. Emitted: ${source?.names.join(\", \") || \"nothing\"}`,\n );\n return;\n }\n const {\n entry: _entry,\n output: _output,\n cleanIntermediate = true,\n ...resourceOptions\n } = environment.app;\n const result = await buildMcpResourceFromSource({\n ...resourceOptions,\n js: source.js,\n css: source.css,\n output: outputPath(root, outDir, environment.app),\n });\n artifacts.set(environment.name, result.artifact);\n if (cleanIntermediate) {\n if (source.jsFile) await rm(join(outDir, source.jsFile), { force: true });\n if (source.cssFile) await rm(join(outDir, source.cssFile), { force: true });\n }\n this.info?.(`mountly-mcp: ${environment.app.uri} → ${result.htmlPath}`);\n\n if (!manifestWritten && artifacts.size === environments.length && manifestOption !== false) {\n manifestWritten = true;\n const path = manifestOption\n ? isAbsolute(manifestOption)\n ? manifestOption\n : resolve(root, manifestOption)\n : join(outDir, MCP_APP_MANIFEST_FILE);\n await writeMcpAppManifest(\n path,\n environments.map((item) => artifacts.get(item.name) as McpAppArtifact),\n );\n this.info?.(`mountly-mcp: manifest → ${path}`);\n }\n },\n };\n\n return plugin;\n}\n"],"mappings":";;;;;;;;;;;AAAA,SAAS,UAAU;AACnB,SAAS,UAAU,YAAY,MAAM,eAAe;AA6BpD,SAAS,aAAa,SAAqE;AACzF,SAAO,UAAU;AACnB;AAEA,SAAS,cAAc,MAAc,OAAuB;AAC1D,QAAM,OAAO,KAAK,QAAQ,mBAAmB,GAAG;AAChD,SAAO,eAAe,KAAK,IAAI,QAAQ,KAAK;AAC9C;AAEA,SAAS,WAAW,MAAc,QAAgB,KAAsC;AACtF,MAAI,CAAC,IAAI,OAAQ,QAAO,KAAK,QAAQ,GAAG,SAAS,IAAI,IAAI,CAAC,OAAO;AACjE,SAAO,WAAW,IAAI,MAAM,IAAI,IAAI,SAAS,QAAQ,MAAM,IAAI,MAAM;AACvE;AAOO,SAAS,iBAAiB,SAAwC;AACvE,QAAM,iBAAiB,aAAa,OAAO,IAAI,CAAC,GAAG,QAAQ,IAAI,IAAI,CAAC,OAAO;AAC3E,QAAM,iBAAiB,QAAQ,IAAI;AACnC,QAAM,OAAO,iBACT,eAAe,OAAO,CAAC,QAAQ,IAAI,SAAS,cAAc,IAC1D;AACJ,QAAM,iBAAiB,aAAa,OAAO,IAAI,QAAQ,WAAW;AAClE,MAAI,KAAK,WAAW,EAAG,OAAM,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```ts
5
+ * import { createMcpWidget } from "mountly-mcp/vue";
6
+ * import Dashboard from "./Dashboard.vue";
7
+ *
8
+ * const widget = createMcpWidget(Dashboard);
9
+ * (globalThis as { __mountlyMcpWidget__?: unknown }).__mountlyMcpWidget__ = widget;
10
+ * ```
11
+ *
12
+ * The component receives the bridge's props (`mcp`, `toolInput`, `toolResult`,
13
+ * `hostContext`) and can also reach them from any depth with the composables
14
+ * below, which mirror `mountly-mcp/react`'s hooks.
15
+ */
16
+ import { type Component, type ComputedRef, type InjectionKey } from "vue";
17
+ import type { AdapterOptions, WidgetModule } from "mountly/adapter";
18
+ import type { App, McpUiDisplayMode, McpUiHostContext } from "@modelcontextprotocol/ext-apps";
19
+ import type { McpWidgetProps } from "../types.js";
20
+ /** What {@link createMcpWidget} provides to descendants. */
21
+ export interface McpVueContext {
22
+ app: App;
23
+ toolInput?: McpWidgetProps["toolInput"];
24
+ toolInputPartial?: McpWidgetProps["toolInputPartial"];
25
+ toolResult?: McpWidgetProps["toolResult"];
26
+ hostContext?: McpUiHostContext;
27
+ }
28
+ export declare const McpInjectionKey: InjectionKey<ComputedRef<McpVueContext>>;
29
+ /**
30
+ * Wraps a Vue component as a mountly `WidgetModule` driven by the mountly-mcp
31
+ * bridge. The component's own props/attrs pass through unchanged; MCP bridge
32
+ * props are consumed by the wrapper and provided to the subtree.
33
+ */
34
+ export declare function createMcpWidget<P extends object>(Component: Component<P>, options?: AdapterOptions): WidgetModule;
35
+ /** The view-side ext-apps App: call server tools, send messages, open links. */
36
+ export declare function useMcpHost(): App;
37
+ /** Complete notification params; read the tool arguments from `.arguments`. */
38
+ export declare function useToolInput<T = unknown>(): ComputedRef<T | undefined>;
39
+ /**
40
+ * Streaming tool arguments (`ui/notifications/tool-input-partial`), present only
41
+ * when the bridge runs with `streamToolInput`. Best-effort recovered JSON —
42
+ * render loading states from it, never critical operations.
43
+ */
44
+ export declare function useToolInputPartial<T = unknown>(): ComputedRef<Partial<T> | undefined>;
45
+ /** Complete MCP tool result; structured data is available at `.structuredContent`. */
46
+ export declare function useToolResult<T = unknown>(): ComputedRef<T | undefined>;
47
+ /** Latest host context (theme, styles, displayMode, container dimensions). */
48
+ export declare function useHostContext(): ComputedRef<McpUiHostContext | undefined>;
49
+ /** Current display mode reported by the host. */
50
+ export declare function useDisplayMode(): ComputedRef<McpUiDisplayMode | undefined>;
51
+ /**
52
+ * Request a display mode change, resolving to the mode the host actually
53
+ * applied. Modes the host didn't advertise are never requested — the spec
54
+ * requires views to check `availableDisplayModes` first.
55
+ */
56
+ export declare function useRequestDisplayMode(): (mode: McpUiDisplayMode) => Promise<McpUiDisplayMode | undefined>;
@@ -0,0 +1,89 @@
1
+ // src/vue/index.ts
2
+ import {
3
+ computed,
4
+ defineComponent,
5
+ h,
6
+ inject,
7
+ provide
8
+ } from "vue";
9
+ import { createWidget } from "mountly-vue";
10
+ var McpInjectionKey = /* @__PURE__ */ Symbol("mountly-mcp");
11
+ function createMcpWidget(Component, options) {
12
+ const Wrapped = defineComponent({
13
+ name: "MountlyMcpProvider",
14
+ inheritAttrs: false,
15
+ props: {
16
+ mcp: { type: Object, required: true },
17
+ toolInput: { type: Object, default: void 0 },
18
+ toolInputPartial: { type: Object, default: void 0 },
19
+ toolResult: { type: Object, default: void 0 },
20
+ hostContext: { type: Object, default: void 0 }
21
+ },
22
+ setup(props, { attrs }) {
23
+ const context = computed(() => ({
24
+ app: props.mcp,
25
+ toolInput: props.toolInput,
26
+ toolInputPartial: props.toolInputPartial,
27
+ toolResult: props.toolResult,
28
+ hostContext: props.hostContext
29
+ }));
30
+ provide(McpInjectionKey, context);
31
+ return () => h(Component, attrs);
32
+ }
33
+ });
34
+ return createWidget(Wrapped, options);
35
+ }
36
+ function useEnsuredContext() {
37
+ const context = inject(McpInjectionKey, null);
38
+ if (!context) {
39
+ throw new Error(
40
+ "mountly-mcp/vue: useMcpHost/useToolResult/etc must be used inside a component wrapped with createMcpWidget()."
41
+ );
42
+ }
43
+ return context;
44
+ }
45
+ function useMcpHost() {
46
+ return useEnsuredContext().value.app;
47
+ }
48
+ function useToolInput() {
49
+ const context = useEnsuredContext();
50
+ return computed(() => context.value.toolInput);
51
+ }
52
+ function useToolInputPartial() {
53
+ const context = useEnsuredContext();
54
+ return computed(() => context.value.toolInputPartial);
55
+ }
56
+ function useToolResult() {
57
+ const context = useEnsuredContext();
58
+ return computed(() => context.value.toolResult);
59
+ }
60
+ function useHostContext() {
61
+ const context = useEnsuredContext();
62
+ return computed(() => context.value.hostContext);
63
+ }
64
+ function useDisplayMode() {
65
+ const context = useEnsuredContext();
66
+ return computed(() => context.value.hostContext?.displayMode);
67
+ }
68
+ function useRequestDisplayMode() {
69
+ const context = useEnsuredContext();
70
+ return async (mode) => {
71
+ const { app, hostContext } = context.value;
72
+ const available = hostContext?.availableDisplayModes;
73
+ if (available && !available.includes(mode)) return hostContext?.displayMode;
74
+ const result = await app.requestDisplayMode({ mode });
75
+ return result.mode;
76
+ };
77
+ }
78
+ export {
79
+ McpInjectionKey,
80
+ createMcpWidget,
81
+ useDisplayMode,
82
+ useHostContext,
83
+ useMcpHost,
84
+ useRequestDisplayMode,
85
+ useToolInput,
86
+ useToolInputPartial,
87
+ useToolResult
88
+ };
89
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/vue/index.ts"],"sourcesContent":["/**\n * Vue entry point: turn a Vue component into an MCP App view.\n *\n * ```ts\n * import { createMcpWidget } from \"mountly-mcp/vue\";\n * import Dashboard from \"./Dashboard.vue\";\n *\n * const widget = createMcpWidget(Dashboard);\n * (globalThis as { __mountlyMcpWidget__?: unknown }).__mountlyMcpWidget__ = widget;\n * ```\n *\n * The component receives the bridge's props (`mcp`, `toolInput`, `toolResult`,\n * `hostContext`) and can also reach them from any depth with the composables\n * below, which mirror `mountly-mcp/react`'s hooks.\n */\nimport {\n computed,\n defineComponent,\n h,\n inject,\n provide,\n type Component,\n type ComputedRef,\n type InjectionKey,\n} from \"vue\";\nimport { createWidget } from \"mountly-vue\";\nimport type { AdapterOptions, WidgetModule } from \"mountly/adapter\";\nimport type { App, McpUiDisplayMode, McpUiHostContext } from \"@modelcontextprotocol/ext-apps\";\nimport type { McpWidgetProps } from \"../types.js\";\n\n/** What {@link createMcpWidget} provides to descendants. */\nexport interface McpVueContext {\n app: App;\n toolInput?: McpWidgetProps[\"toolInput\"];\n toolInputPartial?: McpWidgetProps[\"toolInputPartial\"];\n toolResult?: McpWidgetProps[\"toolResult\"];\n hostContext?: McpUiHostContext;\n}\n\nexport const McpInjectionKey: InjectionKey<ComputedRef<McpVueContext>> = Symbol(\"mountly-mcp\");\n\n/**\n * Wraps a Vue component as a mountly `WidgetModule` driven by the mountly-mcp\n * bridge. The component's own props/attrs pass through unchanged; MCP bridge\n * props are consumed by the wrapper and provided to the subtree.\n */\nexport function createMcpWidget<P extends object>(\n Component: Component<P>,\n options?: AdapterOptions,\n): WidgetModule {\n const Wrapped = defineComponent({\n name: \"MountlyMcpProvider\",\n inheritAttrs: false,\n props: {\n mcp: { type: Object, required: true },\n toolInput: { type: Object, default: undefined },\n toolInputPartial: { type: Object, default: undefined },\n toolResult: { type: Object, default: undefined },\n hostContext: { type: Object, default: undefined },\n },\n setup(props, { attrs }) {\n const context = computed<McpVueContext>(() => ({\n app: props.mcp as App,\n toolInput: props.toolInput as McpVueContext[\"toolInput\"],\n toolInputPartial: props.toolInputPartial as McpVueContext[\"toolInputPartial\"],\n toolResult: props.toolResult as McpVueContext[\"toolResult\"],\n hostContext: props.hostContext as McpUiHostContext | undefined,\n }));\n provide(McpInjectionKey, context);\n return () => h(Component as Component, attrs);\n },\n });\n return createWidget(Wrapped, options);\n}\n\nfunction useEnsuredContext(): ComputedRef<McpVueContext> {\n const context = inject(McpInjectionKey, null);\n if (!context) {\n throw new Error(\n \"mountly-mcp/vue: useMcpHost/useToolResult/etc must be used inside a component wrapped with createMcpWidget().\",\n );\n }\n return context;\n}\n\n/** The view-side ext-apps App: call server tools, send messages, open links. */\nexport function useMcpHost(): App {\n return useEnsuredContext().value.app;\n}\n\n/** Complete notification params; read the tool arguments from `.arguments`. */\nexport function useToolInput<T = unknown>(): ComputedRef<T | undefined> {\n const context = useEnsuredContext();\n return computed(() => context.value.toolInput as T | undefined);\n}\n\n/**\n * Streaming tool arguments (`ui/notifications/tool-input-partial`), present only\n * when the bridge runs with `streamToolInput`. Best-effort recovered JSON —\n * render loading states from it, never critical operations.\n */\nexport function useToolInputPartial<T = unknown>(): ComputedRef<Partial<T> | undefined> {\n const context = useEnsuredContext();\n return computed(() => context.value.toolInputPartial as Partial<T> | undefined);\n}\n\n/** Complete MCP tool result; structured data is available at `.structuredContent`. */\nexport function useToolResult<T = unknown>(): ComputedRef<T | undefined> {\n const context = useEnsuredContext();\n return computed(() => context.value.toolResult as T | undefined);\n}\n\n/** Latest host context (theme, styles, displayMode, container dimensions). */\nexport function useHostContext(): ComputedRef<McpUiHostContext | undefined> {\n const context = useEnsuredContext();\n return computed(() => context.value.hostContext);\n}\n\n/** Current display mode reported by the host. */\nexport function useDisplayMode(): ComputedRef<McpUiDisplayMode | undefined> {\n const context = useEnsuredContext();\n return computed(() => context.value.hostContext?.displayMode);\n}\n\n/**\n * Request a display mode change, resolving to the mode the host actually\n * applied. Modes the host didn't advertise are never requested — the spec\n * requires views to check `availableDisplayModes` first.\n */\nexport function useRequestDisplayMode(): (\n mode: McpUiDisplayMode,\n) => Promise<McpUiDisplayMode | undefined> {\n const context = useEnsuredContext();\n return async (mode) => {\n const { app, hostContext } = context.value;\n const available = hostContext?.availableDisplayModes;\n if (available && !available.includes(mode)) return hostContext?.displayMode;\n const result = await app.requestDisplayMode({ mode });\n return result.mode;\n };\n}\n"],"mappings":";AAeA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAIK;AACP,SAAS,oBAAoB;AActB,IAAM,kBAA4D,uBAAO,aAAa;AAOtF,SAAS,gBACd,WACA,SACc;AACd,QAAM,UAAU,gBAAgB;A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Q,MAAM,WAAW;AACjD;AAGO,SAAS,iBAA4D;AAC1E,QAAM,UAAU,kBAAkB;AAClC,SAAO,SAAS,MAAM,QAAQ,MAAM,aAAa,WAAW;AAC9D;AAOO,SAAS,wBAE2B;AACzC,QAAM,UAAU,kBAAkB;AAClC,SAAO,OAAO,SAAS;AACrB,UAAM,EAAE,KAAK,YAAY,IAAI,QAAQ;AACrC,UAAM,YAAY,aAAa;AAC/B,QAAI,aAAa,CAAC,UAAU,SAAS,IAAI,EAAG,QAAO,aAAa;AAChE,UAAM,SAAS,MAAM,IAAI,mBAAmB,EAAE,KAAK,CAAC;AACpD,WAAO,OAAO;AAAA,EAChB;AACF;","names":[]}
package/package.json CHANGED
@@ -1,38 +1,184 @@
1
1
  {
2
2
  "name": "mountly-mcp",
3
- "version": "0.0.0",
4
- "description": "Publish a Mountly widget as an MCP Apps ui:// resource (SEP-1865).",
3
+ "version": "3.1.0",
4
+ "description": "Build MCP Apps (SEP-1865) views from your React, Vue or Svelte components — one build emits the ui:// resource, its sidecar, and the MCP server wiring.",
5
+ "keywords": [
6
+ "chatgpt",
7
+ "claude",
8
+ "mcp",
9
+ "mcp-apps",
10
+ "mcp-ui",
11
+ "model-context-protocol",
12
+ "react",
13
+ "sep-1865",
14
+ "svelte",
15
+ "vite-plugin",
16
+ "vue",
17
+ "widget"
18
+ ],
5
19
  "license": "Apache-2.0",
6
20
  "repository": {
7
21
  "type": "git",
8
22
  "url": "https://github.com/jagreehal/mountly",
9
- "directory": "packages/adapters/mountly-mcp"
23
+ "directory": "packages/mcp-apps"
10
24
  },
25
+ "bin": {
26
+ "mountly-mcp": "./dist/cli.js"
27
+ },
28
+ "files": [
29
+ "dist"
30
+ ],
11
31
  "type": "module",
12
32
  "main": "./dist/index.js",
13
33
  "types": "./dist/index.d.ts",
14
34
  "exports": {
15
- ".": { "import": "./dist/index.js", "types": "./dist/index.d.ts" },
16
- "./build": { "import": "./dist/build/index.js", "types": "./dist/build/index.d.ts" },
17
- "./bridge": { "import": "./dist/bridge/index.js", "types": "./dist/bridge/index.d.ts" },
18
- "./bridge/iframe-entry.js": "./dist/bridge/iframe-entry.js"
35
+ ".": {
36
+ "types": "./dist/index.d.ts",
37
+ "import": "./dist/index.js"
38
+ },
39
+ "./build": {
40
+ "types": "./dist/build/index.d.ts",
41
+ "import": "./dist/build/index.js"
42
+ },
43
+ "./artifact": {
44
+ "types": "./dist/artifact/index.d.ts",
45
+ "import": "./dist/artifact/index.js"
46
+ },
47
+ "./bridge": {
48
+ "types": "./dist/bridge/index.d.ts",
49
+ "import": "./dist/bridge/index.js"
50
+ },
51
+ "./bridge/iframe-entry.js": "./dist/bridge/iframe-entry.js",
52
+ "./react": {
53
+ "types": "./dist/react/index.d.ts",
54
+ "import": "./dist/react/index.js"
55
+ },
56
+ "./server": {
57
+ "types": "./dist/server/index.d.ts",
58
+ "import": "./dist/server/index.js"
59
+ },
60
+ "./json-render": {
61
+ "types": "./dist/json-render/index.d.ts",
62
+ "import": "./dist/json-render/index.js"
63
+ },
64
+ "./json-render/server": {
65
+ "types": "./dist/json-render/server.d.ts",
66
+ "import": "./dist/json-render/server.js"
67
+ },
68
+ "./json-render/app": {
69
+ "types": "./dist/json-render/app.d.ts",
70
+ "import": "./dist/json-render/app.js"
71
+ },
72
+ "./json-render/mcp": {
73
+ "types": "./dist/json-render/mcp.d.ts",
74
+ "import": "./dist/json-render/mcp.js"
75
+ },
76
+ "./vue": {
77
+ "types": "./dist/vue/index.d.ts",
78
+ "import": "./dist/vue/index.js"
79
+ },
80
+ "./svelte": {
81
+ "types": "./dist/svelte/index.d.ts",
82
+ "import": "./dist/svelte/index.js"
83
+ },
84
+ "./vite": {
85
+ "types": "./dist/vite/index.d.ts",
86
+ "import": "./dist/vite/index.js"
87
+ },
88
+ "./dev": {
89
+ "types": "./dist/dev/index.d.ts",
90
+ "import": "./dist/dev/index.js"
91
+ },
92
+ "./dev/host-entry.js": "./dist/dev/host-entry.js",
93
+ "./dev/sandbox-entry.js": "./dist/dev/sandbox-entry.js",
94
+ "./sandbox": {
95
+ "types": "./dist/sandbox/index.d.ts",
96
+ "import": "./dist/sandbox/index.js"
97
+ },
98
+ "./testing": {
99
+ "types": "./dist/testing/index.d.ts",
100
+ "import": "./dist/testing/index.js"
101
+ }
19
102
  },
20
- "files": ["dist"],
21
- "publishConfig": { "access": "public" },
22
- "scripts": {
23
- "build": "tsup",
24
- "typecheck": "tsc --noEmit",
25
- "dev": "tsup --watch"
26
- },
27
- "peerDependencies": {
28
- "mountly": "^0.2.2"
103
+ "publishConfig": {
104
+ "access": "public"
29
105
  },
30
106
  "dependencies": {
31
- "@modelcontextprotocol/ext-apps": "^1.7.1"
107
+ "@modelcontextprotocol/ext-apps": "^1.7.5",
108
+ "@modelcontextprotocol/sdk": "^1.30.0",
109
+ "zod": "^4.4.3"
32
110
  },
33
111
  "devDependencies": {
34
- "mountly": "^0.2.2",
112
+ "@json-render/core": "0.20.0",
113
+ "@json-render/react": "0.20.0",
114
+ "@testing-library/react": "^16.3.2",
115
+ "@types/react": "^19.2.18",
116
+ "@types/react-dom": "^19.2.4",
117
+ "ai": "6.0.208",
118
+ "axe-core": "4.13.0",
119
+ "jsdom": "^30.0.1",
120
+ "mountly": "^0.4.0",
121
+ "react": "^19.2.8",
122
+ "react-dom": "^19.2.8",
35
123
  "tsup": "^8.5.1",
36
- "typescript": "^6.0.3"
124
+ "typescript": "^7.0.2",
125
+ "vite": "^8.1.5",
126
+ "mountly-svelte": "^2.0.3",
127
+ "mountly-react": "^2.0.2",
128
+ "mountly-vue": "^2.0.3"
129
+ },
130
+ "peerDependencies": {
131
+ "@json-render/core": "^0.20.0",
132
+ "@json-render/react": "^0.20.0",
133
+ "ai": "^7.0.65",
134
+ "axe-core": ">=4.10.0",
135
+ "mountly": "^0.4.0",
136
+ "mountly-react": "^2.0.2",
137
+ "mountly-svelte": "^2.0.3",
138
+ "mountly-vue": "^2.0.3",
139
+ "playwright": ">=1.62.1",
140
+ "react": "^19",
141
+ "react-dom": "^19",
142
+ "vite": "^8.2.1"
143
+ },
144
+ "peerDependenciesMeta": {
145
+ "@json-render/core": {
146
+ "optional": true
147
+ },
148
+ "@json-render/react": {
149
+ "optional": true
150
+ },
151
+ "ai": {
152
+ "optional": true
153
+ },
154
+ "mountly-react": {
155
+ "optional": true
156
+ },
157
+ "react": {
158
+ "optional": true
159
+ },
160
+ "react-dom": {
161
+ "optional": true
162
+ },
163
+ "mountly-vue": {
164
+ "optional": true
165
+ },
166
+ "mountly-svelte": {
167
+ "optional": true
168
+ },
169
+ "playwright": {
170
+ "optional": true
171
+ },
172
+ "vite": {
173
+ "optional": true
174
+ },
175
+ "axe-core": {
176
+ "optional": true
177
+ }
178
+ },
179
+ "scripts": {
180
+ "build": "tsup && tsc -p tsconfig.json --noEmit false --declaration --emitDeclarationOnly --declarationMap false --outDir dist",
181
+ "typecheck": "tsc --noEmit",
182
+ "dev": "tsup --watch"
37
183
  }
38
- }
184
+ }