MCP Sidecar

io.github.lsequeiraa由 GitHub 帳號 lsequeiraa 發布v0.3.2更新於 Oct 24, 2026

Cross-platform MCP server for managing long-lived background processes from any MCP client

已驗證STDIO僅桌面效率與工作流開發者工具

概覽

AI 產生的概覽

一個本機 MCP 伺服器,讓 AI 助理啟動、檢視、寫入並停止長時間執行的背景程序,例如開發伺服器、監看式建置與測試資料庫。

可以做什麼
以指令、選用名稱、工作目錄與環境變數啟動背景程序,回傳 ID 與 PID。列出所有受管理的程序,並檢視單一程序的詳細狀態、結束碼與執行時間。讀取緩衝的 stdout 與 stderr,支援 tail 與位元組上限並回報截斷情況。將內容寫入執行中程序的標準輸入。先溫和再強制地停止程序,終止等待時間可設定。已結束的程序在可設定的保留期後自動移除。
適用情境
適合助理需要讓某個程序在多次工具呼叫之間持續存活的場景,例如啟動 API 伺服器後再探測它、在編輯程式碼時以監看模式執行建置,或啟動資料庫、寫入種子資料、執行測試後再拆除。短時間的指令較適合交給助理自帶的 shell。
執行需求
以本機程序透過 stdio 執行,可用 npx 或預先建置的執行檔安裝;README 稱其為單一 Go 執行檔,無需執行階段相依套件。所有設定皆為選用環境變數:SIDECAR_MAX_PROCESSES、SIDECAR_BUFFER_SIZE、SIDECAR_KILL_TIMEOUT、SIDECAR_CLEANUP_AFTER、SIDECAR_MAX_OUTPUT_SIZE、SIDECAR_ALLOWED_EXECUTABLES、SIDECAR_BLOCKED_PATTERNS 與 SIDECAR_AUDIT_LOG。未宣告任何身分驗證。
安裝前請注意
預設透過 shell 執行指令,助理因此可在本機執行任意程式;設定 SIDECAR_ALLOWED_EXECUTABLES 可切換為直接執行並啟用允許清單,還可搭配 SIDECAR_BLOCKED_PATTERNS。send 工具會寫入程序標準輸入,stop 會終止程序,可能中斷工作或遺失未儲存的狀態。只有設定 SIDECAR_MAX_OUTPUT_SIZE 才會限制輸出大小。未設定 SIDECAR_AUDIT_LOG 時不記錄稽核日誌,已結束程序的輸出在保留期過後會遺失。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 MCP Sidecar,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

mcp-sidecar

A lightweight, cross-platform MCP server for managing background processes. Built in Go for single-binary distribution with zero runtime dependencies.

Why?

AI coding agents (Claude Code, Gemini CLI, Cursor, etc.) lack the ability to run long-lived processes while continuing to interact with them. Common workflows affected:

  • Start an API server, wait for it to be ready, then run HTTP requests against it
  • Run a build in watch mode while editing code
  • Start a database, seed it, run tests, tear it down

mcp-sidecar solves this by exposing process lifecycle management as MCP tools over stdio transport.

Features

  • Cross-platform -- Windows, Linux, macOS from a single codebase
  • Zero dependencies -- Single Go binary, no runtime required
  • Minimal surface -- 6 tools, no unnecessary complexity
  • Reliable cleanup -- All child processes are terminated when the server exits; exited processes are auto-removed after a configurable TTL
  • Output control -- Per-request maxBytes and global SIDECAR_MAX_OUTPUT_SIZE to cap output returned to the LLM
  • Command security -- Optional executable allowlist, blocked patterns, and audit logging

Installation

Quick Setup (any agent)

The fastest way to install mcp-sidecar into any supported coding agent:

bash
# Interactive -- detects installed agents and lets you picknpx add-mcp mcp-sidecar
# Install to a specific agentnpx add-mcp mcp-sidecar -a claude-codenpx add-mcp mcp-sidecar -a cursornpx add-mcp mcp-sidecar -a vscode
# Install to all detected agentsnpx add-mcp mcp-sidecar --all

Supported agents: Claude Code, Codex, Cursor, VS Code, Gemini CLI, OpenCode, Zed, Goose, Cline, and more. See add-mcp for the full list.

Manual Configuration

Claude Code:

bash
claude mcp add sidecar -- npx -y mcp-sidecar

opencode (~/.config/opencode/opencode.json):

json
{  "mcp": {    "sidecar": {      "type": "local",      "command": ["npx", "-y", "mcp-sidecar"],      "enabled": true    }  }}

Generic (mcp.json):

json
{  "mcpServers": {    "sidecar": {      "command": "npx",      "args": ["-y", "mcp-sidecar"]    }  }}

From Source

bash
go install github.com/lsequeiraa/mcp-sidecar@latest

Pre-built binaries are also available on GitHub Releases for windows/amd64, linux/amd64, darwin/arm64, and darwin/amd64.

Tools

ToolDescriptionParametersReturns
startSpawn a background processcommand, name?, cwd?, env?{ id, name, pid }
stopTerminate a process (graceful, then force)id{ id, exitCode, uptime }
listList all managed processes--[{ id, name, pid, state, uptime }]
outputGet buffered stdout/stderrid, tail?, maxBytes?{ stdout, stderr, uptime }
sendWrite to a process's stdinid, input{ ok }
statusGet detailed state of one processid{ id, name, pid, state, exitCode, uptime, outputSize }

The uptime field reflects actual runtime: for running processes it's the time since start; for exited processes it's the time the process was alive (not the time since start).

