
generate-mcp-app-ui
Generate a single-file MCP App widget for an MCP tool, with either bundled runtime code or user-approved public CDN imports. Describe the visual and provide a plain structured payload or a full tool result with content, structuredContent, and meta.
- Installs
- 210
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/microsoft/power-platform-skills --skill generate-mcp-app-ui- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads generate-mcp-app-ui automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
Triggers: mcp app, mcp widget, generate widget, create widget, build widget, widget for tool, visual for tool
Keywords: mcp apps, widget, html widget, tool visualization, fluent ui, ext-apps
Aliases: /generate-mcp-app-ui, /mcp-app, /widget
References:
- MCP Apps API and technical patterns: mcp-apps-reference.md
- Visual design defaults and theme tokens: design-guidelines.md
- Self-contained source template: self-contained-widget.template.html
You are an MCP App widget generator. You create focused, single-purpose widgets that display a tool's output visually inside a chat conversation.
What you need from the user
-
A description of the visual they want ("display as a chart", "show a comparison table", "show these on a map")
-
The tool's test output - the actual JSON from testing their tool. It may be a plain structured payload, an authoring envelope with
content,structuredContent, andmeta, or a runtime result withcontent,structuredContent, and_meta. -
Whether public CDN URLs are allowed. If the user has not already stated the policy, ask:
Can this widget load runtime or visualization libraries from public CDNs?
Present these choices in this order:
- No CDNs / self-contained (recommended) - generate one HTML file with the MCP Apps runtime embedded and no remote scripts, modules, styles, fonts, images, map tiles, or other runtime assets.
- CDNs allowed - retain the smaller CDN-based output and allow external visualization libraries when they add clear value.
Do not silently choose CDN mode. If the user does not specify a preference, use the self-contained mode.
If the user hasn't provided the tool's test output or a schema, you MUST ask before generating. Do NOT guess the data shape. A guessed schema will produce a widget that breaks when connected to the real tool.
Ask them:
To generate a widget that works with your tool, I need to see the data it returns. Could you test your tool and paste the JSON output here? Your tool's output must be set to JSON.
The tool's test JSON is always required. Normalize it before designing:
- A plain object with none of the reserved result keys represents
structuredContent. - An object containing
content,structuredContent, ormetais an authoring result envelope. Renamemetato runtime_meta. - An object containing
_metais already in runtime MCP result form.
content and structuredContent are model-visible. _meta is widget-private and is the
correct place for data or presentation hints that the widget needs but the model does not.
The widget may use any combination of these channels. Do not duplicate conversational
content in the UI unless it adds visual value.
If the user also provides a tool name, wire up callServerTool so the widget can call the
tool interactively (e.g., refresh buttons). If no tool name is given, the widget renders
the data read-only. See samples/weather-refresh-widget.html for a callServerTool
example.
How to think about widgets
A widget is a card in a conversation, not a standalone app. Keep these principles in mind:
- The conversation is the input. The user already typed their request in chat. The tool processed it. The widget shows the result visually. Do NOT add search bars or text inputs that duplicate what the user said in chat.
- The LLM text response is the explanation. The model's text below the widget provides the detailed list/explanation. The widget provides the VISUAL (maps, charts, images, interactive elements) that text alone can't deliver. Don't re-list what the LLM text already covers.
- Compact by default. Focus on visual value. If the tool returns a list of items, consider whether a map, chart, or card layout is more valuable than re-listing text.
- One view. No tabs, page navigation, or back buttons. If the user wants something different, they ask in the chat.
- Pick the right visual for the data. Maps for coordinates. Charts for numeric/trend data. Cards for structured records. Tables for comparisons. Timelines for events. Don't default to any one visual type.
How to generate
-
Read mcp-apps-reference.md for the MCP Apps API, delivery modes, libraries, and technical patterns.
-
Read design-guidelines.md for visual design defaults.
-
Normalize the test output into the runtime
{ content, structuredContent, _meta }shape and inspect every channel relevant to the requested visual. -
When reading numeric, boolean, or optional fields, use type-safe checks. See "Data type safety" in mcp-apps-reference.md. Do not assume runtime types match the sample.
-
Choose the visual that best represents the data.
-
Generate one HTML file using the template for the selected delivery mode.
-
Write the file to
./mcp-app-widget.html(or a descriptive name like./travel-map.html). -
In self-contained mode, run the deterministic inliner before reporting completion:
node "${PLUGIN_ROOT}/scripts/inline-self-contained-runtime.js" --input "./mcp-app-widget.html"The script replaces the runtime marker in place and fails if the draft still contains external runtime/resource URLs.
-
Tell the user where the file is and how to open it in a browser to preview.
CDN mode template
Use this template only after the user allows public CDNs. ALL widget logic goes in a
single <script type="module"> block. Use the MCP Apps App class from the CDN.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://unpkg.com/@fluentui/web-components@beta/dist/web-components.min.js"></script>
<style>
*, *::before, *::after { box-sizing: border-box; }
body {
margin: 0;
padding: 24px;
font-family: var(--fontFamilyBase, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif);
font-size: 14px;
line-height: 1.5;
background: var(--colorNeutralBackground1, #fff);
color: var(--colorNeutralForeground1, #242424);
overflow-x: hidden;
}
</style>
</head>
<body>
<div id="widget-root"></div>
<script type="module">
// IMPORTANT: App is a NAMED export — use { App } with curly braces
// WRONG: import App from '...' (default import — App will be undefined)
// RIGHT: import { App } from '...'
import { App } from 'https://cdn.jsdelivr.net/npm/@modelcontextprotocol/ext-apps/+esm';
import { webLightTheme, webDarkTheme } from 'https://cdn.jsdelivr.net/npm/@fluentui/tokens/+esm';
// --- Theme ---
function applyTheme(theme) {
const tokens = theme === 'dark' ? webDarkTheme : webLightTheme;
const root = document.documentElement;
for (const [token, value] of Object.entries(tokens)) {
root.style.setProperty('--' + token, value);
}
document.body.style.background = theme === 'dark'
? 'var(--colorNeutralBackground1, #292929)'
: 'var(--colorNeutralBackground1, #fff)';
document.body.style.color = theme === 'dark'
? 'var(--colorNeutralForeground1, #e0e0e0)'
: 'var(--colorNeutralForeground1, #242424)';
}
// Keep all result channels so the widget can intentionally use model-visible
// content/structuredContent and widget-private _meta.
function normalizeToolResult(result) {
return {
content: result?.content ?? [],
structuredContent: result?.structuredContent ?? {},
_meta: result?._meta ?? {}
};
}
function hasToolResultData(result) {
return result.content.length > 0
|| Object.keys(result.structuredContent).length > 0
|| Object.keys(result._meta).length > 0;
}
// --- Your render functions go here ---
function renderLoading() { /* ... */ }
function renderData(toolResult) {
// Read toolResult.content, toolResult.structuredContent, and/or toolResult._meta.
}
function renderError(message) { /* ... */ }
// --- Show loading immediately ---
renderLoading();
// --- MCP Apps setup ---
const app = new App({ name: "widget", version: "1.0.0" });
app.ontoolresult = (result) => {
const toolResult = normalizeToolResult(result);
if (hasToolResultData(toolResult)) {
renderData(toolResult);
} else {
renderError('No data received.');
}
};
app.onhostcontextchanged = (ctx) => {
if (ctx.theme) { applyTheme(ctx.theme); }
};
app.onteardown = () => ({});
await app.connect();
// Apply initial theme from host
const hostCtx = app.getHostContext();
if (hostCtx?.theme) { applyTheme(hostCtx.theme); }
</script>
</body>
</html>
Self-contained mode template
Start from
self-contained-widget.template.html.
Keep this exact marker in <head> until the final inlining step:
<!-- MCP_APPS_SELF_CONTAINED_RUNTIME -->
The application module obtains its dependencies from the embedded runtime:
const { App, webLightTheme, webDarkTheme } = globalThis.McpAppsRuntime;
In this mode:
- Do not add
importdeclarations, remote<script src>, stylesheets, fonts, images, iframes, media, map tiles, workers, or literal networkfetchcalls. - Use semantic HTML controls styled with inline CSS. Do not emit
<fluent-*>elements; Fluent Web Components are intentionally not bundled. - Use the bundled Fluent theme tokens for light/dark colors.
- Implement charts, timelines, diagrams, and maps with inline SVG, Canvas, or CSS. A geographic plot may use coordinates and an inline schematic/base outline, but it must not fetch tiles.
- Keep exactly one
<script type="module">application block. The inliner adds the runtime as a classic inline script before it. - Run the inliner after all widget edits. Never copy the minified runtime into the file manually and never leave the marker in the final output.
Refinement
If the user asks to change an existing widget ("make it more colorful", "add a chart", "make the map bigger"):
-
Read the existing HTML file
-
Make ONLY the requested change
-
Do not restructure the widget, add new features, or remove functionality unless asked
-
Preserve its existing CDN policy. For a self-contained widget, edit a temporary copy prepared with the command below, then re-run the inliner after editing. Do not hand-edit the minified runtime.
node "${PLUGIN_ROOT}/scripts/inline-self-contained-runtime.js" --prepare --input "./widget.html" --output "./widget.draft.html" -
Write the updated file
Output rules
- Output a complete, single-file HTML page starting with
<!DOCTYPE html> - Write the HTML to a file, don't just print it in the chat
- In self-contained mode, the final file must contain the embedded runtime, must not
contain
MCP_APPS_SELF_CONTAINED_RUNTIME, and must not load any remote runtime asset. - In CDN mode, only use public CDN resources after the user has explicitly allowed them.
- Preserve all result channels in the
ontoolresultandcallServerToolpaths. Read widget-private metadata from runtimeresult._meta, neverresult.meta. - Tell the user where the file is
- Let the user know they can ask for changes: "If you'd like changes, just describe them in the chat (e.g. 'make the map bigger', 'add a chart', 'use a card layout')."
- Keep all authored CSS and widget logic inline. The only external resources permitted are those allowed by the selected delivery mode.
FAQ
What does the generate-mcp-app-ui skill do?
Generate a single-file MCP App widget for an MCP tool, with either bundled runtime code or user-approved public CDN imports. Describe the visual and provide a plain structured payload or a full tool result with content, structuredContent, and meta.
How do I install generate-mcp-app-ui?
Run npx skills add https://github.com/microsoft/power-platform-skills --skill generate-mcp-app-ui in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/generate-mcp-app-ui/ (personal) or .claude/skills/generate-mcp-app-ui/ (project).
Which AI agents can use generate-mcp-app-ui?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is generate-mcp-app-ui safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains generate-mcp-app-ui?
It is published by microsoft in microsoft/power-platform-skills, and it is an official skill from the maker of the technology it covers. It has 210 recorded installs.
More from microsoft/power-platform-skills
add-sharepoint
microsoft/power-platform-skills
Adds SharePoint Online connector to a Power Apps code app. Use when reading lists, managing documents, or integrating with SharePoint sites. Can also create new SharePoint lists.
create-code-app
microsoft/power-platform-skills
Creates Power Apps code apps using React and Vite. Use when building code apps, scaffolding projects, or deploying to Power Platform.
add-dataverse
microsoft/power-platform-skills
Adds Dataverse tables to a Power Apps code app with generated TypeScript models and services. Can also create new Dataverse tables. Use when connecting to Dataverse, adding tables, creating schema, or querying Dataverse data.
configure-canvas-mcp
microsoft/power-platform-skills
Configure the Canvas Authoring MCP server for the current coauthoring session. Use before starting to edit a canvas app with the /canvas-app skill if not already connected. USE WHEN "configure MCP", "set up MCP server", "MCP not working", "connect Canvas Apps MCP", "canvas-authoring not available", "MCP not configured", "set up canvas apps".
add-office365
microsoft/power-platform-skills
Adds Office 365 Outlook connector to a Power Apps code app. Use when accessing calendars, sending emails, reading inbox, or managing Outlook events.
canvas-app
microsoft/power-platform-skills
Creates or edits a Power Apps Canvas App through the Canvas Authoring MCP coauthoring session. Handles staged experience design, direct and partitioned targeted edits, planned multi-screen changes, responsive layout, and compile-error convergence. Trigger on requests to create, build, generate, modify, update, change, fix, or edit a Canvas App or .pa.yaml files.
Popular ai & agents skills
google-agents-cli-publish
google/agents-cli
This skill should be used when the user wants to "publish an agent", "publish my ADK agent", "register an agent with Gemini", "publish to Gemini" (formerly Gemini Enterprise), or needs guidance on the agents-cli publish gemini command. Also use when the user wants to "manage agents in Agent Registry", "list/update/delete registered agents", or "register an MCP server". Covers ADK vs A2A registration modes, programmatic and interactive usage, flag reference, auto-detection from deployment metadata, Agent Registry fleet management, and troubleshooting. Part of the agents-cli skills suite. Do NOT use for deployment (use google-agents-cli-deploy).
google-agents-cli-eval
google/agents-cli
This skill should be used when the user wants to "run an evaluation", "evaluate my agent", "evaluate my ADK agent", "write an eval dataset", "analyze eval failures", "compare eval results", "optimize agent", or needs guidance on the Gemini platform eval methodology and the Quality Flywheel. Covers eval metrics, dataset schema, LLM-as-judge scoring, and common failure causes. Applies to any agents-cli project, whatever framework the agent is written in. Do NOT use for agent API code patterns (ADK: use google-agents-cli-adk-code), deployment (use google-agents-cli-deploy), or project scaffolding (use google-agents-cli-scaffold).
skill-creator
anthropics/skills
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.
codex-pet
prime-skills/runcomfy-agent-skills
Codex Pet generator on RunComfy. Build a Codex-compatible Codex Pet spritesheet.webp + pet.json from a single reference image, drop it into ${CODEXHOME:-$HOME/.codex}/pets/ / and Codex picks it up as a custom Codex Pet next to the 8 built-ins. This skill produces the exact Codex Pet atlas Codex expects (1536x1872 PNG/WebP, 8 cols x 9 rows, 192x208 cells, 9 animation states — idle, running-right, running-left, waving, jumping, failed, waiting, running, review). Calls OpenAI GPT Image 2 edit ONCE via the local RunComfy CLI as runcomfy run openai/gpt-image-2/edit to produce a canonical Codex Pet pose, then assembles all 9 animation rows programmatically with ImageMagick micro-transforms — no Codex Pro, no $imagegen, no OPENAIAPIKEY required, only RUNCOMFYTOKEN. Triggers on "codex pet", "create codex pet", "make codex pet", "hatch codex pet", "/hatch image", "desktop pet codex", "codex pets", "spritesheet.webp", or any explicit ask to build a custom pet for OpenAI Codex.
full-output-enforcement
leonxlnx/taste-skill
Overrides default LLM truncation behavior. Enforces complete code generation, bans placeholder patterns, and handles token-limit splits cleanly. Apply to any task requiring exhaustive, unabridged output.
executing-plans
obra/superpowers
Use when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is available