How to build a website with Gemini CLI and publish it to your own domain
Add PageHub to Gemini CLI with one command, then describe the site you want. Gemini builds it, checks it with screenshots, and puts it on your domain. You end up with a real site that anyone can edit visually, not a folder of code you still have to host.
Signed in with a Google account? Since June 18, 2026, Gemini CLI no longer works with a free, Google AI Pro, or Ultra sign-in. Google moved those users to Antigravity. Follow the Antigravity guide instead.
Gemini CLI still works with a paid Gemini API key or a company Gemini Code Assist license. If that's you, the steps below still apply.
What you need: Gemini CLI, a free PageHub account, and a domain if you want one. Without a domain, the site publishes to a pagehub.dev subdomain.
How it works
PageHub runs an MCP server, which is a set of tools an AI agent can call. Gemini CLI supports remote MCP servers over HTTP with OAuth sign-in, so once you add PageHub, Gemini CLI can call tools like create_site, set_theme, screenshot_site, and publish_site for you.
The site lives in PageHub, not in your project folder. PageHub also sends its own build rules to Gemini CLI when it connects, so you don't paste any instructions.
Step 1: Create a free PageHub account
Go to pagehub.dev/signin and enter your email. You'll get a magic link and a 6-digit code. Use either one to sign in.
The free plan has no credit card and no time limit. It includes 1 published site, 20 pages per site, and hosting with SSL, and you can connect 1 domain you own. Connecting Gemini CLI works on every plan.
Step 2: Add the PageHub MCP server to Gemini CLI
Run this in your terminal:
gemini mcp add --transport http --scope user PageHub https://pagehub.dev/api/mcp
--scope user saves PageHub to ~/.gemini/settings.json, so it's there in every folder. Without it, Gemini CLI saves it to .gemini/settings.json in the current folder only.
Now sign in. Start gemini and type /mcp auth PageHub. A PageHub page opens in your browser. Sign in with your email, then click Approve on the Authorize PageHub screen. There's no API key to paste.
To check it worked, type /mcp. PageHub should say CONNECTED with its tools listed under it. Then ask: “List my PageHub sites.”
Gemini CLI asks before it runs each PageHub tool. If you'd rather not approve every call, pick the option to always allow the server.
Step 3: Prompt Gemini CLI to build the site
Start gemini in a terminal and describe the site. Say who it's for, which pages you want, and what visitors should do. Real details (hours, prices, your email) beat placeholders. Swap the bracketed parts in these prompts for your own.
A local business site
Use PageHub to build a website for [business name], a [type of business] in [city]. Pages: Home, Services (with prices), and Contact. Hours: [days and times]. Address: [address]. Phone: [phone]. Add a contact form that asks for name, email, and what they need. Keep the look [warm and simple / bold / minimal]. Screenshot it on desktop and mobile before you tell me it's done. Don't publish yet.
A portfolio
Use PageHub to create a portfolio site for me. I'm a [job title] in [city]. Home page: a short intro, then a grid of 6 projects, each with a title, a one-line summary, and an image. Add an About page and a contact section with my email, [you@example.com]. Clean layout with lots of white space. Use stock photos for now and I'll swap in my own. Show me screenshots before publishing.
A landing page for a side project
Use PageHub to make a one-page site for my side project, [name]: [one sentence on what it does]. Sections: a hero with an email sign-up form, 3 features, a short FAQ, and a footer. Suggest 3 color palettes and let me pick one before you build. When it's built, run an SEO check and fix what it finds. Don't publish until I say so.
From there, Gemini CLI looks up PageHub's templates and section blocks, creates the site with create_site, sets colors and fonts with set_theme, adds sections, and finds stock photos with find_image. Then it checks its work with screenshot_site.
Step 4: Review the draft and edit it yourself
Everything Gemini CLI builds lands in a draft. Nobody else sees it until you publish.
Ask for screenshots at any point. screenshot_site takes a real browser screenshot of the draft, one section at a time if you like, and at phone width (390 pixels). Gemini reads the screenshots itself and fixes what it sees. To look for yourself, open the site in your PageHub dashboard.
To edit by hand, open your PageHub dashboard, pick the site, and click Design. That opens the visual editor. Drag sections around, change colors and fonts, and rewrite text. Gemini CLI reads the same draft, so it sees your edits the next time you ask for changes.
Before you publish, ask Gemini CLI to run audit_seo and audit_accessibility and fix what they find.
Step 5: Publish and connect your domain
Ask Gemini CLI: “Connect [example.com] to this site and tell me the DNS records to add.” It calls set_domain, which attaches the domain and returns the records. Add them where you bought the domain:
- The bare domain (example.com) gets an A record at
@. - A subdomain such as
wwwgets a CNAME record. - Sometimes there's also a TXT record, to prove you own the domain.
Copy each value exactly as Gemini CLI gives it to you. The values are specific to your site, so a value from another guide won't work.
PageHub sets up both example.com and www.example.com, and by default sends www visitors to the bare domain. SSL certificates are issued automatically and can take a few minutes once DNS is in place.
Then ask: “Is my domain working yet?” Gemini CLI checks with get_domain_status. Connecting a domain doesn't publish the site, so finish with: “Publish the site.” That calls publish_site, and the site is live.
Rather click? The Domains page for your site in the PageHub dashboard shows the same records.
Step 6: Make changes later
You have two ways in, and both edit the same draft.
- From Gemini CLI: ask, for example, “In my PageHub site [name], add a reviews section under Services.” Check the screenshot, then say “publish.”
- From the editor: open the site, click Design, make your changes, and publish.
If a change goes wrong, the site's History page lets you restore an earlier version of the whole site or one page. The free plan keeps 15 versions.
Other ways to ship from Gemini CLI
PageHub is one way to publish a website from Gemini CLI. You can also have Gemini CLI write the site as code in your project, then deploy the code yourself. That's how most people deploy a website from Gemini CLI today.
- Vercel or Netlify: connect your Git repository, and each push builds and deploys the site. You add your domain in their dashboard and set DNS at your registrar. A good fit when the site is really an app with its own code.
- GitHub Pages: serves static files straight from a repository. A good fit for simple static sites and project docs.
The tradeoff: you own every line and can build anything. You also handle Git, builds, and DNS yourself, and every text change is a code change. Someone who doesn't use Gemini CLI can't easily update it. PageHub fits when you want a site that people can edit visually. It isn't the right tool for custom app logic.
Troubleshooting
PageHub doesn't connect
Type /mcp inside Gemini CLI to see each server's status.
- Asks you to sign in: type
/mcp auth PageHub. Run it again if your sign-in expires. - DISCONNECTED: run
gemini mcp listand check the URL is exactlyhttps://pagehub.dev/api/mcp. - Not listed: you probably added it without
--scope userin a different folder. Run the add command again with it.
Sign-in doesn't finish
Gemini CLI signs you in through a browser on the same computer, so it won't work over SSH or in a remote container. In the browser window, sign in with the email link or the 6-digit code, then click Approve.
If the browser sign-in still won't complete, use an API key instead. Create one at pagehub.dev/dashboard/api-key, set it as PAGEHUB_API_KEY in your shell profile, and change PageHub's entry in ~/.gemini/settings.json to:
{
"mcpServers": {
"PageHub": {
"httpUrl": "https://pagehub.dev/api/mcp",
"headers": {
"Authorization": "Bearer $PAGEHUB_API_KEY"
}
}
}
}Gemini says a tool isn't available
Servers load when Gemini CLI starts. If you added PageHub while it was running, quit and start it again, then type /mcp to see PageHub's tools.
If you see a rate-limit error, wait a minute. The server allows 120 requests per minute for each sign-in.
The domain isn't working
- Compare each record at your registrar with what Gemini CLI gave you, character for character. A wrong value fails the same way slow DNS does.
- The bare domain needs an A record. It can't be a CNAME.
- If Gemini CLI gave you a TXT record, add it as well as the others.
- DNS changes can take a while to spread. Ask Gemini CLI to check the domain again later.
- If the domain is already attached to another Vercel project, remove it there first, then ask Gemini CLI to try again.
- Each site takes 1 domain, plus its www version.
Want the full tool list and other clients? See the MCP server docs or compare plans.
Frequently Asked Questions
Short answers about building and hosting a site from Gemini CLI.
Build your first site from Gemini CLI
Make a free account, run one command, and ask Gemini for the site.
Gemini is a trademark of Google LLC. PageHub isn't affiliated with or endorsed by Google.