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 分