命令执行 MCP(模型上下文协议)服务器是一款安全且受控的工具,它能让 Claude 直接在您的本地系统上执行 shell 命令。通过该服务器,您可以借助 Claude 的界面,安全又灵活地与计算机的命令行进行交互。
此服务器允许 Claude 直接在本地系统执行 shell 命令,为与计算机命令行交互提供了安全灵活的方式。使用前需完成安装和配置,具体步骤见下文。
服务器实现了多层安全保护:
rm -rf、sudo 等。cd /path/to/command-execution-tool
npm install @modelcontextprotocol/sdk
将以下内容添加到您的 Claude Desktop 配置文件中:
~/Library/Application Support/Claude/claude_desktop_config.json%APPDATA%\Claude\claude_desktop_config.json{
"mcpServers": {
"command-execution": {
"command": "node",
"args": [
"/full/path/to/command-execution-tool.js"
],
"env": {
"NODE_OPTIONS": "--no-deprecation"
}
}
}
}
注意:将 /full/path/to/command-execution-tool.js 替换为您实际的脚本路径。
execute-command在可选的工作目录中执行 shell 命令。
command (必需):要执行的 shell 命令。workingDirectory (可选):指定命令执行的目录。execute-command with command="ls -la" and workingDirectory="/Users/yourusername/Documents"
simple-hello一个基本演示工具,返回问候语。
name (可选):要问候的姓名(默认为 "World")。simple-hello with name="Claude"
欢迎贡献!请通过提交拉取请求或在 GitHub 仓库中打开问题。
有关问题或功能请求,请在 GitHub 上打开一个问题。
本项目采用 MIT 许可证。