Skip to content

Commit 4298d34

Browse files
examples: drop v1 inputSchema:{} shape; vite external Node builtins; basic-host typo+v1 schema usage
1 parent cce8436 commit 4298d34

19 files changed

Lines changed: 24 additions & 20 deletions

File tree

docs/quickstart.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ export default defineConfig({
138138
minify: !isDevelopment,
139139

140140
rollupOptions: {
141+
external: (id) => /^node:|^(child_process|cross-spawn|fs|path|os|crypto|stream|util|net|http|https|events|url|buffer|process)$/.test(id),
141142
input: INPUT,
142143
},
143144
outDir: "dist",
@@ -205,7 +206,7 @@ export function createServer(): McpServer {
205206
{
206207
title: "Get Time",
207208
description: "Returns the current server time.",
208-
inputSchema: {},
209+
209210
_meta: { ui: { resourceUri } }, // Links this tool to its UI resource
210211
},
211212
async () => {

examples/basic-host/src/implementation.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { RESOURCE_MIME_TYPE, getToolUiResourceUri, type McpUiSandboxProxyReadyNotification, AppBridge, PostMessageTransport, type McpUiResourceCsp, type McpUiResourcePermissions, buildAllowAttribute, type McpUiUpdateModelContextRequest, type McpUiMessageRequest } from "@modelcontextprotocol/ext-apps/app-bridge";
22
import { Client } from "@modelcontextprotocol/client";
3-
import { SSEClientTransport } from "@modelcontextprotocol/sdk/client/sse.js";
3+
import { SSEClientTransport } from "@modelcontextprotocol/client";
44
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/client";
55
import type { CallToolResult, Resource, Tool } from "@modelcontextprotocol/server";
66
import { getTheme, onThemeChange } from "./theme";
@@ -303,7 +303,7 @@ export function newAppBridge(
303303
// Listen for theme changes (from toggle or system) and notify the app
304304
onThemeChange((newTheme) => {
305305
log.info("Theme changed:", newTheme);
306-
appBridge.sendHostContextChange({ theme: newTheme });
306+
appBridge.sendHostContextChanged({ theme: newTheme });
307307
});
308308

309309
// Per spec, the host SHOULD notify the view when container dimensions
@@ -315,7 +315,7 @@ export function newAppBridge(
315315
const iframeResizeObserver = new ResizeObserver(([entry]) => {
316316
const width = Math.round(entry.contentRect.width);
317317
if (width > 0) {
318-
appBridge.sendHostContextChange({
318+
appBridge.sendHostContextChanged({
319319
containerDimensions: { width, maxHeight: 6000 },
320320
});
321321
}
@@ -397,7 +397,7 @@ export function newAppBridge(
397397
log.info("Display mode request from MCP App:", params);
398398
const newMode = params.mode === "fullscreen" ? "fullscreen" : "inline";
399399
// Update host context and notify the app
400-
appBridge.sendHostContextChange({
400+
appBridge.sendHostContextChanged({
401401
displayMode: newMode,
402402
});
403403
// Notify the host UI (via callback)

examples/basic-host/vite.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export default defineConfig({
1616
cssMinify: !isDevelopment,
1717
minify: !isDevelopment,
1818
rollupOptions: {
19+
external: (id) => /^node:|^(child_process|cross-spawn|fs|path|os|crypto|stream|util|net|http|https|events|url|buffer|process)$/.test(id),
1920
input: INPUT,
2021
},
2122
outDir: `dist`,

examples/basic-server-preact/server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export function createServer(): McpServer {
2828
{
2929
title: "Get Time",
3030
description: "Returns the current server time as an ISO 8601 string.",
31-
inputSchema: {},
31+
3232
_meta: { ui: { resourceUri } }, // Links this tool to its UI resource
3333
},
3434
async (): Promise<CallToolResult> => {

examples/basic-server-react/server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export function createServer(): McpServer {
2929
{
3030
title: "Get Time",
3131
description: "Returns the current server time as an ISO 8601 string.",
32-
inputSchema: {},
32+
3333
_meta: { ui: { resourceUri } }, // Links this tool to its UI resource
3434
},
3535
async (): Promise<CallToolResult> => {

examples/basic-server-react/vite.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export default defineConfig({
1717
minify: !isDevelopment,
1818

1919
rollupOptions: {
20+
external: (id) => /^node:|^(child_process|cross-spawn|fs|path|os|crypto|stream|util|net|http|https|events|url|buffer|process)$/.test(id),
2021
input: INPUT,
2122
},
2223
outDir: "dist",

examples/basic-server-solid/server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export function createServer(): McpServer {
2828
{
2929
title: "Get Time",
3030
description: "Returns the current server time as an ISO 8601 string.",
31-
inputSchema: {},
31+
3232
_meta: { ui: { resourceUri } }, // Links this tool to its UI resource
3333
},
3434
async (): Promise<CallToolResult> => {

examples/basic-server-svelte/server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export function createServer(): McpServer {
2828
{
2929
title: "Get Time",
3030
description: "Returns the current server time as an ISO 8601 string.",
31-
inputSchema: {},
31+
3232
_meta: { ui: { resourceUri } }, // Links this tool to its UI resource
3333
},
3434
async (): Promise<CallToolResult> => {

examples/basic-server-vanillajs/server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export function createServer(): McpServer {
2929
{
3030
title: "Get Time",
3131
description: "Returns the current server time as an ISO 8601 string.",
32-
inputSchema: {},
32+
3333
outputSchema: z.object({
3434
time: z.string(),
3535
}),

examples/basic-server-vanillajs/vite.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export default defineConfig({
1616
minify: !isDevelopment,
1717

1818
rollupOptions: {
19+
external: (id) => /^node:|^(child_process|cross-spawn|fs|path|os|crypto|stream|util|net|http|https|events|url|buffer|process)$/.test(id),
1920
input: INPUT,
2021
},
2122
outDir: "dist",

0 commit comments

Comments
 (0)