Skip to content

Commit 14740aa

Browse files
committed
fix build
1 parent b738294 commit 14740aa

File tree

2 files changed

+45
-2
lines changed

2 files changed

+45
-2
lines changed

examples/simple-host/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@
66
"scripts": {
77
"start:server": "python3 serve.py",
88
"start:mcp-server": "cd ../simple-server && npm install && npm run start",
9-
"start:proxy": "python3 serve.py",
109
"build": "concurrently 'INPUT=example-host.html vite build' 'INPUT=example-host-react.html vite build' 'INPUT=sandbox.html vite build'",
1110
"server": "bun server.ts",
12-
"start": "NODE_ENV=development npm run build && concurrently 'npm run start:server' 'npm run start:mcp-server' 'npm run start:proxy'"
11+
"start": "NODE_ENV=development npm run build && concurrently 'npm run start:server' 'npm run start:mcp-server'"
1312
},
1413
"dependencies": {
1514
"@modelcontextprotocol/ext-apps": "../..",

src/app-bridge.ts

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ import {
1212
ListResourcesResultSchema,
1313
ListResourceTemplatesRequestSchema,
1414
ListResourceTemplatesResultSchema,
15+
LoggingMessageNotification,
16+
LoggingMessageNotificationSchema,
1517
Notification,
1618
PingRequest,
1719
PingRequestSchema,
@@ -40,6 +42,12 @@ import {
4042
McpUiInitializeRequest,
4143
McpUiInitializeRequestSchema,
4244
McpUiInitializeResult,
45+
McpUiMessageRequest,
46+
McpUiMessageRequestSchema,
47+
McpUiMessageResult,
48+
McpUiOpenLinkRequest,
49+
McpUiOpenLinkRequestSchema,
50+
McpUiOpenLinkResult,
4351
McpUiResourceTeardownRequest,
4452
McpUiResourceTeardownResultSchema,
4553
McpUiSandboxProxyReadyNotification,
@@ -101,6 +109,42 @@ export class AppBridge extends Protocol<Request, Notification, Result> {
101109
callback(n.params),
102110
);
103111
}
112+
set onmessage(
113+
callback: (
114+
params: McpUiMessageRequest["params"],
115+
extra: RequestExtra,
116+
) => Promise<McpUiMessageResult>,
117+
) {
118+
this.setRequestHandler(
119+
McpUiMessageRequestSchema,
120+
async (request, extra) => {
121+
return callback(request.params, extra);
122+
},
123+
);
124+
}
125+
set onopenlink(
126+
callback: (
127+
params: McpUiOpenLinkRequest["params"],
128+
extra: RequestExtra,
129+
) => Promise<McpUiOpenLinkResult>,
130+
) {
131+
this.setRequestHandler(
132+
McpUiOpenLinkRequestSchema,
133+
async (request, extra) => {
134+
return callback(request.params, extra);
135+
},
136+
);
137+
}
138+
set onloggingmessage(
139+
callback: (params: LoggingMessageNotification["params"]) => void,
140+
) {
141+
this.setNotificationHandler(
142+
LoggingMessageNotificationSchema,
143+
async (notification) => {
144+
callback(notification.params);
145+
},
146+
);
147+
}
104148

105149
assertCapabilityForMethod(method: Request["method"]): void {
106150
// TODO

0 commit comments

Comments
 (0)