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_create makes a new instance and waits until it runs: a name, and optionally an image (poema's base image unless given), workspaces, a gateway, a model, env (its environment variables, names to values), labels (on its Task), timeout_seconds (it is suspended that many seconds after it starts, as spec.timeoutSeconds), a host of poema's fleet to run on, which it waits for and is never moved from, and allowed_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; default reaches package registries and git hosts.
  • sandbox_run runs a shell command (bash -lc) to its end, in /workspace unless given a cwd, 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_file and sandbox_write_file read and write a file, the write making its directories.
  • sandbox_list_files lists the files and directories under a path, /workspace unless given, to a depth of levels, 1 unless given: a line each, a directory's path ending in / and a file's followed by its size in bytes.
  • sandbox_list lists the instances and their phases.
  • sandbox_status says 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_logs returns the last tail lines its own command printed, 200 unless given.
  • sandbox_set_timeout suspends it seconds from now (from when it next starts, if it is not running), and 0 clears its timeout.
  • sandbox_suspend suspends an instance and waits until it is: it stops using compute, and its memory and files are kept.
  • sandbox_resume wakes it and waits until it runs.
  • sandbox_fork forks an instance into new ones, 1 to 100 names, each running on a copy of its /workspace (with memory, 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_delete deletes 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.