script-sandbox
v1.2.2MCP server (stdio) to run any script (PowerShell, bash, Python, Node, Ruby, Perl, Lua, PHP, R, Java, batch, VBScript) and any executable inside a lightweight…
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
sandbox_info Sandbox info
Sandbox information: the root/scripts/work/logs folders, languages + interpreters available on this device (with versions), limits, per-language guardrails, env allowlist, file count, and the file-log redirect (Spring Boot / Quarkus built in, any other stack via SCRIPT_SANDBOX_LOG_VARS; the files land in logs/<run_id>/ so running a project never drops .log files into its folder).
list_scripts List scripts
Lists every script file in the sandbox scripts/ folder (all supported languages), sorted newest first.
write_script Write script
Creates or overwrites a script file inside the sandbox scripts/ folder. Relative paths only (subfolders allowed). The extension selects the language: .ps1 PowerShell, .sh/.bash bash, .py Python, .js/.mjs/.cjs Node, .rb Ruby, .pl Perl, .lua Lua, .php PHP, .r R, .java Java, .bat/.cmd batch, .vbs VBScript. .sh/.bash is normalized to LF and reported via normalized_crlf. For .java: the public class name must match the file name (the usual Java rule); without the public modifier the file name is free.
| Parameter | Type | Description |
|---|---|---|
content * | string | Script content (UTF-8) matching its extension language. |
name * | string | Relative file name with its language extension, e.g. build/deploy.py |
overwrite | boolean | Set true to overwrite an existing file. |
read_script Read script
Reads the contents of any script file from the sandbox scripts/ folder.
| Parameter | Type | Description |
|---|---|---|
name * | string | Relative file name, e.g. build/deploy.py |
delete_script Delete script
Deletes a script file from the sandbox scripts/ folder.
| Parameter | Type | Description |
|---|---|---|
name * | string | Relative file name, e.g. build/deploy.py |
run_script Run script
Runs a script file of any language in the sandbox: separate process, per-run working dir, minimal env, timeout, logs, and a result with exit_code/duration/stdout/stderr. The interpreter is chosen from the file extension (see sandbox_info). If the interpreter for that extension is not installed on this device, the run is rejected with code INCOMPATIBLE plus a fix suggestion.
| Parameter | Type | Description |
|---|---|---|
script * | string | Relative script path, e.g. build/deploy.py or check.ps1 |
args | array | Extra arguments (an array so spaces are not split). |
env | object | Additional env vars for this run (max 20). |
label | string | Free-form label for run bookkeeping. |
timeout_ms | integer | Timeout in ms (default 120000, max 600000). |
run_code Run inline code
Runs a code snippet of any language directly. The code is written to a temporary file in the sandbox (deleted automatically after the run) and executed with the same protections as run_script. For long or multi-file code, use write_script + run_script.
| Parameter | Type | Description |
|---|---|---|
code * | string | Code to execute. |
language * | string | Code language: one of the kind/extension — ps1, sh, py, js, rb, pl, lua, php, r, java, bat, vbs. Java note: the file name is generated automatically, so do not give the first class the public modifi… |
args | array | Extra arguments (an array so spaces are not split). |
env | object | Additional env vars for this run (max 20). |
label | string | |
timeout_ms | integer | Timeout in ms (default 120000, max 600000). |
run_executable Run executable
Runs any executable (CLI tools, compiled binaries) in the same sandbox: per-run cwd, minimal env, timeout, logs. A bare name is looked up on PATH; an absolute path is used as-is. Args are scanned by the guardrails. WARNING: native binaries cannot be contained by this soft sandbox — only run what you trust.
| Parameter | Type | Description |
|---|---|---|
executable * | string | Executable name on PATH (e.g. node, git) or an absolute path. |
args | array | Extra arguments (an array so spaces are not split). |
env | object | Additional env vars for this run (max 20). |
label | string | |
timeout_ms | integer | Timeout in ms (default 120000, max 600000). |
read_log Read run log
Reads the full stdout/stderr log of a run (the output returned by run_script is already truncated).
| Parameter | Type | Description |
|---|---|---|
run_id * | string | run_id from a run result, e.g. 20260101-120000-a1b2c3 |
which | string | Default: stdout |
list_allowed_directories List allowed directories
Lists every directory the filesystem tools may read/write: the sandbox root plus anything in SCRIPT_SANDBOX_FS_ROOTS. Paths outside these are refused.
read_text_file Read text file
Reads a UTF-8 text file inside an allowed directory. Optionally return only the first (head) or last (tail) N lines — head and tail cannot be combined.
| Parameter | Type | Description |
|---|---|---|
path * | string | Absolute path inside an allowed directory, or a path relative to the sandbox root. |
head | integer | First N lines of the file. |
tail | integer | Last N lines of the file. |
read_multiple_files Read multiple files
Reads several UTF-8 text files in one call. A failing path does not stop the batch: the failure is reported per file (ok=false + code).
| Parameter | Type | Description |
|---|---|---|
paths * | array | Files to read (max 50). |
read_media_file Read media file
Reads an image/audio/video/PDF file and returns it base64-encoded with its MIME type. Size cap: SCRIPT_SANDBOX_FS_MAX_MEDIA_BYTES (default 5 MB).
| Parameter | Type | Description |
|---|---|---|
path * | string | Absolute path inside an allowed directory, or a path relative to the sandbox root. |
write_file Write file
Creates a file (parents are created automatically) inside an allowed directory. An existing file is only replaced with overwrite=true. Size cap: SCRIPT_SANDBOX_FS_MAX_WRITE_BYTES (default 1 MB).
| Parameter | Type | Description |
|---|---|---|
content * | string | File content (UTF-8). |
path * | string | Absolute path inside an allowed directory, or a path relative to the sandbox root. |
overwrite | boolean | Set true to replace an existing file. |
edit_file Edit file
Makes selective edits with git-style diff output. Each edit replaces a unique oldText with newText (substring match; when only whitespace differs, indentation is carried over line by line). Ambiguous or missing patterns are refused with a clear code. Always dry_run=true first to preview the diff before applying.
| Parameter | Type | Description |
|---|---|---|
edits * | array | Edits applied in order (max 50). |
path * | string | Absolute path inside an allowed directory, or a path relative to the sandbox root. |
dryRun | boolean | Preview the diff without writing (default false). |
create_directory Create directory
Creates a directory (and its parents) inside an allowed directory.
| Parameter | Type | Description |
|---|---|---|
path * | string | Absolute path inside an allowed directory, or a path relative to the sandbox root. |
move_file Move file or directory
Moves or renames a file/directory inside the allowed directories. Fails with ALREADY_EXISTS if the destination exists.
| Parameter | Type | Description |
|---|---|---|
destination * | string | Absolute path inside an allowed directory, or a path relative to the sandbox root. |
source * | string | Absolute path inside an allowed directory, or a path relative to the sandbox root. |
list_directory List directory
Lists a directory: every entry with its type (file or directory).
| Parameter | Type | Description |
|---|---|---|
path * | string | Absolute path inside an allowed directory, or a path relative to the sandbox root. |
list_directory_with_sizes List directory with sizes
Lists a directory with file sizes, modification times and a summary (total files/directories/bytes); entries sorted by name or size.
| Parameter | Type | Description |
|---|---|---|
path * | string | Absolute path inside an allowed directory, or a path relative to the sandbox root. |
sortBy | string | Default: name. |
search_files Search files
Recursively searches a directory for files/directories matching a glob pattern (e.g. "*.js", "src/**/*.ts"). A pattern without "/" matches names at any depth. Returns full paths, up to 500 matches.
| Parameter | Type | Description |
|---|---|---|
path * | string | Absolute path inside an allowed directory, or a path relative to the sandbox root. |
pattern * | string | Glob pattern, e.g. "*.py" or "src/**/*.ts". |
excludePatterns | array | Globs to skip, e.g. ["node_modules", "**/*.tmp"]. |
directory_tree Directory tree
Recursive JSON tree of a directory: name/type per entry, children for directories (empty array when empty). Symlinks are listed but never followed.
| Parameter | Type | Description |
|---|---|---|
path * | string | Absolute path inside an allowed directory, or a path relative to the sandbox root. |
excludePatterns | array | Globs to skip, e.g. ["node_modules", "**/*.tmp"]. |
get_file_info Get file info
File/directory metadata: size, created/modified/accessed times, type, permissions (octal + rwx) and whether it is a symlink.
| Parameter | Type | Description |
|---|---|---|
path * | string | Absolute path inside an allowed directory, or a path relative to the sandbox root. |