Token导航 LogoToken导航TokenDH.com
Local Bash MCP logo
开发工具stdio官方级别未说明来源级核验

Local Bash MCP

MCP Server

@smithery/cli

一个实现模型上下文协议(MCP)的安全Shell命令执行服务器,支持远程执行白名单命令并提供标准输入支持。

工具数

7

提示词数

0

GitHub Stars

0

资源数

0
安全协议PythonClaude开发工具Claude DesktopClaude

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

xyphanajay

提供方

xyphanajay

最后核验

2026/5/17 20:22

运行时

Node.js

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

命令预览

npx -y @smithery/cli install mcp-shell-server --client claude

详细介绍

MCP外壳服务器

![codecov](https://codecov.io/gh/tumf/mcp-shell-server) ](https://smithery.ai/server/mcp-shell-server)

实现模型上下文协议(MCP)的安全shell命令执行服务器。此服务器允许远程执行白名单shell命令,并支持stdin输入。

特性

  • 安全命令执行:只能执行白名单中的命令
  • 标准输入支持:通过stdin将输入传递给命令
  • 综合产出:返回stdout、stderr、退出状态和执行时间
  • 壳牌操作员安全:验证shell运算符(;、&&、||、|)后的命令
  • 超时控制:设置命令的最大执行时间

Claude.app中的MCP客户端设置

已发布版本

code ~/Library/Application\ Support/Claude/claude_desktop_config.json
{
  "mcpServers": {
    "shell": {
      "command": "uvx",
      "args": [
        "mcp-shell-server"
      ],
      "env": {
        "ALLOW_COMMANDS": "ls,cat,pwd,grep,wc,touch,find"
      }
    },
  }
}

本地版本

配置

code ~/Library/Application\ Support/Claude/claude_desktop_config.json
{
  "mcpServers": {
    "shell": {
      "command": "uv",
      "args": [
        "--directory",
        ".",
        "run",
        "mcp-shell-server"
      ],
      "env": {
        "ALLOW_COMMANDS": "ls,cat,pwd,grep,wc,touch,find"
      }
    },
  }
}

安装

通过Smithery安装

通过以下方式自动安装Claude Desktop的Shell Server 史密瑟里:

npx -y @smithery/cli install mcp-shell-server --client claude

手动安装

pip install mcp-shell-server

通过Smithery安装

通过以下方式自动安装Claude Desktop的Shell Server 史密瑟里:

npx -y @smithery/cli install mcp-shell-server --client claude

用法

启动服务器

ALLOW_COMMANDS="ls,cat,echo" uvx mcp-shell-server
# Or using the alias
ALLOWED_COMMANDS="ls,cat,echo" uvx mcp-shell-server

ALLOW_COMMANDS (或其别名 ALLOWED_COMMANDS )环境变量指定允许执行哪些命令。命令之间可以用逗号分隔,两边可以有空格。

ALLOW_COMMANDS或ALLOWED_COMMANDS的有效格式:

ALLOW_COMMANDS="ls,cat,echo"          # Basic format
ALLOWED_COMMANDS="ls ,echo, cat"      # With spaces (using alias)
ALLOW_COMMANDS="ls,  cat  , echo"     # Multiple spaces

请求格式

# Basic command execution
{
    "command": ["ls", "-l", "/tmp"]
}

# Command with stdin input
{
    "command": ["cat"],
    "stdin": "Hello, World!"
}

# Command with timeout
{
    "command": ["long-running-process"],
    "timeout": 30  # Maximum execution time in seconds
}

# Command with working directory and timeout
{
    "command": ["grep", "-r", "pattern"],
    "directory": "/path/to/search",
    "timeout": 60
}

响应格式

成功响应:

{
    "stdout": "command output",
    "stderr": "",
    "status": 0,
    "execution_time": 0.123
}

错误响应:

{
    "error": "Command not allowed: rm",
    "status": 1,
    "stdout": "",
    "stderr": "Command not allowed: rm",
    "execution_time": 0
}

安全

服务器实施了多种安全措施:

  1. 命令白名单:只能执行明确允许的命令
  2. 壳牌操作员验证:shell运算符(;、&&、||、|)后的命令也会根据白名单进行验证
  3. 无外壳注射:命令直接执行,无需shell解释

发展

建立开发环境

  1. 克隆存储库
git clone https://github.com/yourusername/mcp-shell-server.git
cd mcp-shell-server
  1. 安装依赖项,包括测试要求
pip install -e ".[test]"

运行测试

pytest

api参考

请求参数

字段类型必填描述
commandstring\[\]Yes命令及其参数作为数组元素
stdinstring要传递给命令的输入
directorystringNo命令执行的工作目录
timeout整数最大执行时间(秒)

响应字段

字段类型描述
stdoutstring命令的标准输出
stderrstring命令输出的标准错误
状态整数退出状态代码
execution_timefloat执行所用的时间(秒)
errorstring错误消息(仅在失败时显示)

需求

  • Python 3.11或更高版本
  • mcp>=1.1.0

许可证

MIT许可证-有关详细信息,请参阅许可证文件

目录标签

目录标签

安全协议PythonClaude开发工具Shell命令执行本地部署远程执行命令白名单

支持客户端

Claude DesktopClaude

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

none

运行时(runtime,运行环境)

Node.js

来源包(packageName,安装包名)

@smithery/cli

工具数量(toolCount,工具数)

7

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdionone部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

来源信息

继续浏览同类 MCP