Windows Sandbox MCP

io.github.fmuecke由 GitHub 账号 fmuecke 发布v1.0.0更新于 Nov 7, 2026

Run risky commands in a disposable, offline Windows Sandbox (Windows only, needs a one-time setup).

已验证STDIO仅桌面开发者工具安全与监控

概览

AI 生成的概览

在一次性、离线的 Windows 沙盒来宾中运行高风险命令,与主机其余部分隔离,仅限 Windows。

可以做什么
  • 启动全新的沙盒来宾,可选将输入文件夹以只读方式映射、输出文件夹以可写方式映射
  • 以来宾中的 system 或 user 身份(均为提权)执行命令,并从输出文件夹读取结果
  • 查看运行状态、沙盒 ID 和已映射的文件夹
  • 停止并丢弃来宾;断开连接、空闲超时或代理退出时也会自动停止
适用场景
适合需要执行不受信任或可能具有破坏性的命令、脚本或下载内容,又不希望影响主机时使用,前提是结果可通过映射的输入和输出文件夹交换。
运行要求
Windows 11 24H2 或更高版本并启用 Windows 沙盒;需要一次管理员安装与初始化;涉及两个账户:运行代理的交互用户账户,以及运行 MCP 代理进程的独立代理账户。发布版为自包含,无需 .NET。
安装前请注意
代理以交互用户权限运行,因此程序必须放在仅管理员或该用户可写的目录中,setup 与 serve 会拒绝不安全位置。命令在来宾中以提权方式运行,来宾无网络访问。同一时间只允许一个会话连接,停止、断开或空闲超时后来宾即被丢弃。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Windows Sandbox MCP,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

Windows Sandbox MCP

MCP server that lets a restricted agent run risky commands in a fresh, offline Windows Sandbox guest, without access to anything else on the host. Design and validated wsb.exe behaviour: SPEC.md. Reporting vulnerabilities: SECURITY.md.

wsb-mcp is the name of the executable, the project and the solution.

Agent host ──stdio──> wsb-mcp proxy ──named pipe──> wsb-mcp serve ──> wsb.exe           (agent account)        (ACL: agent only)  (your account)

Tools

ToolPurpose
sandbox_startStart a guest; optionally map inputPath read-only at C:\SandboxIn and outputPath writable at C:\SandboxOut.
sandbox_execRun a command (runAs system or user, both elevated). Returns the guest exit code only; redirect output to files in C:\SandboxOut.
sandbox_statusRunning state, id, mapped folders.
sandbox_stopStop and discard the guest.

The guest is also stopped when the agent disconnects, after the idle timeout, and when the broker exits.

Build and test

powershell
dotnet builddotnet run --project tests/WsbMcp.Tests          # all tests, optional name filter as argumentpwsh -NoProfile -File tests/WindowsSandboxTest.Tests.ps1   # psm1 tests

The tests use a fake wsb.exe and do not need Windows Sandbox.

Installation

Two accounts are involved:

  • You: the interactive user, who runs the broker.
  • The agent: for example AgentSandbox, which runs Claude Code and the proxy.

Requirements: Windows 11 24H2 or later, with Windows Sandbox enabled. To enable it, run this as admin and reboot:

powershell
Enable-WindowsOptionalFeature -Online -FeatureName Containers-DisposableClientVM -All

The release build is self-contained, so no .NET is needed.

Quick start

  1. Install the program (admin; installs below C:\Program Files):
    powershell
    winget install fmuecke.WsbMcp --scope machine
  2. Set up the broker. Run this as you, in a normal terminal, not elevated:
    powershell
    wsb-mcp setup --agent AgentSandbox --root C:\AgentSandbox
    • --root is the folder below which the agent may map folders into the sandbox.
    • setup checks the prerequisites, writes the config, and registers a logon task that starts the broker hidden in your desktop session.
    • It then starts the broker and prints the next step.
  3. Connect Claude Code. As the agent, in Claude Code:
    /plugin marketplace add fmuecke/windows-sandbox-mcp/plugin install wsb-mcp@windows-sandbox-mcp
    The plugin adds the four tools plus a skill that teaches Claude how to use them. Without plugins, use this instead: claude mcp add --scope user wsb -- wsb-mcp proxy.

Check everything with wsb-mcp diag, run as you or as the agent. If the broker isn't running, the tools say so and tell you what to run. Once it's running, the next call works without restarting Claude Code.

Commands

CommandRun asPurpose
wsb-mcp setup --agent <account> --root <dir> [--pipe <name>] [--no-autostart] [--force]you (not elevated)One-time setup: config, logon task, start.
wsb-mcp start / wsb-mcp stopyouStart the broker now / stop it (and its guest) gracefully.
wsb-mcp diagyou or the agentCheck each link of the chain, with a fix for each failure.
wsb-mcp uninstall [--keep-config]youStop, then remove the logon task, config and log.
wsb-mcp serve [--config <path>]youRun the broker in the foreground; Ctrl+C stops it.
wsb-mcp proxy [--pipe <name>]the agent's MCP hoststdio bridge to the broker; you never run this yourself.

