MCP for Claude Code, Cursor, Codex, and other hosts
The Tori MCP interface is a preview. It is a second thin client of the same public API as the CLI, intended for coding agents that need to deploy and operate an app without learning a separate control-plane interface. The managed Postgres tools work with service apps; static sites cannot have a managed database.
Connect a host
Section titled “Connect a host”Tori is a local stdio server. The host starts it and speaks MCP over the process’s standard input and output. Every host needs the same three facts: a name (tori), the command npx, and the arguments -y, tori.host, mcp. Keep stdout attached to the host: it carries the protocol, while diagnostics go to stderr.
There is no install command that every host shares. These are the hosts that document one, or a file to put the server in:
Claude Code adds it for the current project; with --scope user, for every project.
claude mcp add tori -- npx -y tori.host mcpCodex CLI adds it for every project, in ~/.codex/config.toml.
codex mcp add tori -- npx -y tori.host mcpVS Code adds it to your user profile.
code --add-mcp '{"name":"tori","type":"stdio","command":"npx","args":["-y","tori.host","mcp"]}'Cursor and Gemini CLI read a JSON file with an mcpServers object. For Cursor it is .cursor/mcp.json in the project or ~/.cursor/mcp.json for every project; for Gemini CLI, .gemini/settings.json in the project or ~/.gemini/settings.json. If the file already exists, add tori to the object it has.
{ "mcpServers": { "tori": { "command": "npx", "args": ["-y", "tori.host", "mcp"] } }}The Claude Code and Codex commands were run and their result read on 2026-11-24 (Claude Code 2.1.327, codex-cli 0.170.0); the VS Code, Cursor and Gemini CLI forms are from each host’s own documentation on the same day. A host changes these more often than Tori changes its three facts, so when a line here disagrees with your host’s documentation, the host is right. Most hosts start a newly added server only after a restart or a reload.
Any other host, or no MCP at all: hand your agent the instructions for coding agents. It can add the server to its own host from the three facts, and it can also do everything with the CLI and no MCP.
The process working directory matters only for tori_deploy with a relative directory or source. Prefer an absolute path when the host’s working directory is unclear.
From the upcoming tori.host 0.21.6 release. When tori_deploy creates an app and loses the answer, it retries app creation once with the same request key on control planes that support it. On older control planes it tries creation once. During a mixed-version rollout, the outcome can be unknown if the support check and the create requests reach replicas with different capabilities. If it reports an unknown outcome, check the console for the configured control plane or query that API’s GET /api/apps. An empty list can mean the request is still running. Wait until you can confirm its outcome before starting another create. When the message includes replay details, use the same account and the exact request it shows within 24 hours of the original attempt. Pass the slug as app if the app exists. Keep the slug returned by a successful deploy for later calls.
tori_deploy takes exactly one of three inputs, and they are not interchangeable:
-
directorypublishes already-built static files as they are. Tori runs no build command for the agent, so build the site first. The directory must containindex.html. Everything in it exceptnode_modules,.gitandtori.jsonis published, so a directory that is a project rather than its build output — aDockerfile, the signstori deployreads to recognise a service, an unbuilt front end such as a Vite project root, or a.envfile at its top — is refused before an app is created, rather than publishing its source and.env. The error says the way out: give the build output directory (for exampledist/), deploy a server assource, or move a stray.envout of a directory that is otherwise the site.sourcealways creates a service, so do not use it for a static site. -
sourceuploads a project for Tori to build: aDockerfileat the root is built, otherwise the language is detected..git,node_modulesand everything.gitignorematches stay out of the upload — the same rules astori deploy --service, including a monorepo root’s.envrule. The result reportsbuiltasdockerfileordetected, read from what was uploaded rather than from the working tree (a.gitignorethat matchesDockerfileleaves it on disk and out of the build).Migrations do not run by themselves. A source deploy runs a release command before the new revision takes traffic only if the
releaseinput is given, or the project’stori.jsonsets"release";"release": falsethere means none. Without either, the new revision serves against the old schema. The result echoesrelease— an array, ornullwhen none ran — so an agent can say which happened rather than inferring it fromstatus: live.A container that does not listen on 8080 needs its port: the
portinput for a source or image deploy, or"port"in the project’stori.jsonfor a source deploy. Without it the revision never becomes ready. Ports 8012, 8013, 8022, 9090 and 9091 are reserved and refused before anything is uploaded. -
imagedeploys a digest-pinned image that is already in a registry.
directory creates a static app; source and image create a service. A source or image deploy to an existing static app is refused unless it passes convert: true, which turns that app into a service, keeping its address and custom domains (Turn a site into a service). It cannot become a static app again, and the result says convertedApp: true. A service app takes no directory deploy. A new app counts toward the plan’s app limit; the tool returns the refusal (app limit reached) when the account has no room.
Account and plan limits
Section titled “Account and plan limits”tori_account (from tori.host 0.21.2) is read-only. It reports the email of the account the tools act on, its plan, and what the plan allows: apps, custom domains, deploys at once, static site upload size, rollback history, build time, database size and connections, database sessions, and whether idle services scale to zero. The numbers come from the API, from the same plan table the platform enforces, so an agent can tell before it creates an app or adds a domain whether the plan allows one at all. They are limits, not usage: the tool does not count what the account already holds. When the control plane does not serve them, limits is null and limitsUnavailable says why; the agent should then say it does not know them rather than guess. A refusal from the API still has the last word.
In the upcoming release, tori_account will also return subscriptionPrice
when the API reports a price for the account’s current plan. The field
includes the amount, currency, billing interval, and taxInclusive (null
when the VAT treatment is unspecified). Divide amount by 10 raised to
amountDecimals to quote the recurring subscription price.
In the upcoming release, tori_account will include a hold field for a
billing hold whose stage and dates it
can read. The field carries the stage, dates, and the same message shown in
the tool’s text. If the API reports a hold whose stage or dates cannot be
read, or the billing read fails, the tool can return a warning in
holdUnavailable. In either case, tell
the person before deploying and direct them to Settings → Billing in
their console.
Authenticate
Section titled “Authenticate”The server uses the same API tokens as the CLI. Choose one of these paths:
- Run
npx tori.host loginonce as the same operating-system user that runs the MCP host. The server reads~/.config/tori/config.json. - Set
TORI_TOKENin the MCP server’s environment. This takes precedence over the config file and is the usual choice for an isolated host or CI.
Most tools need a token for the whole account. A deploy token (torid_…) works only for deploying its one app and reading that app’s deploys; every other tool is refused.
TORI_API_URL overrides the default API base URL. Do not paste a token into a prompt or tool argument; the tools have no token field. Revoke a token under Settings → API tokens in the console when the host should lose access.
Work with asynchronous operations
Section titled “Work with asynchronous operations”Tool results report observed state, not a promise that background work has finished.
tori_deploywaits for an authoritative live or superseded deploy result, or a failure. Fromtori.host0.22.9, it waits as long as Tori keeps working on the deploy: until two minutes after the time by which Tori reports it will have settled the deploy in the phase it is in (settlesBy), which for a source deploy moves from the build’s own deadline to the rollout’s once the image is built. It waits at least 24 minutes, and exactly that against a control plane that does not report the deadline and in earlier versions. When the wait ends, it reads the deploy once more, for up to five seconds. If that read finds the deploy live or failed, the tool reports that outcome. If the deploy is still building, it says the deploy is still running, and if the read does not answer, it says the outcome is not known. In those two cases the deploy has not been cancelled and can still go live or fail later. Check it in the Tori console before deploying again.- The MCP preview will expose
tori_app_create_with_databasein the upcomingtori.host0.22.1 release. Update and restart the MCP server once that version is available, then configure an account token and call the tool with empty arguments. It requires a control plane that supports atomic app and database creation. A refusal for the plan’s app limit or a full database pool leaves neither resource. Each successful call takes an app slot. On a control plane with replay support, the tool retries a lost response once with the same request key. Treat a timeout, cancellation, or missing tool result as an unknown outcome. Check the configured control plane’s console for the new app and use any same-key replay details from the error. Wait until you can confirm the outcome before calling the tool again. An empty app list can mean the request is still running. Invoke the tool again only if you have confirmed that the original request did not create an app. Use the returnedappslug withtori_db_statusand check the environment as described below. An older control plane may create the app alone. In that case the tool reports the created slug and says it could not confirm the database. Keep that slug and continue with the same app. If the app exists without a managed database, first check its env tab for an existingDATABASE_URL. If the key is present, confirm with the owner which database the migration targets before creating a database or deploying. If the key is absent, usetori_db_createwith the saved slug. Once the database is ready, verify thatDATABASE_URLis attached to the saved app. If you skipped checking the app’s environment before provisioning, or another session could have set the URL, ask the app owner to confirm the migration target. Tori preserves a custom URL, and the masked key alone does not identify the database. Run the migration only after that confirmation. For a source deploy, pass the saved slug asapptotori_deployalong withsourceand a release command. See the database workflow for agents. tori_db_createusually returnsprovisioning. Checktori_db_statuswhile it is provisioning. If the status iserror, report the message and calltori_db_createwith the sameappto retry without using another app slot. If Tori reports that the failed attempt is still being cleaned up, wait before trying again. Stop if the new attempt fails. Continue to deployment only aftertori_db_statusreturnsready. That state proves the database resource is available, but not that Tori attached its URL: an existing customer-suppliedDATABASE_URLis preserved and attachment can fail independently. Before deploying, open the app in the console and check for the key in its env tab. In a directory whosetori.jsonalready points to the app, you can also check withtori env list. Because the value is masked, its presence does not distinguish a preserved customer URL from the managed one. No tool returns the URL or password, but a release command that prints them puts them in a failed deploy’s error, whichtori_deployreturns to a whole-account token: do not print connection strings from a migration.tori_db_restorerestores a succeeded nightly dump into a separate database. It never overwrites the live database and never changesDATABASE_URL. Follow it withtori_db_restore_status.- There is no tool that queries the database or opens a session on it.
tori db shellandtori db proxyare for a person at a terminal; an agent that can run shell commands should use them only when the user asked for exactly that, because a statement changes live data. tori_db_deletepermanently removes the live managed database.tori_db_restore_deleterequests removal of only the named restore copy; its response does not prove that asynchronous zone cleanup has completed. MCP hosts should ask for confirmation before either destructive call.tori_app_delete(fromtori.host0.19.0) permanently deletes a whole app, its database included, and itsconfirminput must repeat the app’s slug. An agent should call it only when the user asked for that app to be deleted, and a host should ask for confirmation first.cleanupPending: truemeans the app is already gone and what it stored is still being removed. See Delete an app.
tori_always_on (from tori.host 0.22.0) reads whether a service app is kept running when idle, or switches it with enabled. Where the control plane does not offer always-on it says so and changes nothing; a refusal (the plan has no place left, the region has no room now, a payment to settle) changes nothing either, and its message is the one to relay. See Keep a service running.
Shared-tier recovery is based on nightly dumps, not point-in-time recovery. A dump with pending or failed status is not restorable.
Domain names
Section titled “Domain names”Preview. Domain sales are not generally available: on api.tori.host both tools below answer that the control plane sells no domains, and the agent should relay that rather than retry.
tori_domains_searchanswers whether a name can be bought and its yearly price in minor units, without VAT (checkout adds the VAT of the buyer’s country), or the reason it cannot be bought; by default also the same label under a short list of popular TLDs. An answer is not a reservation.tori_domains_ownedlists the names the account has bought or is buying, with status, expiry date, whether each renews, and the app it connects to.connection.missingnames a hostname of the name that is not on that app — it did not fit the plan when the name was registered, or it was removed since — andtori_domains_addadds it once a custom domain is free.renewalgives the next charge date, the renewal subscription’s payment status (past_dueis a failed charge being retried), and whether only a renewal by hand could still renew the name (paymentRequired);byHandsays whether this control plane renews a name by hand, which the customer pays on the name’s page in the console or withnpx tori.host domains renew <name> --now. A status the agent does not know is not a registered name.tori_domains_purchasereads one purchase by itsid, ended ones included: whether it is held for its checkout, settling, paid, registered, failed, released or refunded, and every refund of a payment made for it.failedandrefundedmean a refund is due, not that it is made;refundssays how much is issued. While the name is held,checkout.urlis the checkout to give to the customer; the agent never opens or pays it.releasedmeans no payment is recorded, not that none was taken.
No tool buys a name. A purchase spends the customer’s money, so the MCP interface does not start or complete one, and does not change or pay a renewal: the customer turns renewal on or off in the console or with npx tori.host domains renew <name> --auto on|off, and renews a name by hand on its page in the console or with npx tori.host domains renew <name> --now. The customer buys a name in the console under Domains, or with npx tori.host domains buy <name>; see Buying a domain.
Read the generated MCP tool catalogue for every advertised tool, its inputs, and its read-only, destructive, and idempotency hints. That page is generated by connecting to the same registry the server exposes, so adding a tool without adding it to the reference is not possible.
The command that starts the server is documented separately under tori mcp.
Download this page as Markdown.