[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-109760":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":17,"stars7d":18,"stars30d":19,"stars90d":16,"forks30d":16,"starsTrendScore":20,"compositeScore":21,"rankGlobal":10,"rankLanguage":10,"license":22,"archived":23,"fork":23,"defaultBranch":24,"hasWiki":25,"hasPages":25,"topics":26,"createdAt":10,"pushedAt":34,"updatedAt":35,"readmeContent":36,"aiSummary":37,"trendingCount":16,"starSnapshotCount":16,"syncStatus":17,"lastSyncTime":38,"discoverSource":39},109760,"sandbox-mcp","shanselman\u002Fsandbox-mcp","shanselman","Fresh, throwaway Windows machines for testing your apps: an MCP server and CLI that automate Windows Sandbox","https:\u002F\u002Fshanselman.github.io\u002Fsandbox-mcp\u002F",null,"JavaScript",497,26,4,1,0,2,62,315,10,78.29,"MIT License",false,"main",true,[27,28,29,30,31,32,33],"ai-agents","mcp","mcp-server","testing","ui-automation","windows","windows-sandbox","2026-11-15 22:34:43","2026-11-23 10:06:49","# sandbox-mcp\n\n## Give your AI agent a brand-new Windows PC. Then throw it away.\n\nNot your desktop. Not a container pretending to be Windows. **A real, disposable Windows 11 machine**:\nboot it, deploy your app, drive the controls, catch the crash, keep the evidence, delete the PC.\nRun it directly with `sbx`; the optional MCP adapter exposes discoverable tools and inline images for clients that want them.\nBoth interfaces use the same engine. The measured GUI samples take roughly **40-50 seconds** end to end.\nSee the [website](https:\u002F\u002Fshanselman.github.io\u002Fsandbox-mcp\u002F).\n\n![Real offline Sandbox: Haptics app UI Automation, light-to-dark theme, app exit and guest teardown](docs\u002Fsandbox-teaser.gif)\n\n*Real app, real guest: Haptics Everywhere's self-contained WPF\u002FWinForms desktop app in a fresh, network-off Sandbox.\nUIA selects the Inspector, the guest switches light to dark, the app relaunches and exits, then the guest is destroyed.\n10-second, 183 KB edited footage: light Inspector slowed for readability, repeated dark frames trimmed.\nBoot\u002Fteardown title cards summarize actual logs, not filmed boot\u002Fshutdown.\nNo guest runtime installation or haptic-hardware claim. [Fresh dark lab screenshot](docs\u002Fhaptics-teaser.png) ·\n[Earlier light-theme inspector](docs\u002Fhaptics-inspector.png).*\n\n### 🤖 Let your agent set it up\n\nGive this to your bot. It checks the PC, verifies the download and asks before admin changes or a restart.\nThe CLI works on its own; configure MCP only if your agent needs that interface:\n\n```text\nSet up the sandbox-mcp CLI by following:\nhttps:\u002F\u002Fraw.githubusercontent.com\u002Fshanselman\u002Fsandbox-mcp\u002Fmain\u002Fdocs\u002Fagent-setup.md\nInstall the latest verified release. The CLI must work without MCP; configure the optional MCP adapter only if my agent needs it. Ask before admin changes or a restart.\n```\n\n**[Download v1.2.0](https:\u002F\u002Fgithub.com\u002Fshanselman\u002Fsandbox-mcp\u002Freleases\u002Ftag\u002Fv1.2.0)**: portable CLI + optional MCP server,\nbundled Node.js, guest agent and setup instructions. No Node\u002Fnpm installation needed.\n\n### “Works on my machine.” Caught in 30 seconds.\n\nThe dev box had Visual C++ installed. The fresh, **network-off** customer PC did not:\n\n```text\nFAIL  NativeProof.exe on a fresh Windows Sandbox (29.8s)\n  why      exited with code -1073741515; Missing dependency: VC++ redistributable.\n```\n\nOpt in to the verified runtime install, then repeat on another fresh guest:\n\n```text\nPASS  NativeProof.exe on a fresh Windows Sandbox (30.9s)\n  baseline PROVISIONED (not a clean-machine pass): VC++ redistributable  x64\n  process  exited with code 0\n```\n\nThose are [actual measured results](docs\u002Fcompatibility.md#combined-feature-verification), not illustrative output.\nThe installer was Microsoft-signed **14.51.36247.0**, downloaded and verified on the host. Guest networking stayed\noff. `sbx deps app.exe` diagnoses; `sbx run app.exe --provision auto` installs **only when explicitly requested**.\n\n### What your agent gets\n\n| A clean customer PC | A real desktop to drive | Evidence that survives |\n|---|---|---|\n| Fresh on every boot; no implicit app-runtime installs | Native UIA: inspect, type, click, toggle, wait | PNGs, bounded recordings, self-contained HTML, optional MP4 |\n| Dependency diagnosis; explicit verified provisioning | WinUI, WPF, WinForms, Win32; MSIX\u002FAUMID activation | Process state, exit codes, crash events, reports |\n| Network **off \u002F firewall \u002F on** | CLI + MCP share state; verified warm incremental deploy | Installer\u002Funinstaller diffs; detonation observations |\n\nSame clean-machine loop, different frameworks:\n\n| WinUI 3, packaged | WPF, self-contained | Native Win32, packaged |\n|---|---|---|\n| ![WinUI greeting and counter after final integrated MCP test](docs\u002Fintegration-winui-msix.png) | ![WPF greeting after final integrated UIA test](docs\u002Fintegration-wpf.png) | ![Native Win32 greeting after UIA](docs\u002Fcompatibility\u002Fnative-msix.png) |\n\nThese are real offline-guest screenshots, not host mockups. WinUI\u002FWPF were refreshed against the final integrated\nsource; the full matrix covers seven configurations. Exact builds, timings, startup defects\nfound and remaining coverage gaps are in the [compatibility evidence](docs\u002Fcompatibility.md).\n\n[Download\u002Fsetup](#download-and-try-it-no-nodejs-install) · [Agent setup guide](docs\u002Fagent-setup.md) ·\n[Measured compatibility and honest limits](docs\u002Fcompatibility.md) · [CLI and MCP interfaces](#one-engine-two-interfaces)\n\n\u003Cdetails>\n\u003Csummary>See a fresh, recorded UI Automation session\u003C\u002Fsummary>\n\n![UI Automation changes real WinUI controls inside a network-off Sandbox](docs\u002Fsandbox-in-action.gif)\n\nThis 138 KB animation comes from a new 74-frame guest recording: UIA changes the text, invokes buttons and\nincrements the counter. The guest was stopped afterward; the HTML viewer, MP4 and frames remained on the host.\nNo synthetic screenshots. This small fixture proves the automation path; the rich app above shows the real-app use case.\n\n\u003C\u002Fdetails>\n\n## Why\n\n**A Windows Sandbox showcase, not a framework gate.** WinUI 3 is welcome, but the entry point is a Windows\nexecutable or package, not a particular UI framework. Bring an app that can run in Sandbox and its prerequisites:\nWin32, WinForms, WPF, WinUI, console, PyInstaller or Electron builds use the same clean-machine workflow.\nInstallers and untrusted files have their own audit\u002Fdetonation workflows. This is not a promise that every\nWindows app or hardware-dependent workload works in Sandbox. See the [measured compatibility matrix](docs\u002Fcompatibility.md)\nand [small source samples](samples\u002FREADME.md) in this matching checkout for the configurations actually exercised.\n\n[winapp CLI's Sandbox execution](https:\u002F\u002Fgithub.com\u002Fmicrosoft\u002FwinappCli\u002Fblob\u002F5f379fb55517b7a47f9aad11885a7c1676dcca2e\u002Fdocs\u002Fsandbox-execution.md)\nalso supports packaged and unpackaged apps: its `--on sandbox` offers a warm, identity-aware developer loop,\nruntime preparation and WinUI diagnostics. sandbox-mcp emphasizes **fresh-by-default clean-machine reports**,\nnetwork-off shared-folder mailbox transport, installer\u002Funinstaller diffs and detonation. The tools have\noverlapping app support but different defaults and goals; sandbox-mcp never implicitly installs app prerequisites.\nInbox Framework\u002FCBS components can exist, but are not proof that an app's requested runtime is available.\n\n\"It works on my machine\" is usually true: your machine has every runtime, SDK, redistributable, font, registry key\nand PATH entry you ever installed. Your users' machines don't. Windows Sandbox is a pristine Windows that boots in\nseconds and is **deleted** when it closes, which makes it the perfect \"brand-new customer PC\". Its supported `wsb`\nCLI provides automation; sandbox-mcp adds orchestrated app deployment, UI Automation, clean-machine checks and\ndurable test evidence around it.\n\n|                              | sandbox-mcp (Windows Sandbox)       | Hyper-V \u002F VMware VM        | Windows containers           | Cloud dev VMs (devvm, Codespaces, Dev Box) |\n|------------------------------|-------------------------------------|----------------------------|------------------------------|--------------------------------------------|\n| Real Windows desktop + GUI   | ✅                                  | ✅                         | ❌ no desktop                 | Linux mostly \u002F ✅ (Dev Box)                 |\n| Clean state every run        | ✅ always, by design                | snapshots to manage        | ✅                            | ❌ persistent                               |\n| Startup                      | ~15 s                               | minutes                    | seconds                      | minutes                                    |\n| Images to build or download  | none (uses your installed Windows)  | a 20+ GB VHD               | multi-GB base images         | none, but it's someone else's computer     |\n| Cost                         | free with Windows Pro\u002FEnterprise    | free-ish + disk            | free                         | 💸                                          |\n| Runs offline \u002F local         | ✅                                  | ✅                         | ✅                            | ❌                                          |\n| Parallel instances           | ❌ one at a time                    | ✅                         | ✅                            | ✅                                          |\n| Persistent environment       | ❌                                  | ✅                         | via volumes                  | ✅                                          |\n\nIf you need many machines, persistence, or Linux, use a VM or a cloud box. If you want to know *\"does my Windows app\ninstall, launch and work on a clean PC, and what does it look like?\"* as quickly and cheaply as possible, this is it.\n\n## What you can do\n\n`sbx deps \u003Capp.exe|folder>` (MCP: `sandbox_deps`) inspects dependencies on the host without running or installing\nanything: PE architecture\u002Fimports, app-local VC++ DLLs, .NET runtime configs, .NET Framework configs, package\ndependencies and script interpreters. `sbx run` includes this diagnosis in its report and names likely missing\nruntimes after a failed launch. This is a conservative static scan, not proof that every dynamic dependency is\npresent. Optional guest components such as WebView2 must be checked in the actual guest.\n\nThe default never installs dependencies. To **explicitly opt in**, use `sbx run \u003Capp> --provision auto`\n(`sandbox_run` parameter `provision: \"auto\"`), or specify a comma-separated list such as\n`--provision desktop:10.0:x64,vcredist:x64`. Supported components: `dotnet:\u003Cversion>:\u003Carch>`,\n`desktop:\u003Cversion>:\u003Carch>`, `aspnetcore:\u003Cversion>:\u003Carch>`, `vcredist:\u003Carch>` and\n`windows-app-runtime:\u003Cmajor.minor>:\u003Carch>`. Architecture is `x86`, `x64` or `arm64` (explicit lists default\nto x64). `sbx provision \u003Chost app path> --provision \u003Cauto|list>` \u002F `sandbox_provision` does the same in\nan already-started sandbox; it never starts or adopts a guest. Unknown versions\u002Farchitectures or unsupported\nauto-provision requests fail explicitly; Java and Python require application-specific setup.\n\nDownloads happen on the **host**, are cached under the sandbox-mcp home `cache\\redistributables` folder,\nverified with published SHA-512 hashes for .NET and a valid Microsoft Authenticode signature for every\ninstaller, then copied in and installed silently. Guest networking can stay **off**. A cached installer\nis reverified before reuse; remove its specific cache file to refresh a mutable VC++\u002FWindows App Runtime\ndownload. Reports record the requested provisioning, completed installs, source and verification details\nand say **PROVISIONED (not a clean-machine test)**. A provisioned pass never means the original clean machine\nhad those runtimes. .NET resolution conservatively stays within the requested major\u002Fminor channel and\nhonors exact-version requests (`rollForward: Disable` \u002F `applyPatches: false`) rather than silently changing\nthe app configuration. A reboot-required installer result fails the run.\nStep-by-step provisioning also writes `provisioning.json` in the run folder and marks `sbx status` \u002F\n`sandbox_status`, so switching clients does not lose the non-clean-machine provenance. This records explicit\nprovisioning only, not arbitrary installers a user runs with `exec`. For a live regression, publish a small\nframework-dependent .NET desktop app and run `node test\\deps-offline.js \u003Cpublish folder>` with exclusive use\nof Windows Sandbox. The observed optional-component baseline for build 26100.9882 is recorded in\n`test\\fixtures\\sandbox-26100.9882.json`; it is evidence for that build, not a promise about future guest images.\n\n- **Clean-machine smoke tests:** does the exe even start without the VC++ runtime \u002F .NET runtime \u002F WebView2 you\n  forgot to bundle? `sbx run` tells you, with a screenshot and the crash events.\n- **Test installers and uninstallers:** `sbx install-test setup.msi` installs on a clean machine, uninstalls, and\n  reports every file, registry key, service, scheduled task and autorun the installer added and the uninstaller\n  forgot. Hung installers waiting on a hidden dialog get screenshotted instead of hanging your CI.\n- **Drive the UI with UI Automation, not pixels:** read the control tree (`Button \"Save\" #SaveButton {invoke}`),\n  set text, click, toggle, select, wait for results. Works for WinForms, WPF, Win32 and WinUI apps, and things like\n  File Explorer. Screenshots, mouse and keyboard are there for everything else.\n- **Let an agent close the loop:** \"build it, test it on a clean machine, look at the screenshot, fix it, repeat\",\n  without the agent touching your real desktop.\n- **Run things with no network at all:** `--network off` boots the sandbox with no network adapter. Control still\n  works (through a shared folder), so you can watch an app's offline behavior or open something you don't trust.\n- **See what a file you don't trust actually does:** `sbx detonate invoice.js` runs it in a sandbox with no network\n  and reports every process it started (with command lines), the names it looked up, the addresses it tried, and the\n  autoruns, scheduled tasks, services and files it planted. Then the whole machine is deleted.\n- **Collect evidence:** every run keeps screenshots, copied-out files, a markdown report and an audit log on the\n  host after the sandbox is gone.\n\n## Download and try it (no Node.js install)\n\nDownload the **Windows x64 portable ZIP** from the [latest GitHub release](https:\u002F\u002Fgithub.com\u002Fshanselman\u002Fsandbox-mcp\u002Freleases\u002Flatest)\nand extract it. The ZIP includes `sbx`, the MCP server, their dependencies, the guest agent and skills, and a private\nNode.js runtime. You do not need to clone the repo, install Node\u002Fnpm, or add anything to PATH.\nUse `sbx.cmd` directly for CLI-only operation; you do not need an MCP client, server configuration or plugin.\nThe package is built and tested on native Windows x64; ARM64 is not currently packaged.\n\nVerify the ZIP against its adjacent `.sha256` file before extracting; the [agent setup guide](docs\u002Fagent-setup.md)\ndoes that automatically and preserves existing client configuration.\n\nOpen PowerShell in the extracted folder and start with the read-only readiness check:\n\n```powershell\n.\\sbx.cmd doctor\n```\n\n`doctor` explains what is missing and how to fix it. It never enables Windows features, elevates, changes PATH, or\nrestarts the PC for you. Windows Sandbox is only available on Windows Pro, Enterprise or Education; Windows Home\nand Windows Server cannot run it.\n\nIf the Sandbox feature is off, open **an administrator PowerShell**, run the command below, then restart Windows:\n\n```powershell\nEnable-WindowsOptionalFeature -Online -FeatureName Containers-DisposableClientVM -All\n```\n\nAfter restarting, open **Windows Sandbox from the Start menu once**, then close it. This updates Sandbox and installs\nthe `wsb` command-line tool that `sbx` uses. Run the check again and try a built-in Windows app:\n\n```powershell\n.\\sbx.cmd doctor\n.\\sbx.cmd run C:\\Windows\\System32\\charmap.exe --open\n```\n\nA passing run leaves `report.md`, `report.json`, screenshots and `audit.jsonl` under\n`%LOCALAPPDATA%\\sandbox-mcp\\runs\\\u003Ctimestamp>` (`out` contains the report and media), even after teardown.\n`--open` opens the report. Add `--record` for a self-contained viewer under\n`out\\recordings\\\u003CrecordingId>\\recording.html` and MP4 when host ffmpeg is available. `SANDBOX_MCP_HOME`\nchanges the artifact root. No ffmpeg or app runtime is silently installed.\n\nFor an MCP client, configure its stdio server with the full paths to the bundled runtime and server. Replace the\nexample folder with the location where you extracted the ZIP:\n\n```json\n{\n  \"servers\": {\n    \"windows-sandbox\": {\n      \"type\": \"stdio\",\n      \"command\": \"C:\\\\Users\\\\you\\\\Downloads\\\\sandbox-mcp\\\\node.exe\",\n      \"args\": [\"C:\\\\Users\\\\you\\\\Downloads\\\\sandbox-mcp\\\\src\\\\server.js\"]\n    }\n  }\n}\n```\n\nThat is the VS Code `.vscode\\mcp.json` shape. For GitHub Copilot CLI's\n`%USERPROFILE%\\.copilot\\mcp-config.json`, use:\n\n```json\n{\n  \"mcpServers\": {\n    \"windows-sandbox\": {\n      \"type\": \"local\",\n      \"command\": \"C:\\\\Users\\\\you\\\\Downloads\\\\sandbox-mcp\\\\node.exe\",\n      \"args\": [\"C:\\\\Users\\\\you\\\\Downloads\\\\sandbox-mcp\\\\src\\\\server.js\"],\n      \"tools\": [\"*\"]\n    }\n  }\n}\n```\n\nFor Claude Desktop, use `\"mcpServers\"` with the same command\u002Fargs and omit `type` and `tools`.\nRestart or reload the client's server configuration, then ask it to run Character Map in a fresh offline Sandbox\nand return the report and screenshot. The server writes logs to stderr; stdout is reserved for MCP messages.\n\n## Turn on Windows Sandbox\n\nIf you have Windows Pro, Enterprise or Education, you already own one of the best tools in Windows and it's probably\nswitched off. [Windows Sandbox](https:\u002F\u002Flearn.microsoft.com\u002Fwindows\u002Fsecurity\u002Fapplication-security\u002Fapplication-isolation\u002Fwindows-sandbox\u002Fwindows-sandbox-overview)\nis a whole, real Windows desktop that:\n\n- **comes with Windows:** nothing to download, no VHD, no license key. It's built from the Windows you're running.\n- **is brand new every time:** it boots as clean as the day Windows was installed, in about 15 seconds.\n- **is thrown away when you close it:** guest files, registry keys and installed apps are deleted.\n  Explicitly shared output folders remain on the host as test evidence.\n- **is properly isolated:** it runs on its own kernel behind the Microsoft hypervisor (the same hardware\n  virtualization as Hyper-V), not just a separate user account.\n- **is light:** it shares memory and files with your PC where it safely can, and uses your GPU.\n\nTurn it on with one line in an **admin** PowerShell, then restart:\n\n```powershell\nEnable-WindowsOptionalFeature -Online -FeatureName Containers-DisposableClientVM -All\n```\n\n(Or *Turn Windows features on or off* > tick *Windows Sandbox*.) After the restart, **open Windows Sandbox from the\nStart menu once**. That updates it to the Store version, which includes the `wsb` command-line tool this project\ndrives. Then check everything with:\n\n```powershell\nsbx doctor\n```\n\n```text\n✅ Windows 11 Pro, build 26100\n✅ Windows Sandbox feature is on\n✅ Virtualization is on\n✅ wsb command-line tool: C:\\Users\\you\\AppData\\Local\\Microsoft\\WindowsApps\\wsb.exe (Windows Sandbox 0.8.107.0)\n✅ Node.js 22.11.0\n\nReady. Try: sbx run C:\\Windows\\System32\\charmap.exe --open\n```\n\nIf something's missing, `sbx doctor` says what and how to fix it, and every other command tells you the same thing\nif it can't reach Windows Sandbox. The full list of what you need:\n\n- Windows 11 24H2 (build 26100) or later, Pro \u002F Enterprise \u002F Education. Windows Sandbox isn't available on Home or Windows Server.\n- Virtualization turned on in your PC's UEFI\u002FBIOS (Intel VT-x or AMD-V). Most PCs ship with it on.\n- At least 4 GB of RAM (8 GB recommended), 2 CPU cores and 1 GB of free disk.\n- Running inside a VM? Turn on nested virtualization on the host first:\n  `Set-VMProcessor -VMName \u003Cname> -ExposeVirtualizationExtensions $true`.\n- The portable ZIP bundles Node.js for Windows x64. If installing from source, use Node.js 20+ (`winget install OpenJS.NodeJS.LTS`).\n\n## Install from source\n\nThe clone command below retrieves the public default branch. Check out `v1.2.0` to reproduce that release's\nsource and WinUI\u002FWPF samples exactly. Samples are not included in the portable ZIP.\n\n```powershell\ngit clone https:\u002F\u002Fgithub.com\u002Fshanselman\u002Fsandbox-mcp\ncd sandbox-mcp\nnpm ci --omit=dev\nnpm link            # puts `sbx` and `sandbox-mcp` on your PATH (or use `node src\u002Fcli.js`)\n\nsbx doctor                                         # is Windows Sandbox ready? (see above)\nsbx run C:\\Windows\\System32\\charmap.exe --open     # try it on something that exists everywhere\n```\n\nTry the included sample (needs nothing but Windows; it compiles with the .NET Framework's `csc.exe`):\n\n```powershell\n.\\samples\\HelloSandbox\\build.ps1\nsbx run .\\samples\\HelloSandbox\\bin --test .\\samples\\HelloSandbox\\test.ps1   # passes\nsbx run .\\samples\\HelloSandbox\\bin --args --crash                            # fails, and shows the crash\nsbx install-test .\\samples\\LeakyApp\\install.ps1                              # an installer whose uninstaller forgets things\nsbx detonate .\\samples\\Suspicious\\suspicious.ps1                             # a harmless script that acts like malware\n```\n\n### Use it from an agent (optional MCP)\n\nThe `sbx` CLI is fully usable without an MCP server. If your agent can run shell commands, use `sbx` (or\n`.\\sbx.cmd` from the portable ZIP) directly. Configure the MCP adapter only when the client benefits from\ndiscoverable tool schemas, structured tool results and inline screenshot images.\n\nFor source installs, use the same client-specific shapes above, replacing the bundled command with your\ninstalled Node executable. For example, VS Code (`.vscode\\mcp.json`):\n\n```json\n{\n  \"servers\": {\n    \"windows-sandbox\": {\n      \"type\": \"stdio\",\n      \"command\": \"node\",\n      \"args\": [\"C:\\\\path\\\\to\\\\sandbox-mcp\\\\src\\\\server.js\"]\n    }\n  }\n}\n```\n\nUse the Copilot CLI or Claude shape above for those clients; their top-level keys differ from VS Code.\nAn absolute Node path avoids differences between your terminal PATH and the MCP client's environment.\n\nThen ask: *\"Build the app, run it in a fresh Windows Sandbox, type my name in the box, click Greet and show me a\nscreenshot.\"*\n\nThere are also agent skills in [`skills\u002F`](skills) that teach agents each workflow: setup, clean-machine runs,\ninteractive UI testing, installer testing and detonating untrusted files. Copy the ones you want into your agent's\nskills folder (for example `~\u002F.copilot\u002Fskills\u002F`), or install the plugin below to get them all with the optional MCP adapter.\n\n### Install the agent plugin\n\nThe [agent plugin](docs\u002Fagent-plugin.md) bundles the MCP adapter and skills, so you don't need to clone anything\nor edit MCP configuration. It needs Node.js 20 or later. The plugin is optional if you use the CLI directly.\nWith GitHub Copilot CLI:\n\n```powershell\ncopilot plugin marketplace add shanselman\u002Fsandbox-mcp\ncopilot plugin install sandbox-mcp@sandbox-mcp\n```\n\nIn VS Code, add `shanselman\u002Fsandbox-mcp` as a marketplace in **Chat: Open Customizations**, or run\n**Chat: Install Plugin from Source**. See the [plugin guide](docs\u002Fagent-plugin.md) for details.\n\n## Fast inner loop\n\nStart once, then build and deploy repeatedly into that **warm** sandbox (any framework, no guest prerequisites\ninstalled implicitly):\n\n```powershell\nsbx start --network off\npowershell -File .\\samples\\HelloSandbox\\build.ps1\nsbx deploy .\\samples\\HelloSandbox\\bin C:\\apps\\HelloSandbox --launch HelloSandbox.exe --restart\nsbx shot --window \"Hello Sandbox\"\n# Edit, build, deploy --restart, screenshot again; when done:\nsbx stop\n```\n\n`deploy` transfers only added\u002Fchanged files through a fresh shared staging folder, removes deleted files, and verifies\nthe entire destination using SHA256. Its report includes added\u002Fchanged\u002Fremoved\u002Funchanged counts, bytes transferred,\nelapsed milliseconds and `verified: true`. `--restart` stops processes whose executable is under the destination before\napplying and requires `--launch` to relaunch the app; `--launch` alone launches after verification. Arguments use\n`--args \"...\"`. TCP and network-off shared-folder transport both work.\n\nUse a dedicated destination: **extra guest files there are deleted**. Links, junctions and reparse points are rejected.\nIf a build changes while staging, deployment fails with `build output changed during deploy; rerun` before touching the\ndestination. Apply\u002Fverification failures restore the previous touched files where possible; rollback failures explicitly\nidentify the retained guest backup. Stopped processes are not automatically restarted after a failed apply.\n`push` \u002F `sandbox_copy_in` still perform a full replacement. `run`, `install-test` and `detonate` still start fresh;\nincremental deployment never adopts an unrelated sandbox.\n\n## One engine, two interfaces\n\nThe `sbx` CLI and MCP server are two interfaces to the same implementation: both import and use `src\u002Fcore.js`,\nand the higher-level run, installer and detonation workflows are shared too. The CLI is the complete standalone\ninterface; MCP is an optional adapter for agents that benefit from discoverable tool schemas, structured results\nand inline screenshot images. They are not separate engines, and their names or output formats are not meant to\nbe identical.\n\nFor example, both forms run Character Map on a fresh offline guest, capture evidence and destroy the guest:\n\n```powershell\nsbx run C:\\Windows\\System32\\charmap.exe --network off\n```\n\nOr call MCP tool `sandbox_run` with these arguments:\n\n```json\n{\n  \"app\": \"C:\\\\Windows\\\\System32\\\\charmap.exe\",\n  \"network\": \"off\"\n}\n```\n\nThe supported workflows map across the interfaces:\n\n| Workflow | CLI | MCP adapter |\n|---|---|---|\n| Fresh app test | `sbx run` | `sandbox_run` |\n| Guest lifecycle and shared state | `sbx start`, `status`, `stop`, `desktop-release` | `sandbox_start`, `sandbox_status`, `sandbox_stop`, `sandbox_desktop_release` |\n| Commands, processes and files | `sbx exec`, `launch`, `proc`, `push`, `pull`, `deploy`, `errors` | `sandbox_exec`, `sandbox_launch`, `sandbox_process`, `sandbox_copy_in`, `sandbox_copy_out`, `sandbox_deploy`, `sandbox_app_errors` |\n| UI automation and capture | `sbx ui`, `ui wait`, `shot`, `windows`, `click`, `type` | `sandbox_ui_tree`, `sandbox_ui_action`, `sandbox_ui_wait`, `sandbox_screenshot`, `sandbox_windows`, `sandbox_click`, `sandbox_type` |\n| Recording | `sbx record start`, `record stop` | `sandbox_record_start`, `sandbox_record_stop` |\n| Dependencies and provisioning | `sbx deps`, `provision` | `sandbox_deps`, `sandbox_provision` |\n| Installer and untrusted-file tests | `sbx install-test`, `detonate` | `sandbox_install_test`, `sandbox_detonate` |\n| System snapshots | `sbx snapshot`, `diff` | `sandbox_snapshot`, `sandbox_diff` |\n\nUse the CLI's human-readable output and process exit codes in a shell; add `--json` for machine-readable output.\nThe MCP adapter presents schemas and structured results to compatible clients and can return screenshots inline.\n\n## MCP tools\n\n| Tool | What it does |\n|---|---|\n| `sandbox_deps` | Host-only conservative dependency diagnosis; does not execute or install the app. |\n| `sandbox_provision` | Explicit opt-in verified runtime installation into the current owned guest; persists non-clean provenance. |\n| `sandbox_run` | The whole loop in one call: boot, copy\u002Finstall, launch or run, observe, test script, collect, destroy, report. |\n| `sandbox_start` | Boot a fresh sandbox (`network`: on \u002F firewall \u002F off, `memoryMB`, `vGpu`). Waits for the agent and an interactive desktop; reports readiness timings. |\n| `sandbox_status` | Is one running, its id\u002FIP\u002Fnetwork mode, agent health and current interactive-desktop facts. |\n| `sandbox_desktop_release` | End this workflow's desktop turn immediately. |\n| `sandbox_stop` | Destroy it. Lists the artifacts left on the host. |\n| `sandbox_copy_in` | Copy a host file or folder in (default `C:\\apps\\\u003Cname>`). |\n| `sandbox_deploy` | Deploy a host directory into an already running sandbox, transfer only changes and verify hashes; optional launch\u002Frestart. |\n| `sandbox_copy_out` | Copy a sandbox file or folder out to the run's `out\\files`. |\n| `sandbox_exec` | Run a PowerShell (or `cmd`) command; returns stdout, stderr, exit code. |\n| `sandbox_launch` | Start an EXE or installed package AUMID; returns the app pid and main window. |\n| `sandbox_process` | Running? Exit code? Window title? |\n| `sandbox_windows` | Visible top-level windows with titles, pids and bounds. |\n| `sandbox_screenshot` | PNG of the desktop or one window, returned inline (and saved on the host), with its own `captureId`, bounds and scale. |\n| `sandbox_record_start` \u002F `sandbox_record_stop` | Bounded desktop recording: frames stream straight to the host share; stop publishes a self-contained HTML flipbook and MP4 if host ffmpeg is available. |\n| `sandbox_click` \u002F `sandbox_type` | Mouse and keyboard, in screenshot coordinates \u002F SendKeys syntax. Click accepts `captureId` (default latest); out-of-image points and moved\u002Fresized captured windows are rejected. |\n| `sandbox_ui_tree` | The UI Automation tree of a window: type, name, automation id, value, state, supported actions. |\n| `sandbox_ui_action` | Find a control by name \u002F automation id \u002F type and click, set a value, toggle, select, expand, read... |\n| `sandbox_ui_wait` | Wait for a control (a result, a dialog) to appear. |\n| `sandbox_app_errors` | Application event log errors: crashes, hangs, .NET unhandled exceptions. |\n| `sandbox_install_test` | The installer loop in one call: snapshot, install, snapshot, optional test, uninstall, snapshot, report what was added and left behind. |\n| `sandbox_detonate` | Run an untrusted file (no network by default) and report its processes, lookups, connections, persistence and changes. |\n| `sandbox_snapshot` | Record files, registry, services, autoruns and installed programs under a name. |\n| `sandbox_diff` | Compare two snapshots: what changed in between. |\n\n## CLI\n\n```text\nsbx run \u003Capp.exe|folder|app.msix> [--exe \u003Cname>] [--args \"\u003Cargs>\"] [--console] [--wait \u003Csec>]\n                         [--cert \u003Cfile.cer>] [--deps \u003Cfolder>] [--app-id \u003Cid>]\n                         [--record] [--provision \u003Cauto|list>]\n                         [--test \u003Cscript.ps1>] [--collect \u003Csandbox path>]... [--keep] [--open]\nsbx install-test \u003Csetup.msi|.exe|.ps1|.cmd> [--args \"\u002FS\"] [--uninstall auto|none|\"\u003Ccmd>\"]\n                         [--uninstall-args \"\u002FS\"] [--test \u003Cscript.ps1>] [--fail-on-leftovers] [--exclude \u003Cpath>]...\nsbx detonate \u003Cfile> [--args \"\u003Cargs>\"] [--network off|firewall|on] [--duration \u003Csec>] [--full] [--every \u003Csec>]\n\nsbx start [--network on|firewall|off] [--memory \u003CMB>] [--no-gpu] [--minimized]\nsbx deps \u003Chost app path>                   sbx provision \u003Chost app path> --provision \u003Cauto|list>\nsbx desktop-release\nsbx push \u003Chost path> [sandbox path]          sbx pull \u003Csandbox path> [name]\nsbx deploy \u003ChostDir> [guestDir] [--launch \u003Cexe>] [--args \"...\"] [--restart]\nsbx exec [--cmd] [--cwd \u003Cdir>] \u003Ccommand...>  sbx launch \u003Cexe|PackageFamilyName!AppId> [--args \"...\"]\nsbx shot [--window \u003Ctitle>|--pid \u003Cpid>]      sbx windows   sbx proc \u003Cpid>\nsbx record start [--fps 2 --duration 120]   sbx record stop\nsbx ui [tree] [--pid \u003Cpid>]                  sbx ui click --name Save\nsbx ui set --id NameBox --value Scott        sbx ui wait --name \"Saved\" --timeout 10\nsbx snapshot \u003Cname> [--exclude \u003Cpath>]...    sbx diff \u003Cfrom> \u003Cto>\nsbx click \u003Cx> \u003Cy>   sbx type \"text\" [--keys] sbx errors   sbx status   sbx stop\nsbx doctor                                   # can this PC run Windows Sandbox? how to fix it if not\nsbx mcp                                      # run the MCP server\n```\n\n`exec` treats the command and everything after it as raw guest input. Put CLI options first:\n`sbx exec --json --timeout 30 'Get-Date'`, not `sbx exec 'Get-Date' --json`.\n\nAdd `--json` to any command for machine-readable output. `sbx exec` and `sbx run` exit with meaningful codes, so they\ndrop straight into scripts. `sbx help` has the details.\n\nCLI and MCP processes share locked, atomically written state, including copy and mailbox sequence numbers.\nDesktop-changing operations (launch, click, type, UI actions and window-focusing screenshots) take cooperative\nFIFO turns; observing windows, UI trees, processes, status and executing commands does not reserve the desktop.\nAn MCP instance retains its turn for four idle seconds. Set `SANDBOX_MCP_WORKFLOW` to the same identifier across\nCLI commands to retain a multi-command turn too; anonymous CLI commands release immediately. End a turn with\n`sbx desktop-release` or `sandbox_desktop_release`. A contender waits at most 60 seconds, then reports\n`desktop busy: held by \u003Cowner>`. These are cooperative turns, not isolation: `exec` can itself start GUI programs.\n\nEach boot has an epoch and a verified agent identity (protocol version, agent version and SHA256 of staged\nagent files), included in `status --json`. A stale boot or incompatible protocol is refused: start a new sandbox.\nBoth TCP and offline mailbox messages use directional HKDF-SHA256 keys, AES-256-CBC encryption and\nHMAC-SHA256 authentication with counters, random IVs and timestamp\u002Freplay checks. The random transport key\nstays in the read-only agent share, never in `current.json`, command-line arguments or request\u002Fresponse messages.\nThis protects the transport, not against an administrator inside the guest: code there can read its agent share.\n\n## Packaged apps (MSIX and Appx)\n\n`sbx run` also accepts `.msix`, `.msixbundle`, `.appx` and `.appxbundle`. It copies the package into a\n**fresh** guest, installs it with `Add-AppxPackage`, resolves its manifest Application Id, and activates the\ninstalled AUMID. Screenshots, UI Automation, crash checks, test scripts and reports use the actual app process,\nnot the short-lived shell launcher.\n\n```powershell\nsbx run .\\build\\MyApp.msix --cert .\\build\\devcert.cer --network off --test .\\smoke.ps1\nsbx run .\\build\\MyApp.msixbundle --deps .\\build\\Dependencies\\x64 --app-id App --network off\n# Inside an already-running sbx session, activate an installed package:\nsbx launch 'MyApp_0123456789abc!App'\n```\n\n`--cert` explicitly trusts a public `.cer` in **the guest's** `LocalMachine\\TrustedPeople` store; it never\ninstalls a certificate on the host. Store-signed\u002Ftrusted packages do not need it. Provide offline framework\npackages in an adjacent `deps` folder, or choose another folder with `--deps`; every package in that folder is\npassed as a `DependencyPath`. Nothing is downloaded or preinstalled automatically. Select `--app-id` when\na manifest contains more than one application. Deployment failures include Windows' error and activity log\nwhen available. Package activation is GUI mode, not `--console`.\n\nThe equivalent `sandbox_run` inputs are `app`, `cert`, `deps` and `appId`. `sandbox_launch` accepts `aumid`\ninstead of `path`, and the CLI also recognizes `shell:AppsFolder\\PackageFamilyName!ApplicationId`.\nTests receive `$env:SBX_APP_AUMID` as well as the usual process\u002Fexecutable paths. Installed package directories\nare read-only: write test output to `$env:SBX_OUT` or an app-data directory, not `$env:SBX_APP_DIR`.\n\n## Recording and capture coordinates\n\nFor visual evidence across an entire session, use `sbx run \u003Capp> --record` (MCP: `sandbox_run` with\n`record: true`), or `sbx record start` \u002F `sbx record stop` for interactive work. Recording runs in a separate\nguest process, including while a long command is running. Defaults: 2 fps, 120 seconds; hard limits:\n5 fps, 300 seconds, 600 frames. `--max-frames` sets a smaller frame budget. Frames (up to 1280 pixels wide)\nand append-only `frames.jsonl` metadata go directly to `out\\recordings\\\u003Cid>`; partial evidence survives\na guest crash or timeout. Stop publishes `recording.html` with embedded images and playback controls,\nplus `recording.mp4` when ffmpeg is already on the host PATH. No guest installation or network is needed.\nMP4 uses the requested frame rate; the HTML player preserves captured timestamps. Neither format includes audio.\nThe run report links the artifacts. `sbx stop` also publishes any tracked recording before destroying the guest.\nOnly one recording can be reserved across CLI\u002FMCP clients. Tracking is bound to the boot epoch and recording ID;\nfailed publication retains recovery metadata so `sbx record stop` can retry without touching a replacement guest.\nRejected starts release a zero-frame reservation only after confirming that its recorder cannot still be active;\nuncertain starts retain tracking and report the error explicitly.\nGuest-returned screenshot filenames are checked as confined PNG leaf paths before host reads or cleanup.\nAfter a guest crash or abrupt MCP disconnect, `sbx record stop` can still publish the preserved partial evidence,\neven if `sbx status` already noticed the guest is gone. Truncated final recorder status is reported as partial,\nnot allowed to hide otherwise valid frames; malformed frame metadata is still rejected.\n\nStart verifies the Default input desktop, explorer shell, screen size and a successful capture before declaring\nready. Screenshot, click, type and UI actions reject locked\u002Fsecure desktops (including UAC) explicitly.\nScreenshot coordinates are pixels in the returned preview, not the full-resolution saved PNG.\nMCP clicks default to the latest screenshot; use `captureId` to select an earlier image. CLI clicks still default\nto raw screen pixels: use `--coordinates screenshot --capture-id \u003Cid>` for a preview. Captured windows that\nmove, resize, minimize or close must be captured again before clicking.\n\n## Test scripts\n\n`sbx run --test smoke.ps1` (or `sandbox_run` with `test`) runs your script **inside** the sandbox after the app\nstarts, with:\n\n- `$env:SBX_APP_PID`, `$env:SBX_APP_DIR`, `$env:SBX_OUT` (anything you write to `SBX_OUT` comes back to the host),\n- these commands already imported:\n\n```powershell\nGet-SbxUiTree [-ProcessId \u003Cpid>] [-WindowTitle \u003Ctitle>] [-Depth \u003Cn>]     # objects: type, name, automationId, value, actions...\nInvoke-SbxUi  -Action \u003Cclick|setvalue|toggle|select|expand|read|...> [-Name \u003Ctext>] [-AutomationId \u003Cid>]\n              [-ControlType \u003CButton|Edit|...>] [-Index \u003Cn>] [-Value \u003Ctext>] [-ProcessId \u003Cpid>]\nWait-SbxUi    [-Name \u003Ctext>] [-AutomationId \u003Cid>] [-ControlType \u003Ctype>] [-TimeoutSec \u003Cn>] [-ProcessId \u003Cpid>]\n```\n\nThrow, or exit non-zero, to fail the run. Example ([samples\u002FHelloSandbox\u002Ftest.ps1](samples\u002FHelloSandbox\u002Ftest.ps1)):\n\n```powershell\n$app = [int]$env:SBX_APP_PID\nInvoke-SbxUi -ProcessId $app -AutomationId NameBox -Action setvalue -Value 'Sandbox'\nInvoke-SbxUi -ProcessId $app -Name Greet -Action click\nWait-SbxUi   -ProcessId $app -Name 'Hello, Sandbox!' -TimeoutSec 5 | Out-Null\n```\n\n## Installer testing\n\nInstallers are the part of an app that only ever runs on clean machines, so they're the part you test least.\n`sbx install-test` takes a system snapshot of a fresh sandbox, runs your installer silently, snapshots again,\nuninstalls it the way Add\u002FRemove Programs would, snapshots a third time and diffs them:\n\n```text\n> sbx install-test .\\7z2501-x64.msi --offline\n\nPASS  7z2501-x64.msi on a fresh Windows Sandbox (117.5s)\n  install    exit 0 in 2.5s\n  added      7-Zip 25.01 (x64 edition); 111 files, 18 registry keys, 0 services, 0 autorun\u002Fenv values\n  uninstall  7-Zip 25.01 (x64 edition): exit 0 in 2.3s\n  leftovers  none, clean uninstall\n```\n\nThe report lists what was added (here: `C:\\Program Files\\7-Zip`, the Start menu folder, the shell extension\nCLSIDs and context-menu handlers, App Paths and the uninstall entry) and what's **left behind**. Try the included\ndeliberately sloppy installer, whose uninstaller only deletes its program folder:\n\n```text\n> sbx install-test .\\samples\\LeakyApp\\install.ps1\n\n## Left behind after uninstall\nServices:  added service LeakyUpdater \"Leaky App Updater\", automatic: \"C:\\Program Files\\LeakyApp\\updater.exe\"\nAutoruns:  added HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run\\LeakyUpdater\nFiles:     C:\\ProgramData\\LeakyApp\\   C:\\Users\\WDAGUtilityAccount\\AppData\\Roaming\\LeakyApp\\\n           C:\\Windows\\System32\\Tasks\\LeakyApp Daily Check\nRegistry:  HKLM\\SOFTWARE\\LeakyApp\n```\n\n- `.msi` files get `msiexec \u002Fi \u002Fqn \u002Fnorestart` with a verbose log (brought back, with its errors in the report).\n  For `.exe` installers pass the silent switch: `--args \u002FS` (NSIS), `\u002FVERYSILENT` (Inno), `--silent` (Squirrel).\n- The uninstall uses what the installer registered: `msiexec \u002Fx {ProductCode}`, else `QuietUninstallString`, else\n  `UninstallString` plus `--uninstall-args`. The run fails if the program is still in Add\u002FRemove Programs afterwards.\n- An installer that doesn't exit within `--timeout` is screenshotted (and its new windows' UI Automation tree\n  recorded) before it's killed. That's usually a \"silent\" install that's waiting for someone to click a dialog.\n- Processes the installer leaves running (tray apps, updaters) are listed and stopped before uninstalling.\n- `--test smoke.ps1` runs between install and uninstall with `$env:SBX_INSTALL_DIR` and `$env:SBX_PROGRAM`.\n- `--fail-on-leftovers` turns leftovers into a failure, for CI.\n- The snapshots skip the things Windows changes on its own (caches, telemetry, Defender, Windows Update, Start menu\n  and Explorer bookkeeping, Windows Installer's internal database), so a 30-second idle sandbox diffs to \"No changes\".\n  `--exclude` adds more.\n\nThe same snapshots are available step by step: `sbx snapshot before`, do anything, `sbx snapshot after`,\n`sbx diff before after` (or the `sandbox_snapshot` \u002F `sandbox_diff` tools).\n\n## Detonate: what does this file actually do?\n\nSomeone sent you `invoice.js`, a \"driver update\", a script from a forum. `sbx detonate` runs it the way a\ndouble-click would, in a fresh sandbox with **no network adapter**, with Windows' own auditing switched on, and\ntells you what it did:\n\n```text\n> sbx detonate .\\samples\\Suspicious\\suspicious.ps1 --network firewall\n\nsuspicious.ps1: 3 red flag(s) (watched 40s, network firewall)\n  findings   🔴 starts itself with Windows: added HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run\\ContosoUpdater =\n                powershell.exe -WindowStyle Hidden -ExecutionPolicy Bypass -File \"C:\\Users\\...\\ContosoUpdater\\updater.ps1\"\n             🔴 created a scheduled task: ContosoUpdate\n             🔴 put something in a Startup folder: C:\\Users\\...\\Start Menu\\Programs\\Startup\\contoso.cmd\n             🟠 wrote 2 runnable file(s): C:\\Users\\...\\ContosoUpdater\\updater.ps1, ...\\Startup\\contoso.cmd\n             🟠 ran built-in Windows tools that malware often uses: schtasks.exe, whoami.exe, ipconfig.exe, net.exe, net1.exe\n             🟠 looked up 1 internet name(s): c2.contoso-updates.example\n             🟠 tried to connect to 2 address(es): 198.51.100.7:4444, 203.0.113.10:80\n  processes  7 (powershell.exe → conhost.exe → schtasks.exe → whoami.exe → ipconfig.exe …)\n  network    1 name lookup(s), 2 connection attempt(s)\n  changed    4 files added, 0 changed, 2 registry keys, 1 autorun\u002Fenv values, 0 services\n```\n\n([samples\u002FSuspicious\u002Fsuspicious.ps1](samples\u002FSuspicious\u002Fsuspicious.ps1) is harmless; it just behaves like\nsomething that isn't.) The report also has a timeline:\n\n```text\n  +0.0s  start    powershell.exe (pid 8180)  ... -File \"C:\\Users\\WDAGUtilityAccount\\Downloads\\suspicious.ps1\"\n  +1.5s  start    schtasks.exe (pid 7848)  \u002FCreate \u002FF \u002FTN ContosoUpdate \u002FSC ONLOGON \u002FTR \"powershell.exe -WindowStyle Hidden ...\"\n  +1.6s  start    whoami.exe (pid 7616)  \u002Fall\n  +1.7s  start    net.exe (pid 9064)  user\n  +1.7s  start    net1.exe (pid 8096)  C:\\Windows\\system32\\net1 user\n +15.0s  lookup   c2.contoso-updates.example (failed)\n +15.1s  connect  203.0.113.10:80\u002FTCP blocked (powershell.exe)\n +15.2s  connect  198.51.100.7:4444\u002FTCP blocked (powershell.exe)\n```\n\nplus the process tree, a before\u002Fafter diff of files, registry, services and autoruns, the windows it opened,\nscreenshots, and \"everything else that happened\" (usually Windows itself, kept separate rather than hidden).\n\n- **How:** process creation auditing with command lines (Security 4688), Windows Filtering Platform connection\n  auditing (5156\u002F5157) and the DNS client log, collected from inside the guest, plus the same snapshots as\n  `install-test`. Activity is attributed to the file's own process tree, so the agent's own work isn't mixed in.\n- **Network:** `off` (default) has no adapter at all. Name lookups are still recorded, but nothing leaves the\n  machine. `--network firewall` also shows the IP addresses and ports it tries, blocked by the guest firewall.\n  `on` gives it the internet; only use that for things you're prepared to let talk to the world.\n- **Runs:** `.exe`, `.msi` (silently), `.ps1`, `.cmd`, `.bat`, `.js`\u002F`.jse`\u002F`.vbs`\u002F`.vbe`\u002F`.wsf` (with `wscript`) and\n  `.hta` (with `mshta`), from the user's Downloads folder.\n- **Watching:** up to `--duration` seconds (60), stopping early once everything it started has exited, unless\n  `--full`. A screenshot every `--every` seconds (15).\n- **Findings are heuristics, not a verdict.** Installers add autoruns and services too. Exit code 0 means \"it was\n  observed\", not \"it's safe\". This is a quick first look on your own PC, not a malware lab: something that checks\n  whether it's in a sandbox can just behave nicely.\n\n## Network modes\n\n| Mode | How | Use it for |\n|---|---|---|\n| `on` (default) | Normal NAT networking. | Apps that need the internet, downloading prerequisites. |\n| `firewall` | Guest firewall blocks all outbound traffic (DNS included); only the control channel from the host is allowed. | Testing offline behavior quickly. Admin code in the guest *could* undo it. |\n| `off` | The sandbox has **no network adapter**. sandbox-mcp talks to it through a shared-folder mailbox (~100 ms per call). | Untrusted files (the default for `detonate`), and proving an app works with no network at all. |\n\nIn `firewall` and `off` mode, sandbox-mcp also switches off Smart App Control in the guest. It ships in evaluation\nmode and asks the cloud about every new exe and msi; with no internet each of those lookups hangs for about two\nminutes (a 2 MB MSI took 125 s to install instead of 1 s).\n\n## Security notes\n\n- Each sandbox is a separate Hyper-V-isolated kernel. It's thrown away on stop, together with everything that ran in it.\n- Hardened defaults: clipboard, printer, microphone and camera redirection are off, and *Protected Client* mode is on.\n- The host shares exactly three folders: the guest agent (read-only), a staging folder for files you copy in\n  (read-only) and an output folder (read-write). Nothing else from your disk is visible.\n- The control channel needs a random per-sandbox token. In `on`\u002F`firewall` mode it's TCP to the sandbox's private\n  NAT address; in `off` mode it's the shared folder.\n- `SANDBOX_MCP_ALLOWED_ROOTS` limits which host folders can be copied in (handy when an agent is driving).\n- Every operation is appended to `audit.jsonl` in the run folder.\n- When the MCP client disconnects, only the boot it started is destroyed, unless `SANDBOX_MCP_KEEP_ON_EXIT=1`.\n  A client joining a CLI-started guest does not own it. An idle watchdog shuts the guest down after 30 minutes\n  with no calls.\n- With `network: on` the guest has internet access like any other machine on your network's NAT. Use `off` for\n  anything you don't trust.\n- The `out` folder is writable from inside the sandbox, so treat what comes back (screenshots, pulled files, logs)\n  as untrusted, especially after `detonate`. sandbox-mcp reads data from it but never runs anything from it.\n- Windows Sandbox is strong isolation, but not a guarantee: a hypervisor or Windows Sandbox escape would be a\n  zero-day. For real malware analysis use a dedicated, disposable analysis machine.\n\n## Configuration\n\n| Environment variable | Default | |\n|---|---|---|\n| `SANDBOX_MCP_HOME` | `%LOCALAPPDATA%\\sandbox-mcp` | Where runs, screenshots and reports are kept. |\n| `SANDBOX_MCP_ALLOWED_ROOTS` | (any) | `;`-separated host folders that may be copied into the sandbox. |\n| `SANDBOX_MCP_IDLE_MINUTES` | `30` | Guest shuts itself down after this long with no calls. `0` disables. |\n| `SANDBOX_MCP_KEEP_ON_EXIT` | (unset) | Set to `1` to leave the sandbox running when the MCP client disconnects. |\n\n## How it works\n\nSince Windows 11 24H2 the Store version of Windows Sandbox ships the supported `wsb.exe` CLI\n(`start \u002F stop \u002F list \u002F ip \u002F exec \u002F share \u002F connect`), but `wsb exec` returns only an exit code: no output, no\nscreenshots, no UI. So:\n\n1. The host creates a run folder and calls `wsb start` with a hardened config (and `\u003CNetworking>Disable` in `off` mode).\n2. It shares the guest agent folder and starts [`agent\u002Fagent.ps1`](agent\u002Fagent.ps1) inside with `wsb exec`, in the\n   interactive user session (it needs a desktop for windows and screenshots).\n3. The agent is a small PowerShell server: exec with real output, file copy, process launch, screenshots, mouse and\n   keyboard, window list, event log, and UI Automation through [`agent\u002Fuia.cs`](agent\u002Fuia.cs). That uses *native* UI\n   Automation (the managed `System.Windows.Automation` can't see inside WinForms apps), with an interop assembly\n   generated on the fly from the OS type library, so nothing needs installing.\n4. With the network on, the host talks to it over TCP. In `off` mode it uses a mailbox in the shared folders.\n   (The guest caches \"file not found\" for ~5 s, so the host bumps a sequence file the guest polls, bringing a round\n   trip from 5 s down to ~100 ms.)\n5. `wsb stop` destroys the VM. The run folder stays on the host.\n\n## Limits\n\n- **One sandbox at a time.** That's a Windows Sandbox rule. `sbx run` calls queue nothing; they fail fast if one is running.\n- Every boot is pristine. Bundle app-local prerequisites or explicitly opt in to provisioning for each fresh guest;\n  automatic runtime installation is never the default.\n- No Microsoft Store apps, winget, Notepad, Calculator or Windows Terminal inside. Windows PowerShell 5.1 and\n  .NET Framework 4.8 are there.\n- The first UI Automation call in a sandbox takes ~4 s (it generates the interop); later calls are fast.\n- A system snapshot takes 10-20 s (about 11k files, 340k registry keys, 700 services), so `install-test` takes\n  roughly two minutes plus your installer's own time.\n- The guest desktop gets a plain background so screenshots stay around 100 KB instead of 16 MB.\n- Needs a logged-in Windows session on the host (Windows Sandbox is a desktop feature).\n\n## Verifying changes locally\n\n`npm test` checks the host logic and parses\u002Fcompiles the guest PowerShell and C# helpers without booting a guest.\nReal desktop verification requires this Windows host's single Sandbox slot; coordinate with other users first\nand never stop somebody else's guest.\n\n```powershell\n$env:SANDBOX_MCP_HOME = Join-Path $PWD 'work\\integration'\nnode test\\integration.js off\nnode test\\integration.js on\nnode test\\integration.js firewall\nnode test\\evidence.js\nnpm run package:win\nnode test\\package-smoke.js dist\\sandbox-mcp-win-x64-v1.2.0.zip\n```\n\nThe integration harness drives the actual MCP stdio server and CLI against the same fresh guest, verifies UIA,\ncopies evidence back, and fails if its guest cannot be torn down. JSON results are saved beneath\n`$env:SANDBOX_MCP_HOME\\integration`. The package smoke test extracts the ZIP, removes host Node from PATH, checks\nCLI\u002FMCP initialization and command surfaces, and compares every shipped source, agent and skill file with the\nworking tree. It does not boot a Sandbox and is not a substitute for the live tests.\n\n`node test\\agent-setup.js --download` follows the stable-download checksum\u002Fdoctor instructions in a temporary\nhome, tests all three JSON client destinations on PowerShell 5.1\u002F7, checks native `copilot mcp add` with isolated\n`COPILOT_HOME`, and requires an actual MCP `sandbox_status` response. It needs the installed Copilot CLI for\nthe native-command check. Use `--portable=\u003Cextracted-path>` for an already downloaded package, or `--candidate`\nto exercise the explicitly optional developer-preview discovery instructions.\n\nFor a live extracted-package check, run the integration harness with the extracted `node.exe` and set\n`SANDBOX_MCP_TEST_ROOT` to the extracted folder. `SANDBOX_MCP_TEST_SHA` records the source commit when Git is not on\nthe isolated PATH. Set `SANDBOX_MCP_EXPECT_NO_HOST_NODE=1` to require both the bundled runtime and no `node` on PATH;\nkeep Windows system directories and the WindowsApps `wsb.exe` alias on PATH.\n\n## Related projects\n\n- [fmuecke\u002Fwindows-sandbox-mcp](https:\u002F\u002Fgithub.com\u002Ffmuecke\u002Fwindows-sandbox-mcp) is another MCP server for Windows\n  Sandbox, focused on running agent-generated code safely and with `Networking Disable` by default. Its ideas\n  (true offline by default, stop on disconnect, an idle watchdog, an audit log, allowed folders) shaped this\n  project. sandbox-mcp leans the other way: testing *your* app on a clean machine, with UI Automation, screenshots\n  and one-shot reports.\n- [devvm.dev](https:\u002F\u002Fdevvm.dev\u002F): disposable cloud dev machines for agents. The inspiration for \"just give the agent a fresh box\".\n\n## License\n\n[MIT](LICENSE)\n","sandbox-mcp 是一个面向 Windows 应用测试的自动化工具，通过 Windows Sandbox 创建真实、隔离、一次性使用的 Windows 11 虚拟环境。它提供 CLI（`sbx`）和可选的 MCP（Model Context Protocol）服务接口，支持程序化启动沙盒、部署应用、执行 UI 自动化（基于 UIA）、捕获崩溃证据并自动清理。核心特点包括离线网络策略、依赖验证与按需安装（如 VC++ 运行库）、端到端耗时约 40–50 秒、无需预装 Node.js。适用于桌面应用兼容性验证、AI 代理驱动的 UI 测试、客户环境复现及回归测试等场景。","2026-11-24 04:37:23","CREATED_QUERY"]