Capsule Bash Server
OfficialCapsule Bash MCP
一个 MCP 服务器,使您的 AI 智能体能够在安全、持久、沙盒化的环境中运行 bash 命令。
工作原理
每个会话都在 WebAssembly 沙盒内运行。沙盒提供:
持久化状态:工作目录 (cwd)、环境变量和文件系统更改在会话内的命令之间保持持久
文件系统差异:每次
run响应都包含磁盘更改的差异 (diff)内存隔离:每个会话都有自己的地址空间,不会发生跨会话泄漏
无主机访问:沙盒无法访问您的主机文件系统或网络
了解更多关于 Capsule Bash 的信息。
Related MCP server: execkit-mcp
工具
工具 | 描述 |
| 在沙盒会话中运行 bash 命令。返回标准输出 (stdout)、标准错误 (stderr)、退出代码、文件系统差异以及当前状态 (cwd + env)。 |
| 将会话的文件系统和状态(cwd、环境变量)重置为其初始值。 |
| 列出所有活动会话。 |
会话
同一 session_id 内的命令在调用之间共享工作目录 (cwd)、环境变量和文件系统状态。
示例
询问您的 AI 智能体:
“编写一个计算数字列表平均值的 Python 脚本。”
智能体按顺序调用 run:
{ "command": "mkdir -p /data && cd /data", "session_id": "custom_session" }
{ "command": "echo 'nums = [x for x in [1, 2, 3, []] if isinstance(x, int)]\nprint(sum(nums) / len(nums))' > avg.py", "session_id": "custom_session" }
{ "command": "python3 avg.py", "session_id": "custom_session" }每次调用都会返回 stdout、stderr、exitCode、文件系统 diff 以及更新后的 state,以丰富上下文并保持对话历史记录中的追踪。
设置
添加到您的 MCP 客户端配置中(例如 Claude Desktop、Cursor):
{
"mcpServers": {
"bash": {
"command": "npx",
"args": ["-y", "@capsule-run/bash-mcp"]
}
}
}限制
并非所有 bash 命令和选项都已实现。如果缺少某个命令或其行为异常,欢迎 提交 issue。
Available Tools
3 toolsresetA
Reset a session's filesystem and shell state (cwd, env vars) to their initial values. Useful to start fresh without creating a new session.
Inputs: session_id.
runB
Execute a Bash command in the sandboxed environment
Inputs: command (required), session_id.
sessionsA
List all active session IDs and their current state.
Inputs: no named parameters.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 3 tools
Each tool has a unique, clear purpose: reset reverts state, run executes commands, and sessions lists active sessions. No ambiguity or overlap exists.
All tool names are single, imperative verbs (reset, run, sessions) following a consistent, simple pattern.
Three tools is well-scoped for a bash sandbox server, covering essential operations without superfluous or missing tools.
The set covers core actions (run, reset, list sessions) but lacks explicit session creation; likely sessions are created implicitly, leaving a minor gap.
Maintenance
Related MCP Connectors
Secure Linux sandboxes for AI agents, as MCP tools.
Cloud Linux VMs for your agent: run code, Docker, files and HTTPS previews in a Sandboxer microVM.
Linux machines for AI agents: create, run commands, snapshot, fork, sandbox. Alpha.
Autonomous agent guardrails, bash sandboxing, MCP rugpull diffing & prompt firewalls.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceA throwaway Docker sandbox for agents to run code and shell commands safely.8 npmMIT
- AlicenseAqualityBmaintenanceStateful, structured, safe shell sessions for AI agents, on real infrastructure.713Apache 2.0
- AlicenseAqualityBmaintenanceExposes persistent, stateful remote Bash sessions to AI agents via SSH, enabling command execution with preserved working directory and environment.772 npm1MIT
- AlicenseAqualityCmaintenanceSandboxed bash execution MCP server for AI agents, using an in-memory virtual filesystem overlay to prevent real filesystem damage, with configurable network access, timeouts, and optional Python/JS runtimes.984 npmApache 2.0