Back to MCP directory
publicPublicdnsLocal runtime

auto-om

一个基于MCP协议的Linux自动化运维管理服务器,提供74+工具覆盖8大类别,通过SSH连接实现高效Linux服务器管理

article

README

🚀 auto-om - Linux自动化运维管理MCP服务器

auto-om是一个全面的用于Linux自动化运维管理的模型上下文协议(MCP)服务器。该MCP服务器通过SSH连接,提供了8大类、74种以上的工具,可高效管理Linux服务器。

🚀 快速开始

你可以通过以下方式快速启动auto-om服务器:

从源码安装

# 克隆仓库
git clone https://github.com/atoncooper/auto-om.git
cd auto-om

# 使用pipenv安装依赖
pipenv install

# 激活虚拟环境
pipenv shell

# 或者直接使用pip安装
pip install -r requirements.txt

使用Docker

# 构建Docker镜像
docker build -t auto-om:latest .

# 或者使用docker-compose
docker-compose up -d

启动服务器

# 以stdio模式运行(默认,适用于MCP客户端)
python main.py

# 以HTTP模式运行
python main.py --mode http

# 使用自定义主机/端口运行
python main.py --mode http --host 127.0.0.1 --port 9000

# 使用自定义配置
python main.py --config /path/to/config.yaml

使用脚本快速启动

# Linux/macOS
./scripts/start.sh

# Windows
scripts\start.bat

✨ 主要特性

工具类别(共88个工具)

| 类别 | 工具数量 | 状态 | |----------|-------------|--------| | 📁 文件与目录管理 | 12 | ✅ 已完成 | | 📝 文本处理与分析 | 11 | ✅ 已完成 | | 📊 系统监控 | 11 | ✅ 已完成 | | ⚙️ 进程管理 | 10 | ✅ 已完成 | | 👤 用户与权限 | 0 | ⏳ 待完成 | | 🌐 网络操作 | 14 | ✅ 已完成 | | 📦 压缩与归档 | 8 | ✅ 已完成 | | 🔄 包管理 | 7 | ✅ 已完成 |

关键能力

  • 文件操作:创建、复制、移动、删除文件和目录
  • 文本处理:查看、搜索、转换文本文件,支持正则表达式
  • 系统监控:实时监控CPU、内存、磁盘和进程
  • 进程控制:终止、发送信号和管理进程优先级
  • 网络诊断:执行ping、traceroute、DNS、HTTP测试和端口扫描
  • 压缩:创建和提取tar、zip、gzip、bzip2、xz归档文件
  • 包管理:安装、删除、更新软件包(apt、yum、dnf)

📦 安装指南

前提条件

  • Python 3.11或更高版本
  • pip和pipenv
  • 具有SSH访问权限的Linux服务器

从源码安装

# 克隆仓库
git clone https://github.com/atoncooper/auto-om.git
cd auto-om

# 使用pipenv安装依赖
pipenv install

# 激活虚拟环境
pipenv shell

# 或者直接使用pip安装
pip install -r requirements.txt

使用Docker

# 构建Docker镜像
docker build -t auto-om:latest .

# 或者使用docker-compose
docker-compose up -d

💻 使用示例

文件管理

{
  "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
}

📚 详细文档

配置

创建一个application.yaml文件:

# 传输模式: "stdio" 或 "http"
transport:
  mode: http

# HTTP设置(适用于http模式)
http:
  host: 0.0.0.0
  port: 8000

# SSH连接池
ssh_pool:
  default_timeout: 30
  max_retries: 3
  connection_timeout: 10
  retry_delay: 5
  max_connections: 10

  # 添加你的Linux服务器
  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}"

与各种AI开发工具集成的完整文档

| 工具 | 文档 | 使用场景 | |------|---------------|----------| | Claude Code | Claude Code指南 | 基于CLI的AI开发助手 | | Cursor | Cursor指南 | 支持AI的编码IDE | | Trae | Trae指南 | 移动/终端AI助手 |

使用AI工具快速开始

Claude Code(CLI)

# 安装Claude Code
npm install -g @anthropic-ai/claude-code

# 在~/.config/Claude/claude_desktop_config.json中配置
# 然后使用: claude-code "Check server status on server1"

Cursor(IDE)

  1. 打开Cursor设置
  2. 导航到MCP部分
  3. 添加服务器: http://localhost:8000/sse
  4. 在Cursor的AI聊天中开始使用工具

Trae(移动)

  1. 安装Trae应用(iOS/Android)
  2. 添加MCP服务器: http://your-server-ip:8000/sse
  3. 使用语音或文本命令进行服务器管理

MCP客户端集成

使用Postman MCP

  1. 安装Postman MCP客户端
  2. 添加MCP服务器: http://your-server:8000/sse
  3. 工具将自动发现

使用Claude Desktop

添加到claude_desktop_config.json

{
  "mcpServers": {
    "auto-om": {
      "command": "python",
      "args": ["/path/to/auto-om/main.py"],
      "env": {
        "PYTHONPATH": "/path/to/auto-om"
      }
    }
  }
}

🔧 技术细节

架构

auto-om/
├── main.py                 # 入口点
├── application.yaml        # 配置文件
├── requirements.txt        # Python依赖项
├── Dockerfile             # 容器定义
├── docker-compose.yml     # 多容器设置
├── src/
│   ├── core/              # 核心MCP功能
│   │   ├── server.py      # MCP服务器实现
│   │   └── ssh_client.py  # SSH连接池
│   └── tools/             # 工具实现
│       ├── file_mgr.py        # 文件管理(12个工具)
│       ├── text_proc.py        # 文本处理(11个工具)
│       ├── system_monitor.py   # 系统监控(11个工具)
│       ├── process_mgr.py      # 进程管理(10个工具)
│       ├── network_ops.py      # 网络操作(14个工具)
│       ├── compress_ops.py     # 压缩(8个工具)
│       └── package_mgr.py      # 包管理(7个工具)
├── VERSION.md             # 版本历史
└── README.md              # 本文件

安全特性

  • 非根用户操作:所有操作均为非根用户设计
  • 路径验证:禁止对系统目录进行操作
  • 命令验证:阻止危险命令
  • 预运行模式:在执行破坏性操作之前进行预览
  • 连接池管理:安全的SSH连接管理
  • 输出限制:防止响应过大

📄 许可证

本项目采用MIT许可证 - 详情请参阅LICENSE文件。

支持

如有问题或疑问:

  • GitHub问题跟踪:https://github.com/atoncooper/auto-om/issues
  • 文档:VERSION.md

致谢

help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client