auto-om-Linux自动化操作管理MCP服务器
](https://github.com/atoncooper/auto-om)  
用于Linux自动化操作管理的综合模型上下文协议(MCP)服务器。此MCP服务器提供8个类别的74多种工具,通过SSH连接实现高效的Linux服务器管理。
特性
工具类别(共88种工具)
| 类别 | 工具计数 | 状态 |
|---|---|---|
| 📁 文件和目录管理 | 12 | ✅ 完成 |
| 📝 文本处理与分析 | 11 | ✅ 完成 |
| 📊 系统监控 | 11 | ✅ 完成 |
| ⚙️ 流程管理 | 10 | ✅ 完成 |
| 👤 用户和权限 | 0 | ⏳ 待定 |
| 🌐 网络运营 | 14 | ✅ 完成 |
| 📦 压缩和存档 | 8 | ✅ 完成 |
| 🔄 包管理 | 7 | ✅ 完成 |
关键能力
- 文件操作:创建、复制、移动、删除文件和目录
- 文本处理:使用正则表达式支持查看、搜索和转换文本文件
- 系统监控:CPU、内存、磁盘、实时进程监控
- 过程控制:终止、发出信号并管理流程优先级
- 网络诊断:Ping、跟踪路由、DNS、HTTP测试、端口扫描
- 压缩:创建和提取tar、zip、gzip、bzip2、xz存档
- 包管理:安装、删除、更新软件包(apt、yum、dnf)
安装
先决条件
- Python 3.11或更高版本
- pip和pipenv
- 具有SSH访问权限的Linux服务器
从源安装
# Clone the repository
git clone https://github.com/atoncooper/auto-om.git
cd auto-om
# Install dependencies with pipenv
pipenv install
# Activate virtual environment
pipenv shell
# Or install with pip directly
pip install -r requirements.txt使用Docker
# Build the Docker image
docker build -t auto-om:latest .
# Or use docker-compose
docker-compose up -d配置
创建 application.yaml 文件:
# Transport mode: "stdio" or "http"
transport:
mode: http
# HTTP settings (for http mode)
http:
host: 0.0.0.0
port: 8000
# SSH connection pool
ssh_pool:
default_timeout: 30
max_retries: 3
connection_timeout: 10
retry_delay: 5
max_connections: 10
# Add your Linux servers
servers:
- host: "192.168.1.100"
port: 22
username: "your_username"
password: "your_password"
alias: "server1"⚠️ 安全警告:在生产中对敏感数据使用环境变量:
export SSH_PASSWORD="your_password"然后在YAML中引用它:
servers:
- host: "192.168.1.100"
username: "your_username"
password: "${SSH_PASSWORD}"用法
启动服务器
# Run in stdio mode (default, for MCP clients)
python main.py
# Run in HTTP mode
python main.py --mode http
# Run with custom host/port
python main.py --mode http --host 127.0.0.1 --port 9000
# Using custom config
python main.py --config /path/to/config.yamlDocker 使用
# Run with docker-compose
docker-compose up
# Run with docker
docker run -p 8000:8000 \
-v $(pwd)/application.yaml:/app/application.yaml \
auto-om:latest文档
与各种AI开发工具集成的完整文档:
快速开始使用AI工具
克劳德代码(CLI)
# Install Claude Code
npm install -g @anthropic-ai/claude-code
# Configure in ~/.config/Claude/claude_desktop_config.json
# Then use: claude-code "Check server status on server1"光标(IDE)
- 打开光标设置
- 导航到MCP部分
- 添加服务器:
http://localhost:8000/sse - 开始在Cursor的AI聊天中使用工具
Trae(移动)
- 安装trae应用程序(IOS/Android)
- 添加MCP服务器:
http://your-server-ip:8000/sse - 使用语音或文本命令进行服务器管理
快速开始
使用提供的脚本:
# Linux/macOS
./scripts/start.sh
# Windows
scripts\start.batMCP客户端集成
使用邮递员MCP
- 安装Postman MCP客户端
- 添加MCP服务器:
http://your-server:8000/sse - 工具将被自动发现
使用克劳德桌面
添加到 claude_desktop_config.json:
{
"mcpServers": {
"auto-om": {
"command": "python",
"args": ["/path/to/auto-om/main.py"],
"env": {
"PYTHONPATH": "/path/to/auto-om"
}
}
}
}工具示例
文件管理
{
"host": "server1",
"path": "/home/user/documents"
}系统监控
{
"host": "server1",
"human_readable": true
}过程控制
{
"host": "server1",
"pid": 1234,
"signal": "TERM"
}网络诊断
{
"host": "server1",
"destination": "google.com",
"count": 5
}包管理
{
"host": "server1",
"packages": "nginx",
"dry_run": true
}建筑
auto-om/
├── main.py # Entry point
├── application.yaml # Configuration file
├── requirements.txt # Python dependencies
├── Dockerfile # Container definition
├── docker-compose.yml # Multi-container setup
├── src/
│ ├── core/ # Core MCP functionality
│ │ ├── server.py # MCP server implementation
│ │ └── ssh_client.py # SSH connection pool
│ └── tools/ # Tool implementations
│ ├── file_mgr.py # File management (12 tools)
│ ├── text_proc.py # Text processing (11 tools)
│ ├── system_monitor.py # System monitoring (11 tools)
│ ├── process_mgr.py # Process management (10 tools)
│ ├── network_ops.py # Network operations (14 tools)
│ ├── compress_ops.py # Compression (8 tools)
│ └── package_mgr.py # Package management (7 tools)
├── VERSION.md # Version history
└── README.md # This file安全功能
- 非根操作:所有为非root用户设计的操作
- 路径验证:禁止对系统目录进行操作
- 命令验证:危险命令被阻止
- 干运行模式:执行前预览破坏性操作
- 连接池:安全的SSH连接管理
- 输出限制:防止压倒性的反应
支持的Linux发行版
- Debian 10+
- Ubuntu 18.04+
- CentOS 7+
- RHEL 7+
- Fedora 30+
依赖项
- Python 3.11+
- paramiko 3.5.0(SSH2协议)
- mcp 1.25.0(模型上下文协议)
- pyyaml 6.0.3(YAML配置)
发展
# Install development dependencies
pipenv install --dev
# Run tests (when available)
pytest tests/
# Format code
black src/
# Type checking
mypy src/版本历史
看 版本.md 查看详细的版本历史。
贡献
- 分叉存储库
- 创建要素分支
- 进行更改
- 提交拉取请求
许可证
此项目根据MIT许可证获得许可-请参阅 许可证 文件以获取详细信息。
支持
对于问题和疑问:
- GitHub问题:https://github.com/atoncooper/auto-om/issues
- 文档: 版本.md
致谢
- 建于 MCP Python SDK
- 灵感来自常见的Linux自动化工具
