Skip to main content
Glama
neu-sandbox-mcp

neu-sandbox-mcp

Official
by neutree-ai

neu-sandbox-mcp

An MCP server that gives an agent remote sandboxes: start a container from an image, run commands in it, read and write its files, reach the servers it runs, and shut it down.

Why

  • One set of tools across backends. Prompts and skills keep the same tool names and outputs when sandboxes move to another backend. Each backend is a small adapter behind one interface.

  • Backends differ, and the tools say so. Sandbox services vary a lot: some take any image and some need it registered first, some keep a background command's output and some only stream it, some previews are public and some need a token. Each backend declares what it supports, and only the tools it can really serve are registered, with descriptions that match. Nothing missing is faked.

  • Credentials stay on the server. The backend token never enters the agent's context.

  • Safe to share between tenants. A scope confines every tool to the sandboxes tagged for one tenant, even when tenants share the backend's credentials.

Related MCP server: sandbox-as-a-service-mcp

Tools

The base tools are always there. The rest appear when the backend supports them.

Tool

What it does

Needs

create_sandbox

Starts a sandbox from an image. Takes timeout_seconds and env, plus resource and resource_requests where the backend accepts them.

—

list_sandboxes

Lists sandboxes in scope.

—

kill_sandbox

Destroys a sandbox.

—

sandbox_run_command

Runs a shell command and waits for it. With background: true, returns a command_id instead.

background needs background commands

sandbox_read_file

Reads a text file, optionally a line range.

—

sandbox_write_files

Writes text files, creating parent directories.

—

sandbox_renew

Pushes the expiry further out.

renew

sandbox_get_command_status

Whether a background command is still running, and its exit code.

background output kept (cursor or snapshot)

sandbox_get_command_logs

A background command's output: in increments from a cursor, or its latest tail.

background output kept (cursor or snapshot)

sandbox_interrupt_command

Stops a background command.

interrupt

sandbox_list_directory

Lists a directory, with entry types.

directory listing

sandbox_search_files

Finds files by glob on the name.

file search

sandbox_replace_contents

Replaces text in files, reporting a count per file.

replace

sandbox_move_files / sandbox_delete_files / sandbox_create_directories / sandbox_delete_directories

File management.

each its own

sandbox_get_preview_url

A URL that reaches a port inside the sandbox.

a public or signed preview

Backends

Backend

Image

Timeout (default / max)

Background output

Preview

Metadata

Renew

List dir

Search

Replace

nap

any, entrypoint override

1 hour / none

cursor

public (when configured)

✅

✅

✅

✅

✅

More backends are planned. See Adding a backend.

Capabilities

A backend declares, in capabilities, the form its create and lifecycle take:

Capability

Values

image.source

any: any image reference at create time. registered: images must be registered with the service first.

image.entrypoint

image: the image's own entrypoint runs. override: create can replace it. none: nothing runs until you start it.

resources

perSandbox: limits can be chosen at create time. requests: requests can be set apart from limits.

timeout

absolute (from creation) or idle (since last activity), with the default and the maximum.

metadata

Sandboxes can be tagged and listed by tag. Required for a scope.

Everything else is an optional member of the provider, present only when the backend has it. A member that comes in several forms carries its kind:

Member

kind

commands (background commands)

cursor: output is read in increments from a byte offset. snapshot: each read returns the whole log. stream: output is only seen while attached, so it cannot be read later.

preview (reaching a port)

public: the URL works as is. signed: a browser-openable URL that expires. header: requests must carry headers, so it serves servers, not people.

renew, commands.interrupt and each file operation beyond read and write are simply present or absent.

Sandbox status is one of creating, running, paused, stopped, failed or unknown; each backend maps its own states onto these.

Run it as a server

Requires Node.js 22 or newer. The server speaks MCP over stdio.

