CodeSandbox

Exposes CodeSandbox SDK operations as stateless MCP tools to manage sandboxes, sessions, and files.
  • typescript

10

GitHub Stars

typescript

Language

6 months ago

First Indexed

2 months ago

Catalog Refreshed

Documentation & install

Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.

Installation

Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "techlibs-codesandbox-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "@techlibs/codesandbox-mcp@latest",
        "--read-only"
      ],
      "env": {
        "CSB_API_KEY": "your-alt-token",
        "CODESANDBOX_API_TOKEN": "<your-api-token>"
      }
    }
  }
}

CodeSandbox MCP Server exposes CodeSandbox SDK operations as stateless tools that you can call from any MCP client. It lets you create and manage sandboxes, sessions, and filesystem interactions directly via MCP, using the official CodeSandbox SDK under Node.js 18+ and a simple token-based authentication flow.

How to use

You integrate this MCP server into your MCP client and call its tools to create, manage, and interact with CodeSandbox sandboxes and their files. Every operation connects to CodeSandbox, performs the requested SDK action, and then immediately disposes the connection. You can control access and VM behavior through the server’s options and per-call parameters.

How to install

Prerequisites: You need Node.js 18.x or newer installed on your system to run MCP servers locally.

Install and run the MCP server using the following configuration in your MCP client. The server runs as a stdio process started with npx and exposes the codesandbox MCP under the name codesandbox.

{
  "mcpServers": {
    "codesandbox": {
      "command": "npx",
      "args": [
        "-y",
        "@techlibs/codesandbox-mcp@latest",
        "--read-only"
      ],
      "env": {
        "CODESANDBOX_API_TOKEN": "<your-api-token>"
      }
    }
  }
}

Notes on configuration and usage

Authentication uses a personal access token with the scope to manage sandboxes, VM access, and related actions. Provide your token in the env for the codesandbox mcp server configuration.

You can also run the MCP server directly to see available flags and help information by executing the CLI command displayed in the server’s documentation.

Security and behavior notes

  • Tools are stateless: every call creates the necessary context, performs the operation, and then releases resources. No server-side session state is retained between calls.

  • The server operates with read-only by default when used in read-only mode. You can override permissions per call where supported.

Limitations

This MCP server targets CodeSandbox sandboxes and their VM lifecycle. It does not apply to legacy projects outside the CodeSandbox VM scope.

Available tools

createSandbox

Create a new sandbox, optionally based on a template, with customizable privacy, title, description, tags, and VM settings.

resumeSandbox

Resume or start a sandbox VM by sandboxId.

hibernateSandbox

Hibernate a sandbox VM to save state and sleep the VM.

getSandboxInfo

Fetch sandbox metadata without starting the VM.

updateSandbox

Update VM settings for a running sandbox, such as VM tier and hibernation timeout.

createSession

Create a session for a sandbox with optional sessionId, permission, environment, and Git identity for the session.

resumeSession

Connect to an existing session by sandboxId and sessionId, or create it with optional parameters.

readFile

Read a file from the sandbox filesystem using a per-call SandboxClient session.

readdir

List files and directories at a given path inside the sandbox filesystem.

writeFile

Write content to a file in the sandbox filesystem, with options for encoding, overwrite, and create.

rename

Rename or move a file or directory inside the sandbox filesystem.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational