MCP server
Let Claude Code, Cursor, Codex and other MCP clients create and drive pols sandboxes through the pols mcp server.
The pols CLI includes an MCP (Model Context Protocol) server. Your MCP client starts it on your machine with pols mcp and talks to it over standard input and output; the server calls the pols API with your API key. Through it, an agent can create, stop, resume, fork and delete sandboxes, take checkpoints and roll back to them, run commands and detached processes, read, write and list files, use the sandbox’s desktop and Chrome, manage databases, and publish sites.
Set it up
Install the CLI and log in
curl -fsSL https://pols.so/install.sh | sh
pols loginpols mcp uses the key pols login stored, so your client configuration holds no secret. If Claude Code is installed, the install script and pols login offer to register the server for you.
Register the server with your client
Every client runs the same command: pols with the argument mcp. Desktop apps often do not see your shell’s PATH; if a client cannot find pols, use the full path that command -v pols prints.
Claude Code
claude mcp add --scope user pols -- pols mcp
To use POLS_API_KEY from your environment instead of pols login, add the server to a project’s .mcp.json and pass the variable through by reference:
{
"mcpServers": {
"pols": {
"command": "pols",
"args": ["mcp"],
"env": { "POLS_API_KEY": "${POLS_API_KEY}" }
}
}
}
Cursor
In ~/.cursor/mcp.json for all projects, or .cursor/mcp.json for one:
{
"mcpServers": {
"pols": { "command": "pols", "args": ["mcp"] }
}
}
To use POLS_API_KEY, add "env": { "POLS_API_KEY": "${env:POLS_API_KEY}" } to the entry.
Codex
codex mcp add pols -- pols mcp
Or in ~/.codex/config.toml, where env_vars passes POLS_API_KEY through when you use it instead of pols login:
[mcp_servers.pols]
command = "pols"
args = ["mcp"]
env_vars = ["POLS_API_KEY"]
Other clients
Any client that runs stdio servers takes the same command, pols with the arguments ["mcp"]. Never put the key itself into a configuration file; use pols login or a reference to an environment variable.
Tools
Sandboxes are named by ID or name. Lifecycle tools wait until the sandbox has arrived (up to wait_timeout_seconds, default 300) unless you set no_wait.
| Tool | Does | Hint to the client |
|---|---|---|
account_signup |
log in or sign up by the user’s email when pols has no key: pols emails them a link and the returned user_code, which the agent shows them; they approve on the page the link opens. name is how the agent describes itself |
not destructive, open world |
account_signup_wait |
wait (wait_seconds, default 60) for that approval; call again while it is pending. Once logged_in, the new key is stored like pols login stores one |
idempotent, open world |
account_handoff |
log in with a one-time handoff link the user made for the agent on the Agents page; it works once, for 15 minutes, and the new key is stored like pols login stores one |
open world |
sandbox_create |
create a sandbox (name, size, template, env, secrets, ttl_seconds, capture_content) and wait until it runs; without name, it gets a generated one like braveotter, and without size, small. template eokit-default adds LibreOffice and Python libraries for Word, Excel and PowerPoint files. With idempotency_key, calling again with the same key and input within 24 hours returns the sandbox the first call made instead of making another |
not destructive |
sandbox_list |
list the org’s sandboxes, newest first; include_deleted adds deleted ones |
read-only |
sandbox_get |
one sandbox with its size, status, desired state and last error | read-only |
sandbox_stats |
a sandbox’s CPU, memory and disk use, with the samples of the last hour | read-only |
sandbox_events |
a sandbox’s timeline, newest first: lifecycle, commands, desktop actions and control, and with content capture on, masked output, typed text and screenshots; types filters, before pages |
read-only |
sandbox_event_thumbnail |
the stored JPEG thumbnail of a screenshot event, by its ID from sandbox_events |
read-only |
sandbox_timeline_settings |
turn a sandbox’s content capture (capture_content) on or off for future events; off by default |
idempotent |
org_stats |
CPU, memory and disk use summed over the running sandboxes | read-only |
vault_list |
names, kinds and hosts of the vault entries, never values | read-only |
sandbox_stop |
stop a sandbox; its disk is kept | destructive |
sandbox_resume |
resume a stopped sandbox | not destructive |
sandbox_fork |
fork a sandbox into a new running one; secrets adds vault entries, and without name it gets a generated one. Takes ttl_seconds (the source’s expiry is not inherited), capture_content and idempotency_key as sandbox_create does |
not destructive |
sandbox_rename |
give a sandbox a new name; its addresses (its host label) do not change |
idempotent |
sandbox_resize |
give a sandbox another size (vCPUs, RAM and disk) and wait until it has it; it keeps its ID, name, addresses, disk, users, environment and vault entries. A running sandbox restarts, so its processes stop; a stopped one stays stopped. The disk only grows; see Resizing |
destructive |
sandbox_delete |
delete a sandbox and its disk | destructive |
sandbox_egress |
replace a sandbox’s egress policy (mode, allow), at once if it runs |
idempotent |
checkpoint_create, checkpoint_list |
take a named checkpoint of a sandbox’s disk at once; list its checkpoints, oldest first | not destructive; read-only |
checkpoint_delete |
delete a checkpoint | destructive |
sandbox_rollback |
roll a sandbox’s disk back to a checkpoint and wait until it is done, discarding everything newer and the checkpoints taken after it; a running sandbox restarts |
destructive |
sandbox_exec |
run a command (an argument array, such as ["bash", "-lc", "npm test"]) with cwd, env, root, stdin and timeout_seconds (default 600); returns exit code, stdout and stderr |
open world |
process_start |
start a command as a detached process and return at once, for builds, test suites and servers that outlast a tool call; takes the input of sandbox_exec |
open world |
process_list, process_output |
a sandbox’s detached processes with status and exit code; a process’s output from offset |
read-only |
process_signal |
send a signal (default TERM) to a detached process |
destructive |
file_read |
read a file as UTF-8 text, or base64 for binary data; at most 1 MiB (max_bytes) |
read-only |
file_write |
create or overwrite a file (encoding utf-8 or base64, mode, root); the parent directory must exist |
may overwrite |
file_list |
list a directory: name, type, size, mode and modification time of each entry | read-only |
file_changes |
track what changes under a directory: action start remembers what is there, list returns the files created, modified or deleted since, stop forgets it |
idempotent |
user_add, user_list, user_remove |
add a Linux user with its own home and desktop to a running sandbox (name, sudo, ssh_keys, shell); list its users; remove one with its processes and home |
not destructive; read-only; destructive |
computer_screenshot |
a PNG of the whole 1920x1080 desktop, as image content | read-only |
computer_click, computer_double_click |
click a mouse button at x, y |
open world |
computer_drag |
drag with the left button from x, y to to_x, to_y |
open world |
computer_type |
type up to 10,000 characters into the focused window | open world |
computer_key |
press keys, such as Return, ctrl+l or Escape Tab Tab |
open world |
computer_scroll |
scroll up, down, left or right by 1 to 50 clicks at x, y |
open world |
computer_control |
whether a person viewing the desktop has taken control of it; while they have it, the other computer_* tools are refused with desktop_controlled |
read-only |
site_publish |
publish a sandbox directory (sandbox, path) as a new live version of a site: of site, made if it does not exist yet, or without it a new site with a generated name; access for a new site, user |
not destructive |
site_upload |
publish a directory, .zip or file on the machine the MCP server runs on (path) as a new live version of a site, without a sandbox; site and access as for site_publish |
open world |
github_repositories |
the GitHub repositories the org’s connected GitHub accounts let pols read | read-only |
site_import |
make a new private site built from a GitHub repo and queue its first deploy |
open world |
site_deploy |
queue a deploy of the head of the branch of a site built from GitHub | open world |
site_deploys, site_deploy_log |
a site’s deploys, newest first; a deploy’s build log, from after |
read-only |
site_list, site_get |
the org’s sites; one site with its versions | read-only |
site_restore, site_update |
make a kept version live again; change a site’s access, keep_versions or whole-site redirect (redirect_url, redirect_status; "" removes it) |
idempotent |
site_redirects |
a site’s path redirect rules | read-only |
site_redirects_set |
replace all of a site’s path redirect rules with redirects (from, to, optional status 301 or 302); an empty list removes them |
destructive |
site_domain_list |
a site’s, or with sandbox and port instead of site a published port’s, custom domains with their status and the DNS records each needs |
read-only |
site_domain_add, site_domain_check, site_domain_set_primary |
add a custom domain to a site or port (move moves it from another of the org’s sites or ports, keeping its verification); check its DNS now; make it the primary domain (primary) |
not destructive |
site_domain_remove |
remove a custom domain from a site or port | destructive |
site_rotate_link, site_delete |
replace a site’s share link; delete a site and all its versions | destructive |
browser_cdp |
a WebSocket URL for Playwright or Puppeteer to drive the sandbox’s Chrome, valid for 5 minutes | not destructive |
database_list, database_get, database_backups |
the org’s PostgreSQL databases; one database; a database’s nightly backups | read-only |
database_create, database_restore, database_duplicate |
make a database (name, size, default micro); make a new database from a backup; make a new database as a copy of a ready database as it is now, with a password of its own |
not destructive |
database_link |
link a site built from a repository to a database, which its build and app then get as DATABASE_URL (or env) from its next deploy on |
idempotent |
database_rotate, database_unlink, database_delete |
give a database a new password; unlink a site from its database; delete a database with all its data | destructive |
sandbox_exec, process_start, the file_* tools, the computer_* tools and browser_cdp take a user: a Linux user added with user_add to act as, with its own desktop and Chrome.
“Open world” tools run arbitrary commands or input in the sandbox, which may reach the internet. Your client may use the hints to decide which calls to confirm with you. Creating, forking and resuming start billed running time; ask your agent to stop sandboxes it no longer needs.
A non-zero exit code from sandbox_exec is a result, not a tool error.
With a key limited to sandboxes
To let an agent work in one sandbox and nothing else, give it an API key limited to that sandbox: click Create key for this sandbox on the sandbox’s page in the account pages, and store the key with pols login or pass it as POLS_API_KEY. The server’s instructions tell the agent what such a key can do.
With that key, sandbox_list shows only its sandboxes and any other sandbox is not found. The tools that act on its sandboxes work as usual: sandbox_get, sandbox_stats, sandbox_events, sandbox_event_thumbnail, sandbox_stop, sandbox_resume, sandbox_exec, the process_* and file_* tools, the checkpoint_* tools and sandbox_rollback, the user_* tools, the computer_* tools and browser_cdp. The tools that act on the org answer forbidden: sandbox_create, sandbox_delete, sandbox_rename, sandbox_egress, sandbox_timeline_settings, org_stats, vault_list, and the site_* and database_* tools. If a task needs them, the agent asks you for an org-wide key.
sandbox_resize and sandbox_fork answer forbidden too, unless an owner or admin gave the key limits that allow them: then the key may resize and fork its sandboxes up to its largest size, monthly spend and number of sandboxes, and a fork joins its sandboxes. Limits can also take checkpoints away from a key. A call beyond them answers key_limit.
Limits
sandbox_execreturns at most 512 KiB per output stream and setstruncatedwhen it cut the output.- A result larger than the MCP response size limit, such as a very long sandbox list or a large screenshot, comes back as an error instead of a partial result. Use the CLI or the API for those.
- Templates, published ports, desktop links and SSH are not available over MCP. Use
pols template,pols host,pols desktopandpols ssh.
Example
Ask your agent:
Create a small pols sandbox called demo, clone https://github.com/octocat/Hello-World
into it and show me the README. Stop the sandbox when you are done.
It calls the tools roughly in this order:
sandbox_create { "name": "demo", "size": "small" }
sandbox_exec { "sandbox": "demo", "command": ["bash", "-lc", "git clone https://github.com/octocat/Hello-World"] }
file_read { "sandbox": "demo", "path": "/home/user/Hello-World/README" }
sandbox_stop { "sandbox": "demo" }