Implements a simple MCP Apps tool that returns an interactive React UI: - Add `mcp_apps_hello_world` tool with `_meta.ui/resourceUri` metadata - Add resource handler for `ui://hello-world/app.html` returning HTML - Create React app using `@modelcontextprotocol/ext-apps/react` hooks - Add Vite build tooling to bundle React apps into single HTML files The tool demonstrates the MCP Apps extension (SEP-1865) which allows MCP servers to return interactive UI that runs in the client. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
21 lines
503 B
TypeScript
21 lines
503 B
TypeScript
import { defineConfig } from "vite";
|
|
import react from "@vitejs/plugin-react";
|
|
import { viteSingleFile } from "vite-plugin-singlefile";
|
|
import path from "path";
|
|
|
|
const input = process.env.INPUT;
|
|
if (!input) {
|
|
throw new Error("INPUT environment variable is required");
|
|
}
|
|
|
|
export default defineConfig({
|
|
plugins: [react(), viteSingleFile()],
|
|
root: path.dirname(input),
|
|
build: {
|
|
outDir: path.resolve("dist/apps"),
|
|
emptyOutDir: false,
|
|
rollupOptions: {
|
|
input: input,
|
|
},
|
|
},
|
|
});
|