microsandbox-mcp

June 18, 2026 · View on GitHub

Give your AI agents sandboxes. This MCP server connects any AI agent to microsandbox — letting them create fast lightweight sandboxes, execute code, manage files, and monitor resources.

Documentation | npm Package | GitHub

Installation

Run the server with npx -y microsandbox-mcp using stdio transport.

Claude Code
claude mcp add --transport stdio microsandbox -- npx -y microsandbox-mcp
Cursor

Add to ~/.cursor/mcp.json:

{
  "mcpServers": {
    "microsandbox": {
      "command": "npx",
      "args": ["-y", "microsandbox-mcp"]
    }
  }
}
VS Code

Add to .vscode/mcp.json:

{
  "servers": {
    "microsandbox": {
      "command": "npx",
      "args": ["-y", "microsandbox-mcp"]
    }
  }
}
Claude Desktop

Add to your config file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
{
  "mcpServers": {
    "microsandbox": {
      "command": "npx",
      "args": ["-y", "microsandbox-mcp"]
    }
  }
}
Windsurf

Add to ~/.codeium/windsurf/mcp_config.json:

{
  "mcpServers": {
    "microsandbox": {
      "command": "npx",
      "args": ["-y", "microsandbox-mcp"]
    }
  }
}
Zed

Add to your Zed settings:

{
  "context_servers": {
    "microsandbox": {
      "command": {
        "path": "npx",
        "args": ["-y", "microsandbox-mcp"]
      }
    }
  }
}
Other Clients

For any MCP client that supports stdio transport:

{
  "mcpServers": {
    "microsandbox": {
      "command": "npx",
      "args": ["-y", "microsandbox-mcp"]
    }
  }
}

Available Tools

Every tool returns a JSON envelope: { "ok": true, "data": ... } on success or { "ok": false, "error": ... } on failure. Large command output, logs, and file reads are capped by default and include truncation metadata when shortened.

Runtime

ToolDescription
runtime_checkCheck whether the microsandbox runtime, msb, and libkrunfw are available
runtime_installInstall runtime dependencies using the microsandbox SDK installer

Sandbox Lifecycle

ToolDescription
sandbox_runCreate an ephemeral sandbox, run a shell command, return output, and remove it
sandbox_createCreate and boot a persistent sandbox with rootfs, resources, process, mounts, patches, network, secrets, and lifecycle options
sandbox_startStart stopped sandboxes by name, labels, or status selector
sandbox_listList sandboxes with status, image, labels, and timestamps
sandbox_statusShow status for one sandbox or a filtered sandbox set
sandbox_inspectReturn full configuration and metadata for one sandbox
sandbox_stopStop selected sandboxes gracefully or forcefully, with optional timeout
sandbox_drainRequest graceful drain for selected sandboxes
sandbox_waitWait until selected sandboxes reach a terminal state
sandbox_removeRemove selected stopped sandboxes, optionally force-stopping running ones first

Command Execution

ToolDescription
sandbox_execExecute an argv command with env, cwd, user, TTY, timeout, rlimits, stdin, and output caps
sandbox_shellExecute a shell command string with the same execution controls
sandbox_exec_startStart a long-running command and return an in-memory exec session id
sandbox_exec_pollPoll output events and exit status for an exec session
sandbox_exec_write_stdinWrite UTF-8 or base64 data to an exec session stdin
sandbox_exec_signalSend hup, int, term, kill, or a numeric signal to an exec session
sandbox_exec_closeClose and forget an exec session

Logs

ToolDescription
sandbox_logs_readRead captured logs with tail, time, source, grep, session id, and output cap filters
sandbox_logs_streamPoll captured logs using cursors and a bounded follow timeout

Filesystem

ToolDescription
sandbox_fs_readRead a sandbox file as UTF-8 text or base64 bytes
sandbox_fs_writeWrite UTF-8 text or base64 bytes to a sandbox file
sandbox_fs_listList sandbox directory entries
sandbox_fs_mkdirCreate a sandbox directory
sandbox_fs_removeRemove a sandbox file or directory
sandbox_fs_copyCopy a file within one sandbox or between two running sandboxes
sandbox_fs_renameRename a sandbox file or directory
sandbox_fs_statGet sandbox path metadata
sandbox_fs_existsCheck whether a sandbox path exists
sandbox_fs_copy_from_hostCopy an allowlisted host path into a sandbox
sandbox_fs_copy_to_hostCopy a sandbox path to an allowlisted host destination

Metrics

ToolDescription
sandbox_metricsGet point-in-time metrics for one running sandbox
sandbox_metrics_allGet point-in-time metrics for all running sandboxes
sandbox_metrics_streamCollect a bounded number of metrics samples from one sandbox

Volumes

