capsulerun/bash

🖥️ Command Line🟢 Verified Active
0 Views
0 Installs

📇 🏠 🍎 🪟 🐧 - Sandboxed bash for agents. Run untrusted commands in WebAssembly sandboxes with no setup required.

Quick Install

One-Click IDE Configuration
claude_desktop_config.json
{
  "mcpServers": {
    "capsulerun-bash": {
      "command": "npx",
      "args": [
        "-y",
        "capsulerun-bash"
      ]
    }
  }
}
Or

Using an AI coding agent (Claude Code, Cursor, etc.)? Copy a ready-made prompt that tells it to fetch the setup instructions and install this server for you.

Documentation Overview

Overview

Capsule Bash is a command interpreter built for executing untrusted commands. It provides a bash-like interface to interact with the filesystem and run commands in a sandboxed environment.

  • Commands and sandboxes: Bash commands are reimplemented in TypeScript and run code inside isolated sandboxes. The sandbox layer is modular, so we can plug in any runtime that implements the interface. The default WasmRuntime uses Capsule runtime to run commands inside WebAssembly sandboxes.

  • Instant feedback: Traditional bash treats silence as success. In agentic workflows for example, that forces a second call just to confirm the first one worked. Capsule Bash returns structured output for every command. Exit code, stdout, stderr, and a diff of filesystem changes.

  • Workspace isolation: Commands operates in a mounted workspace directory. The host filesystem is not accessible from inside the sandbox. You get full visibility into what is executed without exposing your system. The workspace is persistent and stays alive until you reset it manually.

Getting Started

TypeScript SDK

npm install @capsule-run/bash @capsule-run/bash-wasm

Run it:

import { Bash } from '@capsule-run/bash';
import { WasmRuntime } from '@capsule-run/bash-wasm';

const bash = new Bash({ runtime: new WasmRuntime() });

const result = await bash.run('mkdir src && touch src/index.ts');

console.log(result);

/**
Result {
  stdout: "Folder created ✔\nFile created ✔",
  stderr: "",
  diff: { created: ['src/index.ts'], modified: [], deleted: [] },
  state: { cwd: '/', env: {} },
  duration: 10,
  exitCode: 0,
}
**/

Interactive shell

Clone the repository, then run from the project root:

pnpm -s bash-wasm-shell

[!IMPORTANT] Python and pip are required to compile the Python sandbox. Both sandboxes (JS and Python) are needed to run the shell.

MCP server

{
  "mcpServers": {
    "capsule": {
      "command": "npx",
      "args": ["-y", "@capsule-run/bash-mcp"]
    }
  }
}

See the MCP Readme for configuration details.

Documentation

Bash Options

ParameterDescriptionTypeDefault
runtimeRuntime to use for the sandboxRuntime classNone
customCommandsCustom commands to add to the bash instanceCustomCommand[][]
hostWorkspaceHost workspace directorystring".capsule/session/workspace"
initialCwdInitial working directorystring"/workspace"

Runtime

The runtime is the engine that runs the bash commands. WasmRuntime is available by default to run the commands in a WebAssembly sandbox.

import { Bash } from '@capsule-run/bash';
import { WasmRuntime } from '@capsule-run/bash-wasm';

const bash = new Bash({ runtime: new WasmRuntime() });

Custom Commands

import { Bash, createCommand } from '@capsule-run/bash';
import { WasmRuntime } from '@capsule-run/bash-wasm';

const firstCustomCommand = createCommand('hello', async (opts, state) => {
  return { stdout: 'Hello', stderr: '', exitCode: 0 };
});

const bash = new Bash({
  runtime: new WasmRuntime(),
  customCommands: [firstCustomCommand],
});

Host Workspace

The host workspace is the directory on the host system that is mounted to the sandbox. It can be any folder in the project directory. By default, it is set to .capsule/session/workspace.

const bash = new Bash({ runtime: new WasmRuntime(), hostWorkspace: 'customFolder' });

Initial Working Directory

