Replace deprecated RESOURCE_URI_META_KEY usage with modern format (#457)
This commit is contained in:
parent
ef8fc6e2f0
commit
19fe73a08a
1 changed files with 80 additions and 28 deletions
|
|
@ -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: [
|
||||
|
|
|
|||
Loading…
Reference in a new issue