MCP Apps in Java: Serve Interactive HTML UIs from a Spring AI MCP Server
Build an MCP App in Java with Spring AI 2.1.0: ui:// HTML resources linked to tools through MetaProvider, a button that calls an app-only tool back, CSP declarations, a script-injection demo, MCP Java SDK client tests and runs in Chromium against the official basic-host. No production chat host or model was used.
Your MCP tool returns a stock list. The model reads it, rewrites it as a paragraph, and the user asks: “which ones are low?”, then “restock the keyboard”, then “show me again”. Three round trips through a language model for what a table with a button does in one click.
MCP Apps is the Model Context Protocol extension that fixes this: your server ships a small HTML page, a tool points at it, and a host that supports the extension draws the page inside the conversation. This post builds one in Java with Spring AI 2.1.0, shows the messages that cross each boundary, breaks it on purpose, and tests it with the MCP Java SDK client and a real browser.
Versions, verified on 2026-12-05. MCP Apps spec 2026-01-26 (status Stable), Spring Boot 4.2.0, Spring AI 2.1.0, MCP Java SDK 2.2.0, JDK 25 (Temurin 25.0.5.1), JUnit 6.1.3, @modelcontextprotocol/ext-apps 2.0.4 (the npm latest tag; a 2.1.0 is also on npm without that tag), Chrome for Testing 158 driven by Playwright 1.65.2.
What was not run: no Claude, ChatGPT, VS Code or other production host, and no language model. The HTML was tested in Chromium against a host harness built on the official AppBridge, and against the official basic-host example.
An MCP App is a tool, an HTML resource, and a link between them
You already know the two MCP building blocks. A tool is a function the model can call. A resource is a document with a URI that a client can read. Between host and server, MCP Apps adds only a capability declaration and some metadata on top of these two: the HTML page is a resource whose URI starts with ui://, and the tool names that URI in its metadata field, _meta.ui.resourceUri.
The diagram above shows the whole mental model. The host learns about the link from tools/list, fetches the page with resources/read, puts it in a locked-down iframe, and after the tool runs it pushes the arguments and the result into that iframe. A host without MCP Apps support ignores the metadata and treats the tool as an ordinary one.
The spec calls the page a template, which is easy to confuse with MCP’s resource templates (URIs with {variables}). They are different things. The page is meant to be predeclared and static, so a host can fetch and review it before any tool runs, and the data arrives later as a message. Here is what the finished server puts on the wire for its three tools and its pages:
From the raw HTTP test (01-wire.txt):
## tools/list: name and _meta of each tool
restock_item _meta={"ui":{"visibility":["app"],"resourceUri":"ui://inventory/board.html"}}
show_inventory _meta={"ui":{"visibility":["model","app"],"resourceUri":"ui://inventory/board.html"}}
show_inventory_sdk _meta={"ui":{"visibility":["model","app"],"resourceUri":"ui://inventory/board-sdk.html"}}
## resources/list
ui://inventory/board-sdk.html mimeType=text/html;profile=mcp-app _meta={"ui":{"prefersBorder":true,"csp":{"resourceDomains":["https://unpkg.com"]}}}
ui://inventory/board.html mimeType=text/html;profile=mcp-app _meta={"ui":{"prefersBorder":true}}
Two names matter and neither is optional: the extension id io.modelcontextprotocol/ui, and the MIME type text/html;profile=mcp-app. The third tool, restock_item, has visibility ["app"]: it exists for the page’s buttons, not for the model.
Going deeper:
Spring AI has no MCP Apps annotation, and does not need one
I searched every class file in the Spring AI 2.1.0 MCP jars used here, plus mcp-core 2.2.0, for the MIME profile, the extension id and the ui:// scheme. Nothing matched:
Output of the search script (09-jar-search.txt):
mcp-spring-webmvc-2.1.0.jar: 0 class files match
spring-ai-autoconfigure-mcp-client-common-2.1.0.jar: 0 class files match
spring-ai-autoconfigure-mcp-client-httpclient-2.1.0.jar: 0 class files match
spring-ai-autoconfigure-mcp-server-common-2.1.0.jar: 0 class files match
spring-ai-autoconfigure-mcp-server-webmvc-2.1.0.jar: 0 class files match
spring-ai-mcp-annotations-2.1.0.jar: 0 class files match
spring-ai-mcp-2.1.0.jar: 0 class files match
spring-ai-starter-mcp-client-2.1.0.jar: 0 class files match
spring-ai-starter-mcp-server-webmvc-2.1.0.jar: 0 class files match
mcp-core-2.2.0.jar: 0 class files match
That is less of a gap than it sounds. @McpTool and @McpResource both take a metaProvider, a class that returns a map which becomes _meta. @McpResource also takes a mimeType. Those two attributes are the whole server-side integration. (The Spring team’s own MCP Apps article uses the same approach.)
The tool link is a plain map (UiMeta.java):
static Map<String, Object> tool(String resourceUri, String... visibility) {
return Map.of("ui", Map.of("resourceUri", resourceUri, "visibility", List.of(visibility)));
}
/** Model and view may call it. */
public static class ShowBoard implements MetaProvider {
public Map<String, Object> getMeta() {
return tool(BOARD_URI, "model", "app");
}
}
The CSP declaration, from the same file (UiMeta.java):
public static class SdkResource implements MetaProvider {
public Map<String, Object> getMeta() {
return Map.of("ui", Map.of("csp", Map.of("resourceDomains", List.of(CDN)), "prefersBorder", true));
}
}
The pages are served by an ordinary resource method (UiResources.java):
@McpResource(uri = UiMeta.BOARD_URI, name = "inventory_board", description = "Stock board view",
mimeType = UiMeta.MIME_TYPE, metaProvider = UiMeta.BoardResource.class)
public String board() throws IOException {
// app.unsafe-render=true switches the view to innerHTML, to demonstrate script injection. Never ship that.
return load("ui/board.html").replace("__UNSAFE_RENDER__", Boolean.toString(unsafeRender));
}
@McpResource(uri = UiMeta.SDK_URI, name = "inventory_board_sdk", description = "Stock board view (ext-apps SDK)",
mimeType = UiMeta.MIME_TYPE, metaProvider = UiMeta.SdkResource.class)
public String sdkBoard() throws IOException {
return load("ui/board-sdk.html");
}
Where the resource’s metadata lands depends on your method’s return type, and this is the one trap in the Spring layer. I added two test-only resources to find out.
The figure shows the result. With a String return type, the map appears on both the list entry and the read content. If you build the ReadResourceResult yourself, perhaps to compute the CSP per request, the list entry still carries the annotation’s metadata but the content does not:
The probe that builds its own result (01-wire.txt):
## resources/read ui://probe/explicit.html
mimeType=text/html;profile=mcp-app
_meta=(absent)
text starts: <!DOCTYPE html><title>explicit</title>
Why it matters. The stable 2026-01-26 text builds the host’s policy from the metadata on the read content. The draft of the next revision says hosts must check both places and prefer the content. If you return ReadResourceResult, call .meta(...) on the contents yourself, or your CSP declaration may never reach a host that only reads that.
A URI with a variable, such as ui://probe/{theme}.html, is registered as a resource template: it appeared under resources/templates/list and not under resources/list. Reading a concrete expansion worked, but a tool’s resourceUri is a fixed string, so I would not use templates for views. Keep one page per view and vary the data.
Going deeper:
content is for the model, structuredContent is for the view
A tool result has two payloads and the spec gives them different readers. content is text for the model and for any host that cannot draw. structuredContent is JSON for the page, and is not meant to enter the model’s context.
As the picture shows, the same call serves both. The method below also asks whether the client declared the extension. If it did not, the text carries the whole table, because text is all that user will see:
The tool and its fallback (InventoryTools.java):
private CallToolResult board(boolean uiSupported) {
List<Inventory.Item> items = inventory.all();
long low = items.stream().filter(Inventory.Item::low).count();
String text = low + " of " + items.size() + " items are below their reorder level.";
if (!uiSupported) {
text += "\n" + items.stream()
.map(i -> i.sku() + " " + i.name() + ": " + i.stock() + " in stock, reorder at " + i.reorderAt())
.collect(Collectors.joining("\n"));
}
return CallToolResult.builder().addTextContent(text).structuredContent(snapshot()).build();
}
Reading the declared capability, available through McpSyncRequestContext (InventoryTools.java):
Two SDK clients, one declaring the extension and one not, then call the same tool:
Captured by a JUnit test (02-capability.txt):
## client that declares io.modelcontextprotocol/ui: content
2 of 3 items are below their reorder level.
## client that does not: content
2 of 3 items are below their reorder level.
KB-01 Mechanical keyboard: 4 in stock, reorder at 10
MN-27 27 inch monitor: 25 in stock, reorder at 8
HB-04 USB4 hub: 0 in stock, reorder at 15
The Spring AI client side behaves as the spec intends here: the string that SyncMcpToolCallback returns to the model held the content text only, not the structured JSON (transcript).
Vary the text, never the metadata. The spec says servers should check the client capability before registering UI tools. The official basic-host example sends "capabilities":{} in its initialize request, shown further down, and still renders views. A server that withheld _meta.ui from clients that declare nothing would show no UI there.
The Java SDK has no MCP Apps helper, but ClientCapabilities has a generic extensions map, which is where the declaration travels. I ran the server with the streamable protocol, where capabilities arrive at initialize. The stateless 2026-07-28 protocol moves them into each request and I did not test this module on it; the stateless migration post covers what changes there.
Going deeper:
Clients.java: how a test client declares the extension
The view is a web page that speaks JSON-RPC to its parent window
There is no special browser API. The page and the host exchange JSON-RPC 2.0 messages with postMessage. The page starts with a ui/initialize request, confirms with a notification, and only then may the host send it anything.
Read the sequence above from the top: three messages of handshake, one push of data, and then whatever the user does. You can write this by hand in a few dozen lines, with no npm and no build step, which makes the protocol visible:
The whole client side of the transport (board.html):
let nextId = 1;
const pending = new Map();
const post = (message) => window.parent.postMessage({ jsonrpc: "2.0", ...message }, "*");
const notify = (method, params = {}) => post({ method, params });
function request(method, params) {
const id = nextId++;
post({ id, method, params });
return new Promise((resolve, reject) => pending.set(id, { resolve, reject }));
}
window.addEventListener("message", (event) => {
if (event.source !== window.parent) return; // only the host may talk to us
const msg = event.data;
if (!msg || msg.jsonrpc !== "2.0") return;
if (msg.method === undefined) { // a response to one of our requests
const waiting = pending.get(msg.id);
if (!waiting) return;
pending.delete(msg.id);
msg.error ? waiting.reject(new Error(msg.error.message)) : waiting.resolve(msg.result);
} else if (msg.id !== undefined) { // a request from the host: it expects an answer
if (msg.method === "ping" || msg.method === "ui/resource-teardown") post({ id: msg.id, result: {} });
else post({ id: msg.id, error: { code: -32601, message: "Method not found" } });
} else if (msg.method === "ui/notifications/tool-result") {
render(msg.params.structuredContent);
} else if (msg.method === "ui/notifications/host-context-changed") {
applyContext(msg.params);
}
});
The handshake, at the bottom of the same file (board.html):
Note the check on event.source: any window can post a message to any other, so the page listens to its parent only. Requests from the host, such as ping and ui/resource-teardown, have an id and expect a reply. size-changed notifications tell the host how tall to make the frame.
In the browser harness, this is the order of messages the host saw, including the button click covered next:
Host log from Chromium (05-browser-board.txt):
## host log (repeated size-changed lines removed)
host: tool show_inventory -> ui://inventory/board.html, declared csp none
view -> host: ui/notifications/sandbox-proxy-ready
view -> host: ui/initialize
view -> host: ui/notifications/initialized
view -> host: ui/notifications/size-changed
host: tool-input and tool-result delivered
view -> host: tools/call restock_item {"sku":"KB-01","quantity":10} (id 2)
view -> host: ui/update-model-context
host: model context = The user restocked KB-01 by 10 from the stock board.
That screenshot is the same page rendered by the official basic-host, after one click on the first button. The panel under the table is the context the view asked the host to give the model.
Message reference: what a view can send and receive
Message
Direction
Purpose
ui/initialize, ui/notifications/initialized
view to host
handshake; the result carries hostContext (theme, style variables, display mode)
ui/notifications/tool-input, tool-input-partial
host to view
tool arguments, optionally while the model is still writing them
ui/notifications/tool-result, tool-cancelled
host to view
the result, or the fact that there will be none
tools/call, resources/read
view to host
proxied to your server, if the host allows it
ui/message
view to host
add a user message to the chat
ui/update-model-context
view to host
replace the context the model sees on later turns
ui/open-link, ui/request-display-mode
view to host
open a URL; ask for fullscreen or picture-in-picture
The spec text and the SDK disagree on ui/message. Both the stable and the draft spec show content as a single object. The SDK’s TypeScript type is an array, and AppBridge 2.0.4 rejected the single object with a JSON-RPC invalid params error. If you write the protocol by hand, send an array.
The +10 button sends tools/call to the host, the host forwards it to your server, and the result comes back the same way. The view redraws from the new structuredContent and then tells the model what happened, so a later question such as “what did I just restock?” has an answer.
The click handler (board.html):
async function restock(sku, quantity) {
const status = document.getElementById("status");
try {
const result = await request("tools/call", { name: "restock_item", arguments: { sku, quantity } });
status.textContent = result.content[0].text;
if (result.isError) return;
render(result.structuredContent);
await request("ui/update-model-context", {
content: [{ type: "text", text: "The user restocked " + sku + " by " + quantity + " from the stock board." }],
});
} catch (error) {
status.textContent = "Host refused: " + error.message;
}
}
The server side is a normal tool with app-only visibility (InventoryTools.java):
@McpTool(name = "restock_item", description = "Add units to one stock item", metaProvider = UiMeta.AppOnly.class)
public CallToolResult restock(
@McpToolParam(description = "Stock keeping unit, for example KB-01") String sku,
@McpToolParam(description = "Units to add, 1 to 100") int quantity) {
Inventory.Item item = inventory.restock(sku, quantity);
return CallToolResult.builder()
.addTextContent("Restocked " + item.sku() + " by " + quantity + ", now " + item.stock() + " in stock.")
.structuredContent(snapshot())
.build();
}
Check result.isError in the view. A validation failure is a successful JSON-RPC response with that flag set, not an exception. Spring AI 2.1.0 also repeated the message here, where the exception has no separate cause:
An SDK client calling the tool with good and bad input (03-callback.txt):
## tools/list from a client with no UI support
[restock_item, show_inventory, show_inventory_sdk]
## restock_item sku=KB-01 quantity=10
isError=false
Restocked KB-01 by 10, now 14 in stock.
## restock_item sku=KB-01 quantity=500
isError=true
quantity must be between 1 and 100, got 500
quantity must be between 1 and 100, got 500
The first lines of that transcript are the important ones. A plain client with no UI support listed restock_item and then called it. Visibility is an instruction to the host, not access control on your server. Anyone who can reach the endpoint can call an app-only tool, so authorize it like any other: scopes per tool with Spring Security.
The rule also binds you if your Java application is the host. The spec says a host must not put app-only tools in the model’s tool list. Spring AI’s client does not apply that on its own:
Tool names offered to the model (04-spring-ai-client.txt):
## tools offered to the model, no filter
[restock_item, show_inventory, show_inventory_sdk]
## tools offered to the model, with VisibilityFilter
[show_inventory, show_inventory_sdk]
public static boolean visibleToModel(Tool tool) {
if (tool.meta() == null || !(tool.meta().get("ui") instanceof Map<?, ?> ui)
|| !(ui.get("visibility") instanceof List<?> visibility)) {
return true; // the spec default is ["model", "app"]
}
return visibility.contains("model");
}
For a write that matters, a button should not be the only gate. If the model can also call the tool, pair it with human-in-the-loop confirmation.
Going deeper:
The SDK means less code, and one external script means declaring a CSP
The official @modelcontextprotocol/ext-apps package wraps the protocol in an App class. The second view loads it from a CDN:
The SDK-based view (board-sdk.html):
import { App, applyHostStyleVariables } from "https://unpkg.com/@modelcontextprotocol/[email protected]/dist/src/app-with-deps.js";
const app = new App({ name: "stock-board-sdk", version: "1.0.0" }, {});
const status = document.getElementById("status");
function render(result) {
document.getElementById("rows").replaceChildren(...result.structuredContent.items.map((item) => {
const li = document.createElement("li");
li.className = item.stock < item.reorderAt ? "low" : "";
li.textContent = item.sku + " " + item.name + ": " + item.stock;
return li;
}));
}
// Register handlers before connect(), so no early notification is missed.
app.ontoolresult = render;
app.onhostcontextchanged = (context) => context.styles?.variables && applyHostStyleVariables(context.styles.variables);
document.getElementById("reload").onclick = async () => {
render(await app.callServerTool({ name: "show_inventory_sdk", arguments: {} }));
status.textContent = "Reloaded.";
};
document.getElementById("ask").onclick = async () => {
const reply = await app.sendMessage({
role: "user", content: [{ type: "text", text: "Which items should I reorder first?" }],
});
status.textContent = reply.isError ? "The host declined the message." : "Sent to the chat.";
};
await app.connect();
The host runs every view under a Content Security Policy (CSP), a browser rule listing which origins a page may load from or call. With nothing declared, no outside origin is allowed. The import works only because the resource lists https://unpkg.com in _meta.ui.csp.resourceDomains.
The diagram shows the arrangement a web host has to build: a proxy iframe on a second origin that applies the policy, and your page inside it. The module’s harness does exactly that, and builds its header from the spec’s restrictive default:
The directives the strict harness sends (csp.mjs):
Here is the same view with the declaration, and then with it removed, as if the server had forgotten it:
Two runs in Chromium (06-browser-csp.txt):
## with _meta.ui.csp.resourceDomains = [https://unpkg.com]
KB-01 Mechanical keyboard: 4
MN-27 27 inch monitor: 25
HB-04 USB4 hub: 0
host: tool show_inventory_sdk -> ui://inventory/board-sdk.html, declared csp {"resourceDomains":["https://unpkg.com"]}
host: tool-input and tool-result delivered
host: chat message = Which items should I reorder first?
## the same view when no domains are declared, 4 seconds later
view shows: Waiting for the tool result…
host: tool show_inventory_sdk -> ui://inventory/board-sdk.html, declared csp none
view -> host: ui/notifications/sandbox-proxy-ready
browser console:
Loading the script 'https://unpkg.com/@modelcontextprotocol/[email protected]/dist/src/app-with-deps.js' violates the following Content Security Policy directive: "script-src 'self' 'unsafe-inline'".
The fingerprint of a missing CSP declaration: no server error, no tool error, a view that never gets past its placeholder, and a host log with no ui/initialize. The only message is in the iframe’s browser console.
There are four lists, each for a different kind of access:
Field
CSP directives
Use it for
resourceDomains
script, style, img, font, media
CDN scripts, images, fonts
connectDomains
connect-src
fetch, XHR, WebSocket to your API
frameDomains
frame-src
embedded players and maps
baseUriDomains
base-uri
rarely needed
My advice is to declare nothing and ship a self-contained page, like the first view, or bundle your front end into one HTML file. Every domain you add is something a reviewer or a cautious host can refuse, and a CDN is code you do not control running next to your tool buttons. Prefer tools/call over connectDomains: your server already has the credentials.
Claude-specific details: stable origins, large results, iOS
Taken from Anthropic’s documentation, not tested here.
A view that needs a stable origin, for its own OAuth flow or an API that allowlists origins, sets _meta.ui.domain. The format is host-specific. For Claude it is the first 32 hex characters of the SHA-256 of the exact connector URL followed by .claudemcpcontent.com, and local stdio connectors cannot use it (getting started).
Very large tool results, roughly 150,000 characters when the code execution sandbox is active, may be written to a file instead of passed inline, so the view never gets its data. Page the data and fetch more with tools/call (troubleshooting).
On iOS, requests from the view carry no Referer; allowlist by Origin on your CDN or API (same page).
ext-apps 1.x to 2.x: the wire protocol is unchanged, the npm peer packages are not
Permissions (camera, microphone, geolocation, clipboardWrite) are requests a host may ignore, so feature-detect; not exercised here
The sandbox protects the host. It does not protect your tools from your own view
The isolation holds. From inside the view in the strict harness, reading the host page failed, and so did every network request, including one straight to the MCP server. eval was refused too:
Probes run by a script inside the view (05-browser-board.txt):
## probes run inside the view's frame
read host page DOM: SecurityError
fetch undeclared origin: TypeError: Failed to fetch
fetch the MCP server directly: TypeError: Failed to fetch
eval(): EvalError
fetch from the sandbox origin ('self'): TypeError
fetch undeclared origin: TypeError
But the view is allowed to call your tools. So think about what happens when data from your database contains markup. I seeded a product whose name is an <img> tag with an onerror handler that posts a tools/call message, and rendered it two ways.
The figure traces the attack: nothing in the chain is broken. The inline handler is allowed by 'unsafe-inline', which the spec’s own default includes, and the message really does come from your view.
textContent against innerHTML, no clicks (07-browser-injection.txt):
## textContent (the shipped view)
CB-99 row text: Cable <img src="x" onerror="parent.postMessage({jsonrpc:'2.0
clicks by the user: 0
tools/call sent by the view: none
KB-01 stock on the server afterwards: 4
## innerHTML (app.unsafe-render=true)
CB-99 row text: Cable
clicks by the user: 0
tools/call sent by the view:
view -> host: tools/call restock_item {"sku":"KB-01","quantity":99} (id 666)
KB-01 stock on the server afterwards: 103
The stock went from 4 to 103 without anyone touching the page. The shipped view uses textContent for every value. Do the same, or use a framework that escapes by default, and keep these three rules:
Treat every field in structuredContent as hostile, including values your own users typed.
Give view-callable tools narrow inputs and server-side limits, like the 1 to 100 check on quantity.
Authorize on the server. The harness forwarded the injected call because a host cannot tell it from a click.
Test it in layers, and do not trust a lenient host
You do not need a chat client to know your app works. You need to know which layer each tool covers.
The picture is the plan, with the third box marked as not done here. Layer one is JUnit and the MCP Java SDK client:
A client that declares MCP Apps support (Clients.java):
assertThat(Clients.text(withUi)).isEqualTo("2 of 3 items are below their reorder level.");
assertThat(Clients.text(without)).contains("HB-04 USB4 hub: 0 in stock");
assertThat(withUi.structuredContent()).isEqualTo(without.structuredContent());
Layer two is a browser. The module’s harness connects to the Java server with the TypeScript MCP client, hands the page to AppBridge, and runs it behind a second-origin proxy (host.js, sandbox.html, run.mjs). In these runs unpkg.com is answered from the pinned npm package, with the browser still enforcing the policy.
Then point the official basic-host at your server. A browser-based host calls /mcp from another origin, so Spring needs CORS, including the exposed session header:
CORS, off unless the browserhost profile is on (CorsConfig.java):
tools offered in basic-host's tool list: ["show_inventory","show_inventory_sdk"]
show_inventory, after clicking +10 on KB-01: Restocked KB-01 by 10, now 14 in stock.
probes in a view that declares no CSP domains:
eval(): ALLOWED
fetch from the sandbox origin ('self'): ALLOWED
fetch undeclared origin: TypeError
basic-host Model Context panel shows: The user restocked KB-01 by 10 from the stock board.
show_inventory_sdk renders: KB-01 Mechanical keyboard: 14 | MN-27 27 inch monitor: 25 | HB-04 USB4 hub: 0
initialize sent by basic-host: {"protocolVersion":"2025-11-25","capabilities":{},"clientInfo":{"name":"MCP Apps Host","version":"1.0.0"}}
methods basic-host sent while loading and running the first tool: initialize, notifications/initialized, tools/list, resources/list, tools/call, resources/read
It hid restock_item from its tool picker, rendered both views and forwarded the click. Compare the probes with the strict harness, though: eval and a request to the sandbox’s own origin were allowed in basic-host, because its serve.ts sends a looser policy than the spec’s restrictive default. A view that works there can still break in a stricter host.
Probe, no CSP declared
Strict harness
basic-host (commit 87bcdc8)
eval()
EvalError
allowed
fetch from the sandbox origin
blocked
allowed
fetch an undeclared origin
blocked
blocked
A testing trap of my own. My first version of the probe said eval() was allowed under the strict policy. It ran while a DevTools call was still on the stack, where Chromium does not apply that restriction. Waiting one timer tick before probing gave the correct EvalError. Test CSP from code the page itself schedules.
Run everything yourself
Needs JDK 25, Maven, Node 20+ and Chromium (module README).
run-all.sh: tests, the browser harness and the jar search (output/01 to 07, and 09)
basic-host.sh: clones ext-apps at the commit used here, builds basic-host with ext-apps 2.0.4 and runs output/08
The upstream example asks for ext-apps ^2.1.0 and serves with bun; the script pins 2.0.4 and serves with tsx.
Going deeper:
Support is per host, and optional. This is the community-maintained extension support matrix as read on 2026-12-05. I have not verified any row by running the host.
MCP Apps in the matrix
Clients
Supported: host applications
Claude (web), Claude Desktop, VS Code GitHub Copilot, Microsoft 365 Copilot, Goose, ChatGPT, Cursor, Kiro Crew, Glean
Claude Code, OpenCode, Hermes Agent, OpenClaw, mcpc, fast-agent, Eve
A host in the “not marked” row is not a dead end if you built the text fallback: it gets the same tool and reads content.
A listing says a host implements the extension, not that it implements every part. Display modes, permissions, ui/message and context updates can differ or ask the user first, so read hostCapabilities from the ui/initialize result and degrade. ChatGPT documents the standard bridge plus its own window.openai additions (OpenAI’s page). In Anthropic’s Claude Desktop walkthrough, Claude asks for permission before displaying an app. The ext-apps testing guide notes that remote hosts such as Claude.ai cannot reach localhost, so testing a local server there needs a tunnel.
Where the stable spec, the draft and the code differ
Topic
Observation
ui/message content
spec text: one object; SDK type and AppBridge 2.0.4: array (run above)
Resource metadata location
stable: examples build the policy from the read content; draft: list entry or read content, content wins; basic-host checks both
Web host iframes
stable: a sandbox proxy on a second origin is required; the draft also describes single-iframe arrangements
Default policy
the spec lists connect-src 'none' as the restrictive default, while its construction example uses connect-src 'self'; basic-host is looser than both
Build a view when the user has to look at many values or pick among many options: a board, a form with dependent fields, a chart they drill into. Skip it when the answer is a sentence or a short list, because you are adding a front end, a CSP, an injection surface and a host-compatibility matrix to something text already does.
Whatever you decide, the tool has to work without the view. Write the text first, then add the page.
A checklist before shipping:
Tool results carry a useful content text for every client.
Metadata is attached regardless of the declared capability.
The page uses textContent or an escaping framework, and checks event.source.
Every CSP domain is one you can justify; none is better.
App-only tools have server-side authorization and input limits.
A Java host filters tools by visibility.
It has been run under a strict policy, and then in each real host you claim to support.
No Comments yet!