fix(examples): use server.registerTool for non-UI tool + fix missing imports (#173)
* fix(threejs-server): use server.registerTool for non-UI tool The learn_threejs tool doesn't have a UI component - it only returns documentation text. Using registerAppTool without _meta causes a runtime error when the function tries to access config._meta.ui. Fixes crash: "Cannot read property 'ui' of undefined" 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * fix(examples): add missing registerAppTool and registerAppResource imports All example servers were using registerAppTool and registerAppResource but not importing them from @modelcontextprotocol/ext-apps/server, causing "ReferenceError: registerAppTool is not defined" at runtime. Affected servers: - budget-allocator-server - cohort-heatmap-server - customer-segmentation-server - scenario-modeler-server - system-monitor-server - threejs-server - wiki-explorer-server 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
parent
894f7936f5
commit
c3e9d4d694
7 changed files with 16 additions and 3 deletions
|
|
@ -16,6 +16,8 @@ import { z } from "zod";
|
||||||
import {
|
import {
|
||||||
RESOURCE_MIME_TYPE,
|
RESOURCE_MIME_TYPE,
|
||||||
RESOURCE_URI_META_KEY,
|
RESOURCE_URI_META_KEY,
|
||||||
|
registerAppResource,
|
||||||
|
registerAppTool,
|
||||||
} from "@modelcontextprotocol/ext-apps/server";
|
} from "@modelcontextprotocol/ext-apps/server";
|
||||||
import { startServer } from "../shared/server-utils.js";
|
import { startServer } from "../shared/server-utils.js";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,8 @@ import { z } from "zod";
|
||||||
import {
|
import {
|
||||||
RESOURCE_MIME_TYPE,
|
RESOURCE_MIME_TYPE,
|
||||||
RESOURCE_URI_META_KEY,
|
RESOURCE_URI_META_KEY,
|
||||||
|
registerAppResource,
|
||||||
|
registerAppTool,
|
||||||
} from "@modelcontextprotocol/ext-apps/server";
|
} from "@modelcontextprotocol/ext-apps/server";
|
||||||
import { startServer } from "../shared/server-utils.js";
|
import { startServer } from "../shared/server-utils.js";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,8 @@ import { z } from "zod";
|
||||||
import {
|
import {
|
||||||
RESOURCE_MIME_TYPE,
|
RESOURCE_MIME_TYPE,
|
||||||
RESOURCE_URI_META_KEY,
|
RESOURCE_URI_META_KEY,
|
||||||
|
registerAppResource,
|
||||||
|
registerAppTool,
|
||||||
} from "@modelcontextprotocol/ext-apps/server";
|
} from "@modelcontextprotocol/ext-apps/server";
|
||||||
import { startServer } from "../shared/server-utils.js";
|
import { startServer } from "../shared/server-utils.js";
|
||||||
import {
|
import {
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,8 @@ import { z } from "zod";
|
||||||
import {
|
import {
|
||||||
RESOURCE_MIME_TYPE,
|
RESOURCE_MIME_TYPE,
|
||||||
RESOURCE_URI_META_KEY,
|
RESOURCE_URI_META_KEY,
|
||||||
|
registerAppResource,
|
||||||
|
registerAppTool,
|
||||||
} from "@modelcontextprotocol/ext-apps/server";
|
} from "@modelcontextprotocol/ext-apps/server";
|
||||||
import { startServer } from "../shared/server-utils.js";
|
import { startServer } from "../shared/server-utils.js";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,8 @@ import { z } from "zod";
|
||||||
import {
|
import {
|
||||||
RESOURCE_MIME_TYPE,
|
RESOURCE_MIME_TYPE,
|
||||||
RESOURCE_URI_META_KEY,
|
RESOURCE_URI_META_KEY,
|
||||||
|
registerAppResource,
|
||||||
|
registerAppTool,
|
||||||
} from "@modelcontextprotocol/ext-apps/server";
|
} from "@modelcontextprotocol/ext-apps/server";
|
||||||
import { startServer } from "../shared/server-utils.js";
|
import { startServer } from "../shared/server-utils.js";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,8 @@ import { z } from "zod";
|
||||||
import {
|
import {
|
||||||
RESOURCE_MIME_TYPE,
|
RESOURCE_MIME_TYPE,
|
||||||
RESOURCE_URI_META_KEY,
|
RESOURCE_URI_META_KEY,
|
||||||
|
registerAppResource,
|
||||||
|
registerAppTool,
|
||||||
} from "@modelcontextprotocol/ext-apps/server";
|
} from "@modelcontextprotocol/ext-apps/server";
|
||||||
import { startServer } from "../shared/server-utils.js";
|
import { startServer } from "../shared/server-utils.js";
|
||||||
|
|
||||||
|
|
@ -178,9 +180,8 @@ function createServer(): McpServer {
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
// Tool 2: learn_threejs
|
// Tool 2: learn_threejs (not a UI tool, just returns documentation)
|
||||||
registerAppTool(
|
server.registerTool(
|
||||||
server,
|
|
||||||
"learn_threejs",
|
"learn_threejs",
|
||||||
{
|
{
|
||||||
title: "Learn Three.js",
|
title: "Learn Three.js",
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,8 @@ import { z } from "zod";
|
||||||
import {
|
import {
|
||||||
RESOURCE_MIME_TYPE,
|
RESOURCE_MIME_TYPE,
|
||||||
RESOURCE_URI_META_KEY,
|
RESOURCE_URI_META_KEY,
|
||||||
|
registerAppResource,
|
||||||
|
registerAppTool,
|
||||||
} from "@modelcontextprotocol/ext-apps/server";
|
} from "@modelcontextprotocol/ext-apps/server";
|
||||||
import { startServer } from "../shared/server-utils.js";
|
import { startServer } from "../shared/server-utils.js";
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue