Write Once, Run Everywhere
frac is designed to be runtime-agnostic. Your view code works the same whether it runs in MCP Apps compatible clients (like Claude, Goose, VSCode) via the MCP ext-apps specification, or in ChatGPT via the Apps SDK.
The Problem
Section titled “The Problem”Different AI runtimes use different APIs to communicate with embedded views:
- ChatGPT uses the Apps SDK with
window.openaiglobal - MCP Apps use JSON-RPC postMessage protocol (MCP ext-apps spec)
Without abstraction, you’d need to write different code for each platform — or lock yourself into one ecosystem.
frac’s Solution
Section titled “frac’s Solution”frac introduces an adaptor layer that normalizes these differences:
%%{init: {'theme': 'base', 'themeVariables': { 'primaryColor': '#2563EB', 'primaryTextColor': '#fff', 'primaryBorderColor': '#1e40af', 'lineColor': '#64748b', 'secondaryColor': '#3B82F6', 'tertiaryColor': '#dbeafe' }}}%%flowchart TB subgraph Code["Your View Code"] Hooks["useToolInfo, useCallTool, etc."] end
Code --> frac
subgraph frac["frac Hooks"] Unified["Unified React Interface"] end
frac --> AppsSdk frac --> McpApp
subgraph AppsSdk["Apps SDK Adaptor"] OpenAI["window.openai"] end
subgraph McpApp["MCP App Adaptor"] JsonRpc["JSON-RPC Bridge"] end
AppsSdk --> ChatGPT["ChatGPT"] McpApp --> McpClients["Claude, Goose, VSCode..."]
style Code fill:#f1f5f9,stroke:#cbd5e1,stroke-width:2px,color:#334155 style frac fill:#f1f5f9,stroke:#cbd5e1,stroke-width:2px,color:#334155 style AppsSdk fill:#f1f5f9,stroke:#cbd5e1,stroke-width:2px,color:#334155 style McpApp fill:#f1f5f9,stroke:#cbd5e1,stroke-width:2px,color:#334155 style ChatGPT fill:#f1f5f9,stroke:#cbd5e1,stroke-width:2px,color:#475569 style McpClients fill:#f1f5f9,stroke:#cbd5e1,stroke-width:2px,color:#475569 style Hooks fill:#2563EB,stroke:#1e40af,stroke-width:2px,color:#fff style Unified fill:#2563EB,stroke:#1e40af,stroke-width:2px,color:#fff style OpenAI fill:#2563EB,stroke:#1e40af,stroke-width:2px,color:#fff style JsonRpc fill:#2563EB,stroke:#1e40af,stroke-width:2px,color:#fffThese include useToolInfo, useCallTool, and other API hooks. frac automatically detects which runtime is available and uses the appropriate adaptor.
Benefits
Section titled “Benefits”As new AI platforms adopt MCP, your views will work without code changes
Build once, deploy to multiple AI clients: ChatGPT, Claude, Goose, VSCode, and more
One set of hooks, one mental model, multiple platforms
Platform-specific features degrade gracefully with clear warnings
Runtime Compatibility
Section titled “Runtime Compatibility”Not all features are available on all platforms. See the API Reference for a full compatibility matrix.
Runtime-specific features:
- useFiles, useSetOpenInAppUrl are Apps SDK only
- useViewState and data-llm attribute in MCP Apps is polyfilled to persist state, and doesn’t persist state across view renders
- useRequestModal in MCP Apps is polyfilled to render in an iframe instead of a host modal
Related
Section titled “Related”- MCP Apps - The open MCP ext-apps specification and client support
- Apps SDK (ChatGPT) - ChatGPT-specific features and APIs
- API Reference - Full hook compatibility matrix