Skip to main content
ClaudeWave

SSH Model Context Protocol Server - 为AI模型提供SSH功能

MCP ServersOfficial Registry3 stars0 forksPythonMITUpdated yesterday
ClaudeWave Trust Score
79/100
Trusted
Passed
  • Open-source license (MIT)
  • Actively maintained (<30d)
  • Clear description
Last scanned: 6/11/2026
Install in Claude Code / Claude Desktop
Method: pip / Python · ssh-licco
Claude Code CLI
claude mcp add ssh-licco -- python -m ssh-licco
claude_desktop_config.json (Claude Desktop)
{
  "mcpServers": {
    "ssh-licco": {
      "command": "python",
      "args": ["-m", "ssh_mcp.server"]
    }
  }
}
1. Run the command above in your terminal (Claude Code), or paste the JSON config into claude_desktop_config.json (Claude Desktop).
2. Replace any <placeholder> values with your API keys or paths.
3. Restart Claude. The MCP server and its tools appear automatically.
💡 Install first: pip install ssh-licco

11 items in this repository

skillsSkill
Install

Implement tasks from an OpenSpec change. Use when the user wants to start implementing, continue implementation, or work through tasks.

Install

Archive a completed change in the experimental workflow. Use when the user wants to finalize and archive a change after implementation is complete.

Install

Enter explore mode - a thinking partner for exploring ideas, investigating problems, and clarifying requirements. Use when the user wants to think through something before or during a change.

Install

Propose a new change with all artifacts generated in one step. Use when the user wants to quickly describe what they want to build and get a complete proposal with design, specs, and tasks ready for implementation.

Install

Complete OpenSpec spec-driven development workflow. Guides feature development from proposal through design, tasks, implementation, and archival.

Install

SSH MCP server development guide. Invoke when working on ssh-licco project, including setup, debugging, version management, Docker deployment, and releases.

Install

SSH MCP operations guide. Invoke when user needs to perform SSH server operations like connecting, executing commands, file transfer, or Docker management.

Install

Local setup and configuration guide for SSH MCP. Invoke when user needs to set up, configure, or customize the SSH MCP server locally.

Install

SSH MCP troubleshooting guide. Invoke when user encounters connection issues, authentication errors, npm/npx startup problems, or needs to diagnose SSH/Docker problems.

Install
devlogSkill

Use when the user wants to record a code change, plan, decision, bug fix, or library gotcha in a project. Maintains a per-project DEVLOG.md (chronological, append-only) and a LESSON.md (indexed knowledge base of problem → root cause → solution). Triggers on phrases like 'log this', '记一下', '记到 DEVLOG', '记到 LESSON', '做个总结', 'save a lesson', 'remember this gotcha', or after completing a coding task, making an architectural decision, or fixing a non-trivial bug. Both files stay local-only via .git/info/exclude. Do NOT use for short-lived TODOs (use the issue tracker) or for public notes (use a wiki).

Install
Use cases

MCP Servers overview

# 🚀 SSH LICCO

<!-- mcp-name: io.github.Echoqili/ssh-licco -->

