Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
.DS_Store
dist/
node_modules/
package-lock.json
yarn.lock
.vscode/
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@ This repo contains the SDK and [specification](./specification/draft/apps.mdx) f
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.

This repo provides:

- [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)).

- [types.ts](./src/types.ts): Types of JSON-RPC messages used to communicate between Apps & their host
- 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

- [examples/simple-example](./examples/simple-example): Example Server + Apps
- [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
- [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
- [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
- [ui-vanilla.tsx](./examples/simple-server/src/ui-vanilla.ts): vanilla App returned by the `create-ui-vanilla`

- [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)).
- [ui-raw.tsx](./examples/simple-server/src/ui-raw.ts): same as vanilla App but doesn't use the SDK runtime (just its types)

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

Expand Down
34 changes: 21 additions & 13 deletions build.bun.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,28 @@ const isDevelopment = Bun.env.NODE_ENV === "development";

// Build all JavaScript/TypeScript files
function buildJs(entrypoint: string, opts: Record<string, any> = {}) {
return Bun.build({
entrypoints: [entrypoint],
outdir: "dist",
target: "browser",
minify: !isDevelopment,
...(isDevelopment ? {
sourcemap: "inline",
} : {}),
...opts
})
return Bun.build({
entrypoints: [entrypoint],
outdir: "dist",
target: "browser",
minify: !isDevelopment,
...(isDevelopment
? {
sourcemap: "inline",
}
: {}),
...opts,
});
}

await Promise.all([
buildJs("src/app.ts", { outdir: "dist/src" }),
buildJs("src/app-bridge.ts", { outdir: "dist/src", external: ["@modelcontextprotocol/sdk"] }),
buildJs("src/react/index.tsx", { outdir: "dist/src/react", external: ["react", "react-dom"]}),
])
buildJs("src/app-bridge.ts", {
outdir: "dist/src",
external: ["@modelcontextprotocol/sdk"],
}),
buildJs("src/react/index.tsx", {
outdir: "dist/src/react",
external: ["react", "react-dom"],
}),
]);
Loading