Integrations
Enables execution of Git commands through the shell interface, allowing AI agents to perform version control operations like commits, pulls, pushes, and branch management.
Supports running npm commands through the shell interface, enabling package management operations like installing, updating, and removing JavaScript packages.
Facilitates running pnpm commands through the shell interface, offering fast, disk-space efficient package management for JavaScript projects.
MCP Shell 服务器
使用模型上下文协议 (MCP) 执行 Shell 命令的服务器。它充当桥梁,使 AI 代理能够安全地执行 Shell 命令。
特征
- 执行shell命令(单行和多行支持)
- 支持各种shell(bash、zsh、fish、powershell、cmd等)
- 详细的错误处理和日志记录
- 兼容 MCP Inspector
安装
从 npm(作为用户)
从源头(用于开发)
MCP 配置
游标配置
将以下内容添加到您的 Cursor 配置文件( ~/.cursor/config.json
):
规则配置
将以下内容添加到您的 Cursor 规则文件中:
用法
直接执行
开发模式
使用 MCP Inspector 进行测试
命令行参数
工具参考
shell_exec
在指定的 shell 中执行命令。
参数:
command
(字符串,必需):要执行的 shell 命令
资源参考
服务器提供以下系统信息作为资源:
主机名
返回系统的主机名。
URI: hostname://
平台
返回操作系统平台。
URI: platform://
壳
返回服务器正在使用的 shell 路径。
URI: shell://
用户名
返回当前用户名。
URI: username://
系统信息
以 JSON 格式返回全面的系统信息,包括:
- 主机名
- 平台
- 壳
- 用户名
- CPU 数量
- 总内存
- 释放内存
- 系统正常运行时间
使用示例
基本命令执行
多行命令(Heredoc)执行
发展
项目结构
日志记录
日志写入mcp-shell.log
文件。
执照
麻省理工学院
You must be authenticated.
Tools
使用模型上下文协议 (MCP) 的服务器允许 AI 代理在主机系统上安全地执行 shell 命令。