Skip to content

Commit adc73e4

Browse files
committed
simplify ui build
1 parent 00023ba commit adc73e4

File tree

4 files changed

+6
-8
lines changed

4 files changed

+6
-8
lines changed

examples/simple-server/package.json

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,9 @@
44
"private": true,
55
"type": "module",
66
"scripts": {
7-
"dev": "vite",
8-
"build": "rm -rf dist && VITE_ENTRY=ui-raw vite build && VITE_ENTRY=ui-vanilla vite build && VITE_ENTRY=ui-react vite build",
9-
"preview": "vite preview",
7+
"build:uis": "rm -rf dist && concurrently 'UI=ui-raw.html vite build' 'UI=ui-vanilla.html vite build' 'UI=ui-react.html vite build'",
108
"server": "bun server.ts",
11-
"start": "npm run build && npm run server"
9+
"start": "npm run build:uis && npm run server"
1210
},
1311
"dependencies": {
1412
"@modelcontextprotocol/ext-apps": "../..",
@@ -23,6 +21,7 @@
2321
"@types/react": "^19.2.2",
2422
"@types/react-dom": "^19.2.2",
2523
"@vitejs/plugin-react": "^4.3.4",
24+
"concurrently": "^9.2.1",
2625
"cors": "^2.8.5",
2726
"express": "^5.1.0",
2827
"typescript": "^5.7.2",

examples/simple-server/server.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,6 @@ app.delete("/mcp", async (req: Request, res: Response) => {
280280

281281
app.listen(MCP_PORT, () => {
282282
console.log(`MCP Server listening on http://localhost:${MCP_PORT}/mcp`);
283-
console.log(` Tools: create-ui-vanilla, create-ui-react, get-weather`);
284283
});
285284

286285
process.on("SIGINT", async () => {

examples/simple-server/ui-raw.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<head>
44
<meta charset="UTF-8">
55
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6-
<title>MCP UI Client (Vanilla)</title>
6+
<title>MCP UI Client (Raw)</title>
77
</head>
88
<body>
99
<div id="root"></div>

examples/simple-server/vite.config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ import { viteSingleFile } from "vite-plugin-singlefile";
44
import { resolve } from "path";
55

66
// Get the entry from environment variable, default to ui-react
7-
const entry = process.env.VITE_ENTRY || "ui-react";
7+
const uiPath = process.env.UI;
88

99
export default defineConfig({
1010
plugins: [react(), viteSingleFile()],
1111
build: {
1212
rollupOptions: {
13-
input: resolve(__dirname, `${entry}.html`),
13+
input: uiPath,
1414
},
1515
outDir: `dist`,
1616
emptyOutDir: false,

0 commit comments

Comments
 (0)