The config is %LOCALAPPDATA%\wsb-mcp\config.json. setup writes the first three keys; the others are optional:

json
{  "agentAccount": "AgentSandbox",  "allowedRoot": "C:\\AgentSandbox",  "pipeName": "wsb-mcp",  "idleTimeoutMinutes": 30,  "maxExecTimeoutSeconds": 1800,  "startupTimeoutSeconds": 120,  "logPath": "%LOCALAPPDATA%\\wsb-mcp\\broker.log"}

Unknown keys are rejected. wsbPath overrides wsb.exe, for tests.

Why the location matters

The broker runs with your rights. If anyone else could replace its exe, they could run code as you. So serve and setup refuse to run if anyone other than SYSTEM, Administrators, TrustedInstaller or you could do one of the following:

  • change the exe;
  • add files next to it;
  • rename or re-permission any folder on its path.

The winget install below C:\Program Files passes by default. The broker also refuses a config or log inside allowedRoot.

Agent accounts with managed Claude Code settings

If C:\Program Files\ClaudeCode\managed-settings.json restricts MCP servers, admin changes are needed:

  • strictKnownMarketplaces: add this repository's marketplace, for /plugin marketplace add.
  • allowedMcpServers: add { "serverCommand": ["wsb-mcp", "proxy"] }, the command the plugin runs.
  • strictPluginOnlyCustomization containing "mcp": only the plugin route works. Alternatively, define the server centrally in C:\Program Files\ClaudeCode\managed-mcp.json:
    json
    { "mcpServers": { "wsb": { "command": "wsb-mcp", "args": ["proxy"] } } }

Symptom of a blocking policy: /mcp shows "No MCP servers configured".

Without winget

Download the zip for your architecture from the Releases page. CI builds and tests it from its tag, and GitHub signs its build provenance. Verify the zip, and extract it into a folder only admins (or you) can write:

powershell
$zip = "$env:USERPROFILE\Downloads\wsb-mcp-<version>-win-x64.zip"gh attestation verify $zip --repo fmuecke/windows-sandbox-mcp$dir = "$env:ProgramFiles\wsb-mcp"            # as adminExpand-Archive $zip -DestinationPath $dir -Force

Then run & "$dir\wsb-mcp.exe" setup ... as in step 2. For the Claude side, setup prints the full exe path to use. SHA256SUMS.txt only detects a damaged download. It does not prove who built the zip; the attestation does.

From source: build a reviewed commit in a clone the agent cannot modify, for example with dotnet publish src/WsbMcp -c Release -r win-x64 -o $dir. That needs the .NET 10 SDK and NuGet access. Never build in a checkout the agent can write, such as one below C:\AgentSandbox.

Verify against the real sandbox

As the agent account, with the broker running:

powershell
pwsh -NoProfile -File tests\smoke\real-smoke.ps1 -ProxyExe (Get-Command wsb-mcp).Source -HoldForCtrlC

It runs 22 checks (19 without -HoldForCtrlC):

  • folder rules
  • read-only input
  • no network
  • exit codes
  • runAs: user
  • timeout
  • stop on disconnect

At the end it asks you to stop the broker (wsb-mcp stop) and checks that the tools then return the offline hint. Afterwards wsb list must show no sandbox.

Update

Windows locks the exe while the broker runs, so stop it first:

powershell
wsb-mcp stopwinget upgrade fmuecke.WsbMcp     # adminwsb-mcp start

Troubleshooting

Start with wsb-mcp diag. Common cases:

SymptomCause / fix
Tool error "The wsb-mcp broker is not reachable"The broker isn't running (wsb-mcp start), was never set up (wsb-mcp setup), or another session is connected (one at a time).
/mcp: "No MCP servers configured"A managed policy blocks the server. See "Agent accounts with managed Claude Code settings".
setup / serve: "not in a safe location" / "refusing to serve"The exe is in a folder others can write to. Install with winget or below C:\Program Files.
The broker log shows client.rejectedThe connecting account is not agentAccount, or it connected anonymously.
serve: "The stop event … already exists"A broker is already running, or another process created the event. Run wsb-mcp stop, or sign out and back in.
Rule 4 rejects a folder you think is fineThe agent lacks list (input) or create-file (output) rights on that exact folder. Check with icacls.
runAs: user fails with "No user session"The broker isn't running in your interactive desktop session. Use the logon task, not a service.

Uninstall

powershell
wsb-mcp uninstall                 # as you: task, config, logwinget uninstall fmuecke.WsbMcp   # admin

In Claude Code, as the agent: /plugin uninstall wsb-mcp (or claude mcp remove wsb).

License

MIT - Florian Mücke, 2026

来源:README.md,提交 768b6a1

工具

0
SourceWeft 曾在隔离沙箱中以无凭据方式启动该软件包一次,以列出其工具,但未能完成:该软件包类型无法在沙箱中运行。

版本历史

1
  1. v1.0.0最新Nov 7, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分