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
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for describing the origin of the Work and
141
+ reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Support. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or support.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 Jag Reehal
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
200
+ implied. See the License for the specific language governing permissions
201
+ and limitations under the License.
package/README.md CHANGED
@@ -1,36 +1,274 @@
1
1
  # mountly-mcp
2
2
 
3
- Bridge runtime and build helpers for publishing mountly widgets as MCP Apps `ui://` resources.
3
+ **Build MCP Apps from the components you already have — in React, Vue, or Svelte.**
4
4
 
5
- ## Exports
5
+ [MCP Apps](https://github.com/modelcontextprotocol/ext-apps) (SEP-1865) lets an
6
+ MCP server render interactive UI inside Claude, ChatGPT and other hosts. The
7
+ official SDK gives you the protocol and expects you to hand-write the view.
8
+ `mountly-mcp` starts from a component instead:
9
+
10
+ ```ts
11
+ import { createMcpWidget } from "mountly-mcp/vue";
12
+ import Dashboard from "./Dashboard.vue";
13
+
14
+ (globalThis as { __mountlyMcpWidget__?: unknown }).__mountlyMcpWidget__ =
15
+ createMcpWidget(Dashboard);
16
+ ```
6
17
 
7
- - `runBridge` from `mountly-mcp` (iframe runtime lifecycle)
8
- - `buildMcpResource` from `mountly-mcp/build` (emit `html` + `.meta.json` sidecar)
9
- - `createMcpHost` and channel helpers from `mountly-mcp/bridge`
18
+ `mountly-mcp build` turns that into a versioned App manifest containing one or
19
+ many `ui://` resources. `registerMcpApps` installs them into the MCP server your
20
+ application already owns. Your component is unchanged, and the same one can
21
+ keep running on your website.
10
22
 
11
- ## Build a resource
23
+ **If you're on React and starting from scratch**, the official
24
+ [`@modelcontextprotocol/ext-apps`](https://www.npmjs.com/package/@modelcontextprotocol/ext-apps)
25
+ skills are the shorter path — this package is worth it when you have existing
26
+ components, a Vite build, or a framework other than React.
27
+
28
+ The wire protocol is delegated to the official `@modelcontextprotocol/sdk` and
29
+ `@modelcontextprotocol/ext-apps` packages in full, so server transports,
30
+ handshakes, capabilities and message types track the spec rather than a
31
+ reimplementation of it. Both are runtime dependencies of `mountly-mcp`.
32
+
33
+ ## Install
34
+
35
+ ```bash
36
+ npm install mountly-mcp mountly
37
+ npm install mountly-vue # or mountly-react / mountly-svelte
38
+ ```
39
+
40
+ Install `@modelcontextprotocol/sdk` directly only when your application imports
41
+ its APIs itself, for example to configure a custom HTTP transport. Mountly's
42
+ server entry point does not require a separate SDK install.
43
+
44
+ ## One build, one command
12
45
 
13
46
  ```ts
14
- import { buildMcpResource } from "mountly-mcp/build";
15
-
16
- await buildMcpResource({
17
- entry: "./dist/widget.js",
18
- uri: "ui://example/hello",
19
- name: "hello-widget",
20
- output: "./dist/hello.html",
21
- awaitToolResult: true,
47
+ // vite.config.ts
48
+ import vue from "@vitejs/plugin-vue";
49
+ import { mountlyMcpWidget } from "mountly-mcp/vite";
50
+
51
+ export default defineConfig({
52
+ plugins: [
53
+ vue(),
54
+ mountlyMcpWidget({
55
+ apps: [
56
+ {
57
+ entry: "src/dashboard.ts",
58
+ uri: "ui://weather-server/dashboard",
59
+ name: "weather_dashboard",
60
+ displayModes: ["inline", "fullscreen"],
61
+ csp: { connectDomains: ["https://api.weather.com"] },
62
+ },
63
+ {
64
+ entry: "src/settings.ts",
65
+ uri: "ui://weather-server/settings",
66
+ name: "weather_settings",
67
+ },
68
+ ],
69
+ }),
70
+ ],
22
71
  });
23
72
  ```
24
73
 
25
- This writes:
74
+ ```bash
75
+ npx mountly-mcp build
76
+ ```
77
+
78
+ Each View is built in an isolated Vite environment and emitted as self-contained
79
+ HTML with a transitional `.meta.json` file. The canonical
80
+ `dist/mountly-mcp.manifest.json` gives build, dev, registration, and CI one
81
+ versioned artifact contract. The original single-View plugin shape and
82
+ `vite build` remain supported.
83
+
84
+ ## One command to develop it
85
+
86
+ ```bash
87
+ npx mountly-mcp dev
88
+ # multi-View project
89
+ npx mountly-mcp dev --app weather_dashboard
90
+ ```
26
91
 
27
- - `./dist/hello.html`
28
- - `./dist/hello.html.meta.json`
92
+ Builds the widget, serves it in a local MCP Apps host, and rebuilds on save.
93
+ Config comes from the plugin already in your vite config.
94
+
95
+ It's a real host, not a preview: the published official `AppBridge` drives the
96
+ handshake and host behavior, while Mountly supplies two origins and a sandbox
97
+ proxy enforcing the CSP and permissions the App artifact declares. Sample tool
98
+ results come from `mcp.fixtures.json`,
99
+ one button each, so clicking between them exercises the update path:
100
+
101
+ ```json
102
+ { "annual": { "total": 99 }, "monthly": { "total": 12 } }
103
+ ```
104
+
105
+ Add `--server ./server.js` (a module default-exporting your server) and the
106
+ fixtures become tool _arguments_ instead: the view renders what your handler
107
+ really returns, and the tool calls the view makes itself are routed there too.
108
+
109
+ ## Install into your production server
110
+
111
+ ```ts
112
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
113
+ import { readMcpAppManifest } from "mountly-mcp/artifact";
114
+ import { registerMcpApps } from "mountly-mcp/server";
115
+
116
+ const server = new McpServer(
117
+ { name: "weather-server", version: "1.0.0" },
118
+ { capabilities: { tools: {}, resources: {} } },
119
+ );
120
+ const { artifacts } = await readMcpAppManifest("dist/mountly-mcp.manifest.json");
121
+
122
+ await registerMcpApps(server, {
123
+ views: artifacts.map((artifact) => ({ artifact })),
124
+ tools: [
125
+ {
126
+ name: "get_weather",
127
+ resourceUri: "ui://weather-server/dashboard",
128
+ config: {
129
+ inputSchema: { type: "object", properties: { location: { type: "string" } } },
130
+ },
131
+ handler: async ({ location }) => ({ structuredContent: { location, temperature: 72 } }),
132
+ },
133
+ ],
134
+ });
135
+ ```
136
+
137
+ Call `registerMcpApps` before connecting the server. Your application retains
138
+ ownership of authentication, transport, prompts, non-UI tools, lifecycle, and
139
+ deployment. Views and tools are independent, so several tools can link to one
140
+ View and app-only tools use `visibility: "app"`. Mountly negotiates the UI
141
+ extension and degrades to text-only model tools for hosts without MCP Apps.
142
+
143
+ `createMcpAppServer` and `serveStdio` remain as convenience adapters for small
144
+ servers and existing projects.
145
+
146
+ ## Verify in CI
147
+
148
+ ```bash
149
+ npx mountly-mcp verify
150
+ npx mountly-mcp verify --strict
151
+ npx mountly-mcp verify --render --strict
152
+ ```
29
153
 
30
- Use these with `mountly-mcp-server`.
154
+ Static verification is deterministic and offline. `--render` additionally
155
+ launches Chromium, waits for the explicit bridge mount state, and rejects Views
156
+ that time out, throw, or mount without content. Errors always fail; advisory
157
+ warnings fail only under `--strict`. The same engine is exported as
158
+ `verifyMcpApps()` from `mountly-mcp/testing` for custom test runners. Install
159
+ Playwright and Chromium for the browser tier.
160
+
161
+ ## Reading tool data in a view
162
+
163
+ The bridge exposes `mcp`, `toolInput`, `toolResult`, and `hostContext`. React
164
+ and Vue consume those bridge props in their wrapper and expose them through
165
+ hooks/composables, leaving the existing component's props unchanged. Svelte
166
+ receives them directly as component props:
167
+
168
+ ```tsx
169
+ // React
170
+ const result = useToolResult<{ structuredContent?: Quote }>();
171
+ const quote = result?.structuredContent;
172
+ useHostStyles(); // adopt the host's theme variables and fonts
173
+ ```
174
+
175
+ ```ts
176
+ // Vue
177
+ const result = useToolResult<{ structuredContent?: Quote }>(); // a ref
178
+ const quote = computed(() => result.value?.structuredContent);
179
+ ```
180
+
181
+ Svelte reads the props directly via `$props()` — see `mountly-mcp/svelte`.
182
+
183
+ ## json-render MCP Apps integration
184
+
185
+ Mountly now exposes a first-class json-render MCP facade so catalog-driven UIs
186
+ can be shipped as MCP Apps with minimal protocol code:
187
+
188
+ ```ts
189
+ import { createJsonRenderMcpApp } from "mountly-mcp/json-render/mcp";
190
+ import { catalog } from "./catalog.js";
191
+ import { html } from "./dist/app-html.js";
192
+
193
+ const app = createJsonRenderMcpApp({
194
+ name: "json-render-dashboard",
195
+ version: "1.0.0",
196
+ catalog,
197
+ html,
198
+ tool: {
199
+ name: "render_ui",
200
+ title: "Render UI",
201
+ description: "Render an interactive dashboard from a json-render spec.",
202
+ resourceUri: "ui://json-render-dashboard/view.html",
203
+ },
204
+ });
205
+ ```
206
+
207
+ For iframe-side React hosts, use `mountly-mcp/json-render/app`:
208
+
209
+ ```tsx
210
+ import { useJsonRenderApp } from "mountly-mcp/json-render/app";
211
+
212
+ function View() {
213
+ const { spec, loading, connected, error } = useJsonRenderApp({
214
+ name: "json-render-dashboard",
215
+ version: "1.0.0",
216
+ });
217
+
218
+ if (error) return <div>{error.message}</div>;
219
+ if (!connected || loading || !spec) return <div>Waiting…</div>;
220
+ return <pre>{JSON.stringify(spec, null, 2)}</pre>;
221
+ }
222
+ ```
223
+
224
+ `buildAppHtml({ title, js, css })` is also exported from
225
+ `mountly-mcp/json-render/app` to generate a self-contained HTML resource.
226
+
227
+ ### Interoperability with `@json-render/mcp`
228
+
229
+ Mountly's facade is wire-compatible with [`@json-render/mcp`](https://www.npmjs.com/package/@json-render/mcp) in both
230
+ directions, so you can mix the two without a bridge:
231
+
232
+ - **Tool input** is `{ spec }`, typed from `catalog.zodSchema()`, and the tool
233
+ description carries `catalog.prompt()` — the model sees the full component
234
+ vocabulary.
235
+ - **Tool output** carries the spec twice: as JSON in `content[0].text` (the
236
+ shape `@json-render/mcp`'s iframe hook reads) and as `structuredContent.spec`
237
+ (what Mountly's own hosts read).
238
+ - **`useJsonRenderApp`** reads either shape, so an iframe built with Mountly
239
+ renders a `@json-render/mcp` server unchanged, and vice versa.
240
+
241
+ One deliberate difference: `@json-render/core` 0.19 generates a _strict_ catalog
242
+ schema that requires `visible` and `children` on every element, which rejects
243
+ most first-attempt model output at the SDK's input gate. Mountly accepts the
244
+ catalog schema **or** a looser spec shape, then validates in the handler and
245
+ renders what it can. Drop the loose branch once core relaxes those fields.
246
+
247
+ ## Exports
248
+
249
+ | Entry | What's in it |
250
+ | ---------------------- | -------------------------------------------------------- |
251
+ | `mountly-mcp` | `runBridge`, spec types re-exported from ext-apps |
252
+ | `mountly-mcp/react` | `createMcpWidget` + hooks |
253
+ | `mountly-mcp/vue` | `createMcpWidget` + composables |
254
+ | `mountly-mcp/svelte` | `createMcpWidget` (props-based) |
255
+ | `mountly-mcp/vite` | single- and multi-View `mountlyMcpWidget()` build plugin |
256
+ | `mountly-mcp/artifact` | versioned manifest and App artifact APIs |
257
+ | `mountly-mcp/dev` | `startDevHost()` and in-process server connectivity |
258
+ | `mountly-mcp/build` | `buildMcpResource` for other bundlers |
259
+ | `mountly-mcp/server` | `registerMcpApps` plus convenience server adapters |
260
+ | `mountly-mcp/testing` | static/browser conformance and report formatting |
261
+
262
+ Types use the spec's own names (`McpUiHostContext`, `McpUiDisplayMode`, …) —
263
+ one vocabulary, no translation layer.
264
+
265
+ ## Agent Skill
266
+
267
+ Ask your coding agent for an MCP App and let it scaffold:
268
+ [`plugins/mountly-mcp/skills/create-mcp-widget`](../../../plugins/mountly-mcp/skills/create-mcp-widget/SKILL.md).
31
269
 
32
270
  ## See also
33
271
 
272
+ - [`docs/examples/mcp-app-demo`](../../../docs/examples/mcp-app-demo) — full demo
273
+ with a sandbox-proxy preview host and an out-of-process stdio check
34
274
  - `docs/how-to-test.md`
35
- - `examples/mcp-app-demo/README.md`
36
-
@@ -0,0 +1,49 @@
1
+ import { LATEST_PROTOCOL_VERSION } from "@modelcontextprotocol/ext-apps";
2
+ import type { McpResourceDeclaration } from "../types.js";
3
+ export declare const MCP_APP_MANIFEST_VERSION: 1;
4
+ export declare const MCP_APP_MANIFEST_FILE = "mountly-mcp.manifest.json";
5
+ export interface McpAppArtifact {
6
+ /** Developer-facing unique key. */
7
+ name: string;
8
+ /** Protocol identity. */
9
+ uri: string;
10
+ /** Absolute path to the self-contained View HTML. */
11
+ htmlPath: string;
12
+ /** Absolute path to the transitional per-View sidecar. */
13
+ metaPath: string;
14
+ declaration: McpResourceDeclaration;
15
+ }
16
+ export interface McpAppManifestEntry {
17
+ name: string;
18
+ uri: string;
19
+ /** Path relative to the manifest, unless explicitly absolute. */
20
+ html: string;
21
+ /** Path relative to the manifest, unless explicitly absolute. */
22
+ meta: string;
23
+ declaration: McpResourceDeclaration;
24
+ }
25
+ export interface McpAppManifest {
26
+ formatVersion: typeof MCP_APP_MANIFEST_VERSION;
27
+ protocolVersion: typeof LATEST_PROTOCOL_VERSION;
28
+ apps: ReadonlyArray<McpAppManifestEntry>;
29
+ }
30
+ export type ConformanceSeverity = "error" | "warning";
31
+ export interface ConformanceDiagnostic {
32
+ severity: ConformanceSeverity;
33
+ code: string;
34
+ message: string;
35
+ source?: string;
36
+ }
37
+ export declare class McpAppConformanceError extends Error {
38
+ readonly diagnostics: ReadonlyArray<ConformanceDiagnostic>;
39
+ constructor(diagnostics: ReadonlyArray<ConformanceDiagnostic>);
40
+ }
41
+ export declare function inspectMcpResourceDeclaration(value: unknown, source?: string): ReadonlyArray<ConformanceDiagnostic>;
42
+ export declare function parseMcpResourceDeclaration(value: unknown, source?: string): McpResourceDeclaration;
43
+ export declare function readMcpAppArtifact(htmlPath: string, expectedUri?: string): Promise<McpAppArtifact>;
44
+ export declare function writeMcpAppManifest(path: string, artifacts: ReadonlyArray<McpAppArtifact>): Promise<McpAppManifest>;
45
+ export declare function readMcpAppManifest(path: string): Promise<{
46
+ path: string;
47
+ manifest: McpAppManifest;
48
+ artifacts: ReadonlyArray<McpAppArtifact>;
49
+ }>;
@@ -0,0 +1,21 @@
1
+ import {
2
+ MCP_APP_MANIFEST_FILE,
3
+ MCP_APP_MANIFEST_VERSION,
4
+ McpAppConformanceError,
5
+ inspectMcpResourceDeclaration,
6
+ parseMcpResourceDeclaration,
7
+ readMcpAppArtifact,
8
+ readMcpAppManifest,
9
+ writeMcpAppManifest
10
+ } from "../chunk-DKK26TRS.js";
11
+ export {
12
+ MCP_APP_MANIFEST_FILE,
13
+ MCP_APP_MANIFEST_VERSION,
14
+ McpAppConformanceError,
15
+ inspectMcpResourceDeclaration,
16
+ parseMcpResourceDeclaration,
17
+ readMcpAppArtifact,
18
+ readMcpAppManifest,
19
+ writeMcpAppManifest
20
+ };
21
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1 @@
1
+ export {};