Skip to content

Commit 207c4e1

Browse files
guyernestclaude
andcommitted
fix: align mcp-preview AppBridge with ext-apps SDK v1.2.2 protocol
The AppBridge used pre-spec camelCase method names causing runtime errors when widgets built with @modelcontextprotocol/ext-apps@1.2.2 called app.sendMessage() or app.updateModelContext(). - Rename ui/sendMessage handler to ui/message (spec name), keep old name as backward-compat fallthrough - Add ui/update-model-context stub handler (was falling through to default and throwing Unknown method) - Update hostCapabilities: sendMessage true, updateModelContext {} - Update bundled App.sendMessage() to send spec-correct "ui/message" - Sync TypeScript source (app-bridge.ts, app.ts) with .mjs bundle - Rewrite mcp-tester README as a focused landing page Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 71d0b7e commit 207c4e1

4 files changed

Lines changed: 113 additions & 733 deletions

File tree

crates/mcp-preview/assets/widget-runtime.mjs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,7 +1030,7 @@ var _App = class _App {
10301030
return;
10311031
}
10321032
try {
1033-
await this._transport.send("ui/sendMessage", params);
1033+
await this._transport.send("ui/message", params);
10341034
} catch (err) {
10351035
console.warn("[App] sendMessage not supported by host:", err);
10361036
}
@@ -1292,7 +1292,8 @@ var AppBridge = class {
12921292
},
12931293
hostCapabilities: {
12941294
callTool: true,
1295-
sendMessage: false,
1295+
sendMessage: true,
1296+
updateModelContext: {},
12961297
openLink: true
12971298
},
12981299
hostContext: this._hostContext
@@ -1305,9 +1306,13 @@ var AppBridge = class {
13051306
}
13061307
return await this._toolCallHandler(name, args);
13071308
}
1308-
case "ui/sendMessage":
1309+
case "ui/message":
1310+
case "ui/sendMessage": // backward compat with pre-spec widgets
13091311
console.log("[AppBridge] Widget sent message:", params);
13101312
return {};
1313+
case "ui/update-model-context":
1314+
console.log("[AppBridge] Widget updated model context:", params);
1315+
return {};
13111316
case "ui/openLink": {
13121317
const url = params?.url;
13131318
if (url) {

0 commit comments

Comments
 (0)