Replace deprecated RESOURCE_URI_META_KEY with _meta.ui.resourceUri

Update all example servers to use the new recommended metadata format
for associating UI resources with tools. The old `RESOURCE_URI_META_KEY`
constant is deprecated in favor of the nested `_meta.ui.resourceUri`
structure.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Jonathan Hefner 2026-01-08 07:07:37 -06:00
commit 94bc708963

View file

@ -3,18 +3,17 @@
*
* Provides tools for rendering interactive 3D scenes using Three.js.
*/
import {
RESOURCE_MIME_TYPE,
registerAppResource,
registerAppTool,
} from "@modelcontextprotocol/ext-apps/server";
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
import type { ReadResourceResult } from "@modelcontextprotocol/sdk/types.js";
import fs from "node:fs/promises";
import path from "node:path";
import { z } from "zod";
import {
RESOURCE_MIME_TYPE,
RESOURCE_URI_META_KEY,
registerAppResource,
registerAppTool,
} from "@modelcontextprotocol/ext-apps/server";
import { startServer } from "./server-utils.js";
const DIST_DIR = path.join(import.meta.dirname, "dist");
@ -170,7 +169,7 @@ export function createServer(): McpServer {
code: z.string(),
height: z.number(),
}),
_meta: { [RESOURCE_URI_META_KEY]: resourceUri },
_meta: { ui: { resourceUri } },
},
async ({ code, height }) => {
const data = { code, height };