The initial working directory is where bash commands are executed. By default it is set to /workspace. You can set it to any directory inside the sandbox filesystem.

const bash = new Bash({ runtime: new WasmRuntime(), initialCwd: '/' });

Run

Use the run method to execute a command in the sandbox.

const bash = new Bash({ runtime: new WasmRuntime() });

const result = await bash.run('mkdir src && touch src/index.ts');

console.log(result);
Response Format
{
  stdout: string,
  stderr: string,
  diff: { created: string[], modified: string[], deleted: string[] }, // Files and directories changes
  state: { cwd: string, env: Record<string, string> }, // last state of the sandbox
  duration: number, // Duration in milliseconds
  exitCode: number
}

Preload

Use the preload method to warm up a sandbox before running commands. By default it preloads the JS sandbox.

const bash = new Bash({ runtime: new WasmRuntime() });

await bash.preload(); // js by default
await bash.preload('python'); // python

Reset

Use the reset method to clear the bash instance and restore the sandbox filesystem to its initial state.

const bash = new Bash({ runtime: new WasmRuntime() });

await bash.reset();

Limitations

  • WasmRuntime runs in Node.js only, browser environments are not supported with the existing runtime yet
  • Not all bash commands are implemented yet. See packages/bash/src/commands/ for the current list. Feel free to open an issue to request a new one.

Contributing

Contributions are welcome, whether it's documentation, new commands, or bug reports.

Adding or improving commands

Commands live in packages/bash/src/commands/. To contribute:

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-command
  3. Add or update your command in packages/bash/src/commands/
  4. Add unit tests
  5. Open a pull request

License

Apache License 2.0. See LICENSE for details.

Related MCP Servers

blinkingbit-oss/execkit

🦀 🏠 🍎 🐧 - Stateful, structured, auditable shell sessions for AI agents over local, SSH, and Docker. Secret redaction, output budgeting, SSH host-key verification, and a loopback read-only browser viewer that streams the live transcript.

🖥️ Command Line0 views
bvisible/mcp-ssh-manager

📇 🏠 🍎 🪟 🐧 - Manage multiple SSH servers from one MCP: command execution, file transfer/rsync, database dump/import/query (MySQL/PostgreSQL/MongoDB), backups & restore, health monitoring, persistent sessions, tunnels, ProxyJump/bastion, and opt-in per-server security modes (readonly/restricted) with audit log. Linux, macOS & Windows OpenSSH.

🖥️ Command Line0 views
cygnussystems/cygnus-ssh-mcp

🐍 🏠 🍎 🪟 🐧 - MCP server for SSH-based control of remote Linux, macOS, and Windows servers with 46 purpose-built tools instead of one generic command-runner: line-level file editing (no download/edit/upload round-trip), background task launch/monitor/kill, real sudo support, host aliases, recursive directory ops, archive create/extract, and full Unicode via SFTP (avoids PowerShell OEM code page corruption on Windows targets). pip install cygnus-ssh-mcp or uvx cygnus-ssh-mcp.

🖥️ Command Line0 views
danmartuszewski/hop

🏎️ 🖥️ - Fast SSH connection manager with TUI dashboard and MCP server for discovering, searching, and executing commands on remote hosts.

🖥️ Command Line0 views

Engagement

Views
0
Installs
0
Upvotes
0

Views and upvotes are unique per visitor network (hashed IP). Installs count copy actions.

Status

Health: Active

Recent health check succeeded.

Last checked: 7/28/2026, 9:06:39 PM

Unclaimed listing (imported or pending owner verification). Claim it →
★ Spotlight Slot

Feature Your MCP Server

Get maximum visibility for your server across our directory, search results, and detail pages.

Spotlight Your Server

Own this project?

This directory is pre-filled from public sources. Claim via GitHub README, site badge, or DNS TXT to get the verified badge and attach your website.

Claim this listing

Promote this listing

Optional paid placement. Free listings stay free forever.

Share & Embed

Add our SVG badge (dark/light directory styles) or embeddable widget to your site.