脚本工具
通过MCP执行命令行脚本的工具。
特性
- 安全执行命令行脚本
- 支持不同的口译员
- 超时保护
- 输出和错误捕获
- 跨平台支持(Linux、macOS、Windows)
安装
有几种方法可以安装脚本工具:
选项1:从GitHub版本下载
- 访问 页
- 下载适用于您平台的二进制文件:
- script-mcp_linux_amd64\用于linux - script-mcp_darwin_amd64 适用于macOS - script-mcp_windows_amd64.exe` 对于Windows
- 使二进制文件可执行(Linux/macOS):
chmod +x script-mcp_*- 将其移动到您的PATH(Linux/macOS):
sudo mv script-mcp_* /usr/local/bin/script-mcp@latest选项2:去安装
go install github.com/nguyenvanduocit/script-mcp配置
克劳德
{
"mcpServers": {
"script": {
"command": "/path-to/script-mcp"
}
}
}CLI使用情况
除了MCP服务器之外, script-mcp 提供独立的CLI二进制文件(script-cli)用于直接终端使用——不需要MCP客户端。
安装
just install-cli
# or
go install github.com/nguyenvanduocit/script-mcp/cmd/script-cli@latest快速开始
不需要凭据。CLI在本地执行脚本。
script-cli execute --content "echo Hello, World!"命令
| 命令 | 描述 |
|---|---|
execute (或 exec, run) | 安全执行超时脚本 |
示例
# Run a shell command
script-cli execute --content "ls -la"
# Run with a specific interpreter
script-cli execute --content "print('Hello')" --interpreter /usr/bin/python3
# Run with a working directory
script-cli execute --content "pwd" --working-dir /tmp
# Run a multi-line script
script-cli execute --content "#!/bin/bash
echo 'Starting...'
date
echo 'Done'"
# JSON output (captures stdout/stderr separately)
script-cli exec --content "echo hello" --output json旗帜
| 标志 | 描述 |
|---|---|
--content | 要执行的脚本内容(必需) |
--interpreter | 解释器路径(默认值: /bin/sh) |
--working-dir | 执行工作目录 |
--env | 通往 .env 文件 |
--output | 输出格式: text (默认)或 json |
注: 脚本在30秒后超时。
贡献
- 分叉存储库
- 创建功能分支(
git checkout -b feature/amazing-feature) - 提交您的更改(
git commit -m 'Add some amazing feature') - 推到分支(
git push origin feature/amazing-feature) - 打开拉取请求
许可证
此项目根据MIT许可证获得许可-有关详细信息,请参阅许可证文件。
安装
自制(macOS/Linux)
brew install nguyenvanduocit/tap/script-mcp