poema-mcp
poema-mcp, which the Python SDK installs, is an MCP server that lets Claude Code, or another MCP client, create and
work in instances: it makes them, runs commands and edits files in them, suspends them when idle and forks them to try
several approaches. It reads the same variables as the SDK. It is how an agent on your machine drives poema cloud, and
not the MCP servers an agent running in an instance uses, which are set on New instance (Deploy from git).
For Claude Code:
claude mcp add poema -e POEMA_URL=https://api.cloud.poema.dev -e POEMA_API_KEY=poema_ns_... -- poema-mcp
Claude Code has to find poema-mcp: put ~/.venvs/poema/bin on its PATH, or give the full path. Any other MCP
client runs the same command, over stdio, with the same two variables.
With the CLI installed too, sign in once instead, and give it no variables: it reads the key poema login keeps.
poema login --url https://cloud.poema.dev claude mcp add poema -- poema-mcp
Tools
sandbox_createmakes a new instance and waits until it runs: a name, and optionally animage(poema's base image unless given),workspaces, agateway, amodel,env(its environment variables, names to values),labels(on its Task),timeout_seconds(it is suspended that many seconds after it starts, asspec.timeoutSeconds), ahostof poema's fleet to run on, which it waits for and is never moved from, andallowed_tools, the tools it may call on its workspaces' MCP servers by server name (the workspaces that declare one are copied for it, and deleted with it). It refuses a name an instance already has. Without a gateway an instance has no network;defaultreaches package registries and git hosts.sandbox_runruns a shell command (bash -lc) to its end, in/workspaceunless given acwd, with no stdin, and returns its exit code and output. One still running after its timeout, 120 seconds unless given, is killed and returns its output so far.sandbox_read_fileandsandbox_write_fileread and write a file, the write making its directories.sandbox_list_fileslists the files and directories under apath,/workspaceunless given, to adepthof levels, 1 unless given: a line each, a directory's path ending in/and a file's followed by its size in bytes.sandbox_listlists the instances and their phases.sandbox_statussays an instance's phase and why (its conditions' messages), its image, gateway and model, when its timeout suspends it, a line each, then its last 10 events.sandbox_logsreturns the lasttaillines its own command printed, 200 unless given.sandbox_set_timeoutsuspends itsecondsfrom now (from when it next starts, if it is not running), and 0 clears its timeout.sandbox_suspendsuspends an instance and waits until it is: it stops using compute, and its memory and files are kept.sandbox_resumewakes it and waits until it runs.sandbox_forkforks an instance into new ones, 1 to 100 names, each running on a copy of its/workspace(withmemory, of its memory too), and waits until they run. The instance is suspended first and stays so until resumed. Forks count toward the instances you may run at once.sandbox_deletedeletes an instance and its workspace.
Each tool carries MCP's tool annotations for the client, and none reaches beyond poema's instances: sandbox_list,
sandbox_status, sandbox_logs, sandbox_read_file and sandbox_list_files are read-only; sandbox_run,
sandbox_write_file and sandbox_delete are destructive, as they can overwrite or remove files; and of the tools that
change something, all but sandbox_run and sandbox_set_timeout are idempotent.
A tool that fails answers with its error, for the client to act on.