
Bash Command Mcp
io.github.mrorigo由 GitHub 帳號 mrorigo 發布v1.0.0更新於 Oct 27, 2026
Sophisticated bash command MCP server that runs and manages shell execution.
概覽
本機 MCP 伺服器,讓助理在你的機器上執行 shell 指令,並支援附日誌的背景工作、等待與終止。
- 可以做什麼
- 在前景執行 shell 指令,可指定逾時、工作目錄與環境變數
- 以背景程序啟動指令,並將標準輸出與錯誤寫入日誌檔
- 列出已追蹤的背景程序並檢視其日誌末段內容
- 等待背景程序結束,或依程序 ID 終止它
- 為工具呼叫、逾時與背景生命週期輸出 OpenTelemetry 追蹤與指標
- 適用情境
- 適合需要助理在本機執行建置、測試、腳本或系統指令,並管理長時間執行程序的場合,而不只是讀寫檔案。
- 執行需求
- 以本機程序執行,通常透過 npx 使用已發佈的 npm 套件,或以 Bun 從原始碼啟動;需要 Node.js 或 Bun。選用環境變數可設定日誌目錄(BASH_COMMAND_MCP_LOG_DIR)與 OpenTelemetry(OTEL_ENABLED、OTEL_EXPORTER_OTLP_ENDPOINT、OTEL_SERVICE_NAME、OTEL_SERVICE_VERSION、OTEL_METRIC_EXPORT_INTERVAL_MS)。HTTP 模式使用 BASH_COMMAND_MCP_TRANSPORT、BASH_COMMAND_MCP_HOST、BASH_COMMAND_MCP_PORT 與 BASH_COMMAND_MCP_ALLOWED_HOSTS。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Bash Command Mcp,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
bash-command-mcp
A highly sophisticated Bash MCP server for safe, structured command execution with first-class background job orchestration.
Important Security Warning
This server executes shell commands on the machine where it is running.
If you run bun run index.ts directly on your host, commands run on your host with your user permissions.
Use Docker to isolate execution unless you fully trust the MCP client and prompts.
To install dependencies:
To run over stdio:
To run over Streamable HTTP:
To run via npm/npx (published package):
Why This Server
- High-fidelity shell execution with clear exit-code semantics.
- Advanced background process lifecycle controls (
run_background,wait_background,kill_background). - Built-in observability via per-process stdout/stderr log files.
- OpenTelemetry traces and metrics for production visibility.
- Agent-friendly ergonomics with
cwdandenvoverrides for precise execution context.
Tool Behavior
Tools:
run: run command in foreground. Args:commandorcmd,timeoutSeconds(default60, min1; values above86400are capped with a hint), optionalcwd, optionalenv.run_background: start command in background with stdout/stderr written to log files. Args:commandorcmd, optionalcwd, optionalenv.list_background: list tracked background processes, including log file paths.kill_background: stop tracked background process bypid.tail_background: show last N lines from background process logs. Args:pid, optionallines(default200, max5000).wait_background: wait for background process completion and return final status/output. Args:pid, optionaltimeoutSeconds(default60, min1; values above86400are capped with a hint).
OpenTelemetry
This server includes built-in OpenTelemetry instrumentation for traces and metrics.
- OpenTelemetry packages are installed with the server package.
- Telemetry initializes unless
OTEL_ENABLED=false. - If
OTEL_EXPORTER_OTLP_ENDPOINTis set, traces/metrics are exported via OTLP HTTP. - If no OTLP endpoint is configured, console exporters are used.
Instrumented operations:
- Tool call spans for
run,run_background,list_background,tail_background,wait_background, andkill_background. - Background lifecycle spans/counters (
started,ended). - Metrics for tool calls, failures, timeouts, and duration histograms.
Common env vars:
OTEL_ENABLED=true|falseOTEL_SERVICE_NAME=bash-command-mcpOTEL_SERVICE_VERSION=1.0.0OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318OTEL_METRIC_EXPORT_INTERVAL_MS=10000BASH_COMMAND_MCP_LOG_DIR=/path/to/log-dir
Example (OTLP Collector on localhost):
Transports
This server supports two transports:
stdiofor local, process-spawned integrations.httpfor remote or network-accessible MCP clients using Streamable HTTP.
Default behavior remains stdio so existing desktop and CLI setups keep working.
Environment variables for HTTP mode:
BASH_COMMAND_MCP_TRANSPORT=http|stdioBASH_COMMAND_MCP_HOST=127.0.0.1BASH_COMMAND_MCP_PORT=3000BASH_COMMAND_MCP_ALLOWED_HOSTS=localhost,127.0.0.1,[::1]
HTTP mode uses host-header validation by default when bound to a loopback address. If you bind to 0.0.0.0 or ::, provide an explicit allow-list in BASH_COMMAND_MCP_ALLOWED_HOSTS.
Docker
Build the image:
Run with a local folder mounted at /workspace:
Run over Streamable HTTP:
/workspace mapping explained:
- Left side (
$(pwd)) is a folder on your host machine. - Right side (
/workspace) is the path inside the container. - Commands run by this MCP server should target files under
/workspace; those changes are written back to the mapped host folder.
For HTTP mode in Docker, bind to 0.0.0.0 and publish the port with -p. If you expose the container beyond localhost, set BASH_COMMAND_MCP_ALLOWED_HOSTS to the hostnames you want to permit.
Example:
- If your host has
./project/file.txtand you run the container from./project, the same file is available in the container at/workspace/file.txt.
來源:README.md,提交 1770662
工具
0版本歷史
1- v1.0.0最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分