MCP Server

smolmachines-mcp is an MCP server that gives an agent tools to create machines, run commands in them, branch and checkpoint them, move files in and out, and change a machine’s credentials, network and ports. This page lists every tool in smolmachines-mcp 1.37.3, with its parameters, what it returns and the limits it enforces.

Run the server

npx -y smolmachines-mcp

The server speaks MCP over stdio, so any MCP client that starts a stdio server can run it with that command. It needs Node.js 18 or later. On the local target, machines run on the engine bundled in the smolmachines npm package, so no smolvm install is needed. The host must be one the engine supports (Supported Platforms).

The server reads these variables from its own environment:

VariableEffect
SMOL_TARGETlocal or cloud: where every tool runs. When it is unset, or any other value, the target is cloud if SMOL_CLOUD_TOKEN is set and local otherwise
SMOL_CLOUD_TOKENsmol cloud API key. On the cloud target with no key set, the key saved by smol auth login is used
SMOL_CLOUD_URLCloud API base URL, when it is not the default
SMOL_MCP_CREDENTIALSThe credentials an agent may attach, described under Credentials. The server exits at start when the value is not a valid list

The session ends when the client closes the server’s stdin, or the server receives SIGINT or SIGTERM. The server then deletes every machine created with persistent: false, and their branches, branches first, and exits. On the cloud target those machines are also created with a one hour TTL, so they are deleted even if the server is killed.

Serve it over HTTP

When the agent does not run where the machines do, the package’s second command serves the same tools over Streamable HTTP:

export SMOL_MCP_AUTH_TOKEN="$(openssl rand -hex 32)"
npx -y -p smolmachines-mcp smolmachines-mcp-http
FlagDefault
--host127.0.0.1
--port8080
--path/mcp; any other path answers 404

It does not start without SMOL_MCP_AUTH_TOKEN, and a request without the token answers 401. Send the token as authorization: Bearer <token> or in an x-smol-mcp-token header; behind the smol cloud ingress, which uses authorization for the account key, send x-smol-mcp-token. Each session runs its own stdio server, and ending the session (the client’s HTTP DELETE) deletes its persistent: false machines as above.

How the tools work

  • A tool that takes machine or source takes a machine name, the one smol_create returns. A name the server has not used yet in this session is connected on first use: on the local target that starts the machine if it is stopped, and on the cloud target a machine ID works as well as a name.
  • Each result is text: JSON for every tool except smol_read_file, which returns the file itself. A failed call returns the error message as its text, flagged as an error.
  • Every machine the server creates or restores can be branched.

Machines

smol_create

Creates and starts a machine from an OCI image, optionally copies a host directory into it, and returns its name.

ParameterTypeDefaultDescription
namestringgeneratedMachine name
imagestringalpine:3.20OCI image to boot, for example python:3.12, node:22 or ubuntu:24.04
workspacestringnoneAbsolute host directory to copy into the machine
workspaceTargetstring/workspaceWhere the copy lands in the machine
excludestring array[]tar exclude patterns for the copy, for example node_modules
cpusinteger, 1 to 642vCPUs
memoryMbinteger, at least 2562048Memory in MiB
networkbooleantrueOutbound networking
allowHostsstring arraynoneLimit outbound traffic to these hosts, for example api.anthropic.com
envobject of stringsnoneVariables for every command smol_exec runs. Keys must be POSIX variable names
credentialsstring arraynoneNames of offered credentials to attach
persistentbooleantrueKeep the machine after the session ends, so a later session can use it by name. false deletes it when the session ends

No parameter is required. Returns { machine, image, target, workspace, ms }, where workspace is { from, to, bytes } when a directory was copied and bytes is the size of the compressed copy.

  • The copy is a gzip tar archive made on the host and unpacked in the machine, so the image needs sh and tar. An archive over 512 MiB is refused. The machine works on its own copy and never writes to the host directory.
  • env is written to /etc/profile.d/smol-mcp.sh in the machine, where anything in the machine can read it. Attach a secret with credentials instead.
  • The machine is created before the copy and env are applied. If either fails, the call returns the error and the machine still exists: delete it with smol_delete.
  • An unknown credential name, or locally a credential whose variable is not set for the server, fails the call before any machine is created.

smol_list

Lists the machines on the current target with their state: locally every machine the engine holds, on the cloud every machine in the account, including ones this server did not create.

It takes no parameters. Returns an array of { machine, state, image, persistent }.

smol_delete

Deletes a machine or a branch.

ParameterTypeDefaultDescription
machinestringrequiredMachine to delete

Returns { deleted }. A machine with live branches is refused until its branches are deleted.

Commands

smol_exec

Runs a shell command in a machine through sh -lc and returns its exit code and output.

ParameterTypeDefaultDescription
machinestringrequiredMachine to run in
commandstringrequiredShell command line
workdirstring/workspace when it existsWorking directory in the machine
timeoutSecinteger, 1 to 86400600Seconds the command may run
envobject of stringsnoneVariables for this command only

Returns { exitCode, stdout, stderr, truncated }, with truncated present only when output was cut. A non-zero exit code flags the result as an error, with the same body. Each of stdout and stderr is cut at 65,536 characters, followed by a note of how many were left out, so write long output to a file and read the part you need.

Branches and checkpoints

smol_branch

Forks a running machine into an independent child with the same files, processes and memory, while the source keeps running.

ParameterTypeDefaultDescription
sourcestringrequiredMachine to branch
namestring<source>-b<n>-<suffix>Name of the child

Returns { machine, source, ms }, where machine is the child. The child can be branched in turn. A branch of a persistent: false machine is deleted with it when the session ends, and its source cannot be deleted while the branch exists.

smol_checkpoint

