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:
| Variable | Effect |
|---|---|
SMOL_TARGET | local 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_TOKEN | smol cloud API key. On the cloud target with no key set, the key saved by smol auth login is used |
SMOL_CLOUD_URL | Cloud API base URL, when it is not the default |
SMOL_MCP_CREDENTIALS | The 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 | Flag | Default |
|---|---|
--host | 127.0.0.1 |
--port | 8080 |
--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
machineorsourcetakes a machine name, the onesmol_createreturns. 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.
| Parameter | Type | Default | Description |
|---|---|---|---|
name | string | generated | Machine name |
image | string | alpine:3.20 | OCI image to boot, for example python:3.12, node:22 or ubuntu:24.04 |
workspace | string | none | Absolute host directory to copy into the machine |
workspaceTarget | string | /workspace | Where the copy lands in the machine |
exclude | string array | [] | tar exclude patterns for the copy, for example node_modules |
cpus | integer, 1 to 64 | 2 | vCPUs |
memoryMb | integer, at least 256 | 2048 | Memory in MiB |
network | boolean | true | Outbound networking |
allowHosts | string array | none | Limit outbound traffic to these hosts, for example api.anthropic.com |
env | object of strings | none | Variables for every command smol_exec runs. Keys must be POSIX variable names |
credentials | string array | none | Names of offered credentials to attach |
persistent | boolean | true | Keep 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
tararchive made on the host and unpacked in the machine, so the image needsshandtar. An archive over 512 MiB is refused. The machine works on its own copy and never writes to the host directory. envis written to/etc/profile.d/smol-mcp.shin the machine, where anything in the machine can read it. Attach a secret withcredentialsinstead.- The machine is created before the copy and
envare applied. If either fails, the call returns the error and the machine still exists: delete it withsmol_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.
| Parameter | Type | Default | Description |
|---|---|---|---|
machine | string | required | Machine 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.
| Parameter | Type | Default | Description |
|---|---|---|---|
machine | string | required | Machine to run in |
command | string | required | Shell command line |
workdir | string | /workspace when it exists | Working directory in the machine |
timeoutSec | integer, 1 to 86400 | 600 | Seconds the command may run |
env | object of strings | none | Variables 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.
| Parameter | Type | Default | Description |
|---|---|---|---|
source | string | required | Machine to branch |
name | string | <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.
| Parameter | Type | Default | Description |
|---|---|---|---|
machine | string | required | Machine to save |
output | string | ~/.smol/checkpoints/<machine>-<suffix>.smolcheckpoint | Local 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.
| Parameter | Type | Default | Description |
|---|---|---|---|
checkpoint | string | required | Checkpoint file path on the local target, checkpoint ID on the cloud |
name | string | restored-<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.
| Parameter | Type | Default | Description |
|---|---|---|---|
machine | string | required | Machine to read from |
path | string | required | File 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.
| Parameter | Type | Default | Description |
|---|---|---|---|
machine | string | required | Machine to write to |
path | string | required | File path in the machine |
content | string | required | Text to write |
mode | integer | none | Unix 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.
| Parameter | Type | Default | Description |
|---|---|---|---|
machine | string | required | Machine to copy from |
guestPath | string | required | Directory or file in the machine |
hostPath | string | required | Absolute 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 inhostPathunder 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,base64andtr.
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"] }] | Field | Description |
|---|---|
name | The name an agent attaches it by |
envVar | The variable the machine sees, holding a placeholder instead of the value |
hosts | At 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.
| Parameter | Type | Default | Description |
|---|---|---|---|
machine | string | required | Machine to change |
credentials | string array | required | Every 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_createwhen 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_createhas one, so the call is refused unless the names are the ones it already has. Attach them atsmol_create.
Network and ports
smol_set_network
Replaces what an existing machine may reach outbound.
| Parameter | Type | Default | Description |
|---|---|---|---|
machine | string | required | Machine to change |
policy | "allow-all", "deny-all", or { allowHosts, allowCidrs } | required | allow-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-allneeds it stopped first, anddeny-allis 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, setnetworkandallowHostsatsmol_create.
smol_publish_port
Publishes a TCP port of an existing machine, running or stopped, without restarting it.
| Parameter | Type | Default | Description |
|---|---|---|---|
machine | string | required | Machine to change |
guest | integer, 1 to 65535 | required | Port 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.
| Parameter | Type | Default | Description |
|---|---|---|---|
machine | string | required | Machine to change |
guest | integer, 1 to 65535 | required | Port in the machine |
Returns { machine, ports }, the ports still published.