# Deploy a website from Claude Code

Let Claude Code put the site it built online: one command or the MCP server, no prompts, and a link back to you that keeps the site. Free to try.

On the web at https://lobsite.com/hosting/claude-code

```sh
npx -y lobsite --yes
```

Claude Code runs this in the project folder; the output ends with a line for it to pass on.

Claude Code builds the site; one command puts it online. Ask it to "deploy this", and it runs `npx -y lobsite --yes`, which finds the built folder, uploads it and prints a line meant for Claude to pass on, with the address and the link that keeps the site. No account, no login prompt, no config file to write first.

## How it works

1. **Ask Claude Code to build and deploy.** It runs your build (`npm run build` or similar), then `npx -y lobsite --yes` in the project folder.
2. **The CLI sees it's under Claude Code** (from the `CLAUDECODE` variable Claude Code sets), so it never asks a question and prints plain lines with no colours or spinners.
3. **Claude relays the last line**: the live URL, when the temporary site expires, and the claim link. You open the link and sign in to keep the site; the address stays the same.

## Make it the project's way to deploy

Add one line to the project's `CLAUDE.md`, so every session deploys the same way without being told:

```text
Deploy with `npx -y lobsite --yes` and relay the "Tell the user:" line from the output.
```

The first deploy writes `lobsite.toml` with the site's name and folder. Commit it: the next deploy, from any session, updates the same site instead of making a new one.

## A /deploy command

A custom slash command makes it one keystroke. Save this as `.claude/commands/deploy.md`:

```md
Build the site, then deploy it with `npx -y lobsite --yes`.
If the build or the deploy fails, read the error's fix line and follow it.
When it succeeds, tell me the "Tell the user:" line word for word.
```

Then type `/deploy`. To let it run without asking for permission each time, allow the command in `.claude/settings.json`:

```json
{ "permissions": { "allow": ["Bash(npx -y lobsite:*)"] } }
```

## Or the MCP server

The MCP server gives Claude Code tools instead of a shell command: `deploy`, `list_sites`, `list_deploys`, `rollback`, `promote` and `whoami`.

```sh
claude mcp add lobsite -- npx -y lobsite@latest mcp
```

With it, "roll the site back to yesterday's deploy" works too: Claude lists the deploys and promotes the one you mean. Logging in and deleting sites aren't tools on purpose; one needs you in a browser, the other can't be undone. More on the [MCP page](https://lobsite.com/mcp).

## Deploying from Claude Code: Lobsite and GitHub Pages

| | Lobsite | GitHub Pages |
|---|---|---|
| Before the first deploy | Nothing: the site lives 6 hours until you claim it | A GitHub account, a repository and Pages turned on |
| What Claude runs | One command | Commit, push, and a Pages workflow for a build step |
| Questions on the way | None under an agent | Git may ask for credentials |
| Upload | Only the files that changed | The whole build, each time |
| Preview a deploy | `--preview` gives it its own URL | Not built in |
| Custom domain | Paid plan, coming soon | Yes, free |
| Private source | Only the built files are uploaded | Pages from a private repository needs a paid GitHub plan |

If the project already lives on GitHub with a custom domain, GitHub Pages is a fine home. Lobsite fits when you want a link now, from the session you're in.

## Frequently asked questions

### Does Claude Code need an account to deploy?

No. Without an account the site lasts 6 hours, and Claude gives you the claim link that keeps it. To deploy into your account instead, run `npx lobsite login` once yourself: it opens a browser to sign in, which an agent can't do for you.

### Which folder does it deploy?

The first of `dist/`, `build/`, `out/`, `_site/` or `public/` that exists, or the folder you name (`npx -y lobsite --yes site/`). The choice is saved in `lobsite.toml`.

### Will it upload my .env file?

No. Secret files (`.env*`, private keys, `.npmrc` and similar) stop the deploy with an error until they're removed or listed in `.lobsiteignore`. Never pass `--include-secrets` from an agent.

### Can Claude Code deploy a preview without changing the live site?

Yes: `npx -y lobsite --yes --preview` gives the deploy its own URL. Promote it later with `npx lobsite promote <id>` or the MCP's `promote` tool.

### What does Claude see when a deploy fails?

An error that says what happened, why, and what to do, with a code that never changes. Add `--json` for machine-readable output; see [Errors](https://lobsite.com/docs/errors).

