By · Founder, Stacktree · Last updated
for Codex CLI

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.

Get started free

How do you publish HTML from Codex CLI?

Install Stacktree by running npx stacktree-install, pick Codex when prompted, and Codex gets twelve new tool calls: publish_html, update_site, get_site, set_password, set_expiry, set_email_gate, set_agentation, list_sites, delete_site, link_wallet, list_feedback, resolve_feedback. 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 began as a workspace-scoped preview for Business and Enterprise; on July 9, 2026 it went GA as ChatGPT Sites for paid subscribers, with public publishing and documented custom domains. The full arc is in our Codex Sites explainer.

Stacktree is for the artifact that should be neither public nor tied to viewer accounts. A ChatGPT Site is either published to the open internet or restricted to signed-in, invited viewers; there is no password or email gate, no expiry, and no API or MCP surface for publishing from outside a chat. When you want to send a page to a client behind a gate they can pass without an account, expire it, or publish it from any agent over MCP, that is Stacktree. The two are not mutually exclusive: use Sites for full apps and public pages, Stacktree for the gated hand-off. See the full Codex Sites comparison.

Codex-specific notes

  • Stdio transport. Codex CLI uses stdio MCP; stacktree-mcp defaults 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_sites returns 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.
FAQ

Frequent questions

How do I add Stacktree to Codex? +
Run 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? +
Codex implements MCP via stdio. Stacktree-mcp is stdio-first and supports both stdio and streamable HTTP transports, so it works with Codex out of the box.
Can Codex run multiple revisions on the same URL? +
Yes. Tell Codex to "update the same site", under the hood it calls 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? +
No. The first publish is anonymous and lives for 24 hours. Run 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? +
GitHub Pages is public-by-default and rebuilds asynchronously, a Codex iteration loop can't bookmark a single URL. Stacktree is private-by-default, the publish takes ~200 ms, and the URL is stable across revisions.
Codex has Sites now. Why use Stacktree instead? +
As of July 2026, Sites went GA as ChatGPT Sites: paid subscribers, public publishing, documented custom domains. Reach for Stacktree when the page should be gated rather than public (a private link, password, email gate, or expiry the viewer passes with no account), when the publisher is an agent calling an API/MCP tool rather than a chat session, or when you want a free anonymous tier. Stacktree also works from the UK and EEA, where Sites is not available at launch.
Can I share a Codex Site with someone outside my company? +
Publicly, yes: since the July 2026 GA, ChatGPT Sites can be published to anyone on the internet. Privately, only with signed-in, invited viewers; there is no password or email gate. Stacktree mints an unguessable URL that is itself the credential: anyone you send it to opens it, no OpenAI account required, with an optional password or email-domain gate on top.
Keep reading

Related guides

References

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 →