Saves a running machine’s complete state (memory, processes and disks) as a checkpoint that smol_restore starts a new machine from. The machine keeps running.

ParameterTypeDefaultDescription
machinestringrequiredMachine to save
outputstring~/.smol/checkpoints/<machine>-<suffix>.smolcheckpointLocal target only: host path of the checkpoint file. On the cloud target, a call that sets it fails

Returns { machine, checkpoint, id, sizeBytes, ms }. checkpoint is what smol_restore takes: the file path locally, the checkpoint ID on the cloud. A local checkpoint file stays on the host after its machine is deleted; the server never removes it.

smol_restore

Starts a new machine from a checkpoint saved with smol_checkpoint, with the saved state, processes included.

ParameterTypeDefaultDescription
checkpointstringrequiredCheckpoint file path on the local target, checkpoint ID on the cloud
namestringrestored-<suffix>Name of the new machine

Returns { machine, checkpoint, ms }. The restored machine is not deleted when the session ends, whatever persistent the saved machine had: delete it with smol_delete.

Files

smol_read_file

Reads a file from a machine and returns its contents as text.

ParameterTypeDefaultDescription
machinestringrequiredMachine to read from
pathstringrequiredFile path in the machine

Returns the contents decoded as UTF-8, not JSON. A file over 262,144 bytes (256 KiB) is cut there, followed by a note of how many bytes were left out. Copy binary or large files out with smol_export.

smol_write_file

Writes text to a file in a machine, creating its parent directories.

ParameterTypeDefaultDescription
machinestringrequiredMachine to write to
pathstringrequiredFile path in the machine
contentstringrequiredText to write
modeintegernoneUnix mode as a decimal number, for example 493 for 0755

Returns { machine, path, bytes }.

smol_export

Copies a directory or a file from a machine into a host directory.

ParameterTypeDefaultDescription
machinestringrequiredMachine to copy from
guestPathstringrequiredDirectory or file in the machine
hostPathstringrequiredAbsolute host directory to write into, created if missing

Returns { machine, from, to, bytes, files, skipped }: bytes is the size of the compressed archive, files the number of files written, and skipped, present when any were, the entries not written.

  • A directory’s contents land directly in hostPath; a file lands in hostPath under its own name.
  • Only regular files and directories are written. Symbolic links, hard links, devices and FIFOs are skipped and listed, up to 50 names and then a count. No write follows a symbolic link on the host, and an existing link, or an entry of another type, in the way fails the call.
  • Ownership is not applied, and modes keep at most 0755: no setuid, setgid or sticky bit, no group or world write.
  • An archive over 512 MiB, compressed or unpacked, is refused. The machine needs sh, tar, base64 and tr.

Credentials

Whoever runs the server decides which secrets an agent may use and where each may be sent, in SMOL_MCP_CREDENTIALS, a JSON array:

[{ "name": "github", "envVar": "GITHUB_TOKEN", "hosts": ["api.github.com"] }]
FieldDescription
nameThe name an agent attaches it by
envVarThe variable the machine sees, holding a placeholder instead of the value
hostsAt least one host. The real value is added only to HTTPS requests to these hosts

The agent picks names only: it never sees a value and cannot choose the hosts. On the local target the value is read from the server’s own environment variable named envVar each time a credential is attached. On the cloud target the credential your account stores under name is used, as Credentials the machine never holds describes. Attach credentials with credentials on smol_create, or change them with smol_credentials.

smol_credentials

Replaces the credentials attached to a machine with exactly the names given: an added one is usable from its next request, and one left out stops working.

ParameterTypeDefaultDescription
machinestringrequiredMachine to change
credentialsstring arrayrequiredEvery name the machine should have; [] removes them all

Returns { machine, credentials }. A name the server does not offer is refused, and the error lists the names it does offer.

  • Locally, a machine created with no credentials takes its first ones at its next start, and until then its HTTPS requests fail their certificate check, to every host. The server has no tool that restarts a machine, so attach credentials at smol_create when the machine will need one.
  • On the cloud, a machine’s credentials change only while it has no copy on a node, as the cloud page above describes, and a machine from smol_create has one, so the call is refused unless the names are the ones it already has. Attach them at smol_create.

Network and ports

smol_set_network

Replaces what an existing machine may reach outbound.

ParameterTypeDefaultDescription
machinestringrequiredMachine to change
policy"allow-all", "deny-all", or { allowHosts, allowCidrs }requiredallow-all opens outbound traffic and deny-all blocks it. An allow list limits it to the hosts in allowHosts (exact names, or *.example.com for subdomains only) and the IP ranges in allowCidrs. An allow list naming nothing allows nothing

Returns { machine, network }.

  • On the cloud, a running machine takes a new allow list at once. Switching it to or from allow-all needs it stopped first, and deny-all is refused once the machine has run: use an allow list instead. Change the network of an existing machine has the rules.
  • Locally, the machine must be stopped. The server has no tool that stops a machine, and connecting to a stopped local machine starts it, so for a machine the server created or reached the call fails with Invalid state: expected stopped, got Running. On the local target, set network and allowHosts at smol_create.

smol_publish_port

Publishes a TCP port of an existing machine, running or stopped, without restarting it.

ParameterTypeDefaultDescription
machinestringrequiredMachine to change
guestinteger, 1 to 65535requiredPort in the machine

Returns the mapping in effect, { host, guest, protocol }. Locally a free host port is picked. On the cloud the machine’s node picks it, and the port is reached through the machine’s URL, as Ingress and published ports describes.

smol_unpublish_port

Stops publishing a TCP port of an existing machine. Connections already open carry on.

ParameterTypeDefaultDescription
machinestringrequiredMachine to change
guestinteger, 1 to 65535requiredPort in the machine

Returns { machine, ports }, the ports still published.