@modelcontextprotocol/ext-apps 0.4.1 → 0.4.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/README.md CHANGED
@@ -6,29 +6,33 @@ This repo contains the SDK and [specification](https://github.com/modelcontextpr
6
6
 
7
7
  MCP Apps are a proposed standard inspired by [MCP-UI](https://mcpui.dev/) and [OpenAI's Apps SDK](https://developers.openai.com/apps-sdk/) to allow MCP Servers to display interactive UI elements in conversational MCP clients / chatbots.
8
8
 
9
+ ## Why MCP Apps?
10
+
11
+ MCP tools return text and structured data. That works for many cases, but not when you need an interactive UI, like a chart, form, or video player.
12
+
13
+ MCP Apps provide a standardized way to deliver interactive UIs from MCP servers. Your UI renders inline in the conversation, in context, in any compliant host.
14
+
9
15
  ## How It Works
10
16
 
11
- MCP Apps extend the Model Context Protocol to let servers deliver **interactive UIs** to MCP hosts. Here's how it works:
17
+ MCP Apps extend the Model Context Protocol by letting tools declare UI resources:
12
18
 
13
- 1. **Tool call** — The LLM calls a tool on your server
14
- 2. **UI Resource** — The tool's definition links to a predeclared `ui://` resource containing its HTML interface
19
+ 1. **Tool definition** — Your tool declares a `ui://` resource containing its HTML interface
20
+ 2. **Tool call** — The LLM calls the tool on your server
15
21
  3. **Host renders** — The host fetches the resource and displays it in a sandboxed iframe
16
22
  4. **Bidirectional communication** — The host passes tool data to the UI via notifications, and the UI can call other tools through the host
17
23
 
18
- This enables dashboards, forms, visualizations, and other rich experiences inside chat interfaces.
19
-
20
- ## Overview
24
+ ## Using the SDK
21
25
 
22
26
  This SDK serves two audiences:
23
27
 
24
- ### App Developers
28
+ ### For App Developers
25
29
 
26
30
  Build interactive UIs that run inside MCP-enabled chat clients.
27
31
 
28
32
  - **SDK for Apps**: `@modelcontextprotocol/ext-apps` — [API Docs](https://modelcontextprotocol.github.io/ext-apps/api/modules/app.html)
29
33
  - **React hooks**: `@modelcontextprotocol/ext-apps/react` — [API Docs](https://modelcontextprotocol.github.io/ext-apps/api/modules/_modelcontextprotocol_ext-apps_react.html)
30
34
 
31
- ### Host Developers
35
+ ### For Host Developers
32
36
 
33
37
  Embed and communicate with MCP Apps in your chat application.
34
38
 
@@ -44,50 +48,284 @@ We have [contributed a tentative implementation](https://github.com/MCP-UI-Org/m
44
48
  npm install -S @modelcontextprotocol/ext-apps
45
49
  ```
46
50
 
47
- Or edit your `package.json` manually:
51
+ ### Install Agent Skills
52
+
53
+ This repository provides two [Agent Skills](https://agentskills.io/) for building MCP Apps. You can install the skills as a Claude Code plugin:
48
54
 
49
- ```json
50
- {
51
- "dependencies": {
52
- "@modelcontextprotocol/ext-apps": "^0.0.1"
53
- }
54
- }
55
55
  ```
56
+ /plugin marketplace add modelcontextprotocol/ext-apps
57
+ /plugin install mcp-apps@modelcontextprotocol-ext-apps
58
+ ```
59
+
60
+ For more information, including instructions for installing the skills in your favorite AI coding agent, see the [agent skills guide](./docs/agent-skills.md).
56
61
 
57
62
  ## Examples
58
63
 
64
+ The [`examples/`](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples) directory contains demo apps showcasing real-world use cases.
65
+
59
66
  <!-- prettier-ignore-start -->
60
67
  | | | |
61
68
  |:---:|:---:|:---:|
62
- | [![Map](examples/map-server/grid-cell.png "Interactive 3D globe viewer using CesiumJS")](examples/map-server) | [![Three.js](examples/threejs-server/grid-cell.png "Interactive 3D scene renderer")](examples/threejs-server) | [![ShaderToy](examples/shadertoy-server/grid-cell.png "Real-time GLSL shader renderer")](examples/shadertoy-server) |
63
- | [**Map**](examples/map-server) | [**Three.js**](examples/threejs-server) | [**ShaderToy**](examples/shadertoy-server) |
64
- | [![Sheet Music](examples/sheet-music-server/grid-cell.png "ABC notation to sheet music")](examples/sheet-music-server) | [![Wiki Explorer](examples/wiki-explorer-server/grid-cell.png "Wikipedia link graph visualization")](examples/wiki-explorer-server) | [![Cohort Heatmap](examples/cohort-heatmap-server/grid-cell.png "Customer retention heatmap")](examples/cohort-heatmap-server) |
65
- | [**Sheet Music**](examples/sheet-music-server) | [**Wiki Explorer**](examples/wiki-explorer-server) | [**Cohort Heatmap**](examples/cohort-heatmap-server) |
66
- | [![Scenario Modeler](examples/scenario-modeler-server/grid-cell.png "SaaS business projections")](examples/scenario-modeler-server) | [![Budget Allocator](examples/budget-allocator-server/grid-cell.png "Interactive budget allocation")](examples/budget-allocator-server) | [![Customer Segmentation](examples/customer-segmentation-server/grid-cell.png "Scatter chart with clustering")](examples/customer-segmentation-server) |
67
- | [**Scenario Modeler**](examples/scenario-modeler-server) | [**Budget Allocator**](examples/budget-allocator-server) | [**Customer Segmentation**](examples/customer-segmentation-server) |
68
- | [![System Monitor](examples/system-monitor-server/grid-cell.png "Real-time OS metrics")](examples/system-monitor-server) | [![Transcript](examples/transcript-server/grid-cell.png "Live speech transcription")](examples/transcript-server) | [![Video Resource](examples/video-resource-server/grid-cell.png "Binary video via MCP resources")](examples/video-resource-server) |
69
- | [**System Monitor**](examples/system-monitor-server) | [**Transcript**](examples/transcript-server) | [**Video Resource**](examples/video-resource-server) |
70
- | [![PDF Server](examples/pdf-server/grid-cell.png "Interactive PDF viewer with chunked loading")](examples/pdf-server) | [![QR Code](examples/qr-server/grid-cell.png "QR code generator")](examples/qr-server) | |
71
- | [**PDF Server**](examples/pdf-server) | [**QR Code (Python)**](examples/qr-server) | |
69
+ | [![Map](examples/map-server/grid-cell.png "Interactive 3D globe viewer using CesiumJS")](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/map-server) | [![Three.js](examples/threejs-server/grid-cell.png "Interactive 3D scene renderer")](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/threejs-server) | [![ShaderToy](examples/shadertoy-server/grid-cell.png "Real-time GLSL shader renderer")](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/shadertoy-server) |
70
+ | [**Map**](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/map-server) | [**Three.js**](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/threejs-server) | [**ShaderToy**](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/shadertoy-server) |
71
+ | [![Sheet Music](examples/sheet-music-server/grid-cell.png "ABC notation to sheet music")](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/sheet-music-server) | [![Wiki Explorer](examples/wiki-explorer-server/grid-cell.png "Wikipedia link graph visualization")](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/wiki-explorer-server) | [![Cohort Heatmap](examples/cohort-heatmap-server/grid-cell.png "Customer retention heatmap")](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/cohort-heatmap-server) |
72
+ | [**Sheet Music**](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/sheet-music-server) | [**Wiki Explorer**](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/wiki-explorer-server) | [**Cohort Heatmap**](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/cohort-heatmap-server) |
73
+ | [![Scenario Modeler](examples/scenario-modeler-server/grid-cell.png "SaaS business projections")](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/scenario-modeler-server) | [![Budget Allocator](examples/budget-allocator-server/grid-cell.png "Interactive budget allocation")](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/budget-allocator-server) | [![Customer Segmentation](examples/customer-segmentation-server/grid-cell.png "Scatter chart with clustering")](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/customer-segmentation-server) |
74
+ | [**Scenario Modeler**](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/scenario-modeler-server) | [**Budget Allocator**](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/budget-allocator-server) | [**Customer Segmentation**](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/customer-segmentation-server) |
75
+ | [![System Monitor](examples/system-monitor-server/grid-cell.png "Real-time OS metrics")](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/system-monitor-server) | [![Transcript](examples/transcript-server/grid-cell.png "Live speech transcription")](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/transcript-server) | [![Video Resource](examples/video-resource-server/grid-cell.png "Binary video via MCP resources")](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/video-resource-server) |
76
+ | [**System Monitor**](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/system-monitor-server) | [**Transcript**](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/transcript-server) | [**Video Resource**](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/video-resource-server) |
77
+ | [![PDF Server](examples/pdf-server/grid-cell.png "Interactive PDF viewer with chunked loading")](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/pdf-server) | [![QR Code](examples/qr-server/grid-cell.png "QR code generator")](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/qr-server) | [![Say Demo](examples/say-server/grid-cell.png "Text-to-speech demo")](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/say-server) |
78
+ | [**PDF Server**](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/pdf-server) | [**QR Code (Python)**](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/qr-server) | [**Say Demo**](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/say-server) |
72
79
 
73
80
  ### Starter Templates
74
81
 
75
82
  | | |
76
83
  |:---:|:---|
77
- | [![Basic](examples/basic-server-react/grid-cell.png "Starter template")](examples/basic-server-react) | The same app built with different frameworks — pick your favorite!<br><br>[React](examples/basic-server-react) · [Vue](examples/basic-server-vue) · [Svelte](examples/basic-server-svelte) · [Preact](examples/basic-server-preact) · [Solid](examples/basic-server-solid) · [Vanilla JS](examples/basic-server-vanillajs) |
84
+ | [![Basic](examples/basic-server-react/grid-cell.png "Starter template")](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/basic-server-react) | The same app built with different frameworks — pick your favorite!<br><br>[React](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/basic-server-react) · [Vue](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/basic-server-vue) · [Svelte](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/basic-server-svelte) · [Preact](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/basic-server-preact) · [Solid](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/basic-server-solid) · [Vanilla JS](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/basic-server-vanillajs) |
78
85
  <!-- prettier-ignore-end -->
79
86
 
80
- The [`examples/`](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples) directory contains additional demo apps showcasing real-world use cases.
87
+ ### Running the Examples
81
88
 
82
- To run all examples:
89
+ #### With basic-host
90
+
91
+ To run all examples locally using [basic-host](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/basic-host) (the reference host implementation included in this repo):
83
92
 
84
93
  ```bash
94
+ git clone https://github.com/modelcontextprotocol/ext-apps.git
95
+ cd ext-apps
85
96
  npm install
86
97
  npm start
87
98
  ```
88
99
 
89
100
  Then open http://localhost:8080/.
90
101
 
102
+ #### With MCP Clients
103
+
104
+ To use these examples with MCP clients that support the stdio transport (such as Claude Desktop or VS Code), add this MCP server configuration to your client's settings:
105
+
106
+ <details>
107
+ <summary>MCP client configuration for all examples (using stdio)</summary>
108
+
109
+ ```json
110
+ {
111
+ "mcpServers": {
112
+ "basic-react": {
113
+ "command": "npx",
114
+ "args": [
115
+ "-y",
116
+ "--silent",
117
+ "--registry=https://registry.npmjs.org/",
118
+ "@modelcontextprotocol/server-basic-react",
119
+ "--stdio"
120
+ ]
121
+ },
122
+ "basic-vanillajs": {
123
+ "command": "npx",
124
+ "args": [
125
+ "-y",
126
+ "--silent",
127
+ "--registry=https://registry.npmjs.org/",
128
+ "@modelcontextprotocol/server-basic-vanillajs",
129
+ "--stdio"
130
+ ]
131
+ },
132
+ "basic-vue": {
133
+ "command": "npx",
134
+ "args": [
135
+ "-y",
136
+ "--silent",
137
+ "--registry=https://registry.npmjs.org/",
138
+ "@modelcontextprotocol/server-basic-vue",
139
+ "--stdio"
140
+ ]
141
+ },
142
+ "basic-svelte": {
143
+ "command": "npx",
144
+ "args": [
145
+ "-y",
146
+ "--silent",
147
+ "--registry=https://registry.npmjs.org/",
148
+ "@modelcontextprotocol/server-basic-svelte",
149
+ "--stdio"
150
+ ]
151
+ },
152
+ "basic-preact": {
153
+ "command": "npx",
154
+ "args": [
155
+ "-y",
156
+ "--silent",
157
+ "--registry=https://registry.npmjs.org/",
158
+ "@modelcontextprotocol/server-basic-preact",
159
+ "--stdio"
160
+ ]
161
+ },
162
+ "basic-solid": {
163
+ "command": "npx",
164
+ "args": [
165
+ "-y",
166
+ "--silent",
167
+ "--registry=https://registry.npmjs.org/",
168
+ "@modelcontextprotocol/server-basic-solid",
169
+ "--stdio"
170
+ ]
171
+ },
172
+ "budget-allocator": {
173
+ "command": "npx",
174
+ "args": [
175
+ "-y",
176
+ "--silent",
177
+ "--registry=https://registry.npmjs.org/",
178
+ "@modelcontextprotocol/server-budget-allocator",
179
+ "--stdio"
180
+ ]
181
+ },
182
+ "cohort-heatmap": {
183
+ "command": "npx",
184
+ "args": [
185
+ "-y",
186
+ "--silent",
187
+ "--registry=https://registry.npmjs.org/",
188
+ "@modelcontextprotocol/server-cohort-heatmap",
189
+ "--stdio"
190
+ ]
191
+ },
192
+ "customer-segmentation": {
193
+ "command": "npx",
194
+ "args": [
195
+ "-y",
196
+ "--silent",
197
+ "--registry=https://registry.npmjs.org/",
198
+ "@modelcontextprotocol/server-customer-segmentation",
199
+ "--stdio"
200
+ ]
201
+ },
202
+ "map": {
203
+ "command": "npx",
204
+ "args": [
205
+ "-y",
206
+ "--silent",
207
+ "--registry=https://registry.npmjs.org/",
208
+ "@modelcontextprotocol/server-map",
209
+ "--stdio"
210
+ ]
211
+ },
212
+ "pdf": {
213
+ "command": "npx",
214
+ "args": [
215
+ "-y",
216
+ "--silent",
217
+ "--registry=https://registry.npmjs.org/",
218
+ "@modelcontextprotocol/server-pdf",
219
+ "--stdio"
220
+ ]
221
+ },
222
+ "scenario-modeler": {
223
+ "command": "npx",
224
+ "args": [
225
+ "-y",
226
+ "--silent",
227
+ "--registry=https://registry.npmjs.org/",
228
+ "@modelcontextprotocol/server-scenario-modeler",
229
+ "--stdio"
230
+ ]
231
+ },
232
+ "shadertoy": {
233
+ "command": "npx",
234
+ "args": [
235
+ "-y",
236
+ "--silent",
237
+ "--registry=https://registry.npmjs.org/",
238
+ "@modelcontextprotocol/server-shadertoy",
239
+ "--stdio"
240
+ ]
241
+ },
242
+ "sheet-music": {
243
+ "command": "npx",
244
+ "args": [
245
+ "-y",
246
+ "--silent",
247
+ "--registry=https://registry.npmjs.org/",
248
+ "@modelcontextprotocol/server-sheet-music",
249
+ "--stdio"
250
+ ]
251
+ },
252
+ "system-monitor": {
253
+ "command": "npx",
254
+ "args": [
255
+ "-y",
256
+ "--silent",
257
+ "--registry=https://registry.npmjs.org/",
258
+ "@modelcontextprotocol/server-system-monitor",
259
+ "--stdio"
260
+ ]
261
+ },
262
+ "threejs": {
263
+ "command": "npx",
264
+ "args": [
265
+ "-y",
266
+ "--silent",
267
+ "--registry=https://registry.npmjs.org/",
268
+ "@modelcontextprotocol/server-threejs",
269
+ "--stdio"
270
+ ]
271
+ },
272
+ "transcript": {
273
+ "command": "npx",
274
+ "args": [
275
+ "-y",
276
+ "--silent",
277
+ "--registry=https://registry.npmjs.org/",
278
+ "@modelcontextprotocol/server-transcript",
279
+ "--stdio"
280
+ ]
281
+ },
282
+ "video-resource": {
283
+ "command": "npx",
284
+ "args": [
285
+ "-y",
286
+ "--silent",
287
+ "--registry=https://registry.npmjs.org/",
288
+ "@modelcontextprotocol/server-video-resource",
289
+ "--stdio"
290
+ ]
291
+ },
292
+ "wiki-explorer": {
293
+ "command": "npx",
294
+ "args": [
295
+ "-y",
296
+ "--silent",
297
+ "--registry=https://registry.npmjs.org/",
298
+ "@modelcontextprotocol/server-wiki-explorer",
299
+ "--stdio"
300
+ ]
301
+ },
302
+ "qr": {
303
+ "command": "uv",
304
+ "args": [
305
+ "run",
306
+ "/path/to/ext-apps/examples/qr-server/server.py",
307
+ "--stdio"
308
+ ]
309
+ },
310
+ "say": {
311
+ "command": "uv",
312
+ "args": [
313
+ "run",
314
+ "--default-index",
315
+ "https://pypi.org/simple",
316
+ "https://raw.githubusercontent.com/modelcontextprotocol/ext-apps/refs/heads/main/examples/say-server/server.py",
317
+ "--stdio"
318
+ ]
319
+ }
320
+ }
321
+ }
322
+ ```
323
+
324
+ </details>
325
+
326
+ > [!NOTE]
327
+ > The `qr` server requires cloning the repository first. See [qr-server README](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/qr-server) for details.
328
+
91
329
  ## Resources
92
330
 
93
331
  - [Quickstart Guide](https://modelcontextprotocol.github.io/ext-apps/api/documents/Quickstart.html)
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Type-checked code examples for the patterns documentation.
3
+ *
4
+ * These examples are included in {@link ./patterns.md} via `@includeCode` tags.
5
+ * Each function's region markers define the code snippet that appears in the docs.
6
+ *
7
+ * @module
8
+ */
9
+ export {};