
CodeSandbox
Connects to CodeSandbox cloud development environments, letting you create sandboxes, manage files, and control VM instances programmatically. Uses the official CodeSandbox SDK with stateless operations.
Provides stateless access to CodeSandbox SDK operations for creating, managing, and interacting with cloud-based development sandboxes through 13 tools covering VM lifecycle management, file system operations, and session handling with configurable tiers and hibernation settings.
What it does
- Create new sandboxes from templates or scratch
- Read and write files in sandbox environments
- Start, stop, and hibernate virtual machines
- Fork existing sandboxes to new projects
- Configure VM tiers and hibernation settings
- Execute shell commands in sandbox VMs
Best for
About CodeSandbox
CodeSandbox is a community-built MCP server published by techlibs that provides AI assistants with tools and capabilities via the Model Context Protocol. Access CodeSandbox SDK for cloud-based development sandboxes with VM management, session handling, and file operations like a cloud 9 editor. It is categorized under cloud infrastructure, developer tools.
How to install
You can install CodeSandbox in your AI client of choice. Use the install panel on this page to get one-click setup for Cursor, Claude Desktop, VS Code, and other MCP-compatible clients. This server runs locally on your machine via the stdio transport.
License
CodeSandbox is released under the MIT license. This is a permissive open-source license, meaning you can freely use, modify, and distribute the software.
CodeSandbox MCP Server
A Model Context Protocol (MCP) server that exposes CodeSandbox SDK operations as tools for AI agents.
- Runtime: Node.js 18+
- Auth:
CODESANDBOX_API_TOKEN(orCSB_API_KEY) - SDK: Official
@codesandbox/sdk
Install / Run
Use via npx in your MCP client config.
Example (Cursor/Claude Desktop mcp.json snippet):
{
"mcpServers": {
"codesandbox": {
"command": "npx",
"args": [
"-y",
"@techlibs/codesandbox-mcp@latest",
"--read-only"
],
"env": {
"CODESANDBOX_API_TOKEN": "<your-api-token>"
}
}
}
}
CLI binary name: mcp-server-codesandbox
You can also run directly:
npx -y @techlibs/codesandbox-mcp@latest --help
Flags:
--read-only: disallow mutating tools (write/rename) and default sessions to read permission--vm-tier <tier>: default VM tier when creating/resuming--hibernation-timeout <seconds>: default inactivity hibernation timeout--keep-alive: keep sessions active while connected--log-level <error|warn|info|debug>
Tools (Stateless)
All tools are stateless: no server-managed session registry. Each call performs the SDK operation directly using only the provided arguments.
-
createSandbox- Description: Create a sandbox (optionally from template
id) and optionally start with custom VM settings. - Params:
privacy(public|private): Privacy of the sandbox.title(string): Optional title.description(string): Optional description.tags(string[]): Up to 10 tags.path(string): Destination folder path inside your workspace.id(string): Template sandbox ID to fork from.ipcountry(string): ISO 3166-1 alpha-2 country hint for VM scheduling.vmTier(string): VM tier (e.g. Pico, Nano, ...). Overrides server default.hibernationTimeoutSeconds(number): Inactivity timeout before VM hibernates.automaticWakeupConfig.http(boolean): Auto-wake on HTTP.automaticWakeupConfig.websocket(boolean): Auto-wake on WebSocket.
- Description: Create a sandbox (optionally from template
-
resumeSandbox- Description: Resume (or start) a sandbox VM.
- Params:
sandboxId(string): Target sandbox ID.
-
hibernateSandbox- Description: Hibernate a sandbox VM (saves and sleeps the VM).
- Params:
sandboxId(string): Target sandbox ID.
-
getSandboxInfo- Description: Get sandbox metadata without starting the VM.
- Params:
sandboxId(string): Sandbox ID to fetch.
-
updateSandbox- Description: Update VM settings for a running sandbox.
- Params:
sandboxId(string): Target sandbox ID.vmTier(string): Change VM tier (Pico|Nano|Micro|Small|Medium|Large|XLarge).hibernationTimeoutSeconds(number): Update inactivity hibernation timeout.
-
createSession- Description: Create a session for a sandbox (no state is stored server-side).
- Params:
sandboxId(string): Target sandbox ID.sessionId(string, optional): Provide a specific session ID; if omitted a UUID is generated.permission(read|write): Session permission. Usereadfor safe, non-mutating access.env(Record<string,string>, optional): Environment variables for the session.git(object, optional): Git identity/options for the session creation.provider(string): e.g. "github".username(string, optional)accessToken(string, optional)email(string)name(string, optional)
-
resumeSession- Description: Connect to an existing session by
sandboxId+sessionId. If the session does not exist, it will be created using the optional parameters. - Params:
sandboxId(string): Target sandbox ID.sessionId(string): Session identifier to connect to.permission(read|write, optional): Used if creating the session.env(Record<string,string>, optional): Used if creating the session.
- Description: Connect to an existing session by
-
readFile- Description: Read a file from the sandbox filesystem. The tool connects per call using
sandboxId+sessionId. - Params:
sandboxId(string): Target sandbox ID.sessionId(string): Session identifier (created if missing as needed).permission(read|write, optional): Used if creating the session.env(Record<string,string>, optional): Used if creating the session.path(string): Absolute path inside the sandbox filesystem.encoding(utf8|base64, optional): Encoding for the returned content (defaultutf8).
- Description: Read a file from the sandbox filesystem. The tool connects per call using
-
readdir- Description: List files and directories at a given path. The tool connects per call using
sandboxId+sessionId. - Params:
sandboxId(string): Target sandbox ID.sessionId(string): Session identifier (created if missing as needed).permission(read|write, optional): Used if creating the session (defaults toreadin read-only mode).env(Record<string,string>, optional): Used if creating the session.path(string): Absolute path to list within the sandbox filesystem.
- Description: List files and directories at a given path. The tool connects per call using
-
writeFile- Description: Write a file in the sandbox filesystem. The tool connects per call using
sandboxId+sessionId. - Params:
sandboxId(string): Target sandbox ID.sessionId(string): Session identifier (created if missing as needed). Must allow write.permission(read|write, optional): Used if creating the session (typicallywrite).env(Record<string,string>, optional): Used if creating the session.path(string): Absolute path to the file.content(string): Content to write (encoded perencoding).encoding(utf8|base64, optional): Content encoding (defaultutf8).overwrite(boolean, optional): Overwrite existing file (defaulttrue).create(boolean, optional): Create the file if missing (defaulttrue).
- Description: Write a file in the sandbox filesystem. The tool connects per call using
-
rename- Description: Rename/move a file or directory. The tool connects per call using
sandboxId+sessionId. - Params:
sandboxId(string): Target sandbox ID.sessionId(string): Session identifier (created if missing as needed). Must allow write.permission(read|write, optional): Used if creating the session (typicallywrite).env(Record<string,string>, optional): Used if creating the session.from(string): Source path.to(string): Destination path.overwrite(boolean, optional): Overwrite if destination exists (defaulttrue).
- Description: Rename/move a file or directory. The tool connects per call using
Notes:
- Filesystem operations connect a
SandboxClientfor the duration of the call and dispose it immediately; no state is retained. - Outputs are returned as text blocks (JSON payloads serialized to string) for broad client compatibility.
Development
- Build:
npm run build - Dev (stdio):
npm run dev(requires token env var)
Environment
CODESANDBOX_API_TOKEN(preferred) orCSB_API_KEY: PAT with scopes for Sandbox Creation, Read/Edit, VM Manage, Preview Token Manage.
Limitations
- This server targets CodeSandbox sandboxes (VMs), not legacy projects.
- Session resume uses
sandbox.connect({ id: sessionId }).
Alternatives
Related Skills
Browse all skillsExpert Kubernetes architect specializing in cloud-native infrastructure, advanced GitOps workflows (ArgoCD/Flux), and enterprise container orchestration. Masters EKS/AKS/GKE, service mesh (Istio/Linkerd), progressive delivery, multi-tenancy, and platform engineering. Handles security, observability, cost optimization, and developer experience. Use PROACTIVELY for K8s architecture, GitOps implementation, or cloud-native platform design.
Build comprehensive ML pipelines, experiment tracking, and model registries with MLflow, Kubeflow, and modern MLOps tools. Implements automated training, deployment, and monitoring across cloud platforms. Use PROACTIVELY for ML infrastructure, experiment management, or pipeline automation.
Expert C# developer specializing in modern .NET development, ASP.NET Core, and cloud-native applications. Masters C# 12 features, Blazor, and cross-platform development with emphasis on performance and clean architecture.
UI design system toolkit for Senior UI Designer including design token generation, component documentation, responsive design calculations, and developer handoff tools. Use for creating design systems, maintaining visual consistency, and facilitating design-dev collaboration.
Comprehensive Cloudflare platform skill covering Workers, Pages, storage (KV, D1, R2), AI (Workers AI, Vectorize, Agents SDK), networking (Tunnel, Spectrum), security (WAF, DDoS), and infrastructure-as-code (Terraform, Pulumi). Use for any Cloudflare development task.
Answer questions about the AI SDK and help build AI-powered features. Use when developers: (1) Ask about AI SDK functions like generateText, streamText, ToolLoopAgent, embed, or tools, (2) Want to build AI agents, chatbots, RAG systems, or text generation features, (3) Have questions about AI providers (OpenAI, Anthropic, Google, etc.), streaming, tool calling, structured output, or embeddings, (4) Use React hooks like useChat or useCompletion. Triggers on: "AI SDK", "Vercel AI SDK", "generateText", "streamText", "add AI to my app", "build an agent", "tool calling", "structured output", "useChat".