Build and publish a website with Claude Code
Claude Code can write, build and publish your site in the same session. AhaGPT hosts the built folder and keeps every version.
What you need
- AhaGPT added to Claude Code:
claude mcp add --transport http AhaGPT https://mcp.ahagpt.com/mcp, then/mcp→ AhaGPT → Authenticate. - A static site: HTML, CSS, JavaScript, images and fonts.
1. Build the site
AhaGPT needs a folder with index.html at the top. Where that folder is depends on your tools:
| Project | Build command | Folder to publish |
|---|---|---|
| Plain HTML | none | the folder with index.html |
| Vite | npm run build | dist |
| Astro | npm run build | dist |
| Next.js | set output: "export", then npm run build | out |
Only static output works: API routes, server rendering and databases won’t run. You don’t need to run the build yourself; Claude Code does it in the next step.
2. Ask Claude Code to publish
From the project folder, say:
Claude Code runs the build, then sends the files to AhaGPT. Small sites go in one call; bigger ones are uploaded in batches (start_upload → add_files → finish_upload), and the site switches to the new version only after the last batch, so visitors never see a half-uploaded site. You get https://mycafe.ahagpt.com back.
Limits: 100 files and 10 MB per site (50 MB on Pro).
3. Publish again after changes
Ask Claude Code to build and publish again. Each publish replaces the whole site at the same address. Paid plans keep the last 10 versions so you can roll back.
To make it automatic, add a line to the project’s CLAUDE.md, which Claude Code reads every session:
After changing the site, build it and publish the output folder with AhaGPT as mycafe.
If something goes wrong
- Too big: compress large images, and leave out source maps and files the site never loads.
- Blank page or missing styles: check that the built folder was published, not the source, and that asset paths work from the root of the address (for Vite, keep
baseat/). - Upload didn’t finish: ask Claude Code to publish again; it starts a fresh upload.
- Name taken: pick another name, or delete your old site with that name first.
- Publish refused: pages that collect passwords or card details can’t be hosted.
Once it’s live, see Get your website on Google.