Publish HTML from Codex with one tool call.
Codex writes HTML. Stacktree gives it a private link to put that HTML behind, and a way to swap the content in place across iterations. One command (npx stacktree-install), no DNS, no project setup.
How do you publish HTML from Codex CLI?
Install Stacktree by running npx stacktree-install, pick Codex when prompted, and Codex gets seven new tool calls: publish_html, update_site, set_password, set_email_gate, set_expiry, list_sites, delete_site. Codex calls them the same way it calls any other MCP tool. The installer signs you in via your browser, so persistence and replace-in-place are on from the first publish.
Why Codex needs a publish primitive
Codex sessions tend to be wider than they are deep, a single conversation might generate a spec, a diff summary, a query plan, a perf report, and a tiny interactive viewer for inspecting a JSON blob. Each of those is an HTML artifact. Without a publish primitive, every one ends up in a different place: pasted into a thread, dropped in /tmp, screenshot into a doc.
Stacktree gives Codex one verb: publish. The agent calls it, the artifact has a URL, the URL is private by default. When Codex iterates on the same artifact, it calls update_site against the existing slug, the URL stays, the content changes. That's the whole loop.
What it looks like in practice
A typical Codex session that uses Stacktree looks like this:
You: "Generate a perf report for the deploy and host it privately."
Codex:
1. wrote perf-2026-05-14.html
2. publish_html({ file: "perf-2026-05-14.html" })
→ https://stacktr.ee/p/RwJjpE3kA…
3. set_email_gate({ slug: "RwJjpE3kA…", domain: "yourco.com" })
Done, link is gated to @yourco.com, viewers verify via magic link. Codex has Sites now. When to reach for Stacktree
In June 2026 OpenAI launched Sites in Codex: type @Sites and Codex builds and deploys an app to a URL, hosted by OpenAI on Cloudflare (D1 and R2), with workspace-scoped access. It is a strong fit for one job: internal tools that people already inside your OpenAI workspace log in to use, like an onboarding hub or a KPI dashboard. It is in preview for ChatGPT Business and Enterprise.
Stacktree is for the artifact that needs to leave that workspace. Codex Sites gates viewing to your OpenAI workspace (admins, all workspace users, or named groups), so a viewer without an OpenAI seat cannot open one, and custom domains and export are not documented. When you want to send a link to a client or a contractor, put it on your own domain, publish from a non-Codex agent, or keep a free anonymous tier, that is Stacktree. The two are not mutually exclusive: use Sites for inside-the-workspace dashboards and Stacktree for everything you share outward. See the full Codex Sites comparison.
Codex-specific notes
- Stdio transport. Codex CLI uses stdio MCP;
stacktree-mcpdefaults to stdio so no env vars are required. - No global state. The token lives in
~/.stacktree/credentials. Two different shells can run two different Codex sessions against the same account. - Streaming-friendly. Codex can stream tool results back into context;
list_sitesreturns JSON Codex can summarise without re-fetching.
Codex + Stacktree vs. ad-hoc hosting
| Criterion | GitHub Pages / Vercel / Pastebin | Stacktree |
|---|---|---|
| MCP-native | No, requires CLI scripting from inside Codex. | Yes, Codex calls publish_html directly. |
| Stable URL across iterations | No, each push is a new commit/deploy. | Yes, update_site replaces content in place. |
| Private by default | No, Pages/Vercel/Pastebin are public-first. | Yes, unguessable URL, optional password + email gate. |
| Time to publish | 30 s – 5 min build/deploy. | ~200 ms. |
| Setup cost | Repo, CI, DNS for every new artifact. | One MCP install, ever. |
Frequent questions
How do I add Stacktree to Codex? +
npx stacktree-install in your terminal. It signs you in to stacktr.ee in your browser, then wires the MCP server into Codex's config. The next session picks it up automatically.What MCP version does Codex CLI use? +
Can Codex run multiple revisions on the same URL? +
update_site, which swaps the content while keeping the URL stable. The link your team bookmarked still works.Do I need a Stacktree account to start? +
stacktree login once when you want persistence, custom slugs, or replace-in-place semantics across sessions.How does Codex + Stacktree compare to writing to GitHub Pages? +
Codex has Sites now. Why use Stacktree instead? +
Can I share a Codex Site with someone outside my company? +
Related guides
Sources and further reading
Wire Stacktree into Codex.
Run one command. The next time Codex writes HTML, you get a private link.
Sign up free →