You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Implement various improvements to A2UI and editor app, including Accept/Reject CTAs, MCP tool allowlisting, model selection, and dependency linking. (#1363)
Copy file name to clipboardExpand all lines: samples/mcp/a2ui-in-mcpapps/README.md
+36-8Lines changed: 36 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,7 +6,8 @@ This sample demonstrates a Model Context Protocol (MCP) Application Host that is
6
6
7
7
-**`client/`**: The host container application (Angular). It hosts the outer safe iframe.
8
8
-**`server/`**: The MCP Server (Python/uv) that provides the micro-app resources and tools.
9
-
-**`server/apps/src/`**: The source source code for the server-hosted isolated micro-app.
9
+
-**`server/apps/src/`**: Source code for the **Basic** isolated micro-app.
10
+
-**`server/apps/editor/`**: Source code for the **Editor** isolated micro-app.
10
11
11
12
## Communication Flow
12
13
@@ -50,14 +51,31 @@ sequenceDiagram
50
51
51
52
## Prerequisites
52
53
53
-
-[Node.js](https://nodejs.org/) (runs the client and build scripts)
54
-
-[Python 3.10+](https://www.python.org/) with `uv` (runs the MCP server)
54
+
-[Node.js](https://nodejs.org/) (LTS recommended)
55
+
-[Python 3.10+](https://www.python.org/) with `uv`
56
+
57
+
### ⚠️ IMPORTANT: Pre-build Core Dependencies
58
+
59
+
The sample apps link to local versions of the A2UI SDK. You **must build the core libraries** before attempting to run `npm install` inside any sample subdirectories.
60
+
61
+
Run the following from the repository root:
62
+
63
+
```bash
64
+
# 1. Web Core
65
+
cd renderers/web_core && npm install && npm run build &&cd ../..
66
+
67
+
# 2. Markdown Utilities
68
+
cd renderers/markdown/markdown-it && npm install && npm run build &&cd ../../..
69
+
70
+
# 3. Angular Renderer SDK
71
+
cd renderers/angular && npm install && npm run build &&cd ../..
72
+
```
55
73
56
74
---
57
75
58
76
## Build & Regeneration
59
77
60
-
This sample relies on some generated bundle artifacts. Some are committed for convenience, while others are ignored and must be built.
The server serves single-file HTML artifacts located in `server/apps/public/`. Choose the app you want to build:
95
+
96
+
#### Option A: The Editor App
97
+
98
+
```bash
99
+
cd server/apps/editor
100
+
npm install
101
+
npm run build:all
102
+
```
75
103
76
-
The server serves a bundled `app.html` artifact located in `server/apps/public/app.html`. If you modify the source code in `server/apps/src/`, you must regenerate this list:
104
+
_(Generates `server/apps/public/editor.html`)_
77
105
78
-
Run this in the `server/apps/src/` directory:
106
+
#### Option B: The Basic App
79
107
80
108
```bash
81
109
cd server/apps/src
82
110
npm install
83
111
npm run build:all
84
112
```
85
113
86
-
_(Runs Angular compilation and triggers `node inline.js` to single-file inline it into`server/apps/public/app.html`)_
This application has file-based dependencies on the core A2UI packages which reside elsewhere in this repository. You **must build these packages first** in specific order before this application's `npm install` will succeed.
31
+
32
+
Run the following commands from the **root of the repository**:
33
+
34
+
```bash
35
+
# 1. Build Web Core
36
+
cd renderers/web_core
37
+
npm install
38
+
npm run build
39
+
40
+
# 2. Build Markdown Utilities
41
+
cd renderers/markdown/markdown-it
42
+
npm install
43
+
npm run build
44
+
45
+
# 3. Build Angular Renderer
46
+
cd renderers/angular
47
+
npm install
48
+
npm run build
49
+
50
+
cd ../../
51
+
```
52
+
53
+
---
54
+
55
+
## Local Execution Workflow
56
+
57
+
To execute and run this application locally, you need to build the application bundle, ensure the host environment assets are ready, and then boot the services.
58
+
59
+
### Step 1: Build the Editor App Bundle
60
+
61
+
From inside this directory (`samples/mcp/a2ui-in-mcpapps/server/apps/editor`):
62
+
63
+
```bash
64
+
# Install local package dependencies
65
+
npm install --legacy-peer-deps
66
+
67
+
# Build Angular project AND generate the single self-contained HTML file
68
+
npm run build:all
69
+
```
70
+
71
+
_This outputs the final static artifact into `../public/editor.html` which the Python server reads._
72
+
73
+
### Step 2: Build the Client Host Bridge (Required Once)
74
+
75
+
Navigate to the client host directory and build its security-sandbox bridge:
76
+
77
+
```bash
78
+
cd ../../../client
79
+
npm install
80
+
npm run build:sandbox
81
+
```
82
+
83
+
### Step 3: Run the Full Local Environment
84
+
85
+
Open two terminals to start the stack:
86
+
87
+
#### Terminal A: Run MCP Server (Python)
88
+
89
+
```bash
90
+
cd samples/mcp/a2ui-in-mcpapps/server
91
+
uv sync
92
+
uv run python server.py --transport sse --port 8000
93
+
```
94
+
95
+
#### Terminal B: Run Host Web App (Angular)
96
+
97
+
```bash
98
+
cd samples/mcp/a2ui-in-mcpapps/client
99
+
npm run start
100
+
```
101
+
102
+
#### Access the Application
103
+
104
+
Visit **[http://localhost:4200](http://localhost:4200)** in your browser to load the host container, which will automatically load this Editor app via the MCP server connection.
0 commit comments