The output tool's maxBytes parameter caps the total bytes of stdout+stderr combined. When both tail and maxBytes are provided, tail selects lines first, then maxBytes caps the byte size of the result. When the output exceeds the limit, the most recent content is kept and stderr is prioritized. Truncation preserves line boundaries. When output is truncated, the response includes "truncated": true and "totalBytes" indicating the original size.

Process States

StateMeaning
runningProcess is alive
exitedProcess terminated normally
failedProcess terminated with non-zero exit code
killedProcess was stopped via the stop tool

Example workflow

A typical session where an agent starts an API server, waits for it to be ready, tests it, and tears it down:

1. start  { command: "dotnet run --project MyApi", name: "api" }   → { id: "sc-a1b2c3", name: "api", pid: 12345 }
2. output { id: "sc-a1b2c3", tail: 5 }   → { stdout: "Now listening on: http://localhost:5000", stderr: "", uptime: "3s" }
3. (agent runs curl http://localhost:5000/health using its own shell)
4. output { id: "sc-a1b2c3", tail: 20 }   → { stdout: "...request logs...", stderr: "", uptime: "15s" }
5. stop   { id: "sc-a1b2c3" }   → { id: "sc-a1b2c3", exitCode: -1, uptime: "18s" }

The agent uses its native shell for short-lived commands (curl, build tools, etc.) and mcp-sidecar for processes that need to stay alive across multiple tool calls.

Configuration

All configuration is via environment variables (all optional):

VariableDefaultDescription
SIDECAR_MAX_PROCESSES10Maximum concurrent processes
SIDECAR_BUFFER_SIZE1048576 (1MB)Output buffer size per process in bytes
SIDECAR_KILL_TIMEOUT5000Milliseconds to wait between SIGTERM and SIGKILL
SIDECAR_CLEANUP_AFTER1800 (30 min)Seconds before exited processes are auto-removed. 0 = disabled
SIDECAR_MAX_OUTPUT_SIZE0 (unlimited)Global cap on bytes returned by the output tool. 0 = no limit
SIDECAR_ALLOWED_EXECUTABLES--Comma-separated allowlist of executables (enables secure mode)
SIDECAR_BLOCKED_PATTERNS--Comma-separated regex patterns to reject commands
SIDECAR_AUDIT_LOG--Audit log directory, or true (cwd) / temp (OS temp dir)

Auto-cleanup note: When SIDECAR_CLEANUP_AFTER is enabled (the default), exited processes are removed from the manager after the TTL expires. Once removed, calls to output, status, or stop for that process ID will return "not found". Retrieve any output you need within the TTL window (30 minutes by default).

Security

When SIDECAR_ALLOWED_EXECUTABLES is set, mcp-sidecar switches from shell mode to secure mode:

Shell mode (default)Secure mode
ExecutionVia sh -c / cmd /CDirect exec (no shell)
AllowlistNoneOnly listed executables can run
MetacharactersAllowed (shell interprets them)Rejected (|, &, ;, >, <, $, `, (, ))
Blocked patternsNoneRegex patterns matched against full command
Audit loggingNoneOptional JSONL log of all start/stop/blocked events

Metacharacters inside quotes are allowed -- grep "error|warning" file.txt works because the | is inside double quotes and won't be interpreted by a shell.

Backslash (\) is intentionally not treated as a metacharacter so Windows paths like C:\Users\me\app.exe work without escaping.

Configuration examples

Claude Desktop / Cursor (mcp.json):

json
{  "mcpServers": {    "sidecar": {      "command": "npx",      "args": ["-y", "mcp-sidecar"],      "env": {        "SIDECAR_ALLOWED_EXECUTABLES": "dotnet,npm,node,git,python",        "SIDECAR_BLOCKED_PATTERNS": "rm\\s+-rf,--force,--no-verify",        "SIDECAR_AUDIT_LOG": "./logs"      }    }  }}

Claude Code:

bash
claude mcp add sidecar \  -e SIDECAR_ALLOWED_EXECUTABLES=dotnet,npm,node,git,python \  -e SIDECAR_BLOCKED_PATTERNS="rm\\s+-rf,--force,--no-verify" \  -e SIDECAR_AUDIT_LOG=true \  -- npx -y mcp-sidecar

Audit log format

The audit log is always written to a file named sidecar-audit.jsonl inside the configured directory. The SIDECAR_AUDIT_LOG variable controls where:

ValueLog file location
true./sidecar-audit.jsonl (current working directory)
temp<OS temp dir>/sidecar-audit.jsonl
./logs./logs/sidecar-audit.jsonl (directory auto-created)

Each line is a JSON object with one of three event types:

jsonl
{"ts":"2025-03-12T10:00:00Z","event":"start","id":"abc123","command":"dotnet run","cwd":"/app"}{"ts":"2025-03-12T10:00:05Z","event":"stop","id":"abc123","exit_code":0,"duration":"5s"}{"ts":"2025-03-12T10:00:06Z","event":"blocked","command":"rm -rf /","reason":"executable \"rm\" is not in allowed list"}

Executable matching

The allowlist supports three matching modes:

Allowlist entryMatches
dotnetdotnet anywhere (basename match)
./build.shOnly ./build.sh (exact match)
/usr/bin/python3Only /usr/bin/python3, or any python3 resolved via PATH

Distribution

ChannelUsage
npmnpx -y mcp-sidecar (platform binary via @mcp-sidecar/* optional packages)
GitHub ReleasesPre-built binaries attached to each release
MCP Registryio.github.lsequeiraa/mcp-sidecar

License

MIT

來源:README.md,提交 10776ba

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v0.3.2最新Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分