Skip to content

Commit ff7c210

Browse files
committed
2 parents 6ea36fe + d07e636 commit ff7c210

File tree

3 files changed

+31
-14
lines changed

3 files changed

+31
-14
lines changed

README.md

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,29 @@
11
# @modelcontextprotocol/ext-apps
22

3-
This repo contains the SDK and [specification](https://github.com/modelcontextprotocol/ext-apps/blob/main/specification/draft/apps.mdx) for MCP Apps Extension ([SEP-1865](https://github.com/modelcontextprotocol/modelcontextprotocol/pull/1865)).
4-
5-
MCP Apps are a standard inspired by [OpenAI's Apps SDK](https://developers.openai.com/apps-sdk/) and [MCP-UI](https://mcpui.dev/) to allow MCP Servers to display interactive UI elements in conversational MCP clients / chatbots.
3+
This repo contains the SDK and [specification](./main/specification/draft/apps.mdx) for MCP Apps Extension ([SEP-1865](https://github.com/modelcontextprotocol/modelcontextprotocol/pull/1865)).
4+
5+
MCP Apps are proposed standard inspired by [OpenAI's Apps SDK](https://developers.openai.com/apps-sdk/) and [MCP-UI](https://mcpui.dev/) to allow MCP Servers to display interactive UI elements in conversational MCP clients / chatbots.
6+
7+
This repo provides:
8+
- [types.ts](./src/types.ts): Types of JSON-RPC messages used to communicate between Apps & their host
9+
- 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+
- [examples/simple-example](./examples/simple-example):
11+
- [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
12+
- [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
13+
- [ui-vanilla.tsx](./examples/simple-server/src/ui-vanilla.ts): vanilla App returned by the `create-ui-vanilla`
14+
- [main/specification/draft/apps.mdx](./main/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)).
15+
- [message-transport](./src/message-transport.ts): `PostMessageTransport` class that uses `postMessage` to exchange JSON-RPC messages between windows / iframes
16+
- [app.ts](./src/app.ts): `App` class used by an App to talk to its host
17+
- [app-bridge.ts](./src/app-bridge.ts): `AppBridge` class used by the host to talk to a single App
18+
19+
What this repo does NOT provide:
20+
- There's no host implementation here (beyond the `AppBridge` just used for communications).
21+
- We have contributed a tentative implementation of hosting / iframing / sandboxing logic to the [MCP-UI](https://github.com/idosal/mcp-ui) repository, and expect OSS clients may use it, while other clients might roll their own hosting logic.
22+
- A prior iteration of an e2e prototype w/ client, server and hosting parts is available [in this gist](https://gist.github.com/ochafik/a9603ba2d6757d6038ce066eded4c354)
623

724
## Installation
825

9-
This repo is in flux and isn't published to npm (when it is, we'll probably use the `@modelcontextprotocol/ext-apps` package). Please install it from git for now:
26+
This repo is in flux and isn't published to npm (when it is, it will use the `@modelcontextprotocol/ext-apps` package). Please install it from git for now:
1027

1128
```bash
1229
npm install git+https://github.com/modelcontextprotocol/ext-apps.git

examples/simple-server/server.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ const getServer = async () => {
4747
uri: "ui://vanilla",
4848
title: "Vanilla UI Template",
4949
description: "A simple vanilla JS UI",
50-
mimeType: "text/html",
50+
mimeType: "text/vnd.mcp.ui+html",
5151
};
5252

5353
server.registerResource(
@@ -89,7 +89,7 @@ const getServer = async () => {
8989
uri: "ui://react",
9090
title: "React UI Template",
9191
description: "A React-based UI",
92-
mimeType: "text/html",
92+
mimeType: "text/vnd.mcp.ui+html",
9393
};
9494

9595
server.registerResource(

specification/draft/apps.mdx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ MCP Apps extends the Model Context Protocol to enable servers to deliver interac
4343
- **Bidirectional Communication:** UI iframes communicate with hosts using standard MCP JSON-RPC protocol
4444
- **Security Model:** Mandatory iframe sandboxing with auditable communication
4545

46-
This specification focuses on HTML content (`text/html`) as the initial content type, with extensibility for future formats.
46+
This specification focuses on HTML content (`text/vnd.mcp.ui+html`) as the initial content type, with extensibility for future formats.
4747

4848
As an extension, MCP Apps is optional and must be explicitly negotiated between clients and servers through the extension capabilities mechanism (see Capability Negotiation section).
4949

@@ -56,7 +56,7 @@ interface UIResource {
5656
uri: string; // MUST start with 'ui://'
5757
name: string; // Human-readable identifier
5858
description?: string; // Description of the UI resource
59-
mimeType: string; // SHOULD be 'text/html' in MVP
59+
mimeType: string; // SHOULD be 'text/vnd.mcp.ui+html' in MVP
6060
}
6161
```
6262

@@ -67,7 +67,7 @@ The resource content is returned via `resources/read`:
6767
{
6868
contents: [{
6969
uri: string; // Matching UI resource URI
70-
mimeType: "text/html"; // MUST be "text/html"
70+
mimeType: "text/vnd.mcp.ui+html"; // MUST be "text/vnd.mcp.ui+html"
7171
text?: string; // HTML content as string
7272
blob?: string; // OR base64-encoded HTML
7373
_meta?: {
@@ -85,7 +85,7 @@ The resource content is returned via `resources/read`:
8585
#### Content Requirements:
8686

8787
- URI MUST start with `ui://` scheme
88-
- `mimeType` MUST be `text/html` (other types reserved for future extensions)
88+
- `mimeType` MUST be `text/vnd.mcp.ui+html` (other types reserved for future extensions)
8989
- Content MUST be provided via either `text` (string) or `blob` (base64-encoded)
9090
- Content MUST be valid HTML5 document
9191

@@ -144,14 +144,14 @@ Example:
144144
"uri": "ui://weather-server/dashboard-template",
145145
"name": "weather_dashboard",
146146
"description": "Interactive weather dashboard widget",
147-
"mimeType": "text/html"
147+
"mimeType": "text/vnd.mcp.ui+html"
148148
}
149149

150150
// Resource content with metadata
151151
{
152152
"contents": [{
153153
"uri": "ui://weather-server/dashboard-template",
154-
"mimeType": "text/html",
154+
"mimeType": "text/vnd.mcp.ui+html",
155155
"text": "<!DOCTYPE html><html>...</html>",
156156
"_meta": {
157157
"ui/csp": {
@@ -841,7 +841,7 @@ Servers SHOULD check client (host would-be) capabilities before registering UI-e
841841

842842
```typescript
843843
const hasUISupport =
844-
clientCapabilities?.extensions?.["io.modelcontextprotocol/ui"]?.mimeTypes?.includes("text/html");
844+
clientCapabilities?.extensions?.["io.modelcontextprotocol/ui"]?.mimeTypes?.includes("text/vnd.mcp.ui+html");
845845

846846
if (hasUISupport) {
847847
// Register tools with UI templates
@@ -925,7 +925,7 @@ This proposal synthesizes feedback from the UI CWG and MCP-UI community, host im
925925

926926
#### 3. Support Raw HTML Content Type
927927

928-
**Decision:** MVP supports only `text/html` (rawHtml), with other types explicitly deferred.
928+
**Decision:** MVP supports only `text/vnd.mcp.ui+html` (rawHtml), with other types explicitly deferred.
929929

930930
**Rationale:**
931931

0 commit comments

Comments
 (0)