Skip to content

Commit c19fdfb

Browse files
committed
Merge origin/main into ochafik/double-tag-capabilities
2 parents fcb5e54 + 1003c17 commit c19fdfb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+5197
-1697
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,12 @@ jobs:
5656
npm run generate:schemas
5757
git diff --exit-code src/generated/ || (echo "Generated schemas are out of date. Run 'npm run generate:schemas' and commit." && exit 1)
5858
59+
- name: Verify synced snippets are up-to-date
60+
shell: bash
61+
run: |
62+
npm run sync:snippets
63+
git diff --exit-code src/ docs/ || (echo "Synced snippets are out of date. Run 'npm run sync:snippets' and commit." && exit 1)
64+
5965
- run: npm test
6066

6167
- run: npm run prettier

AGENTS.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ MCP Apps SDK (`@modelcontextprotocol/ext-apps`) enables MCP servers to display i
66

77
Key abstractions:
88

9-
- **Guest** - UI running in an iframe, uses `App` class with `PostMessageTransport` to communicate with host
9+
- **View** - UI running in an iframe, uses `App` class with `PostMessageTransport` to communicate with host
1010
- **Host** - Chat client embedding the iframe, uses `AppBridge` class to proxy MCP requests
1111
- **Server** - MCP server that registers tools/resources with UI metadata
1212

@@ -67,22 +67,22 @@ rm -fR package-lock.json node_modules && \
6767
### Protocol Flow
6868

6969
```
70-
Guest UI (App) <--PostMessageTransport--> Host (AppBridge) <--MCP Client--> MCP Server
70+
View (App) <--PostMessageTransport--> Host (AppBridge) <--MCP Client--> MCP Server
7171
```
7272

73-
1. Host creates iframe with Guest UI HTML
74-
2. Guest UI creates `App` instance and calls `connect()` with `PostMessageTransport`
75-
3. App sends `ui/initialize` request, receives host capabilities and context
73+
1. Host creates iframe with view HTML
74+
2. View creates `App` instance and calls `connect()` with `PostMessageTransport`
75+
3. View sends `ui/initialize` request, receives host capabilities and context
7676
4. Host sends `sendToolInput()` with tool arguments after initialization
77-
5. Guest UI can call server tools via `app.callServerTool()` or send messages via `app.sendMessage()`
77+
5. View can call server tools via `app.callServerTool()` or send messages via `app.sendMessage()`
7878
6. Host sends `sendToolResult()` when tool execution completes
7979
7. Host calls `teardownResource()` before unmounting iframe
8080

8181
## Documentation
8282

83-
JSDoc `@example` tags use `{@includeCode ./file.examples.ts#regionName}` to pull in type-checked code from companion `.examples.ts`/`.examples.tsx` files. Regions are marked with `//#region name` and `//#endregion name`, wrapped in functions (whose parameters provide types for external values). Region names follow `exportedName_variant` or `ClassName_methodName_variant` pattern (e.g., `useApp_basicUsage`, `App_hostCapabilities_checkAfterConnection`).
83+
JSDoc `@example` tags should pull type-checked code from companion `.examples.ts` files (e.g., `app.ts``app.examples.ts`). Use ` ```ts source="./file.examples.ts#regionName" ` fences referencing `//#region regionName` blocks, then run `npm run sync:snippets`. Region names follow `exportedName_variant` or `ClassName_methodName_variant` pattern (e.g., `useApp_basicUsage`, `App_hostCapabilities_checkAfterConnection`).
8484

85-
Standalone docs in `docs/` (listed in `typedoc.config.mjs` `projectDocuments`) can also have type-checked companion `.ts`/`.tsx` files using the same `@includeCode` pattern.
85+
Standalone docs in `docs/` (listed in `typedoc.config.mjs` `projectDocuments`) can also have type-checked companion `.ts`/`.tsx` files using the same pattern.
8686

8787
## Full Examples
8888

docs/migrate_from_openai_apps.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ function createServer() {
7272
inputSchema: { userId: z.string() },
7373
annotations: { readOnlyHint: true },
7474
_meta: {
75-
"openai/outputTemplate": "ui://widget/cart.html",
75+
"openai/outputTemplate": "ui://view/cart.html",
7676
"openai/toolInvocation/invoking": "Loading cart...",
7777
"openai/toolInvocation/invoked": "Cart ready",
7878
"openai/widgetAccessible": true,
@@ -89,13 +89,13 @@ function createServer() {
8989

9090
// Register UI resource
9191
server.registerResource(
92-
"Cart Widget",
93-
"ui://widget/cart.html",
92+
"Cart View",
93+
"ui://view/cart.html",
9494
{ mimeType: "text/html+skybridge" },
9595
async () => ({
9696
contents: [
9797
{
98-
uri: "ui://widget/cart.html",
98+
uri: "ui://view/cart.html",
9999
mimeType: "text/html+skybridge",
100100
text: getCartHtml(),
101101
_meta: {
@@ -137,7 +137,7 @@ function createServer() {
137137
description: "Display the user's shopping cart",
138138
inputSchema: { userId: z.string() },
139139
annotations: { readOnlyHint: true },
140-
_meta: { ui: { resourceUri: "ui://widget/cart.html" } },
140+
_meta: { ui: { resourceUri: "ui://view/cart.html" } },
141141
},
142142
async (args) => {
143143
const cart = await getCart(args.userId);
@@ -151,13 +151,13 @@ function createServer() {
151151
// Register UI resource
152152
registerAppResource(
153153
server,
154-
"Cart Widget",
155-
"ui://widget/cart.html",
154+
"Cart View",
155+
"ui://view/cart.html",
156156
{ description: "Shopping cart UI" },
157157
async () => ({
158158
contents: [
159159
{
160-
uri: "ui://widget/cart.html",
160+
uri: "ui://view/cart.html",
161161
mimeType: RESOURCE_MIME_TYPE,
162162
text: getCartHtml(),
163163
_meta: {

0 commit comments

Comments
 (0)