Replace deprecated RESOURCE_URI_META_KEY usage with modern format (#457)

This commit is contained in:
Hryhorii (Greg) Avcharov 2026-03-06 15:32:04 +01:00 • committed by GitHub
commit 19fe73a08a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -9,13 +9,12 @@ import {
registerAppTool,
registerAppResource,
RESOURCE_MIME_TYPE,
RESOURCE_URI_META_KEY,
} from "@modelcontextprotocol/ext-apps/server";
// Works both from source (server.ts) and compiled (dist/server.js)
const DIST_DIR = import.meta.filename.endsWith(".ts")
? path.join(import.meta.dirname, "dist")
: import.meta.dirname;
const RESOURCE_URI = "ui://transcript/mcp-app.html";
const resourceUri = "ui://transcript/mcp-app.html";
/**
* Creates a new MCP server instance with tools and resources registered.
@ -35,7 +34,7 @@ export function createServer(): McpServer {
description:
"Opens a live speech transcription interface using the Web Speech API.",
inputSchema: {},
_meta: { [RESOURCE_URI_META_KEY]: RESOURCE_URI },
_meta: { ui: { resourceUri } },
},
async (): Promise<CallToolResult> => {
return {
@ -55,8 +54,8 @@ export function createServer(): McpServer {
// Register the UI resource
registerAppResource(
server,
RESOURCE_URI,
RESOURCE_URI,
resourceUri,
resourceUri,
{ mimeType: RESOURCE_MIME_TYPE, description: "Transcript UI" },
async (): Promise<ReadResourceResult> => {
const html = await fs.readFile(
@ -67,7 +66,7 @@ export function createServer(): McpServer {
return {
contents: [
{
uri: RESOURCE_URI,
uri: resourceUri,
mimeType: RESOURCE_MIME_TYPE,
text: html,
_meta: {