{
  "mcpServers": {
    "sandbox": {
      "command": "npx",
      "args": ["-y", "neu-sandbox-mcp"],
      "env": {
        "NEU_SANDBOX_BACKEND": "nap",
        "NAP_SANDBOX_URL": "https://sandbox.example.com",
        "NAP_SANDBOX_TOKEN": "<token>",
        "NAP_SANDBOX_PUBLIC_URL": "https://sandbox.example.com"
      }
    }
  }
}

NEU_SANDBOX_BACKEND picks the backend and defaults to nap. Each backend then reads its own variables.

nap

Variable

Meaning

NAP_SANDBOX_URL

Base URL of the sandbox service API. Required.

NAP_SANDBOX_TOKEN

Bearer token for the sandbox service. Required.

NAP_SANDBOX_PUBLIC_URL

Public URL of the sandbox service, whose host fronts the preview subdomains (<id>-<port>.<host>). Without it there is no preview tool.

Use it as a library

To add the tools to an MCP server you already run, register them on it:

import { McpServer } from '@modelcontextprotocol/server'
import { createNapProvider, registerSandboxTools } from 'neu-sandbox-mcp'

const server = new McpServer({ name: 'my-server', version: '1.0.0' })

registerSandboxTools(server, {
  provider: createNapProvider({
    baseUrl: 'http://sandbox.internal:3006',
    previewBaseUrl: 'https://sandbox.example.com',
    token: async () => lookUpTokenFor(tenant),
  }),
  scope: { tenant_id: tenant.id },
})

The server can come from either generation of the MCP TypeScript SDK: @modelcontextprotocol/server (v2) or @modelcontextprotocol/sdk (v1).

scope is a set of tags that confines the tools to one tenant. Every sandbox they create carries the tags, list_sandboxes returns only sandboxes that carry them, and a tool given a sandbox ID refuses it unless that sandbox carries them.

registerSandboxTools returns the provider the tools act through, already confined to the scope, so tools you add yourself get the same confinement. The provider is also usable on its own, for example behind your own REST API: wrap it with scopeProvider(provider, scope), and calls on an out-of-scope ID throw SandboxNotFoundError. unsupportedCreateOptions(provider.capabilities, opts) names create options the backend cannot honour, so your API can refuse them.

To pick the backend from the environment, the way the standalone server does, use providerFromEnv(process.env).

License

Apache License 2.0

Available Tools

17 tools
create_sandboxCreate SandboxA

Create an isolated sandbox environment with a specified container image. Returns a sandbox_id for use with other sandbox tools. The sandbox auto-expires after the timeout (default 1 hour). Extend it with sandbox_renew. For coding tasks (e.g. git clone, npm install, dev server), use a longer timeout like 21600 (6h) or 86400 (24h) and higher resources (cpu: "2", memory: "4Gi").

Inputs: image (required), env, resource, timeout_seconds, +1 more.

kill_sandboxKill SandboxA

Stop and destroy a sandbox. All data inside the sandbox will be lost.

Inputs: sandbox_id (required).

list_sandboxesList SandboxesB

List all sandboxes.

Inputs: no named parameters.

sandbox_create_directoriesCreate Directories in SandboxA

Create directories. Not needed before sandbox_write_files, which creates parents on its own.

Inputs: paths (required), sandbox_id (required).

sandbox_delete_directoriesDelete Directories from SandboxC

Delete directories and everything inside them.

Inputs: paths (required), sandbox_id (required).

sandbox_delete_filesDelete Files from SandboxA

Delete one or more files. For directories use sandbox_delete_directories.

Inputs: paths (required), sandbox_id (required).

sandbox_get_command_logsGet Background Command LogsA

Fetch output from a background command. Returns { content, cursor }. Pass the cursor back on the next call to get only what was written since — polling from cursor 0 every time re-reads the whole log and will eventually blow past the tool output limit.

Inputs: command_id (required), sandbox_id (required), cursor.

sandbox_get_command_statusGet Background Command StatusB

