TM

tumf/mcp-shell-server

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

202 stars 50 forks 质量 85 趋势 14MIT

tumf/mcp-shell-server 是从 https://github.com/tumf/mcp-shell-server. 导入的 MCP 服务器候选

概览

tumf/mcp-shell-server 是从 https://github.com/tumf/mcp-shell-server. 导入的 MCP 服务器候选

概述(AI 翻译)

一个可信的执行服务器,实现了模型上下文协议(MCP)。它以 argv 数组的形式运行允许列表命令,包含 stdin 输入、包含重定向、最小子环境、执行限制和结构化审计日志。

本包不是沙箱。 允许命令委托该命令,程序对服务器进程的现有操作系统权限。在配置前阅读可信执行合同。

特色

  • 基于Argv的命令执行:允许通过子进程argv执行命令,无需shell-string解释
  • 标准输入支持:通过标准输入传递命令输入
  • 综合输出:返回stdout、stderr、退出状态和执行时间
  • 安全流水线支持:流水线保留并验证 argv 段,而不是调用 shell
  • 执行限制:服务器端默认超时、最大超时和输出字节上限被强制执行
  • 包含重定向: 和[>>目标必须保持在请求的工作目录内
  • 最小子环境:子进程获得一个小型允许列表环境,而非继承所有服务器秘密

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

MCP Shell Server

A trusted execution server implementing the Model Context Protocol (MCP). It runs allowlisted commands as argv arrays, with stdin input, contained redirection, a minimal child environment, execution limits, and structured audit logging.

This package is not a sandbox. Allowing a command delegates that program the server process’s existing OS authority. Read Trusted execution contract before configuring it.

Development and releases follow Branch and release flow.

Features

  • Argv-based Command Execution: Allowed commands run via subprocess argv without shell-string interpretation
  • Standard Input Support: Pass input to commands via stdin
  • Comprehensive Output: Returns stdout, stderr, exit status, and execution time
  • Safe Pipeline Support: Pipelines preserve and validate argv segments instead of invoking a shell
  • Execution Limits: Server-side default timeout, maximum timeout, and output byte caps are enforced
  • Contained Redirection: ``, and >> targets must stay inside the requested working directory
  • Minimal Child Environment: Child processes receive a small allowlisted environment instead of inheriting all server secrets
  • Structured Audit Logging: Success, rejection, timeout, output-cap, and process-error outcomes are logged with redaction

Trusted execution contract

Read this before the configuration examples below. The server emits the same warning once at startup through its logger (stderr); MCP stdout framing is unchanged.

What the server controls

mcp-shell-server enforces a boundary around its own behavior:

  • which executable names it launches directly (ALLOW_COMMANDS, ALLOW_PATTERNS),
  • argv-based process creation without shell-string interpretation,
  • server-managed ``, and >> redirection contained under the requested working directory,
  • the child environment it builds,
  • timeout and output-byte limits,
  • structured audit records.

What the server does not control

Allowing a command is authority delegation: the allowed program runs with the server process’s existing OS identity, filesystem access, network access, and credentials. ALLOW_COMMANDS and ALLOW_PATTERNS restrict only the command names the server launches directly. They do not guarantee containment of:

  • child processes an allowed program spawns,
  • program-specific interpreters, expression languages, or plugins,
在 GitHub 查看完整 README

安装

uvx mcp-shell-server
新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "shell": { "command": "uvx", "args": [ "mcp-shell-server" ], "env": { "ALLOW_COMMANDS": "ls,cat,pwd,grep,wc,touch,find" } }, } }