Porthole
A host-side TypeScript library for safely rendering untrusted, agent-written HTML inside an app with isolation, egress hardening and MCP Apps support.
At a Glance
About Porthole
Porthole is an open-source host-side library from Botiverse for showing HTML written by an agent or other untrusted source inside an application, like the inline cards and standalone pages seen in ChatGPT and the Claude app. A host app embeds it to isolate the HTML, restrict what it can reach on the network, apply a themed shell, and expose a small gated set of host functions. The latest release noted in the repository is 0.14.13, and the project is pre-1.0.
What It Is
Porthole is a display layer for untrusted HTML. From a single config it produces the sandbox, the in-frame shell and the agent-facing manual that teaches how to write for it, so the three stay consistent. It ships as one npm package, @botiverse/porthole, with React, MCP, conformance, server, Node and check subpaths. Web is the first platform; native hosts are described as coming later.
Display Presets and Mechanisms
Presets cover inline widgets, live widgets that show host data without network access of their own, artifacts (standalone pages of one or many files), MCP Apps, and URL displays such as a dev server preview. Each preset fixes the CSP, allowed origins, gated host functions, theme vocabulary and generated manual. Underlying mechanisms include origin isolation, egress hardening, streaming render, auto-sizing, theming, a host-function bridge and a guide generator. MCP Apps (io.modelcontextprotocol/ui) is the external contract for agent-written UI.
Host Kit, Annotations and Runtime
The host kit provides createContentHost for routing, tickets and clean addresses on Node and Cloudflare Workers, plus a client and a React PortholeView. Hosts can add annotations anchored with W3C selectors, a find-in-page bar, and nested pages that run in an opaque child frame. An optional app runtime lets a page reach host services such as user, comments, artifact, assets and db through porthole.use(name), with each call checked and gated. On the agent side, lintContent, admitContent and checkPage validate a page before people see it.
Verification and Status
The repository describes a conformance suite and a leak suite with negative controls run on Chromium, WebKit and Firefox, and conformance kits for hosts to verify their own integration. The README says Raft and Ferry use it. A threat model document describes what each layer guarantees and what remains the host's responsibility. It is licensed under Apache-2.0.
Community Discussions
Be the first to start a conversation about Porthole
Share your experience with Porthole, ask questions, or help others learn from your insights.
Pricing
Open Source (Apache-2.0)
Porthole host-side library for safely displaying agent-made HTML, licensed under Apache-2.0 and published on npm as @botiverse/porthole.
- Apache-2.0 licensed core library
- Display presets: inline widget, live widget, artifact, MCP Apps, URL
- Host kit with Node and Cloudflare Workers support
- Annotations and find in page
- Optional app runtime
Capabilities
Key Features
- Safe-by-default presets: inline widget, live widget, artifact, MCP Apps and URL
- Origin isolation and egress hardening
- In-frame shell runtime with streaming render, auto-sizing and theming
- Gated host-function bridge
- Generated agent-facing guide from the same config
- Host kit with createContentHost for Node and Cloudflare Workers
- React binding (PortholeView) and client
- Annotations with W3C-selector anchors
- Find in page
- Nested pages with opaque child frame
- Optional app runtime via porthole.use(name)
- Content linting and admission checks (lintContent, admitContent, checkPage)
- Conformance and leak test suites across Chromium, WebKit and Firefox
