sandkiln-mcp is a Model Context Protocol server over stdio. An MCP client (an AI agent host) launches it as a subprocess, and the agent then creates sandboxes, runs code, moves files and snapshots state through tools. It is built on the JS SDK and talks to the daemon’s HTTP API.
Client configuration
Tools
Resources:
sandkiln://sandboxes and sandkiln://status.
sandbox_exec runs the command directly, not through a shell; use command: "sh", args: ["-c", "..."] for pipes. A nonzero exit code is a normal result. Output past the cap keeps its head and tail with a marker between.
Errors
A failure is anisError result whose text is {"error": {"kind", "message", "status", "hint", "details"}}. kind is one of invalid_request, unauthorized, not_found, conflict, rate_limited, daemon_error, daemon_unreachable, timeout, limit_reached, internal; hint says what to try next.
Cleanup and safety
- Sandboxes the session created, resumed or forked are destroyed when the client disconnects or the server receives
SIGTERMorSIGINT.SIGKILLcannot be intercepted; those sandboxes stay until an operator removes them. - Snapshots are durable and outlive the session.
- The
sandbox_exectimeout is enforced inside the sandbox: on expiry the command and its child processes are killed and the call returns atimeouterror whosedetailshold the output captured so far, so nothing keeps running. Against a daemon or guest agent that predates this, the limit is not enforced in the guest. - Tools accept any sandbox id on the daemon, not only the session’s own. Use an auth token whenever the daemon is reachable by others, and pass
egress: "deny_all"for code that must stay offline.