[![PyPI version](https://img.shields.io/pypi/v/ssh-licco.svg?cacheSeconds=1800)](https://pypi.org/project/ssh-licco/)
[![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![MCP Registry](https://img.shields.io/badge/MCP-Registry-green.svg)](https://registry.modelcontextprotocol.io/)

> **让 AI 帮你操作服务器!** 通过自然语言对话,AI 可以帮你执行命令、管理文件、查看日志、部署应用等。

---

## 📚 文档导航

### 快速开始
- **[⬇️ 安装指南](#-快速安装)** - 2 种安装方式
- **[🚀 快速开始](#-快速开始)** - 5 分钟上手
- **[📋 配置模板](#-完整配置示例)** - 开箱即用的配置

### 核心功能
- **[🔐 安全配置](#-安全配置)** - 多级安全策略
- **[🛠️ 可用工具](#-可用工具)** - 完整功能列表
- **[💡 使用示例](#-使用示例)** - 实际应用场景

### 高级主题
- **[📖 完整配置指南](MCP_CONFIG_GUIDE.md)** - 所有配置选项详解
- **[🔧 故障排除](docs/API_REFERENCE.md)** - 常见问题解决
- **[📊 API 参考](docs/API_REFERENCE.md)** - 详细 API 文档

### 开发资源
- **[🎓 Skills 文档](docs/skills/)** - 开发、运维、安装指南
- **[📦 发布指南](docs/skills/RELEASE_SKILL.md)** - 版本发布流程
- **[🐛 GitHub Issues](https://github.com/Echoqili/ssh-licco/issues)** - 问题反馈

---

## ✨ 特性亮点

- 🎯 **自然语言控制** - 用对话方式操作服务器
- 🔐 **多种认证方式** - 密码、密钥、Agent 转发
- 🔗 **长连接支持** - 自动保活(30 秒心跳),避免账户锁定
- ⏱️ **可配置超时** - Banner 超时 (60s)、会话超时 (2 小时),支持自动重连
- 📦 **异步高性能** - 基于 Paramiko 的异步架构(线程池 + asyncio)
- 🛡️ **完善的异常处理** - 统一的错误处理机制(7 层异常层次)
- 📊 **会话管理** - 支持多个并发 SSH 会话(最大 10 个,每主机 3 个)
- 📁 **SFTP 文件传输** - 上传、下载、目录管理
- 🖊️ **远程文件编辑** - 直接写入/追加文件内容,无需下载再上传
- 🔑 **密钥管理** - 生成和管理 SSH 密钥对(RSA/Ed25519)
- 📝 **审计日志** - 完整的操作审计记录(JSON 结构化日志)
- 🚀 **连接池** - 高性能连接复用(PooledConnection + ConnectionPool)
- 📊 **批量执行** - 多主机并行命令执行(BatchExecutor + AsyncBatchExecutor)
- 🐳 **Docker 支持** - Docker 构建和状态监控
- 📋 **后台任务** - 可靠的后台进程启动(nohup + bash -c 包装,单次 SSH 调用无竞态)
- 🖥️ **screen/tmux 会话** - 持久化远程会话,SSH 断开后进程依然存活
- 🪟 **Windows 服务器支持** - 支持 Windows Server(OpenSSH for Windows)与 Linux/macOS 目标主机
- 🔍 **进程管理** - 启动/停止/查询远程进程、SSH 端口转发(tunnel)
- 🔍 **看门狗** - 任务监控、心跳检测、全局异常处理
- 🛡️ **文件传输路径安全校验** - `ssh_file_transfer` delete 自动识别 Windows / Unix 路径风格并拦截敏感路径与路径遍历

---

## 🖥️ 目标主机支持

SSH-LICCO 基于标准 SSH/SFTP 协议,可连接以下目标主机:

| 操作系统 | 要求 | 备注 |
|---|---|---|
| **Linux** | OpenSSH 7.0+ | 推荐,完整支持所有功能 |
| **Windows Server** | OpenSSH for Windows / PowerShell Remoting over SSH | v2.1.3+ 支持 Windows 路径风格与安全校验 |
| **macOS** | 系统内置 OpenSSH | 完整支持 |

> **提示**:连接 Windows 服务器时,请使用 Windows 风格路径(如 `C:\temp\file.txt`),系统会自动识别并进行路径安全校验。

---

## 📦 快速安装

### 方式一:pip 安装(推荐)

```bash
pip install ssh-licco
```

### 方式二:从源码安装

```bash
git clone https://github.com/Echoqili/ssh-licco.git
cd ssh-licco
pip install -e .
```

**Python 版本要求:** Python 3.10+

---

## 🚀 快速开始

### 1️⃣ 配置 MCP 服务器

#### 在 Trae / Cursor / Claude Desktop 中使用

打开设置 → MCP → 添加新服务器:

```json
{
  "mcpServers": {
    "ssh": {
      "command": "python -m ssh_mcp.server"
    }
  }
}
```

### 2️⃣ 配置 SSH 连接(可选但推荐)

#### 方式 A:环境变量配置(推荐)

```json
{
  "mcpServers": {
    "ssh": {
      "command": "python -m ssh_mcp.server",
      "env": {
        "SSH_HOST": "192.168.1.100",
        "SSH_USER": "root",
        "SSH_PASSWORD": "your_password",
        "SSH_PORT": "22",
        "SSH_TIMEOUT": "60",
        "SSH_KEEPALIVE_INTERVAL": "30",
        "SSH_SESSION_TIMEOUT": "7200",
        "SSH_CLIENT_TYPE": "common"
      }
    }
  }
}
```

**环境变量说明:**
- `SSH_HOST`: SSH 服务器地址
- `SSH_USER`: 用户名
- `SSH_PASSWORD`: 密码
- `SSH_PORT`: 端口(默认 22)
- `SSH_TIMEOUT`: 连接超时(秒)
- `SSH_KEEPALIVE_INTERVAL`: 保活间隔(秒)
- `SSH_SESSION_TIMEOUT`: 会话超时(秒)
- `SSH_CLIENT_TYPE`: SSH 客户端类型(可选,默认 `common`)
  - `common` - paramiko(稳定可靠,推荐)⭐
  - `performance` - asyncssh(高性能,适合高并发)🚀
  - `development` - fabric(简化 API,适合快速开发)👨‍💻

---

## 🔐 安全配置

> **重要**:从 v0.2.1 开始,ssh-licco 提供多级安全策略,可根据使用场景灵活配置。

### 多级安全策略

| 级别 | 名称 | 适用场景 | 安全评分 |
|------|------|----------|----------|
| **STRICT** | 严格模式 | 生产环境、公共服务器 | 最高 ⭐⭐⭐ |
| **BALANCED** | 平衡模式 | 开发环境、个人服务器(默认) | 高 ⭐⭐ |
| **RELAXED** | 宽松模式 | 测试环境、完全信任的服务器 | 中等 ⭐ |

### 快速配置

#### 方式 1:环境变量(推荐)

**Windows PowerShell**:
```powershell
$env:SSH_SECURITY_LEVEL = "balanced"
$env:SSH_EXTRA_ALLOWED_COMMANDS = "git,pip,npm"
```

**Linux/Mac**:
```bash
export SSH_SECURITY_LEVEL="balanced"
export SSH_EXTRA_ALLOWED_COMMANDS="git,pip,npm"
```

#### 方式 2:MCP 配置文件

```json
{
  "mcpServers": {
    "ssh": {
      "command": "python -m ssh_mcp.server",
      "env": {
        "SSH_SECURITY_LEVEL": "balanced",
        "SSH_EXTRA_ALLOWED_COMMANDS": "git,pip,npm",
        "SSH_BASE_DIR": "/home"
      }
    }
  }
}
```

### 📖 详细文档

- **[MCP_CONFIG_GUIDE.md](MCP_CONFIG_GUIDE.md)** - 完整配置指南,包含 5 种使用场景示例
- **[SECURITY_CONFIG_GUIDE.md](SECURITY_CONFIG_GUIDE.md)** - 安全配置详解

### 🛡️ 硬拦截灾难性命令(v2.2.0 新增)

为防止任何误操作或越权调用直接打到远程 shell,ssh-licco 在所有安全级别下都**无条件**拦截以下灾难性命令模式,**无法通过 `confirm_dangerous=true`、`confirmation_layer=N`、调整 `SSH_SECURITY_LEVEL` 等任何方式绕过**:

- `rm -rf` 作用于绝对路径(含 `/`、`/*`、`/path`、`/path/*`,`-fr` 变体同效)
- `mkfs.*` 任意文件系统格式化
- `dd if=/dev/(zero|random|urandom) of=/dev/(sd|nvme)` 覆写裸盘
- bash fork-bomb(`:(){ :|:& };:` 及空白变体)
- `chmod -R 777 /` / `chmod -R 000 /` 根目录递归改权限
- `> /dev/(sd|nvme)` / `>> /dev/(sd|nvme)` 裸设备重定向

如确需执行上述操作,请直接通过 SSH 登录服务器(绕过 MCP 网关)进行。安全且可逆的替代方案:

```bash
# 旧做法(v2.2.0 之前):rm -rf /path/to/junk  ← 现已被硬拦截
# 推荐做法:mv 到回收站,约定时间后清理
mv /path/to/junk /tmp/.trash_$(date +%s)/
```

命中硬拦截时会输出 `WARNING` 审计日志(含 category 与命令),便于 SOC 监控。

---

## 🛠️ 可用工具(v2.2.0 维持 9 个;v2.1.0 曾增加的 3 个审批工具因流程闭环风险已下线)

| 工具 | 描述 | 核心能力 |
|------|------|---------|
| `ssh_connect` | 连接管理 | 自动读取环境变量/配置,支持密码+密钥认证,可保存配置,登录后自动执行命令 |
| `ssh_execute` | 命令执行 | 自动连接、智能后台检测、长任务等待、超时控制,支持 nohup/screen/tmux 三种后台模式;v2.2.0 起对灾难性命令(rm -rf 绝对路径、mkfs、raw-disk dd、fork-bomb 等)做**无条件硬拦截** |
| `ssh_disconnect` | 会话管理 | 断开指定会话 OR 列出所有活跃会话 |
| `ssh_file_transfer` | 文件传输 | 上传/下载/列表/写入/追加/删除/创建目录/查看元信息(8 种操作);v2.1.3+ delete 操作新增 Windows/Unix 敏感路径拦截与路径遍历防护 |
| `ssh_host` | 主机管理 | `action=list/add/remove` 增删查主机配置 |
| `ssh_docker` | Docker 管理 | `action=ps/images/build/logs` 全生命周期管理 |
| `ssh_generate_key` | 密钥生成 | RSA / Ed25519 密钥对 |
| `ssh_session` | screen/tmux 会话 | 持久化远程会话管理(create/send/capture/list/kill),SSH 断开后进程依然存活 |
| `ssh_process` | 进程管理 | 启动/停止/查询远程进程,SSH 端口转发(tunnel_open/tunnel_close/tunnel_list) |

> **关于 v2.1.0 引入的 3 个审批工具**(`ssh_request_approval` / `ssh_approve_command` / `ssh_list_approvals`):已从 MCP `list_tools()` 移除,**代码已在 v2.2.0 删除**(`ssh_mcp/approval.py`、`ssh_mcp/handlers/approval.py`)。审批流程依赖 AI 自报命令、运维侧背书,存在闭环风险;v2.2.0 的硬拦截更直接——灾难性命令在 MCP 网关层就被拒绝,运维侧不需要再走"先申请再审批"流程。

### 📖 详细文档

- **[docs/API_REFERENCE.md](docs/API_REFERENCE.md)** - 完整 API 参考
- **[docs/skills/ssh-mcp-ops/SKILL.md](docs/skills/ssh-mcp-ops/SKILL.md)** - 运维操作指南

---

## 💡 使用示例

### 示例 1:执行命令

```
用户:帮我查看服务器上的 Docker 容器
AI:调用 ssh_connect → ssh_execute "docker ps"

[执行结果]
CONTAINER ID   IMAGE     COMMAND   STATUS   PORTS
abc123         nginx     "nginx"   Up 2 days 80:80
```

### 示例 2:文件上传

```
用户:把这个文件上传到 /var/www/html
AI:调用 ssh_connect → ssh_file_transfer

[上传成功]
本地:./index.html
远程:/var/www/html/index.html
大小:2.3 KB
```

### 示例 3:Docker 构建(长任务)

```
用户:帮我构建 Docker 镜像
AI:调用 ssh_execute(background=True) 后台执行 docker build...

[后台任务已启动]
Session ID: a1b2c3d4
命令:docker build -t myapp .
使用 ssh_execute(session_id="a1b2c3d4", command="cat /tmp/build.log") 查看进度
```

### 示例 4:数据库检查

```
用户:检查 PostgreSQL 是否正常运行
AI:调用 ssh_execute "pg_isready -h localhost -p 5432"

[检查结果]
localhost:5432 - accepting connections
✅ PostgreSQL 运行正常
```

### 📖 更多示例

- **[docs/skills/ssh-mcp-ops/SKILL.md](docs/skills/ssh-mcp-ops/SKILL.md)** - 运维操作示例
- **[docs/skills/ssh-mcp-dev/SKILL.md](docs/skills/ssh-mcp-dev/SKILL.md)** - 开发场景示例

---

## 📋 完整配置示例

### 场景 1:Web 开发者

```json
{
  "mcpServers": {
    "ssh": {
      "command": "python -m ssh_mcp.server",
      "env": {
        "SSH_SECURITY_LEVEL": "balanced",
        "SSH_EXTRA_ALLOWED_COMMANDS": "git,npm,docker,composer,pm2",
        "SSH_BASE_DIR": "/var/www",
        "SSH_HOST": "192.168.1.100",
        "SSH_USER": "deploy",
        "SSH_PASSWORD": "your-password"
      }
    }
  }
}
```

### 场景 2:Python 开发者

```json
{
  "mcpServers": {
    "ssh": {
      "command": "python -m ssh_mcp.server",
      "env": {
        "SSH_SECURITY_LEVEL": "balanced",
        "SSH_EXTRA_ALLOWED_COMMANDS": "pip,poetry,python3,pytest,black",
        "SSH_HOST": "192.168.1.100",
        "SSH_USER": "developer",
        "SSH_PASSWORD": "your-password"
      }
    }
  }
}
```

### 场景 3:数据库管理员

```json
{
  "mcpServers": {
    "ssh": {
      "command": "python -m ssh_mcp.server",
      "env": {
        "SSH_SECURITY_LEVEL": "balanced",
        "SSH_EXTRA_ALLOWED_COMMANDS": "psql,mysql,mongosh,pg_isready",
        "SSH_HOST": "192.168.1.100",
        "SSH_USER": "dbadmin",
        "SSH_PASSWORD": "your-password"
      }
    }
  }
}
```

### 场景 4:系统管理员

```json
{
  "mcpServers": {
    "ssh": {
      "command": "python -m ssh_mcp.server",
      "env": {
        "SSH_SECURITY_LEVEL": "relaxed",
        "SSH_EXTRA_ALLOWED_COMMANDS": "sudo,apt,yum,systemctl,journalctl,docker,kubectl",
        "SSH_HOST": "192.168.1.100",
        "SSH_USER": "root",
        "SSH_PASSWORD": "your-password"
      }
    }
  }
}
```

### 场景 5:生产环境(最高安全)

```json
{
  "mcpServers": {
    "ssh": {
      "command": "python -m ssh_mcp.server",
      "env": {
        "SSH_SECURITY_LEVEL": "strict",
        "SSH_HOST": "192.168.1.100",
        "SSH_USER": "app-user",
        "SSH_PASSWORD": "your-password",
        "SSH_BASE_DIR": "/home/app-user"
      }
    }
  }
}
```

### 📖 更多配置

- **[MCP_CONFIG_GUIDE.md](MCP_CONFIG_GUIDE.md)** - 包含所有配置选项的详细说明

### 🌐 完整环境变量速查(v2.3.0)

> 下表所有变量均被代码读取。**注意**:
> - `SSH_RATE_LIMIT` 是 **bool** 总开关(true/false),`SSH_RATE_LIMIT_MAX` 才是次数上限,两者分开配置
> - 主机密钥检查(strict_host_key_checking)**不通过 env 配置**,请用 `ssh_connect` 工具参数或 `hosts.json`

| 分类 | 变量 | 默认 | 说明 |
|------|------|------|------|
| **安全** | `SSH_SECURITY_LEVEL` | `balanced` | 安全级别:`strict` / `balanced` / `relaxed` |
|  | `SSH_BASE_DIR` | `/home` | 路径校验基目录 |
|  | `SSH_EXT

What people ask about ssh-licco

What is Echoqili/ssh-licco?

+

Echoqili/ssh-licco is mcp servers for the Claude AI ecosystem. SSH Model Context Protocol Server - 为AI模型提供SSH功能 It has 3 GitHub stars and was last updated yesterday.

How do I install ssh-licco?

+

You can install ssh-licco by cloning the repository (https://github.com/Echoqili/ssh-licco) or following the README instructions on GitHub. ClaudeWave also provides quick install blocks on this page.

Is Echoqili/ssh-licco safe to use?

+

Our security agent has analyzed Echoqili/ssh-licco and assigned a Trust Score of 79/100 (tier: Trusted). See the full breakdown of passed checks and flags on this page.

Who maintains Echoqili/ssh-licco?

+

Echoqili/ssh-licco is maintained by Echoqili. The last recorded GitHub activity is from yesterday, with 0 open issues.

Are there alternatives to ssh-licco?

+

Yes. On ClaudeWave you can browse similar mcp servers at /categories/mcp, sorted by popularity or recent activity.

Deploy ssh-licco to your cloud

Ship this repo to production in minutes. Each platform spins up its own environment with editable env vars.

Maintain this repo? Add a badge to your README

Drop the badge into your GitHub README to show it's tracked on ClaudeWave. Each badge links back to this page and reflects the live Trust Score.

Featured on ClaudeWave: Echoqili/ssh-licco
[![Featured on ClaudeWave](https://claudewave.com/api/badge/echoqili-ssh-licco)](https://claudewave.com/repo/echoqili-ssh-licco)
<a href="https://claudewave.com/repo/echoqili-ssh-licco"><img src="https://claudewave.com/api/badge/echoqili-ssh-licco" alt="Featured on ClaudeWave: Echoqili/ssh-licco" width="320" height="64" /></a>

More MCP Servers

ssh-licco alternatives