Deploy from Codex
Start Codex CLI with codex in your project directory. Use the shared authentication setup. Confirm and set the API endpoint as described there before any Tori command. For browser sign-in on the default endpoint https://api.tori.host, run /absolute/path/to/tori login in your own terminal as the same OS user, where the CLI can save its login. With TORI_TOKEN unset in Codex’s shell, run /absolute/path/to/tori whoami from Codex to verify that it can read that login. For a custom API endpoint or an app deploy token, follow the shared token setup. The deploy needs network access and writes tori.json in your project. Approve the command if your Codex permissions prompt for it.
Try a static deploy
Section titled “Try a static deploy”For a first deploy, use a fresh project directory without a tori.json in the root or in site/. Put your public files, including index.html, in its site/ subdirectory, then paste:
Use the absolute path to the published Tori CLI I installed outside this project. Replace /absolute/path/to/tori with that path for all Tori commands, including any recovery commands printed by the CLI. If the path is unknown, ask me before proceeding.
Before making any Tori request, determine the API endpoint in the shell that will run the deploy: use nonempty TORI_API_URL, otherwise the apiUrl field in ~/.config/tori/config.json, otherwise https://api.tori.host. Read only the apiUrl field from the config and never print tokens. Stop without printing the value if it is not an HTTPS URL or it contains credentials, a query string, or a fragment. Remove trailing slashes from the base URL before comparing it with the default. Show me the resulting endpoint and wait for confirmation. Use that confirmed endpoint as TORI_API_URL for every Tori command in this workflow.
Before any authenticated request, confirm that the credential is intended for that endpoint. If the confirmed endpoint differs from https://api.tori.host, require a token specifically issued for that endpoint in TORI_TOKEN. Do not use an inherited token of unknown origin or fall back to a saved login for a non-default endpoint. A saved browser login for https://api.tori.host is valid there even when TORI_API_URL explicitly pins that same URL. If the correct credential is unavailable, stop and ask me to configure it securely without pasting it into the conversation.
Check for tori.json in the project root and in ./site. If either exists, parse every existing file as JSON and require a valid, nonempty string slug. If a file cannot be read or parsed or its binding is invalid, stop before deploying. Read the app slug and wait for my explicit confirmation of the target slug and API endpoint together before updating it. If the files disagree or the slug is missing, stop and explain. If neither file exists, run `/absolute/path/to/tori whoami`, show me the account email and API endpoint together, and wait for my confirmation before creating an app. If the account cannot be verified, stop and explain. Before creating an app, check that the CLI can write tori.json in the project root. If the check fails, stop before deploying. Check that ./site contains index.html and only files intended for public access. If it is missing or contains secrets, server source, or other private files, stop and explain.
For an update, choose an exact public file URL or a unique revision marker already present in the new output. Before deploying, record what the existing site serves at that URL. Use it as evidence only if the pre-deploy response is known to differ from the expected new response.
Then deploy with `/absolute/path/to/tori deploy --static ./site -v`. Keep the deploy ID from the verbose output. If monitoring is interrupted after Tori accepts the deploy, use the saved ID with deploy status or deploy watch from the app binding directory.
If upload acceptance is unclear and the CLI has no usable deploy ID, report the outcome as unknown even if it suggests a retry. This includes a lost connection, a gateway timeout, or an unreadable success response. Check the bound app’s deploy history on the confirmed control plane and do not retry until you establish whether this attempt was accepted. If you still cannot identify the attempt, leave its outcome unknown.
If the app-creation result is unknown on a first deploy, including when writing tori.json fails after creation or when creation fails before upload without a binding or deploy ID, do not retry. Follow https://docs.tori.host/guides/deploys/#recovering-a-first-deploy on the confirmed endpoint. If the app was created, restore its slug in the correct tori.json before resuming. If the outcome remains unknown, stop.
If the CLI stops waiting while the deploy is still in progress, report it as pending. Use the printed deploy watch or deploy status command from the directory containing the tori.json that the CLI used or created for this app (the output directory or project root) and read the state for the exact deploy ID. Use the reported state rather than the command exit code: keep a building or starting deploy pending, report cancellation as cancelled, and continue to the live check only once this attempt is live.
If the deploy fails, report the exact deploy error. If Tori reports that a newer deploy superseded this attempt, report that outcome and include the URL only if Tori printed one. Any check of that URL describes the currently served page, so do not mark this attempt verified even if the page matches. Otherwise, if the deploy succeeds, report the URL printed by Tori and separately report whether the live check passed.
Fetch the URL, require a successful HTTP status (2xx), and compare the response body with ./site/index.html. For an update, also fetch the exact file or marker checked before the deploy, require a 2xx response, and compare its body with the new output and the recorded pre-deploy response. Use an exact file URL with an extension, such as /index.html or /version.txt, so a missing file cannot be masked by the SPA fallback. If the URL is unreachable, any checked response is outside the 2xx range, or an expected response differs, report that the live check failed and explain what you observed.
After the live HTTP checks, run deploy status with the saved deploy ID from the directory holding the app binding. Only report this attempt as verified if it is still live and the expected content matched. If the status cannot be checked or the attempt is no longer live, report the observed content and the separate deploy state without claiming this revision was verified. If there is no distinguishing content to check, report which content matched and say that the specific revision could not be confirmed.Codex sees the CLI’s output, including the live URL or the failure message. If the sandbox blocks the network request, check the permissions in your Codex environment. Follow the build and runtime log instructions for the token you use.
Can I add Tori to Codex as an MCP server?
Section titled “Can I add Tori to Codex as an MCP server?”Yes. Connect Codex to the local Tori server over stdio. Tori MCP is in Preview. You can deploy with the CLI while it is unavailable.