Deploy (or publish) HTML from Claude Code
Claude Code can ship a static HTML file four ways: the Netlify CLI, the Vercel CLI, Cloudflare Wrangler, or Stacktree over MCP. The first three deploy a project. The last one publishes a single file. Here is how each works, and which fits the HTML an agent just wrote.
How do you deploy or publish HTML from Claude Code?
Two different jobs. To deploy a project, Claude Code runs a CLI against a folder: Netlify, Vercel, or Cloudflare Wrangler ship the directory to a hosting platform, sometimes after a build. To publish one finished file, Claude Code calls publish_html over MCP and gets a private URL back. For an app, deploy. For a single agent-made file, publish.
Deploy a project vs publish a file
The word people search for is "deploy," but the right verb depends on what Claude Code just handed you. A deploy ships a project: a directory of files, often with a build step, tracked as a site you maintain over time with previews, rollbacks, and a dashboard. A publish ships a finished file: the agent calls one tool, you get one URL, done. Deploy platforms are genuinely the better tool when Claude Code is building you an application. A publish primitive is the better tool when it is handing you a one-off report, spec, or dashboard you want to send to one or two people.
The four options below split cleanly along that line. Netlify, Vercel, and Cloudflare Pages deploy a folder to a platform you own. Stacktree publishes a single file over MCP. Each section covers how an agent triggers it, whether a build runs, how auth works, whether you can go account-free, and what each is best for.
Netlify CLI
How an agent triggers it. Claude Code runs the Netlify CLI
in a shell. A production deploy is netlify deploy --prod (short
form netlify deploy -p). A bare folder of static files ships
with netlify deploy --dir=public --prod.
Build or not. No build is required. You can deploy a bare
directory with --dir and no framework, or let Netlify run a
build for a framework project.
Auth. Interactive OAuth via netlify login
(browser authorization, token stored in config), or a Personal Access Token
passed through the NETLIFY_AUTH_TOKEN environment variable for
automation.
Anonymous or not. Netlify is the one deploy platform here
with a true no-account path: netlify deploy --allow-anonymous
creates a project, deploys it, and generates a live URL, giving you one hour
to claim ownership by logging in or creating an account.
MCP. Netlify ships an official MCP server, the Netlify MCP
Server, as the npm package @netlify/mcp (run via
npx -y @netlify/mcp). It is a local stdio server, not a remote
URL, and it lets code agents create, manage, build, and deploy projects. It
requires Node.js 22+ and a Netlify account.
Best for. Static or framework sites you want to maintain on Netlify, especially the rare case where you want a live URL with no account up front.
Vercel CLI
How an agent triggers it. Claude Code runs vercel
(equivalent to vercel deploy); a production deploy uses
vercel --prod. The deployment URL is always written to stdout,
which is convenient for an agent to capture.
Build or not. The CLI operates on a Vercel project. Running
vercel in a directory sets up or links a project (prompts can be
skipped with --yes, and agent environments default to
non-interactive). A directory of static files can be deployed, but it is
associated with a Vercel project rather than a bare anonymous upload.
Auth. Interactive vercel login, or token-based
auth via the --token flag (short form -t) or the
VERCEL_TOKEN environment variable (recommended for CI).
Anonymous or not. A Vercel account is required. The docs describe no anonymous, no-account deploy path.
MCP. Vercel ships an official remote OAuth MCP server,
Vercel MCP, at https://mcp.vercel.com. It can manage projects
and deployments and analyze logs, and it is supported in Claude Code (added
with claude mcp add --transport http vercel https://mcp.vercel.com).
It only supports Vercel-approved AI clients.
Best for. Framework apps and projects on Vercel that need builds, preview deploys, and serverless or edge functions.
Cloudflare Wrangler (Pages)
How an agent triggers it. Claude Code runs
npx wrangler pages deploy [directory], where
[directory] is the folder of static files to upload. It can
deploy a bare folder of static assets without a build or project.
Build or not. No build is required for a bare folder of static assets. Wrangler uploads the directory directly.
Auth. Interactive wrangler login (OAuth browser
flow), or non-interactive via the CLOUDFLARE_API_TOKEN
environment variable (with CLOUDFLARE_ACCOUNT_ID) for CI/CD and
automation.
Anonymous or not. A Cloudflare account is required. No anonymous deploy is documented.
MCP. Cloudflare ships official remote MCP servers over OAuth,
including the Cloudflare API MCP server
(https://mcp.cloudflare.com/mcp), Workers Bindings, Workers
Builds, and Workers Observability. Their tool sets center on managing
existing Cloudflare resources rather than a one-call static upload.
Best for. Static sites and apps you run on Cloudflare's network, where you already manage other Cloudflare resources.
Stacktree (over MCP)
How an agent triggers it. Claude Code calls the
publish_html tool over MCP. Install once with
npx stacktree-install (or
claude mcp add stacktree -- npx -y stacktree-mcp), then ask
Claude Code to publish the file it wrote. The server exposes
publish_html, update_site, set_expiry,
set_password, set_email_gate,
list_sites, and delete_site.
Build or not. No build, no repo, no project. Stacktree hosts static HTML directly. The unit is a single file, not a directory you deploy.
Auth. The installer signs you in via your browser. You can
also publish anonymously over the raw API:
curl -X POST https://api.stacktr.ee/sites -F file=@index.html
works with no account and no API key.
Anonymous or not. Yes. The first publish is anonymous: Stacktree mints an unguessable URL that lives for 24 hours, with no account. Signed-in sites persist and can be replaced in place.
Private by default. Every URL is unguessable
(for example stacktr.ee/p/RwJjpE3kA…), so the link is the
credential. You can layer an optional shared password and an optional
email-domain gate verified by magic link. update_site replaces
the contents at the same URL, so a bookmarked link always renders the latest
revision.
Best for. The single finished HTML file Claude Code emits: a report, a spec, a status writeup, a one-file dashboard, that you want to send privately without it becoming a repository or a tracked project.
Side by side
| Criterion | Stacktree | Netlify | Vercel | Cloudflare Pages |
|---|---|---|---|---|
| Trigger from agent | publish_html over MCP | netlify deploy --prod (CLI) | vercel --prod (CLI) | npx wrangler pages deploy [dir] (CLI) |
| Build step | None, hosts HTML directly | Optional, bare folder OK with --dir | Project build, static folder also OK | None for a bare static folder |
| Private by default | Yes, unguessable URL plus optional gates | No, public site URL | No, public unless protection added | No, public site URL |
| Replace-in-place URL | Yes, update_site keeps the same URL | Re-deploy to the same project | Re-deploy to the same project | Re-deploy to the same project |
| Anonymous / no account | Yes, 24h anonymous URL | Yes, --allow-anonymous (claim within 1h) | No, account required | No, account required |
| Official MCP server | Yes, stacktree-mcp (publishes one file) | Yes, @netlify/mcp (local stdio) | Yes, remote at mcp.vercel.com | Yes, remote API + Workers MCP servers |
| Best for | One finished file an agent emits | Sites/projects on Netlify | Framework apps with builds + functions | Sites/apps on Cloudflare's network |
When to use which
Be honest about the split. If Claude Code is building you an application, a folder with a build, a framework, server logic, a site you will maintain, the deploy platforms win and it is not close. Use the Vercel CLI for framework apps that want fast builds, preview deploys, and functions. Use Cloudflare Pages via Wrangler when you live on Cloudflare's network. Use the Netlify CLI for static or framework sites on Netlify, and for the unusual case where you want a live URL with no account at all.
If Claude Code is handing you a single finished HTML file,
a report, a spec, a one-off dashboard, the deploy model is overkill. There is
no project, nothing to build, and no reason to create one to share one page.
That is where Stacktree fits: an agent
calls publish_html, you get a private unguessable URL, and
update_site replaces it in place as the agent iterates. It hosts
static HTML only, so it is not an app platform like Vercel and not a
maintained-site host like Pages. For the file an agent just wrote, that
narrowness is the point. See
how agents publish HTML over MCP and the
Claude Code publish primitive.
Frequent questions
How do I deploy a static HTML site from Claude Code? +
How do I publish just one HTML file from Claude Code without a project? +
What is the difference between deploying and publishing HTML? +
Can Claude Code deploy to Netlify, Vercel, or Cloudflare without a browser login? +
Can Claude Code deploy a static site with no account at all? +
Do these platforms have official MCP servers for Claude Code? +
Related guides
- Publish HTML over MCP The twelve tools the server exposes, and how an agent ships a private link with one call.
- Publish HTML from Claude Code The publish primitive wired into Claude Code, with replace-in-place across iterations.
- Publish from OpenAI Codex The same MCP publish primitive, wired into the Codex CLI.
- Agent loop hosting Why a stable, replace-in-place URL is the right contract for iterating agents.
- Private HTML hosting Unguessable URLs, password, email-domain gate, and end-to-end encryption.
- Private GitHub Pages alternative When the deploy needs to stay private without an Enterprise Cloud seat.
- All hosting alternatives Compare Stacktree against the other places people deploy and publish HTML.
Sources and further reading
- Netlify CLI: Get Started ↗ Official docs for netlify deploy --prod, the --dir flag, token auth, and --allow-anonymous.
- Netlify MCP Server documentation ↗ The @netlify/mcp local stdio server that lets code agents create and deploy projects.
- Vercel CLI: vercel deploy reference ↗ Official reference for vercel, vercel --prod, project linking, and the stdout deployment URL.
- Vercel: Use Vercel's MCP server ↗ The remote OAuth MCP at mcp.vercel.com and how to add it in Claude Code.
- Cloudflare: Wrangler Pages commands ↗ Official docs for npx wrangler pages deploy [directory] to ship a static folder.
- Cloudflare: MCP servers for Cloudflare ↗ The official remote MCP servers for the Cloudflare API and Workers.
Publishing a single file an agent made?
Skip the project and the build. Claude Code calls publish_html, you get a private unguessable link, and update_site replaces it in place as the agent iterates.
Sign up free →