Skip to content

Commit 4ca20f2

Browse files
Smoothen the process of getting started (#103)
* Restructure threejs-server README to match marketing examples - Update title format to "Example: Three.js App" - Constrain screenshot width using table layout - Add Features section with key capabilities - Reorganize Running section with Tool Input subsection - Add Architecture section describing server and app components - Remove implementation-focused sections (WidgetProps, Creating a New Widget) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]> * Add bun as devDependency to example packages npm install now automatically installs bun, eliminating the need for separate installation instructions. Removed manual bun install step from customer-segmentation-server README. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]> * Add start:http and start:stdio npm scripts to examples For the 6 examples supporting --stdio transport, add explicit scripts: - serve:http / serve:stdio for running the server - start:http / start:stdio for build + serve - start now aliases to start:http for backward compatibility Update READMEs to document both transport options. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]> * Default basic-host SERVERS to localhost:3001/mcp - Change threejs-server default port from 3109 to 3001 for consistency - Add default SERVERS value in basic-host serve.ts - Document SERVERS env var in basic-host README 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]> * Improve Examples section in README Frame the three basic examples as foundational starting points and add a link to the examples directory for additional demo apps. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]> --------- Co-authored-by: Claude Opus 4.5 <[email protected]>
1 parent c03e99d commit 4ca20f2

File tree

19 files changed

+149
-132
lines changed

19 files changed

+149
-132
lines changed

README.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,18 +54,22 @@ Your `package.json` will then look like:
5454
5555
## Examples
5656

57-
- [`examples/basic-server-react`](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/basic-server-react) — Example MCP server with tools that return UI Apps (React)
57+
Start with these foundational examples to learn the SDK:
58+
5859
- [`examples/basic-server-vanillajs`](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/basic-server-vanillajs) — Example MCP server with tools that return UI Apps (vanilla JS)
60+
- [`examples/basic-server-react`](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/basic-server-react) — Example MCP server with tools that return UI Apps (React)
5961
- [`examples/basic-host`](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/basic-host) — Bare-bones example of hosting MCP Apps
6062

61-
To run the examples end-to-end:
63+
The [`examples/`](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples) directory contains additional demo apps showcasing real-world use cases.
64+
65+
To run all examples together:
6266

6367
```
64-
npm i
68+
npm install
6569
npm run examples:start
6670
```
6771

68-
Then open http://localhost:8080/
72+
Then open http://localhost:8080/.
6973

7074
## Resources
7175

examples/basic-host/README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Example: Basic Host
22

3-
A reference implementation showing how to build an MCP Host application that connects to MCP servers and renders tool UIs in a secure sandbox.
3+
A reference implementation showing how to build an MCP host application that connects to MCP servers and renders tool UIs in a secure sandbox.
44

55
This basic host can also be used to test MCP Apps during local development.
66

@@ -14,10 +14,16 @@ This basic host can also be used to test MCP Apps during local development.
1414

1515
```bash
1616
npm install
17-
npm run dev
17+
npm run start
1818
# Open http://localhost:8080
1919
```
2020

21+
By default, the host application will try to connect to an MCP server at `http://localhost:3001/mcp`. You can configure this behavior by setting the `SERVERS` environment variable with a JSON array of server URLs:
22+
23+
```bash
24+
SERVERS='["http://localhost:1234/mcp", "http://localhost:5678/mcp"]' npm run start
25+
```
26+
2127
## Architecture
2228

2329
This example uses a double-iframe sandbox pattern for secure UI isolation:

examples/basic-host/serve.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ const __dirname = dirname(__filename);
1818
const HOST_PORT = parseInt(process.env.HOST_PORT || "8080", 10);
1919
const SANDBOX_PORT = parseInt(process.env.SANDBOX_PORT || "8081", 10);
2020
const DIRECTORY = join(__dirname, "dist");
21-
const SERVERS: string[] = process.env.SERVERS ? JSON.parse(process.env.SERVERS) : [];
21+
const SERVERS: string[] = process.env.SERVERS
22+
? JSON.parse(process.env.SERVERS)
23+
: ["http://localhost:3001/mcp"];
2224

2325
// ============ Host Server (port 8080) ============
2426
const hostApp = express();

examples/basic-server-react/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
"@types/react": "^19.2.2",
2525
"@types/react-dom": "^19.2.2",
2626
"@vitejs/plugin-react": "^4.3.4",
27+
"bun": "^1.3.2",
2728
"concurrently": "^9.2.1",
2829
"cors": "^2.8.5",
2930
"express": "^5.1.0",

examples/basic-server-vanillajs/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"@types/cors": "^2.8.19",
2020
"@types/express": "^5.0.0",
2121
"@types/node": "^22.0.0",
22+
"bun": "^1.3.2",
2223
"concurrently": "^9.2.1",
2324
"cors": "^2.8.5",
2425
"express": "^5.1.0",

