MCP 终端服务器
一个实现了模型上下文协议 (MCP) 的安全终端执行服务器。该服务器提供受控的命令执行功能,并具有安全功能和资源限制。
特征
命令执行:执行带有输出捕获和错误处理的 shell 命令
安全控制:限制允许的命令并防止命令注入
资源控制:
命令超时
最大输出大小限制
MCP 协议支持:
标准 MCP 消息格式
能力广告
流输出支持
发展
本地设置
发布到 PyPI
使用 MCP Inspector 进行测试
MCP Inspector 工具可用于测试服务器实现:
运行测试
与 Claude Desktop 一起使用
一旦包发布到 PyPI:
安装 UV (如果尚未安装):
pip install uv使用 UV 安装包:
uv pip install mcp-terminal配置 Claude Desktop :编辑您的 Claude Desktop 配置文件(在 macOS 上通常位于
~/Library/Application Support/Claude/claude_desktop_config.json):{ "mcpServers": { "terminal": { "command": "uv", "args": [ "pip", "run", "mcp-terminal", "--allowed-commands", "python,pip,git,ls,cd", "--timeout-ms", "30000", "--max-output-size", "1048576" ] } } }
协议实现
服务器实现了具有以下功能的模型上下文协议(MCP):
能力广告
消息格式
要求:
回复:
错误:
安全注意事项
命令验证:
只能执行允许的命令
Shell 操作员被阻止
阻止命令注入尝试
资源保护:
命令超时防止挂起
输出大小限制可防止内存耗尽
所有失败情况的错误处理
最佳实践:
在生产环境中始终设置
allowed-commands使用保守的超时和大小限制
监控命令执行日志
贡献
分叉存储库
创建你的功能分支(
git checkout -b feature/amazing-feature)提交您的更改(
git commit -m 'Add some amazing feature')推送到分支(
git push origin feature/amazing-feature)打开拉取请求
执照
该项目根据 MIT 许可证获得许可 - 有关详细信息,请参阅LICENSE文件。
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
Tools
安全终端执行服务器,通过模型上下文协议 (MCP) 实现具有安全功能和资源限制的受控命令执行。
Related Resources
Related MCP Servers
- Asecurity-licenseAqualityA secure shell command execution server implementing the Model Context Protocol (MCP). This server allows remote execution of whitelisted shell commands with support for stdin input.Last updated -1141MIT License
- Asecurity-licenseAqualityAn MCP server that enables secure terminal command execution, directory navigation, and file system operations through a standardized interface for LLMs.Last updated -1084MIT License
- Asecurity-licenseAqualityAn MCP server that enables secure execution of shell commands across Windows, macOS, and Linux with built-in whitelisting and approval mechanisms for enhanced security.Last updated -94297MIT License
- Asecurity-licenseAqualityA secure server that implements the Model Context Protocol (MCP) to enable controlled execution of authorized shell commands with stdin support.Last updated -1