使用说明
MCP外壳服务器
一个JavaScript MCP服务器,它创建一个目录,根据用户提供的任务生成一个shell脚本,并执行它。它还通过检测缺失的命令并安装它们来尝试简单的自我修复。
特性
- 通过创建目录
mkdir cd进入目录(执行cwd)- 创建
.sh文件通过touch(通过写入文件实现) - 编写一个shell脚本来解释任务中第一个冒号后的命令。,
task: ls -la - 运行shell脚本
- 失败时,尝试使用以下命令安装缺少的命令
brew,apt-get,或apk如有 - 暴露工具
get_instructions返回嵌入的指令文本
嵌入式指令提示
analyze the task provided by the user.
if the task can't be performed using shell scripting, deny to perform the task.
mcp will analyze how many module or script file to create and connect them to perform the task.
mcp will analyze the error on running the script and will fix the error
on error, mcp will also analyze if any installation of package is required, if required, it create a script to install those before running the final script.
本地运行
安装依赖项并启动服务器:
npm install
npm start
服务器使用stdio传输;与支持stdio服务器的MCP客户端集成。
与Docker MCP网关(Docket MCP工具包)一起使用
构建图像并使用工作工件卷运行:
# Build
docker build -t mcp-shell-server .
# Run (stdio)
docker run --rm -i \
-v "$PWD/work":/work \
mcp-shell-server
然后配置Docker MCP网关,为stdio MCP服务器启动此容器(请参阅网关文档)。服务器二进制文件为 node src/server.js 并期待stdio。
工具
-
generate_and_run_script输入:task(string):描述,可以包括冒号后的命令,例如。,task: echo helloworkspace(可选字符串):子文件夹名称WORK_ROOT(默认值/work)
-
get_instructions:返回指令文本
环境
WORK_ROOT:为生成的文件和执行挂载的目录,默认/work
局限性
- 启发式可行性检查;一些任务仍然可能失败。
- 包安装是最好的努力,取决于运行时可用的包管理器。
- 脚本解释器只查找第一个冒号来提取命令。