examples/budget-allocator-server/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ An interactive budget allocation tool demonstrating real-time data visualization
3030
2. Build and start the server:
3131

3232
```bash
33-
npm start
33+
npm run start:http # for Streamable HTTP transport
34+
# OR
35+
npm run start:stdio # for stdio transport
3436
```
3537

36-
The server will listen on `http://localhost:3001/mcp`.
37-
3838
3. View using the [`basic-host`](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/basic-host) example or another MCP Apps-compatible host.
3939

4040
## Architecture

examples/budget-allocator-server/package.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,12 @@
66
"scripts": {
77
"build": "INPUT=mcp-app.html vite build",
88
"watch": "INPUT=mcp-app.html vite build --watch",
9-
"serve": "bun server.ts",
10-
"start": "NODE_ENV=development npm run build && npm run serve",
11-
"dev": "NODE_ENV=development concurrently 'npm run watch' 'npm run serve'"
9+
"serve:http": "bun server.ts",
10+
"serve:stdio": "bun server.ts --stdio",
11+
"start": "npm run start:http",
12+
"start:http": "NODE_ENV=development npm run build && npm run serve:http",
13+
"start:stdio": "NODE_ENV=development npm run build && npm run serve:stdio",
14+
"dev": "NODE_ENV=development concurrently 'npm run watch' 'npm run serve:http'"
1215
},
1316
"dependencies": {
1417
"@modelcontextprotocol/ext-apps": "../..",
@@ -20,6 +23,7 @@
2023
"@types/cors": "^2.8.19",
2124
"@types/express": "^5.0.0",
2225
"@types/node": "^22.0.0",
26+
"bun": "^1.3.2",
2327
"concurrently": "^9.2.1",
2428
"cors": "^2.8.5",
2529
"express": "^5.1.0",

examples/cohort-heatmap-server/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ A demo MCP App that displays cohort retention data as an interactive heatmap, sh
3030
2. Build and start the server:
3131

3232
```bash
33-
npm start
33+
npm run start:http # for Streamable HTTP transport
34+
# OR
35+
npm run start:stdio # for stdio transport
3436
```
3537

36-
The server will listen on `http://localhost:3001/mcp`.
37-
3838
3. View using the [`basic-host`](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/basic-host) example or another MCP Apps-compatible host.
3939

4040
## Architecture

examples/cohort-heatmap-server/package.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,12 @@
66
"scripts": {
77
"build": "INPUT=mcp-app.html vite build",
88
"watch": "INPUT=mcp-app.html vite build --watch",
9-
"serve": "bun server.ts",
10-
"start": "NODE_ENV=development npm run build && npm run serve",
11-
"dev": "NODE_ENV=development concurrently 'npm run watch' 'npm run serve'"
9+
"serve:http": "bun server.ts",
10+
"serve:stdio": "bun server.ts --stdio",
11+
"start": "npm run start:http",
12+
"start:http": "NODE_ENV=development npm run build && npm run serve:http",
13+
"start:stdio": "NODE_ENV=development npm run build && npm run serve:stdio",
14+
"dev": "NODE_ENV=development concurrently 'npm run watch' 'npm run serve:http'"
1215
},
1316
"dependencies": {
1417
"@modelcontextprotocol/ext-apps": "../..",
@@ -24,6 +27,7 @@
2427
"@types/react": "^19.2.2",
2528
"@types/react-dom": "^19.2.2",
2629
"@vitejs/plugin-react": "^4.3.4",
30+
"bun": "^1.3.2",
2731
"concurrently": "^9.2.1",
2832
"cors": "^2.8.5",
2933
"express": "^5.1.0",

examples/customer-segmentation-server/README.md

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,27 +22,21 @@ A demo MCP App that displays customer data as an interactive scatter/bubble char
2222

2323
## Running
2424

25-
1. Install [Bun](https://github.com/oven-sh/bun) (if not already installed):
26-
27-
```bash
28-
curl -fsSL https://bun.com/install | bash
29-
```
30-
31-
2. Install dependencies:
25+
1. Install dependencies:
3226

3327
```bash
3428
npm install
3529
```
3630

37-
3. Build and start the server:
31+
2. Build and start the server:
3832

3933
```bash
40-
npm start
34+
npm run start:http # for Streamable HTTP transport
35+
# OR
36+
npm run start:stdio # for stdio transport
4137
```
4238

43-
The server will listen on `http://localhost:3001/mcp`.
44-
45-
4. View using the [`basic-host`](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/basic-host) example or another MCP Apps-compatible host.
39+
3. View using the [`basic-host`](https://github.com/modelcontextprotocol/ext-apps/tree/main/examples/basic-host) example or another MCP Apps-compatible host.
4640

4741
## Architecture
4842

0 commit comments

Comments
 (0)