# Deploy a website from Codex

Have Codex deploy the site it built: a section in AGENTS.md, network access for the command, and a live URL with a link that keeps it. Free to try.

On the web at https://lobsite.com/hosting/codex

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

Codex runs this from the project folder once it may reach the network.

OpenAI's Codex reads `AGENTS.md` to learn how a project works. Give it a short "Deploying" section and it can put the site online with one command, then hand you the address and a link that keeps the site. The one thing to sort out first is the sandbox: a deploy needs the network.

## How it works

1. **Add the section below to AGENTS.md**, so Codex knows the command and what to tell you afterwards.
2. **Let the command reach the network.** Codex runs commands in a sandbox, and the deploy has to talk to lobsite.com (see [Network access](#network)).
3. **Ask Codex to deploy.** It builds, runs `npx -y lobsite --yes`, and relays the URL and the claim link. The site lasts 6 hours unless you open the link and sign in.

## The AGENTS.md section

Paste this into the project's `AGENTS.md`. Other agents that read the file (Cursor, Gemini CLI, Copilot and more) use it too:

````md
## Deploying

This site deploys with [Lobsite](https://lobsite.com). Build it, then from the project folder run:

```bash
npx -y lobsite --yes
```

- Tell the user the URL, and relay the "Tell the user:" line from the output word for word.
- Sites deployed without logging in are removed after 6 hours. The claim link in the output keeps the site; the user opens it and signs in.
- `lobsite.toml` remembers the site, so the same command updates it. Use `--preview` to deploy without changing the live site, and `--json` for machine-readable output.
- If a deploy fails, follow the fix in the error message. Never pass `--include-secrets`.
````

The CLI knows it runs under Codex from the `CODEX_SANDBOX` variable: it asks no questions and prints plain lines.

## Network access

Codex's sandbox can block network access for commands, and then the deploy fails with a connection error rather than a Lobsite error. For the Codex CLI, allow the network for commands in the workspace in `~/.codex/config.toml`:

```toml
[sandbox_workspace_write]
network_access = true
```

Or approve the command when Codex asks to run it outside the sandbox. In Codex cloud tasks, internet access for the agent is a setting of the environment; allow `lobsite.com` and `upload.lobsite.app` (and the npm registry, for `npx`).

## The MCP server, or curl

The Codex CLI can also start Lobsite's MCP server, which gives it `deploy`, `list_sites`, `list_deploys`, `rollback`, `promote` and `whoami` as tools. Add it to `~/.codex/config.toml`:

```toml
[mcp_servers.lobsite]
command = "npx"
args = ["-y", "lobsite@latest", "mcp"]
```

Where Node isn't installed, one page (or a few files) deploys with curl, which answers with the URL and the claim link:

```sh
curl --data-binary @index.html https://lobsite.com/api/v1/drop
```

## Command, MCP server or curl

| | `npx -y lobsite --yes` | MCP server | curl |
|---|---|---|---|
| Needs | Node and network | Node and network | Network only |
| What it uploads | The built folder, only changed files | The built folder, only changed files | The files you name, up to 25 MB |
| Updates the same site | Yes, `lobsite.toml` remembers it | Yes | Yes, with `?site=` and the claim token |
| Roll back, list deploys | With more commands | As tools | No |
| Set-up | AGENTS.md section | `config.toml` entry | None |

Start with the command; add the MCP server if you want Codex to manage deploys, and keep curl for sandboxes without Node.

## Frequently asked questions

### Why does the deploy fail with a network error?

The sandbox stopped the command from reaching lobsite.com. Turn on network access for the workspace, approve the command outside the sandbox, or allow the domains in your Codex cloud environment.

### Does Codex need my Lobsite account?

No. Without one the site lasts 6 hours and Codex gives you the claim link. To deploy into your account, run `npx lobsite login` yourself once; signing in happens in a browser.

### Can Codex deploy a preview first?

Yes. `npx -y lobsite --yes --preview` gives the deploy its own URL and leaves the live site as it was. `npx lobsite promote <id>` makes it live.

### What if my project has a .env file?

Secret files are never uploaded. They stop the deploy with an error that says how to leave them out (`.lobsiteignore`); Codex should never pass `--include-secrets`.

### Does this work for Codex in the IDE?

Yes. The extension runs the same agent, so it reads the same `AGENTS.md`, and the command behaves the same.

