forkd-mcp
v0.2.1Model Context Protocol server for forkd microVM sandboxes (BRANCH, diff snapshots, prewarm)
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
list_snapshots
List parent snapshots registered with the forkd controller. Each snapshot is a tagged warmed-VM image you can fork children from. Returns SnapshotInfo objects: tag, dir, created_at_unix.
spawn_sandboxes
Fork N children from a parent snapshot. Args: snapshot_tag: Name of a registered snapshot (see list_snapshots). n: Number of children to spawn, 1..1000. per_child_netns: When true, each child is placed in a per-child network namespace forkd-child-<i>. The host must have run scripts/netns-setup.sh N first. memory_limit_mib: Cgroup memory.max for each child. prewarm: When true, the daemon performs a throwaway snapshot immediately after restore to amortize the cold-cache penalty. Relocates the cold cost f…
| Parameter | Type | Description |
|---|---|---|
snapshot_tag * | string | |
live_fork | boolean | |
memory_limit_mib | integer | |
n | integer | |
per_child_netns | boolean | |
prewarm | boolean |
branch_sandbox
Branch a running sandbox into a new snapshot. Pauses the source sandbox briefly, snapshots its memory + vCPU state, and resumes the source. The resulting snapshot is a new tag that any later spawn_sandboxes call can use as its snapshot_tag — fan out N children that all inherit the source's exact state at branch time. This is forkd's core primitive. Modal does this as their proprietary moat; forkd is the open-source equivalent. Args: sandbox_id: Id of the source sandbox (see list_sandboxes). tag: Optional name for the new snapshot. When unset…
| Parameter | Type | Description |
|---|---|---|
sandbox_id * | string | |
diff | boolean | |
measure_diff | boolean | |
mode | ||
tag | ||
wait | boolean |
create_snapshot
Build a parent snapshot from a kernel + rootfs. Boots a fresh VM with the given kernel + rootfs, waits `boot_wait_secs` for the guest to settle, snapshots it, and registers the snapshot under `tag` so later spawn_sandboxes calls can fork children from it. Args: tag: Name to register the snapshot under (alnum + dash/ underscore, 1-64 chars). kernel: Host path to a vmlinux kernel image. rootfs: Host path to a rootfs image (.ext4 for writable, .squashfs for read-only). rw: When true, mount the rootfs read-write. Auto-en…
| Parameter | Type | Description |
|---|---|---|
kernel * | string | |
rootfs * | string | |
tag * | string | |
boot_wait_secs | integer | |
rw | boolean | |
tap |
wait_for_text
Poll a file inside a sandbox until it contains a marker string. Common pattern: agent writes its progress to a stdout log inside the guest; the orchestrator (you, the MCP client) polls until a marker like "READY_TO_BRANCH" appears, then triggers branch. Avoids busy-waiting from outside the daemon's exec round-trip. Args: sandbox_id: Target sandbox. path: Absolute path inside the guest of the file to poll. marker: Substring to wait for. Returned as-is when found. timeout_secs: Max wall-clock seconds to wait. Default 60. poll_interval…
| Parameter | Type | Description |
|---|---|---|
marker * | string | |
path * | string | |
sandbox_id * | string | |
poll_interval_ms | integer | |
timeout_secs | number |
list_sandboxes
List currently-alive child sandboxes.
get_sandbox
Fetch metadata about one sandbox by id.
| Parameter | Type | Description |
|---|---|---|
sandbox_id * | string |
kill_sandbox
Terminate one sandbox. Kills Firecracker, removes its cgroup leaf.
| Parameter | Type | Description |
|---|---|---|
sandbox_id * | string |
exec_command
Run a subprocess inside a sandbox. Example: exec_command("sb-abc-0000", ["python3", "-c", "print(2+2)"]) Returns: {stdout, stderr, exit_code}.
| Parameter | Type | Description |
|---|---|---|
args * | array | |
sandbox_id * | string | |
timeout_secs | integer |
eval_code
Evaluate a Python expression against the sandbox's warmed PID-1. The parent VM already imported numpy / torch / etc.; eval returns in single-digit ms instead of ~100 ms for a fresh subprocess. Returns: {result, error, exit_code}.
| Parameter | Type | Description |
|---|---|---|
code * | string | |
sandbox_id * | string |
ping_sandbox
Round-trip to the in-guest agent. Returns its health and runtime info.
| Parameter | Type | Description |
|---|---|---|
sandbox_id * | string |