ToolDescription
volume_createCreate a directory or disk-backed named volume with quota, capacity, and labels
volume_listList named volumes with kind, quota, capacity, usage, disk format, labels, and timestamps
volume_inspectInspect one named volume
volume_removeRemove one or more named volumes
volume_fs_readRead a volume file as UTF-8 text or base64 bytes
volume_fs_writeWrite UTF-8 text or base64 bytes to a volume file
volume_fs_listList volume directory entries
volume_fs_mkdirCreate a directory inside a volume
volume_fs_removeRemove a file or directory from a volume
volume_fs_copyCopy a file inside a volume
volume_fs_renameRename a file or directory inside a volume
volume_fs_statGet volume path metadata
volume_fs_existsCheck whether a volume path exists

Images

ToolDescription
image_listList cached images
image_inspectInspect cached image config and layers
image_removeRemove one or more cached images, optionally forced with confirmation
image_pruneRemove cached image artifacts unused by sandboxes, with confirmation

Snapshots

ToolDescription
snapshot_createCreate a snapshot from a stopped sandbox by name or explicit host path
snapshot_listList indexed snapshots
snapshot_inspectInspect snapshot metadata by name, digest, or path, optionally verifying integrity
snapshot_verifyVerify recorded snapshot content integrity
snapshot_removeRemove one or more snapshots, optionally forced with confirmation
snapshot_reindexRebuild the local snapshot index
snapshot_exportExport a snapshot to an allowlisted host archive path
snapshot_importImport a snapshot archive from an allowlisted host path

SSH and SFTP

ToolDescription
sandbox_ssh_execExecute a command through the sandbox SSH subsystem
sandbox_sftp_readRead a file through sandbox SFTP as UTF-8 text or base64 bytes
sandbox_sftp_writeWrite UTF-8 text or base64 bytes through sandbox SFTP
sandbox_sftp_mkdirCreate a directory through sandbox SFTP
sandbox_sftp_removeRemove a file or directory through sandbox SFTP
sandbox_sftp_renameRename a path through sandbox SFTP
sandbox_sftp_realpathResolve a real path through sandbox SFTP
sandbox_sftp_readlinkRead a symlink target through sandbox SFTP
sandbox_sftp_symlinkCreate a symlink through sandbox SFTP

Resources

URIDescription
microsandbox://runtimeRuntime installation status and MCP configuration
microsandbox://sandboxesCurrent sandbox inventory
microsandbox://volumesCurrent volume inventory
microsandbox://imagesCurrent image cache inventory
microsandbox://snapshotsCurrent snapshot index
microsandbox://schemas/sandbox-createJSON Schema for sandbox creation inputs
microsandbox://policyEffective host path and dangerous-operation policy

Configuration

Env varDefaultDescription
MICROSANDBOX_MCP_HOST_PATHScurrent working directoryColon-separated allowlist for bind mounts, host copy, snapshot import/export, and other host path operations
MICROSANDBOX_MCP_HOST_PATH_POLICYallowlistSet to unrestricted to allow any host path
MICROSANDBOX_MCP_ENABLE_DANGEROUS0Enables future dangerous operations; destructive cache operations still require explicit confirm: true
MICROSANDBOX_MCP_MAX_OUTPUT_BYTES1048576Default cap for command output, logs, and file reads
MICROSANDBOX_MCP_DEFAULT_TIMEOUT_MS120000Default timeout budget for exec-style operations
MICROSANDBOX_MCP_SESSION_TTL_MS900000Idle TTL for in-memory exec sessions
MSB_PATHunsetOptional path to the msb binary for SDK/runtime discovery
MSB_LIBKRUNFW_PATHunsetOptional path to libkrunfw

SDK Gaps

The server intentionally stays a thin TypeScript SDK adapter and does not shell out to msb for core behavior. Image pull/load/save, persistent registry login/logout/list, SSH authorization management, and managed SSH serving are not exposed until the TypeScript SDK provides first-class APIs for them. Command aliases (msb install/msb uninstall) and runtime self-update/uninstall are intentionally out of scope.

Requirements

macOS (Apple Silicon) or Linux (x86_64/ARM64 with KVM support).

Use runtime_check to verify whether msb and libkrunfw are available. Use runtime_install to install them from the MCP server. If that fails, install manually:

curl -fsSL https://install.microsandbox.dev | sh

Development

git clone https://github.com/superradcompany/microsandbox-mcp.git
cd microsandbox-mcp
npm install
npm run build
npm test
npm run test:e2e
node dist/index.js

npm run test:e2e launches the built MCP server over stdio and calls every registered tool and resource with live parameters. It creates temporary sandboxes, volumes, snapshots, and host files, then cleans them up. Global image cache deletion is guarded by default; set MICROSANDBOX_MCP_E2E_DESTRUCTIVE_CACHE=1 to let the e2e script run destructive image prune behavior instead of the safe confirmation-error path.

License

Apache-2.0