Token导航 LogoToken导航TokenDH.com
MCP Shell Server (Mkusaka) logo
开发工具HTTP官方级别未说明来源级核验

MCP Shell Server (Mkusaka)

MCP Server

一个使用模型上下文协议(MCP)执行Shell命令的服务器,作为AI代理安全执行Shell命令的桥梁。

工具数

1

提示词数

0

GitHub Stars

8

资源数

0
开发工具TypeScriptClaude命令行工具ClaudeCursorClineVS Code

安装说明

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

作者 / 组织

mkusaka

提供方

mkusaka

最后核验

2026/5/17 21:00

运行时

Node.js

快速接入

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

命令预览

npx mcp-shell-server

详细介绍

MCP外壳服务器

使用模型上下文协议(MCP)执行shell命令的服务器。它作为一个桥梁,允许AI代理安全地执行shell命令。

特性

  • 执行shell命令(单行和多行支持)
  • 支持各种shell(bash、zsh、fish、powershell、cmd等)
  • 详细的错误处理和记录
  • MCP检查器兼容

安装

来自npm(作为用户)

# Using npm
npm install -g @mkusaka/mcp-shell-server

# Using yarn
yarn global add @mkusaka/mcp-shell-server

# Using pnpm
pnpm add -g @mkusaka/mcp-shell-server

来源(用于开发)

# Clone the repository
git clone https://github.com/mkusaka/mcp-shell-server.git
cd mcp-shell-server

# Install dependencies
pnpm install

# Build the project
pnpm build

MCP配置

光标配置

将以下内容添加到Cursor配置文件中(~/.cursor/config.json):

{
  "mcpServers": {
    "shell": {
      "command": "npx",
      "args": ["-y", "@mkusaka/mcp-shell-server"]
    }
  }
}

临床整合

克莱恩 是一个VS Code扩展,允许您将MCP服务器与Claude AI一起使用。要使用Cline设置此MCP shell服务器:

  1. 打开Cline MCP设置文件:

- macOS: ~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json - 窗户: %APPDATA%/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json - Linux: ~/.config/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json

  1. 添加shell服务器MCP配置:
   {
     "mcpServers": {
       "shell": {
         "command": "npx",
         "args": ["-y", "@mkusaka/mcp-shell-server"],
         "disabled": false,
         "autoApprove": []
       }
     }
   }

或者,如果您想使用本地安装的软件包:

   {
     "mcpServers": {
       "shell": {
         "command": "node",
         "args": ["/path/to/mcp-shell-server/dist/index.js"],
         "disabled": false,
         "autoApprove": []
       }
     }
   }

规则配置

将以下内容添加到AI助手的规则或提示中:

You have MCP Shell tools at your disposal. Follow these rules regarding Shell tool usage:
1. ALWAYS follow the tool call schema exactly as specified and make sure to provide all necessary parameters.
2. **NEVER refer to tool names when speaking to me.** For example, instead of saying 'I need to use the shell_exec tool to run this command', just say 'I'll run that command for you'.
3. Only use Shell tools when they are necessary. If my task is general or you already know the answer, just respond without calling tools.
4. When I ask you to execute shell commands, use the appropriate tool to:
   - Run single-line commands
   - Run multi-line commands (using heredoc syntax when appropriate)
   - Execute file operations, git commands, or system utilities
   - Provide system information when relevant
5. Always be careful with shell commands that might modify the system, and explain what the command will do before executing it.
6. If a shell command produces an error, explain what went wrong in simple terms and suggest ways to fix it.

用法

直接执行

node dist/index.js
# or as an executable
./dist/index.js

开发模式

pnpm dev

MCP检验员测试

pnpm inspect

命令行参数

-s, --shell   Specify the path to the shell to use
-w, --working-dir   Specify the working directory for command execution
-h, --help           Display help message
-V, --version        Display version information

工具参考

shell-exec

在指定的shell中执行命令。

参数:

  • command (string,必填):要执行的shell命令
  • workingDir (string,可选):执行命令的工作目录。必须在$HOME下。

资源引用

服务器提供以下系统信息作为资源:

主机名

返回系统的主机名。

URI: hostname://

平台

返回操作系统平台。

URI: platform://

外壳

返回服务器正在使用的shell路径。

URI: shell://

用户名

返回当前用户名。

URI: username://

系统信息

以JSON格式返回全面的系统信息,包括:

  • 主机名
  • 平台
  • 外壳
  • 用户名
  • CPU计数
  • 总内存
  • 可用内存
  • 系统正常运行时间

使用示例

基本命令执行

{
  "name": "shell_exec",
  "parameters": {
    "command": "echo Hello, World!"
  }
}

多行命令(Heredoc)执行

{
  "name": "shell_exec",
  "parameters": {
    "command": "cat << EOF | grep 'example'\nThis is an example text.\nAnother line without the keyword.\nEOF"
  }
}

发展

项目结构

src/
├── index.ts                # Main entry point
└── shell-server/
    ├── index.ts            # Shell server implementation
    └── lib/
        └── logger.ts       # Logging configuration

日志记录

日志被写入 mcp-shell.log 文件。

许可证

麻省理工学院

目录标签

目录标签

开发工具TypeScriptClaude命令行工具Shell命令执行本地部署AI代理工具系统管理

支持客户端

ClaudeCursorClineVS Code

接入字段

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

HTTP

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

none

运行时(runtime,运行环境)

Node.js

部署方式(deploymentType,部署类型)

local-only

工具数量(toolCount,工具数)

1

资源数量(resourceCount,资源数)

0

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

0

权限和风险

HTTPnonelocal-only

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

安装前确认

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

来源信息

继续浏览同类 MCP