@interopio/mcp-apps-proxy
v1.0.0
Published
MCP Apps sandbox proxy web component - hosts the MCP Apps sandbox-proxy iframe protocol as a <mcp-apps-proxy> custom element
Readme
@interopio/mcp-apps-proxy
<mcp-apps-proxy> - the MCP Apps sandbox-proxy (per the
MCP Apps spec, "Sandbox proxy"
section) as an installable web component, instead of a copy-pasted HTML file.
Serve a page that imports this package. In workspace mode, also call
IOBrowser()/IODesktop() somewhere on that page - the element discovers and
reuses that io instance itself, so you never need to find the element or hand
it anything directly:
<script type="module">
import "@interopio/mcp-apps-proxy";
import IOBrowser from "@interopio/browser";
const params = new URLSearchParams(window.location.search);
if (params.get("mode") === "workspace") {
await IOBrowser();
}
</script>
<mcp-apps-proxy></mcp-apps-proxy>Host apps (e.g. @interopio/ai-web) keep pointing their existing
sandboxProxyUrl at wherever you serve this page - nothing changes on the host
side. ?mode=workspace on the URL still selects workspace mode, exactly like
before.
This package has no dependency on @interopio/browser/@interopio/desktop - it
never calls IOBrowser()/IODesktop() itself. In workspace mode it instead
discovers the io instance the page already initialized, using the window
"Glue42" event handshake that IOBrowser()/IODesktop() wire up internally
(see io-connect-agent-init-protocol.md at the repo root for the full
protocol). This means:
- no risk of the proxy running a different io.Connect instance/session than the rest of your app - it reuses whatever the host page already initialized,
- zero io.Connect runtime code executed for inline-only consumers (never call
IOBrowser()/IODesktop()in that page).
See apps/mcp-apps-proxy in this repo for a full reference consumer.
