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

@ -17,7 +17,6 @@ import {
registerAppTool,
registerAppResource,
RESOURCE_MIME_TYPE,
RESOURCE_URI_META_KEY,
} from "@modelcontextprotocol/ext-apps/server";
import { randomUUID } from "crypto";
@ -25,7 +24,7 @@ import { randomUUID } from "crypto";
const DIST_DIR = import.meta.filename.endsWith(".ts")
? path.join(import.meta.dirname, "dist")
: import.meta.dirname;
const RESOURCE_URI = "ui://cesium-map/mcp-app.html";
const resourceUri = "ui://cesium-map/mcp-app.html";
// Nominatim API response type
interface NominatimResult {
@ -118,8 +117,8 @@ export function createServer(): McpServer {
// Register the CesiumJS map resource with CSP for external tile sources
registerAppResource(
server,
RESOURCE_URI,
RESOURCE_URI,
resourceUri,
resourceUri,
{ mimeType: RESOURCE_MIME_TYPE },
async (): Promise<ReadResourceResult> => {
const html = await fs.readFile(
@ -130,7 +129,7 @@ export function createServer(): McpServer {
contents: [
// CSP metadata on the content item takes precedence over listing-level _meta
{
uri: RESOURCE_URI,
uri: resourceUri,
mimeType: RESOURCE_MIME_TYPE,
text: html,
_meta: cspMeta,
@ -175,7 +174,7 @@ export function createServer(): McpServer {
.optional()
.describe("Optional label to display on the map"),
},
_meta: { [RESOURCE_URI_META_KEY]: RESOURCE_URI },
_meta: { ui: { resourceUri } },
},
async ({ west, south, east, north, label }): Promise<CallToolResult> => ({
content: [