From 2903c3a023a6b9ad4079adcab23b67cfdea21a50 Mon Sep 17 00:00:00 2001 From: Anton Pidkuiko MacBook Date: Wed, 14 Jan 2026 20:09:04 +0000 Subject: [PATCH] fix: update MCP Apps to use new _meta.ui.resourceUri format - Update @modelcontextprotocol/ext-apps to 0.4.0 - Use new nested format `_meta.ui.resourceUri` in tool definition - Remove resourceUri from tool result (only needed in tool definition) - Add example structuredContent and _meta in tool result for demo --- package.json | 2 +- src/modules/mcp/services/mcp.ts | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 10e4d5a..1ce20f2 100644 --- a/package.json +++ b/package.json @@ -23,7 +23,7 @@ "clean": "rm -rf dist" }, "dependencies": { - "@modelcontextprotocol/ext-apps": "https://pkg.pr.new/modelcontextprotocol/ext-apps/@modelcontextprotocol/ext-apps@95663d4", + "@modelcontextprotocol/ext-apps": "^0.4.0", "@modelcontextprotocol/sdk": "^1.24.2", "@redis/client": "^1.6.0", "cors": "^2.8.5", diff --git a/src/modules/mcp/services/mcp.ts b/src/modules/mcp/services/mcp.ts index b697f7d..ec74fe4 100644 --- a/src/modules/mcp/services/mcp.ts +++ b/src/modules/mcp/services/mcp.ts @@ -96,7 +96,6 @@ enum ToolName { } // MCP Apps constants -const RESOURCE_URI_META_KEY = "ui/resourceUri"; const HELLO_WORLD_APP_URI = "ui://hello-world/app.html"; enum PromptName { @@ -492,7 +491,7 @@ export const createMcpServer = (): McpServerWrapper => { description: "Demonstrates MCP Apps - returns an interactive UI that runs in the client", inputSchema: { type: "object", properties: {} }, - _meta: { [RESOURCE_URI_META_KEY]: HELLO_WORLD_APP_URI }, + _meta: { ui: { resourceUri: HELLO_WORLD_APP_URI } }, }, ]; @@ -767,7 +766,19 @@ export const createMcpServer = (): McpServerWrapper => { text: "If this client supports MCP Apps, an interactive UI should have rendered for the user.", }, ], - _meta: { [RESOURCE_URI_META_KEY]: HELLO_WORLD_APP_URI }, + structuredContent: { + greeting: "Hello from MCP Apps!", + timestamp: new Date().toISOString(), + features: ["interactive UI", "bidirectional communication", "theme support"], + stats: { + version: "1.0.0", + requestCount: Math.floor(Math.random() * 1000), + }, + }, + _meta: { + exampleKey: "exampleValue", + processed: true, + }, }; }