Check whether a background command is still running. Returns running, exit_code, and timing.

Inputs: command_id (required), sandbox_id (required).

sandbox_interrupt_commandInterrupt CommandA

Stop a running background command. The command ends with a non-zero exit code.

Inputs: command_id (required), sandbox_id (required).

sandbox_list_directoryList Sandbox DirectoryA

List a directory inside a sandbox. Each entry carries a type (file / directory / symlink). Use depth to walk subdirectories. To find a file by name rather than list a directory, use sandbox_search_files.

Inputs: path (required), sandbox_id (required), depth.

sandbox_move_filesMove or Rename Files in SandboxB

Move or rename files and directories inside a sandbox.

Inputs: entries (required), sandbox_id (required).

sandbox_read_fileRead File from SandboxA

Read the contents of a file inside a sandbox. Reads the whole file by default. For a large file, page through it with offset/limit instead — an oversized read gets truncated on the way back to you, and you will not be told where it was cut.

Inputs: path (required), sandbox_id (required), limit, offset.

sandbox_renewRenew SandboxA

Extend a sandbox expiry. Use this instead of creating a replacement when a task runs longer than the original timeout.

Inputs: sandbox_id (required), extend_seconds (required).

sandbox_replace_contentsReplace Text in Sandbox FilesA

Replace text inside files, editing in place instead of rewriting the whole file. Returns a replaced_count per file — 0 means the old text was not found, so check it rather than assuming the edit landed. If detail_available is false the sandbox runtime is too old to report counts: the replacement still happened, but you have to read the file back to confirm what changed.

Inputs: entries (required), sandbox_id (required).

sandbox_run_commandRun Command in SandboxA

Execute a shell command inside a sandbox. Returns stdout, stderr, exit_code, and execution_time_ms. By default this blocks until the command exits. For anything long-running (dev servers, builds, watchers) pass background: true — it returns a command_id immediately. Follow it with sandbox_get_command_logs / sandbox_get_command_status and stop it with sandbox_interrupt_command.

Inputs: command (required), sandbox_id (required), cwd, env, +2 more.

sandbox_search_filesSearch Files in SandboxB

Find files under a directory by glob pattern (e.g. "*.py"). Returns a flat list.

Inputs: path (required), sandbox_id (required), pattern.

sandbox_write_filesWrite Files to SandboxC

Write one or more files inside a sandbox. Creates parent directories automatically.

Inputs: files (required), sandbox_id (required).

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.5/5.0

    Scored across 17 tools

    Disambiguation4/5

    Each tool targets a distinct resource+action, and the descriptions actively disambiguate the risky pairs (delete_files vs delete_directories, create_directories vs write_files, sandbox_list_directory vs sandbox_search_files). Minor residual overlap between list_sandboxes and sandbox_list_directory, and between renew and create, but both are clarified in the text. An agent can select correctly without guessing.

    Naming Consistency4/5

    14 of 17 tools follow a clear sandbox_<verb>_<noun> pattern (sandbox_read_file, sandbox_move_files, sandbox_delete_directories). The lifecycle trio (list_sandboxes, create_sandbox, kill_sandbox) drops the prefix and inverts to verb_noun, which is a systematic but noticeable deviation. Still highly readable with no chaotic mixing.

    Tool Count4/5

    17 tools is at the upper edge of comfortable but each one maps to a real capability gap in a sandbox runtime: lifecycle, command execution/streaming, and file operations. Nothing looks like a redundant alias. Slightly heavy, but no obvious removal candidate.

    Completeness4/5

    Coverage is strong for the domain: create/list/renew/kill lifecycle, blocking and background command execution with status, cursor-based logs, and interrupt, plus a full file surface (read, write, replace, move, search, list, delete files and directories). Small gaps remain — no single-sandbox detail/inspect call, no host-to-sandbox upload/download, and no permission or attr operations — but agents can work around these via run_command.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers