Skip to content

Commit 0f31e0a

Browse files
authored
Merge pull request #9 from modelcontextprotocol/ochafik/update-packages
update simple-examples (add "raw" no-sdk example)
2 parents 3ef1d3b + aa80fcf commit 0f31e0a

File tree

14 files changed

+424
-5041
lines changed

14 files changed

+424
-5041
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
.DS_Store
22
dist/
33
node_modules/
4+
package-lock.json
5+
yarn.lock
6+
.vscode/

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,16 @@ This repo contains the SDK and [specification](./specification/draft/apps.mdx) f
55
MCP Apps are proposed standard inspired by [MCP-UI](https://mcpui.dev/) and [OpenAI's Apps SDK](https://developers.openai.com/apps-sdk/) to allow MCP Servers to display interactive UI elements in conversational MCP clients / chatbots.
66

77
This repo provides:
8+
9+
- [specification/draft/apps.mdx](./specification/draft/apps.mdx): The Draft Extension Specification. It's still... in flux! Feedback welcome! (also see discussions in [SEP-1865](https://github.com/modelcontextprotocol/modelcontextprotocol/pull/1865)).
10+
811
- [types.ts](./src/types.ts): Types of JSON-RPC messages used to communicate between Apps & their host
912
- Note that MCP Apps also use some standard MCP messages (e.g. `tools/call` for the App to trigger actions on its originating Server - these calls are proxied through the Host), but these types are the additional messages defined by the extension
10-
1113
- [examples/simple-example](./examples/simple-example): Example Server + Apps
12-
- [server.ts](./examples/simple-server/server.ts): MCP server with two tools that declare UI resources of Apps to be show in the chat when called
14+
- [server.ts](./examples/simple-server/server.ts): MCP server with three tools that declare UI resources of Apps to be show in the chat when called
1315
- [ui-react.tsx](./examples/simple-server/src/ui-react.tsx): React App returned by the `create-ui-react` tool shows how to use the `useApp` hook to register MCP callbacks
1416
- [ui-vanilla.tsx](./examples/simple-server/src/ui-vanilla.ts): vanilla App returned by the `create-ui-vanilla`
15-
16-
- [specification/draft/apps.mdx](./specification/draft/apps.mdx): The Draft Extension Specification. It's still... in flux! Feedback welcome! (also see discussions in [SEP-1865](https://github.com/modelcontextprotocol/modelcontextprotocol/pull/1865)).
17+
- [ui-raw.tsx](./examples/simple-server/src/ui-raw.ts): same as vanilla App but doesn't use the SDK runtime (just its types)
1718

1819
- [message-transport](./src/message-transport.ts): `PostMessageTransport` class that uses `postMessage` to exchange JSON-RPC messages between windows / iframes
1920

build.bun.ts

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,28 @@ const isDevelopment = Bun.env.NODE_ENV === "development";
88

99
// Build all JavaScript/TypeScript files
1010
function buildJs(entrypoint: string, opts: Record<string, any> = {}) {
11-
return Bun.build({
12-
entrypoints: [entrypoint],
13-
outdir: "dist",
14-
target: "browser",
15-
minify: !isDevelopment,
16-
...(isDevelopment ? {
17-
sourcemap: "inline",
18-
} : {}),
19-
...opts
20-
})
11+
return Bun.build({
12+
entrypoints: [entrypoint],
13+
outdir: "dist",
14+
target: "browser",
15+
minify: !isDevelopment,
16+
...(isDevelopment
17+
? {
18+
sourcemap: "inline",
19+
}
20+
: {}),
21+
...opts,
22+
});
2123
}
2224

2325
await Promise.all([
2426
buildJs("src/app.ts", { outdir: "dist/src" }),
25-
buildJs("src/app-bridge.ts", { outdir: "dist/src", external: ["@modelcontextprotocol/sdk"] }),
26-
buildJs("src/react/index.tsx", { outdir: "dist/src/react", external: ["react", "react-dom"]}),
27-
])
27+
buildJs("src/app-bridge.ts", {
28+
outdir: "dist/src",
29+
external: ["@modelcontextprotocol/sdk"],
30+
}),
31+
buildJs("src/react/index.tsx", {
32+
outdir: "dist/src/react",
33+
external: ["react", "react-dom"],
34+
}),
35+
]);

0 commit comments

Comments
 (0)