diff --git a/examples/simple-host/example-host-react.html b/examples/simple-host/example-host-react.html new file mode 100644 index 0000000..fc71204 --- /dev/null +++ b/examples/simple-host/example-host-react.html @@ -0,0 +1,21 @@ + + +
+ + + +Connecting to MCP server...
+No tools available with UI resources.
+ ) : ( ++ No tool UIs active. Click a button above to add one. +
+ )} +
* npx esbuild src/ui-raw.ts --bundle --outfile=dist/ui-raw.js --minify --sourcemap --platform=browser
*
- *
+ *
* 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).
diff --git a/examples/simple-server/vite.config.ts b/examples/simple-server/vite.config.ts
index a4d7fa9..28d7e5b 100644
--- a/examples/simple-server/vite.config.ts
+++ b/examples/simple-server/vite.config.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,
diff --git a/package.json b/package.json
index 4f5b0cf..eaf0136 100644
--- a/package.json
+++ b/package.json
@@ -23,11 +23,7 @@
"dist"
],
"scripts": {
- "start:example-server0": "bun examples/example-server.ts",
- "start:example-server": "cd ../openai-apps-sdk-examples && concurrently \"npm run serve\" \"cd pizzaz_server_node && PORT=3001 npm start\"",
- "start:sandbox-proxy": "python3 sandbox_proxy.py",
- "start": "npm run build && npm run start:example-server",
- "start:dev": "NODE_ENV=development npm start",
+ "start": "cd examples/example-host && npm i && npm start",
"build": "bun build.bun.ts",
"prepare": "npm run build",
"prettier:base-cmd": "prettier -u --ignore-path ./.gitignore --ignore-path ./.prettierignore",