microsoft/mcp-interactiveui-samples/mcpserver-migrate-mcpapps
Claude Code and agent skill by microsoft/mcp-interactiveui-samples
- vendor
- ext:[{"type":"hook","description":"Pre/post lifecycle hooks"}]
Checking that the SKILL.md file is still in the repository.
Migrates an MCP server with interactive widgets from the OpenAI Apps SDK (window.openai, text/html+skybridge) to the MCP Apps standard (@modelcontextprotocol/ext-apps), covering server-side and client-side changes.
Install
npx vskill@latest install microsoft/mcp-interactiveui-samples/mcpserver-migrate-mcpappsSemi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard
SKILL.md
The same SKILL.md was published earlier as microsoft/mcp-interactiveui-samples/mcpserver-migrate-mcpapps.
Skill: Migrate OpenAI Apps SDK → MCP Apps
Migrate an MCP server with interactive widgets from the OpenAI Apps SDK (window.openai, text/html+skybridge, flat _meta["openai/..."] keys) to the MCP Apps standard (@modelcontextprotocol/ext-apps).
When to Use
Use this skill when:
- An MCP server uses
text/html+skybridgeMIME type for widget resources - Widget code references
window.openaiglobals (e.g.window.openai.callTool,window.openai.toolOutput,window.openai.theme) - Server code uses flat
_meta["openai/outputTemplate"]or_meta["openai/widgetAccessible"]keys - The goal is to make the server compatible with MCP Apps hosts (Claude, ChatGPT, Microsoft 365 Copilot, etc.)
References
- MCP Apps repo: https://github.com/modelcontextprotocol/ext-apps
- API docs: https://modelcontextprotocol.github.io/ext-apps/api/
- Migration guide: https://modelcontextprotocol.github.io/ext-apps/api/documents/Migrate_OpenAI_App.html
- Patterns: https://modelcontextprotocol.github.io/ext-apps/api/documents/Patterns.html
- Quickstart: https://modelcontextprotocol.github.io/ext-apps/api/documents/Quickstart.html
- React module: https://modelcontextprotocol.github.io/ext-apps/api/modules/_modelcontextprotocol_ext-apps_react.html
- Examples: https://github.com/modelcontextprotocol/ext-apps/tree/main/examples
Packages
| Package | Where | Purpose | |
|---|---|---|---|
@modelcontextprotocol/ext-apps | Server + Widgets | Core MCP Apps SDK | |
@modelcontextprotocol/ext-apps/server | Server | registerAppTool, registerAppResource, RESOURCE_MIME_TYPE | |
@modelcontextprotocol/ext-apps/react | Widgets | useApp, useHostStyleVariables, useDocumentTheme, useHostFonts | |
@modelcontextprotocol/sdk | Server | MCP protocol SDK (keep existing) | |
zod | Server | Schema definitions for McpServer.tool() |
Migration Mapping
MIME Type
| Before | After | |
|---|---|---|
text/html+skybridge | text/html;profile=mcp-app (use RESOURCE_MIME_TYPE constant) |
Server: _meta Keys
| OpenAI flat key | MCP Apps nested key | |
|---|---|---|
_meta["openai/outputTemplate"] (URI string) | _meta.ui.resourceUri (URI string) | |
_meta["openai/widgetAccessible"]: true | _meta.ui.visibility: ["app"] (visible to app only, hidden from model) | |
_meta["openai/visibility"]: "public" | _meta.ui.visibility: ["app", "model"] (visible to both) |
Server: Class & Helpers
| Before | After | |
|---|---|---|
import { Server } from "@modelcontextprotocol/sdk/server/index.js" | import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js" | |
new Server({ name, version }, { capabilities }) | new McpServer({ name, version }) | |
server.setRequestHandler(ListToolsRequestSchema, ...) | server.tool(name, desc, schema, handler) or registerAppTool(...) | |
server.setRequestHandler(ReadResourceRequestSchema, ...) | registerAppResource(...) | |
| Manual tool/resource list handlers | Automatic via McpServer + helpers |
Server: Tool Registration
Widget tools (tools that render UI) use registerAppTool:
Data-only tools (no UI) use server.tool() directly:
Client (Widget): Global API
OpenAI (window.openai) | MCP Apps (App from @modelcontextprotocol/ext-apps) | |
|---|---|---|
window.openai.toolOutput | app.ontoolresult = (result) => result.structuredContent | |
window.openai.callTool(name, args) | await app.callServerTool({ name, arguments: args }) | |
window.openai.theme ("light" / "dark") | app.getHostContext()?.theme ("light" / "dark") | |
window.openai.displayMode | app.getHostContext()?.displayMode | |
window.openai.requestDisplayMode(mode) | await app.requestDisplayMode({ mode }) (takes { mode: string }) | |
window.openai.locale | app.getHostContext()?.locale | |
window.openai.maxHeight | app.getHostContext()?.viewport?.maxHeight | |
window.openai.safeArea | app.getHostContext()?.safeAreaInsets | |
window.openai.sendFollowUpMessage({ prompt }) | await app.sendMessage({ role: "user", content: [{ type: "text", text: prompt }] }) | |
window.openai.openExternal({ href }) | await app.openLink({ url: href }) | |
window.openai.notifyIntrinsicHeight(height) | app.sendSizeChanged({ width, height }) (auto by default via autoResize) | |
window.addEventListener("openai:set_globals", ...) | app.onhostcontextchanged = (ctx) => { ... } | |
| N/A | app.ontoolinputpartial = (params) => { ... } (streaming partial args) | |
| N/A | app.ontoolcancelled = (params) => { ... } | |
| N/A | app.onteardown = async () => { ... } | |
| N/A | await app.updateModelContext({ content: [...] }) |
Client (Widget): React Hook
| Before | After | |
|---|---|---|
useOpenAiGlobal("toolOutput") | useMcpToolData<T>() (custom hook wrapping useApp) | |
useOpenAiGlobal("theme") | useMcpTheme() (custom hook returning "light" / "dark") |
Client (Widget): useApp Hook API
The useApp hook from @modelcontextprotocol/ext-apps/react has the following signature:
Important: Event handlers (ontoolresult, onhostcontextchanged, ontoolinput, etc.) must be set in the onAppCreated callback, which fires before the connection handshake. The app in the returned AppState is App | null, so always use optional chaining (app?.callServerTool(...)).
Client (Widget): Built-in React Hooks
The SDK also provides these hooks (no custom wrapper needed):
| Hook | Purpose | ||
|---|---|---|---|
useHostStyleVariables(app) | Applies host CSS variables + theme to <html> | ||
useDocumentTheme(app) | Reactive "light" \ | "dark" from host context | |
useHostFonts(app) | Injects host font @font-face CSS | ||
useAutoResize(app) | Manual control when App is created outside useApp |
Step-by-Step Migration Process
1. Update Dependencies
Server `package.json` — add:
Widgets `package.json` — add:
2. Create MCP Apps React Context (Widgets)
Create a shared hook file (e.g. hooks/useMcpApp.tsx) that wraps the useApp hook.
Key API rules:
useApptakes{ appInfo: { name, version }, capabilities: {}, onAppCreated? }- Event handlers (
ontoolresult,onhostcontextchanged) must be registered inonAppCreated onAppCreatedfires before connection, so use refs to bridge into React stateuseAppreturns{ app: App | null, isConnected: boolean, error: Error | null }
3. Update Widget Entry Points (main.tsx)
Wrap the app in <McpAppProvider> instead of reading window.openai:
4. Update Widget Components
Replace all window.openai references:
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 100 of 100Pattern checks on the skill's files. Certified 30 Sep 2026.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingmcp-apps/trey-research/node/src/mcpserver/.github/mcpserver-migrate-mcpapps/SKILL.md
Popularity
- Repository stars
- 80
- Repository forks
- 19
- 7-day trend score
- 22
Stars and forks are for the whole GitHub repository, not this skill alone. Refreshed 16 Mar 2026, 8 months ago.
Extension points
hookPre/post lifecycle hooks
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/microsoft/mcp-interactiveui-samples/mcpserver-migrate-mcpapps)