Files
..

mcp-apps

Companion code for MCP Apps in Java: Serve Interactive HTML UIs from a Spring AI MCP Server on ankurm.com. A Spring AI MCP server whose tools come with an HTML view (the MCP Apps extension, io.modelcontextprotocol/ui, spec 2026-01-26).

mvn -pl mcp-apps package                     # tests write output/01-04, builds target/mcp-apps.jar
java -jar mcp-apps/target/mcp-apps.jar       # Streamable HTTP on http://localhost:3001/mcp
./mcp-apps/scripts/run-all.sh                # output/01-07 and 09 (needs Node 20+ and Chromium)
./mcp-apps/scripts/basic-host.sh             # output/08: the official ext-apps basic-host (clones it, needs the network)

Set CHROMIUM_PATH to use an installed Chromium; otherwise run npx playwright install chromium in harness/.

File Role
UiMeta The _meta.ui blocks as MetaProvider classes: tool link, visibility, CSP
InventoryTools show_inventory, show_inventory_sdk, and the app-only restock_item; text fallback by client capability
UiResources The two ui:// resources
resources/ui/board.html A view with no library: postMessage JSON-RPC by hand
resources/ui/board-sdk.html A view on @modelcontextprotocol/ext-apps loaded from unpkg, so it declares a CSP domain
VisibilityFilter McpToolFilter logic for a Java host: keeps app-only tools away from the model
CorsConfig Off by default; for hosts that call /mcp from the browser
McpAppsServerTest Raw HTTP and MCP Java SDK clients, Spring AI SyncMcpToolCallbackProvider
harness/ A web host on the official AppBridge with a second-origin sandbox proxy and a strict CSP, driven by Playwright

Profiles: browserhost (CORS for the basic-host), poisoned (a product name carrying markup), unsafe (the same, rendered with innerHTML; never ship it).

Captured output

File Shows
output/01-wire.txt capabilities, tools/list, resources/list, resources/read and where _meta ends up
output/02-capability.txt the same tool for a client with and without the UI extension
output/03-callback.txt restock_item, its errors, and that any client can call an "app-only" tool
output/04-spring-ai-client.txt Spring AI as host offers app-only tools to the model unless filtered
output/05-browser-board.txt, board.png the hand-written view in Chromium, sandbox probes, ui/message shapes
output/06-browser-csp.txt, board-sdk.png the SDK view with and without the CSP declaration
output/07-browser-injection.txt script injection through tool data
output/08-basic-host.txt, basic-host.png the official reference host
output/09-jar-search.txt no MCP Apps specific API in the Spring AI 2.1.0 / SDK 2.2.0 MCP jars

Versions

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, @modelcontextprotocol/client 2.4.0, Playwright 1.65.2 driving Chrome for Testing 158, Node 22. The basic-host is from modelcontextprotocol/ext-apps commit 87bcdc8.

Not covered

Nothing here was run in Claude, ChatGPT, VS Code or another production host, and no model was involved. The server was run with the streamable protocol only, not the stateless one. In the browser runs unpkg.com is answered from the pinned npm package.