add simple-host example
This commit is contained in:
parent
535dae6a73
commit
1f3bc52142
3 changed files with 1187 additions and 13 deletions
|
|
@ -4,13 +4,13 @@
|
|||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"build:uis": "rm -rf dist && concurrently 'UI=ui-raw.html vite build' 'UI=ui-vanilla.html vite build' 'UI=ui-react.html vite build'",
|
||||
"build": "concurrently 'INPUT=ui-raw.html vite build' 'INPUT=ui-vanilla.html vite build' 'INPUT=ui-react.html vite build'",
|
||||
"server": "bun server.ts",
|
||||
"start": "npm run build:uis && npm run server"
|
||||
"start": "npm run build && npm run server"
|
||||
},
|
||||
"dependencies": {
|
||||
"@modelcontextprotocol/ext-apps": "../..",
|
||||
"@modelcontextprotocol/sdk": "^1.22.0",
|
||||
"@modelcontextprotocol/sdk": "../../../modelcontextprotocol-typescript-sdk",
|
||||
"react": "^19.2.0",
|
||||
"react-dom": "^19.2.0",
|
||||
"zod": "^3.25.0"
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
* <code>
|
||||
* npx esbuild src/ui-raw.ts --bundle --outfile=dist/ui-raw.js --minify --sourcemap --platform=browser
|
||||
* </code>
|
||||
*
|
||||
*
|
||||
* We implement a barebones JSON-RPC message sender/receiver (see `app` object below),
|
||||
* but without timeouts or runtime type validation of any kind
|
||||
* (for that, use the Apps SDK / see ui-vanilla.ts or ui-react.ts).
|
||||
|
|
|
|||
|
|
@ -1,16 +1,23 @@
|
|||
import { defineConfig } from "vite";
|
||||
import react from "@vitejs/plugin-react";
|
||||
import { viteSingleFile } from "vite-plugin-singlefile";
|
||||
import { resolve } from "path";
|
||||
|
||||
// Get the entry from environment variable, default to ui-react
|
||||
const uiPath = process.env.UI;
|
||||
const INPUT = process.env.INPUT;
|
||||
if (!INPUT) {
|
||||
throw new Error("INPUT environment variable is not set");
|
||||
}
|
||||
|
||||
const isDevelopment = process.env.NODE_ENV === "development";
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [react(), viteSingleFile()],
|
||||
build: {
|
||||
sourcemap: isDevelopment ? "inline" : undefined,
|
||||
cssMinify: !isDevelopment,
|
||||
minify: !isDevelopment,
|
||||
|
||||
rollupOptions: {
|
||||
input: uiPath,
|
||||
input: INPUT,
|
||||
},
|
||||
outDir: `dist`,
|
||||
emptyOutDir: false,
|
||||
|
|
|
|||
Loading…
Reference in a new issue