MCP Apps 2.1.0 Tutorial: Build an Interactive TypeScript Release Dashboard with App-Only Tools (2026 Guide)
Your MCP server can return perfect JSON and still leave the user staring at a wall of text. A release checklist, status board, map, chart or configuration form is often better as an interface than another paragraph. MCP Apps gives an MCP server a standard way to link a tool to an HTML interface that a compatible host can render in a sandboxed view.
In this guide, you will build a local release-readiness dashboard with TypeScript, Node.js and the official @modelcontextprotocol/ext-apps SDK. The model will have one visible tool that opens the board. The interface will use two app-only tools to read checklist items and update their status. The example stores data in a local JSON file, so you can see the complete request path without needing an external database or SaaS account.
The goal is not just to display HTML. You will connect the tool, the ui:// resource, the sandboxed view and the server-side actions, then test the result with the official MCP Apps reference host.
What you are building
- Model-visible tool:
open-release-boardopens the dashboard and returns a useful text fallback. - UI resource:
ui://release-board/index.htmlserves a single bundled HTML file. - App-only read tool:
list-release-itemsreturns the current checklist to the view. - App-only update tool:
set-release-item-statuschanges one item's status after server-side validation. - Local persistence: the server writes the demo checklist to
data/release-items.json.
The architecture follows the official MCP Apps pattern: a tool points to a predeclared UI resource through _meta.ui.resourceUri; the host reads the resource and renders it; the view talks to the host through the Apps bridge; and the host proxies tool calls back to the originating MCP server. The view does not need a direct connection to your database or server process.
Version and compatibility notes
Version-specific checks for this guide were made on 29 November 2026. The official GitHub releases page lists v2.1.0 as the latest release. The npm registry exposes a separate latest dist-tag; its version page showed 2.0.4 as the latest-tagged package on 26 November even though a 2.1.0 release exists. The install command therefore pins @modelcontextprotocol/[email protected] explicitly rather than relying on @latest. Check npm view @modelcontextprotocol/ext-apps dist-tags versions --json against your registry before installing, especially when using a private mirror.
The 2.x SDK line uses the split MCP TypeScript packages, requires Node.js 20 or later, and uses Zod 4.2 or later. The v2.1.0 release adds WebMCP interoperability; this example does not register browser-side WebMCP tools, so its tool surface remains the server tools shown below. The wire protocol is defined separately from the SDK version. This guide follows the stable MCP Apps specification dated 2026-01-26.
Host support is not universal. MCP Apps is an optional extension, not a feature every MCP client automatically renders. The official extension support matrix is community-maintained and changes over time. Use the reference basic-host in this tutorial to verify your implementation independently of a commercial host.
Prerequisites
- Node.js 20+ and npm.
- TypeScript and basic familiarity with MCP tools and resources.
- A terminal and a browser.
- Enough disk space for npm packages and the local reference-host repository.
If MCP tools, resources and transports are new to you, first read the GyanAangan guide MCP Explained in 2026. You do not need an AI model to test this dashboard: the reference host lets you call the tool directly.
Step 1 — Create the project and install the SDK
mkdir mcp-release-board
cd mcp-release-board
npm init -y
npm install @modelcontextprotocol/[email protected] @modelcontextprotocol/client@^2.0.0 @modelcontextprotocol/server@^2.0.0 @modelcontextprotocol/node@^2.0.0 @modelcontextprotocol/express@^2.0.0 zod@^4.2.0 express@^5.1.0 cors
npm install -D typescript vite vite-plugin-singlefile tsx cross-env @types/node @types/express @types/cors
Use the same package family for the client, server, Node transport and Express adapter. Mixing the old monolithic @modelcontextprotocol/[email protected] with the 2.x split packages is a common source of TypeScript and peer-dependency errors.
Set package.json to use ES modules and add the build and development scripts:
{
"name": "mcp-release-board",
"private": true,
"type": "module",
"scripts": {
"build": "tsc --noEmit && cross-env INPUT=release-board.html vite build",
"watch:view": "cross-env INPUT=release-board.html vite build --watch",
"dev": "tsx watch main.ts",
"start": "tsx main.ts"
}
}
Create this project layout:
mcp-release-board/
├── data/
├── src/
│ └── release-board.ts
├── main.ts
├── server.ts
├── release-board.html
├── vite.config.ts
├── tsconfig.json
└── package.json
Step 2 — Register the model-visible tool and app-only tools
Create server.ts. The first tool is visible to the model and links to the UI resource. The other two tools are marked visibility: ["app"], which tells a compliant host that the view may call them but the model should not receive them as ordinary tools. This is useful for keeping UI actions out of the model's direct tool list.
import {
registerAppResource,
registerAppTool,
RESOURCE_MIME_TYPE,
} from "@modelcontextprotocol/ext-apps/server";
import { McpServer } from "@modelcontextprotocol/server";
import fs from "node:fs/promises";
import path from "node:path";
import { fileURLToPath } from "node:url";
import { z } from "zod";
const ROOT = path.dirname(fileURLToPath(import.meta.url));
const DATA_DIR = path.join(ROOT, "data");
const DATA_FILE = path.join(DATA_DIR, "release-items.json");
const UI_FILE = path.join(ROOT, "dist", "release-board.html");
const RESOURCE_URI = "ui://release-board/index.html";
type Status = "todo" | "doing" | "done";
type Item = {
id: string;
title: string;
owner: string;
status: Status;
};
const seed: Item[] = [
{ id: "R-101", title: "Freeze dependency versions", owner: "Platform", status: "todo" },
{ id: "R-102", title: "Run integration tests", owner: "Backend", status: "doing" },
{ id: "R-103", title: "Review release notes", owner: "Release", status: "todo" },
{ id: "R-104", title: "Verify rollback plan", owner: "SRE", status: "done" }
];
async function saveItems(items: Item[]): Promise<void> {
await fs.mkdir(DATA_DIR, { recursive: true });
await fs.writeFile(DATA_FILE, JSON.stringify(items, null, 2), "utf8");
}
async function loadItems(): Promise<Item[]> {
await fs.mkdir(DATA_DIR, { recursive: true });
try {
const raw = await fs.readFile(DATA_FILE, "utf8");
return JSON.parse(raw) as Item[];
} catch (error) {
if ((error as NodeJS.ErrnoException).code !== "ENOENT") {
throw error;
}
await saveItems(seed);
return seed;
}
}
function jsonResult(value: unknown) {
return {
content: [{ type: "text" as const, text: JSON.stringify(value) }]
};
}
export function createServer() {
const server = new McpServer({
name: "mcp-release-board",
version: "1.0.0"
});
registerAppTool(
server,
"open-release-board",
{
title: "Open Release Board",
description: "Open the interactive local release checklist. Hosts without MCP Apps support receive a text summary.",
inputSchema: z.object({}),
_meta: {
ui: {
resourceUri: RESOURCE_URI,
visibility: ["model", "app"]
}
}
},
async () => {
const items = await loadItems();
return {
content: [{
type: "text",
text: "Release board is ready with " + items.length + " checklist items."
}]
};
}
);
registerAppTool(
server,
"list-release-items",
{
title: "List Release Items",
description: "Read the current release checklist for the release-board interface.",
inputSchema: z.object({}),
annotations: { readOnlyHint: true },
_meta: { ui: { visibility: ["app"] } }
},
async () => jsonResult(await loadItems())
);
registerAppTool(
server,
"set-release-item-status",
{
title: "Set Release Item Status",
description: "Update one release checklist item from the interactive interface.",
inputSchema: z.object({
id: z.string().regex(/^R-[0-9]{3}$/),
status: z.enum(["todo", "doing", "done"])
}),
_meta: { ui: { visibility: ["app"] } }
},
async ({ id, status }) => {
const items = await loadItems();
const item = items.find((entry) => entry.id === id);
if (!item) {
return {
isError: true,
content: [{ type: "text", text: "Unknown release item." }]
};
}
item.status = status;
await saveItems(items);
return jsonResult(item);
}
);
registerAppResource(
server,
"Release Board UI",
RESOURCE_URI,
{ mimeType: RESOURCE_MIME_TYPE },
async () => {
const html = await fs.readFile(UI_FILE, "utf8");
return {
contents: [{
uri: RESOURCE_URI,
mimeType: RESOURCE_MIME_TYPE,
text: html
}]
};
}
);
return server;
}
There are three important details here:
RESOURCE_URIuses the requiredui://scheme.- The model-visible tool uses
_meta.ui.resourceUri. Avoid the deprecated flat_meta["ui/resourceUri"]form. - The status-changing tool validates both the item ID and the status on the server. Hiding it from the model is an additional boundary, not a substitute for validation or authorization.
The example data is intentionally local and small. It is not a concurrent database: if you turn this into a multi-user service, replace the JSON file with a database and add transactions, authentication and per-user authorization.
Step 3 — Add HTTP and stdio transports
The reference host connects to an MCP server over Streamable HTTP. Other MCP clients may prefer stdio. The entry point below supports both modes. Create main.ts:
import { createMcpExpressApp } from "@modelcontextprotocol/express";
import { NodeStreamableHTTPServerTransport } from "@modelcontextprotocol/node";
import { StdioServerTransport } from "@modelcontextprotocol/server/stdio";
import cors from "cors";
import type { Request, Response } from "express";
import { createServer } from "./server.js";
async function startHttpServer() {
const host = "127.0.0.1";
const port = Number(process.env.PORT ?? "3001");
const app = createMcpExpressApp({ host });
// The local reference host runs at this origin.
app.use(cors({ origin: "http://localhost:8080" }));
app.all("/mcp", async (req: Request, res: Response) => {
const server = createServer();
const transport = new NodeStreamableHTTPServerTransport({
sessionIdGenerator: undefined
});
res.on("close", () => {
void transport.close();
void server.close();
});
try {
await server.connect(transport);
await transport.handleRequest(req, res, req.body);
} catch (error) {
console.error("MCP request failed:", error);
if (!res.headersSent) {
res.status(500).json({
jsonrpc: "2.0",
error: { code: -32603, message: "Internal server error" },
id: null
});
}
}
});
app.listen(port, host, () => {
console.log("MCP server listening at http://" + host + ":" + port + "/mcp");
});
}
async function main() {
if (process.argv.includes("--stdio")) {
await createServer().connect(new StdioServerTransport());
return;
}
await startHttpServer();
}
main().catch((error) => {
console.error(error);
process.exit(1);
});
The HTTP example binds to loopback and allows the reference host's local origin only. Do not change this to 0.0.0.0 or wildcard CORS for convenience on a public machine. If you later expose the server, put it behind HTTPS, authentication, a strict origin allowlist and a network policy.
Step 4 — Build the interactive view
Create release-board.html. The page contains no remote scripts, fonts or images, which keeps the view simple and compatible with a restrictive content-security policy.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Release Board</title>
<style>
body { margin: 0; padding: 20px; font: 15px system-ui, sans-serif; background: #f6f7f9; color: #172033; }
main { max-width: 900px; margin: auto; }
header { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
h1 { margin: 0; font-size: 1.5rem; }
#message { min-height: 24px; color: #475569; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
article { padding: 16px; border: 1px solid #dbe1e8; border-radius: 12px; background: white; }
article h2 { margin: 0 0 8px; font-size: 1rem; }
article p { color: #64748b; font-size: .9rem; }
select, button { padding: 8px 10px; border: 1px solid #cbd5e1; border-radius: 8px; background: white; }
button { cursor: pointer; }
</style>
</head>
<body>
<main>
<header>
<div>
<h1>Release readiness</h1>
<p>A local checklist backed by MCP tools</p>
</div>
<button id="refresh" type="button">Refresh</button>
</header>
<p id="message" role="status">Connecting to the MCP host…</p>
<section id="items" class="grid" aria-live="polite"></section>
</main>
<script type="module" src="/src/release-board.ts"></script>
</body>
</html>
Now create src/release-board.ts. The view uses the SDK's App class to connect to the host. It then calls the app-only read tool, renders the returned items, and calls the app-only update tool when a status changes.
import { App } from "@modelcontextprotocol/ext-apps";
import type { CallToolResult } from "@modelcontextprotocol/client";
type Status = "todo" | "doing" | "done";
type Item = {
id: string;
title: string;
owner: string;
status: Status;
};
const app = new App({ name: "Release Board", version: "1.0.0" });
const root = document.querySelector<HTMLElement>("#items")!;
const message = document.querySelector<HTMLElement>("#message")!;
const refreshButton = document.querySelector<HTMLButtonElement>("#refresh")!;
function readText(result: CallToolResult): string {
if (result.isError) {
throw new Error("The MCP tool returned an error.");
}
const part = result.content.find((entry) => entry.type === "text");
if (!part || part.type !== "text") {
throw new Error("The MCP tool returned no text content.");
}
return part.text;
}
async function refresh() {
message.textContent = "Loading checklist…";
const result = await app.callServerTool({
name: "list-release-items",
arguments: {}
});
const items = JSON.parse(readText(result)) as Item[];
root.replaceChildren();
for (const item of items) {
const card = document.createElement("article");
const heading = document.createElement("h2");
const details = document.createElement("p");
const select = document.createElement("select");
heading.textContent = item.title;
details.textContent = item.id + " · " + item.owner;
const statuses: Status[] = ["todo", "doing", "done"];
for (const value of statuses) {
const option = document.createElement("option");
option.value = value;
option.textContent = value;
select.append(option);
}
select.value = item.status;
select.setAttribute("aria-label", "Status for " + item.title);
select.addEventListener("change", async () => {
select.disabled = true;
try {
const update = await app.callServerTool({
name: "set-release-item-status",
arguments: { id: item.id, status: select.value }
});
if (update.isError) {
throw new Error(readText(update));
}
await refresh();
} catch (error) {
message.textContent = "Update failed: " + String(error);
select.disabled = false;
}
});
card.append(heading, details, select);
root.append(card);
}
message.textContent = items.length + " checklist items loaded";
}
refreshButton.addEventListener("click", () => {
void refresh().catch((error) => {
message.textContent = "Refresh failed: " + String(error);
});
});
async function main() {
try {
await app.connect();
await refresh();
} catch (error) {
message.textContent = "Could not connect to the MCP host: " + String(error);
}
}
void main();
Notice that dynamic task names are assigned with textContent, not inserted as HTML. If you later load user-controlled titles or notes, keep that rule. The view should not turn untrusted tool data into executable markup.
Step 5 — Configure Vite and TypeScript
Create vite.config.ts so the view is bundled into one HTML resource. A single-file output makes it straightforward for the MCP server to read and return the interface as a resource.
import { defineConfig } from "vite";
import { viteSingleFile } from "vite-plugin-singlefile";
const input = process.env.INPUT;
if (!input) {
throw new Error("Set INPUT to the HTML entry file.");
}
export default defineConfig({
plugins: [viteSingleFile()],
build: {
rollupOptions: { input },
outDir: "dist",
emptyOutDir: true
}
});
Create a minimal tsconfig.json:
{
"compilerOptions": {
"target": "ES2022",
"lib": ["ES2022", "DOM", "DOM.Iterable"],
"types": ["node", "vite/client"],
"module": "ESNext",
"moduleResolution": "Bundler",
"strict": true,
"skipLibCheck": true,
"noEmit": true,
"verbatimModuleSyntax": true,
"esModuleInterop": true
},
"include": ["src", "server.ts", "main.ts", "vite.config.ts"]
}
Step 6 — Build and start the MCP server
Run the TypeScript check and build the single-file view:
npm run build
Expected result: TypeScript exits without diagnostics and Vite creates dist/release-board.html. This is an expected result to check on your machine, not a claim that the project was executed as part of writing this guide.
Open two terminals in the project directory. In terminal one, start the bundled-view watcher:
npm run watch:view
In terminal two, start the local Streamable HTTP server:
npm run dev
Wait for the build watcher and server to start. The server should announce an endpoint at http://127.0.0.1:3001/mcp. Keep this terminal open.
Step 7 — Test with the official MCP Apps reference host
Open a second terminal and clone the official repository at the matching SDK tag:
git clone --branch v2.1.0 --depth 1 https://github.com/modelcontextprotocol/ext-apps.git
cd ext-apps
npm install
cd examples/basic-host
Start the host and explicitly point it at your local server. On macOS or Linux:
SERVERS='["http://127.0.0.1:3001/mcp"]' npm run start
In PowerShell:
$env:SERVERS='["http://127.0.0.1:3001/mcp"]'
npm run start
Open http://localhost:8080. Select your mcp-release-board server and choose open-release-board from the tool list. Call it. The host should fetch ui://release-board/index.html, verify the MCP Apps MIME type, and render the dashboard in its sandbox.
Try changing R-101 from todo to doing. The view calls set-release-item-status, the server validates the ID and status, writes the JSON file, and the view refreshes the list. You should see the new status remain after closing and reopening the board because the demo writes to data/release-items.json.
The reference host's README documents the default server endpoint, its SERVERS environment variable and the sandbox-proxy architecture. If you want to test with a different MCP client, use the stdio mode described next and check that client's current MCP Apps support first.
Step 8 — Connect a stdio-based MCP client
The same server can run over stdio because main.ts checks for the --stdio argument. A generic client configuration looks like this; replace the path with the absolute path to your project and adapt the configuration key to your client's documented format.
{
"mcpServers": {
"release-board": {
"command": "npx",
"args": [
"tsx",
"/absolute/path/to/mcp-release-board/main.ts",
"--stdio"
]
}
}
}
When the model calls open-release-board, a client with MCP Apps support can render the view. A client without the extension should still receive the tool's text response. That fallback is deliberate: it prevents the server from becoming unusable just because a host does not render interactive resources.
How the app-only tool boundary works
The stable specification defines tool visibility values. A tool marked ["model", "app"] can be called by the model and by the app. A tool marked ["app"] is hidden from the model's tool list and can be called by the view through the host. This is why the sample exposes only open-release-board to the model while the interface reads and changes checklist data.
This is a useful design for forms, dashboards and approval interfaces: the model can open the interface, but the view drives its own constrained UI operations. Still, the server must treat every request as untrusted. A malicious or buggy client may not enforce the same UI policy, and a visibility flag is not an authorization system.
Security and production considerations
- Validate every input on the server. The sample restricts IDs to a known format and status values to a fixed enum. Also check that the item exists before writing.
- Keep app-only operations narrow. Do not expose a generic file-write, shell or database-admin tool just because a view needs to update one field.
- Use the host sandbox, but do not rely on it alone. MCP Apps views are rendered in a sandboxed environment and communicate through the host. The host and server still need strict validation and capability boundaries.
- Declare only the external origins you need. This demo uses no remote scripts, images or APIs. If a real app needs network access, add the minimum required CSP domains in resource metadata and review them.
- Restrict network exposure. The sample binds to
127.0.0.1and limits CORS to the local reference host. For remote use, add TLS, authentication, origin validation, rate limits and a firewall. - Protect persistent data. The JSON file is a single-user demonstration. Use a transactional database, backups, per-user access checks and audit logging for real workflows.
- Review WebMCP interoperability. SDK v2.1.0 adds a bridge between app tools and page-provided WebMCP tools. If you add browser-side tools later, review their names, schemas, permissions and side effects before exposing them.
- Do not trust rendered content. Use
textContentfor untrusted strings, validate URLs before opening them, and avoid inserting arbitrary HTML from tool results.
Troubleshooting
The tool appears, but the interface is blank
Check that npm run build created dist/release-board.html. Confirm that the resource URI in the tool metadata exactly matches the URI registered by registerAppResource. Verify that the returned MIME type is text/html;profile=mcp-app. Finally, confirm that the selected host supports MCP Apps rather than only core MCP tools.
The reference host cannot connect
Check that the MCP server is listening on port 3001, that the SERVERS value points to http://127.0.0.1:3001/mcp, and that the server CORS allowlist matches the page origin http://localhost:8080. Do not mix localhost and 127.0.0.1 casually when debugging origins.
The view loads but tool calls fail
Check the exact names list-release-items and set-release-item-status. Make sure both tools are registered on the same server connection as the UI resource and that their metadata includes visibility: ["app"]. Inspect the host console and server terminal for validation errors.
The status changes but disappears after restart
Check that the process can write to the project's data directory. Confirm that the server is running from the intended project and that the file path in server.ts is based on the source file location rather than an unexpected working directory.
npm reports a version or peer-dependency error
Check the registry and exact published versions with npm view @modelcontextprotocol/ext-apps versions --json. Do not assume the npm latest tag matches the newest GitHub release. Keep the 2.x split packages together and use Zod 4.2 or newer. If a corporate registry mirror is stale, refresh it or choose a version that it actually serves.
FAQ
Is an MCP App a replacement for an MCP tool?
No. An MCP App is built around an ordinary MCP tool plus a linked UI resource. The tool remains callable through MCP, and a text fallback can serve hosts that do not render the interface.
Does every MCP client display MCP Apps?
No. MCP Apps is an optional extension. Check the current client support matrix and test with the reference host before promising UI support in a target client.
Can I use React instead of vanilla TypeScript?
Yes. The official SDK provides React bindings, and the repository includes examples for React, Vue, Svelte, Preact and other frameworks. The server-side tool/resource pattern stays the same.
Can an app call another MCP server directly?
The intended flow is for the view to call the host through the Apps SDK. The host proxies permitted calls to the originating server and remains in control of the interaction. Do not hard-code privileged backend credentials into the HTML view.
Do I need WebMCP for this tutorial?
No. The sample uses server-registered MCP tools only. WebMCP interoperability in SDK 2.1.0 is an additional integration path for browser-provided tools, not a requirement for rendering an MCP App.
Related GyanAangan guides
- MCP Explained in 2026: Servers, Tools, Security and Extensions — core concepts and protocol architecture.
- Build a Local Notes MCP Server in Python with SQLite and MCP Inspector — a practical tool-and-resource server in Python.
- Secure Multi-Tenant MCP Servers with OAuth and Tenant Isolation — authentication and server-side authorization patterns.
- MCP Elicitation with Python SDK 2.3.0 — human input and approval workflows.
- Open WebUI 0.13.0: Build a Local AI Coding Workspace — another way to build an interactive local developer workflow.
Official references
- Official MCP Apps repository — source code, examples and implementation notes.
- MCP Apps releases — version history, including v2.1.0 and its WebMCP interoperability changes.
- Official MCP Apps quickstart — project setup, tool/resource registration and reference-host testing.
- Server helper API —
registerAppTool,registerAppResourceand MIME helpers. - App class API — connection lifecycle and
callServerTool. - Stable MCP Apps specification — resource URI, tool metadata, visibility, host communication and sandbox requirements.
- Official basic-host example — reference host and local test setup.
- MCP extension support matrix — current client support, maintained by the community.
- npm package versions — published package versions and dist-tags.
Final takeaway: the most useful MCP Apps are not just attractive HTML wrapped around a tool. They define a narrow interaction contract: a model-visible entry point, a predeclared UI resource, app-only actions where appropriate, strict server validation and a safe text fallback. Start with that contract, then add charts, forms, maps or richer views only when the workflow genuinely benefits from an interface.
