Deploy with Your Agent
Tell your coding agent "deploy this to potions" and it pushes your commit, deploys that exact commit, waits and tells you how it went. It can also create apps, check whether a server has room for another app, create servers on your cloud account, and ask you to delete an app. It never sees a secret, and anything that costs money or deletes something waits for your yes.
Before you start
- A Potions server that can host apps, or a connected DigitalOcean or Hetzner account so your agent can create one.
- Your code on GitHub, in a repository the Potions GitHub App can access. If it can't yet, your agent gives you the link to grant access.
Pick how you connect
| You use | Connect with | Setup |
|---|---|---|
| Claude Code or Codex | Sign in to the Potions MCP server (recommended) | The steps below |
| Cursor, VS Code or Gemini CLI | Sign in to the Potions MCP server | Connect AI Apps |
| Claude on the web, desktop or mobile, or ChatGPT | A connector: you sign in with your Potions account | Connect AI Apps |
| CI and scripts | An API token | API Tokens and the CLI |
Each way reaches the same Potions abilities. Only an agent working in your project, like Claude Code, Codex or Cursor, can also commit and push your code before it deploys. To connect with a token instead of signing in, see Use Potions over MCP.
Set up Claude Code or Codex
1. Add Potions to your agent
In Claude Code:
claude mcp add --transport http --scope user potions https://potions.io/mcp
--scope user adds Potions to every project. Without it, Claude Code adds it only to the folder you ran the command in. You can also ask Claude Code to "add the Potions MCP server at https://potions.io/mcp for all my projects", and it runs the command for you.
In Codex, which adds Potions to every project:
codex mcp add potions --url https://potions.io/mcp
2. Sign in
-
Claude Code: start Claude Code (restart it if it's running), run
/mcp, choose potions and Authenticate. -
Codex:
codex mcp addopens Potions in your browser right away. If it doesn't, runcodex mcp login potions.
In Potions, sign in, leave the abilities ticked and approve. Your agent keeps the sign-in, so there's no token for you or your agent to handle. It lasts up to 90 days, or 30 without use; after that, sign in again the same way.
3. Deploy
Open your agent in your project and ask it to "deploy this to potions".
In Codex, expect approval prompts before it commits and pushes: its sandbox keeps commands off the network and out of .git unless you allow them.
Use the CLI and plugin instead
In Claude Code or Codex, you can use the Potions CLI and plugin instead of the MCP server. Install the CLI:
brew install potionsio/tap/potions
Or run curl -fsSL https://potions.io/install.sh | sh. Both need macOS 15 or newer on a Mac; the Potions CLI lists every way to install it, including with Hex. Then log in:
potions login
Potions opens in your browser with a one-time code. Check that it matches the code in your terminal, leave the abilities ticked and approve. The CLI keeps its token in your system keychain for 90 days, so there's no token for you or your agent to handle. Then add Potions to your agent:
potions setup agent
This installs the Potions plugin for Claude Code and the deploy skill for Codex. To install the plugin yourself instead, in Claude Code:
/plugin marketplace add potionsio/agent-plugin
/plugin install potions@potions
In Codex:
codex plugin marketplace add potionsio/agent-plugin
codex plugin add potions@potions
Start a new session of your agent in your project and ask it to "deploy this to potions".
In Codex, expect approval prompts: its sandbox keeps commands off the network and out of .git unless you allow them, so it asks before calling Potions, committing and pushing.
Without the CLI, open API tokens, choose Agent access and create a token. Add it to your shell profile (for example ~/.zshrc) and restart your agent:
export POTIONS_TOKEN=pot_...
Never paste the token into a chat with your agent. The plugin only ever uses it as $POTIONS_TOKEN, so the value stays out of your conversation.
Your first deploy
When you ask your agent to "deploy this to potions", it:
- Asks before committing any uncommitted changes.
-
Finds your app in Potions by its GitHub repository, and its folder for a monorepo. If there's no app yet, it asks before creating one: it picks your server or asks which one, chooses PostgreSQL, SQLite or no database from your
mix.exs, and matches the Elixir and OTP versions in your.tool-versions. - Asks first if your current branch isn't the one the app deploys.
- Pushes your commit and deploys that exact commit.
- Waits for the deploy and gives you the result, with your app's URL.
Before every deploy, Potions checks config/runtime.exs for the variables your app requires (see Missing Variables). When some are missing, your agent lists the names and gives you a link to the app's Environment page with them filled in. Enter the values there and click Save and deploy, or tell your agent you're done and it deploys.
What you can ask
| Ask your agent | What it does | Your part |
|---|---|---|
| "Deploy this to potions" | Pushes, deploys that commit, waits and gives you the URL | Your yes before it commits, or deploys a branch the app doesn't use |
| "Why did the deploy fail?" | Shows the failed step, Potions' AI summary of the failure and the end of the log, then suggests a fix | Your yes before it changes your code |
| "Roll back shop" | Switches to the previous release in seconds, without a rebuild. Database migrations aren't undone | Your yes |
| "Create an app for this repo on web-1" | Creates the app with the right database and versions. Asking twice returns the same app | Your yes |
| "Set POOL_SIZE to 20" | Sets a value that isn't secret. It applies on the next deploy | Asking is enough |
| "Generate a LIVE_VIEW_SALT" | Potions creates a random value that nobody sees, and keeps any value already set | Your yes |
| "Add STRIPE_SECRET_KEY" | Gives you a link to the app's Environment page | You type the value in Potions |
| "Does web-1 have room for another app?" | Reads the server's memory, disk and load over the last day: room, tight or full, with the numbers | Nothing: it only reads |
| "Create a server for this app" | Shows your cloud account's regions, sizes and monthly prices, creates the server and follows its 5 to 10 minute setup | Your yes to the provider, region, size and price |
| "Add my server at 203.0.113.10" | Adds a server you bring to Potions | You run its connect command on the server as root |
| "Delete the shop-staging app" | Tells you what would go and gives you a link | You type the name and confirm in Potions |
Good to know
- Secrets stay with you. Your agent never reads a variable's value and never writes a secret. Potions refuses values that look like secrets and gives your agent a link for you instead. See Config and Secret Variables.
- One deploy at a time. If you push to an app with push-to-deploy on, Potions notices the deploy that's already running and doesn't start a second one.
- Room is a guide. Potions adds about 250 MB for another Phoenix app to the server's highest memory use of the last day, and checks disk too. Use Potions over MCP explains the verdict.
- Potions tells you about new servers. It emails you about every server an agent creates, with its size, region and monthly price, and the server's page shows which login created it. If no app has run on it after 48 hours, Potions emails you once more. It never deletes the server for you. Each login can create 5 servers an hour, and your plan's server limit applies.
- Deleting needs you. Asking to delete an app only gives you a link to the app's danger zone, where you type the name and tick each item, the same as deleting from the dashboard. The link works for an hour. Potions also emails you about the request and shows it on the app's Settings page, so you can open Potions yourself instead.
What your agent can't do
Agents can't delete servers or ask to, delete anything without you, read a variable's value or write a secret, connect cloud accounts, run commands on your servers or open a console, edit build hooks, or create database servers and load balancers. Those stay in the dashboard.
Troubleshooting
-
Potions isn't listed in
/mcp: it was added in a different folder. Run theclaude mcp addcommand again with--scope user. -
"POTIONS_TOKEN is not set": add the export to your shell profile and restart your agent. In Codex, if you set
shell_environment_policyto drop variables containingTOKEN, allowPOTIONS_TOKEN. -
commit_not_found: the commit isn't on GitHub yet. Push it and try again. -
repo_not_accessible: give the Potions GitHub App access to the repository under Manage repos in your account. -
choose_server: more than one server can host the app. Tell your agent which one. -
no_eligible_server: ask your agent to create a server, or add or finish setting one up in the dashboard, then ask again. -
insufficient_ability: the login doesn't allow that action, often because it was made before the action existed. With the CLI, runpotions login --force. For a connected app, disconnect it on your account page and connect it again. For a token, create a new one with Agent access.
See the API reference for the endpoints behind all of this.