cygnus-ssh-mcp

cygnus-ssh-mcp

Enables AI assistants to manage remote servers via SSH with 43 specialized tools for command execution, file editing, directory operations, and background tasks across Linux, macOS, and Windows.

Category
访问服务器

README

<div align="center">

<img src="https://raw.githubusercontent.com/cygnussystems/cygnus-ssh-mcp/master/assets/banner.png" alt="cygnus-ssh-mcp" width="400">

cygnus-ssh-mcp

The most powerful SSH MCP server for AI assistants

PyPI version Python License: GPL v3 Tests

Give Claude full control of your Linux, macOS, and Windows servers with 43 specialized tools

Installation · Quick Start · Features · Documentation

</div>


Why cygnus-ssh-mcp?

Most SSH MCP servers let you run commands. cygnus-ssh-mcp lets you manage servers.

What you get Basic SSH MCP cygnus-ssh-mcp
Run commands
Pre-configured hosts with aliases
Sudo support (Linux/macOS) Limited
Windows Server support
Background task management
Line-level file editing
Command history with output
Recursive directory operations
Archive create/extract
Full Unicode support ?

Installation

pip install cygnus-ssh-mcp

Or run without installing using uvx:

uvx cygnus-ssh-mcp

Quick Start

1. Create your hosts file

Create ~/.mcp_ssh_hosts.toml:

# Minimal (password auth) - only required fields
["user@server.example.com"]
password = "your_password"
port = 22

# With alias and sudo (most common setup)
["admin@production.example.com"]
password = "your_password"
port = 22
sudo_password = "sudo_pass"        # optional: for use_sudo operations
alias = "prod"                     # optional: connect by alias
description = "Production server"  # optional: for documentation

# SSH key authentication
["deploy@staging.example.com"]
keyfile = "~/.ssh/id_ed25519"
port = 22
alias = "staging"

# Windows Server (requires OpenSSH)
["administrator@winserver.example.com"]
password = "your_password"
port = 22
alias = "win-prod"

Required fields: port + (password OR keyfile) Optional fields: alias, description, sudo_password, key_passphrase

Host file locations: Default is ~/.mcp_ssh_hosts.toml. Falls back to ./mcp_ssh_hosts.toml if not found. Use --config /path/to/hosts.toml for a custom location.

2. Add to Claude Desktop

Edit your claude_desktop_config.json:

{
  "mcpServers": {
    "ssh": {
      "command": "cygnus-ssh-mcp"
    }
  }
}

Or with a custom hosts file location:

{
  "mcpServers": {
    "ssh": {
      "command": "cygnus-ssh-mcp",
      "args": ["--config", "/path/to/my_hosts.toml"]
    }
  }
}

3. Start managing servers

In Claude, just say:

"Connect to prod and show me the disk usage"

"Edit /etc/nginx/nginx.conf and change worker_connections to 2048"

"Find all .log files larger than 100MB in /var/log"


Platform Support

cygnus-ssh-mcp works from any client (Windows, Linux, macOS) to any target server:

<div align="center"> <img src="https://raw.githubusercontent.com/cygnussystems/cygnus-ssh-mcp/master/assets/ssh_mcp_platforms.png" alt="Platform Support" width="600"> </div>

From (Client) To (Target) Status
Windows Linux ✅ Tested
Windows Windows ✅ Tested
Linux Linux ✅ Tested
Linux Windows ✅ Tested
macOS Any ✅ Supported

Windows targets require OpenSSH Server installed and running.


Features

Host Configuration

Stop typing credentials. Connect by alias.

["admin@server.com"]
password = "secret"
port = 22
alias = "web"

Then just: "Connect to web"

Supports password, SSH key, and encrypted keys with passphrase.


Line-Level File Editing

Edit config files with surgical precision—no download/upload needed.

# Replace a single line
ssh_file_replace_line(
    file_path="/etc/nginx/nginx.conf",
    match_line="worker_connections 1024;",
    new_line="worker_connections 4096;"
)

# Insert lines after a match
ssh_file_insert_lines_after_match(
    file_path="/etc/hosts",
    match_line="# Custom entries",
    lines_to_insert=["192.168.1.10 app.local", "192.168.1.11 db.local"]
)

Safety built-in: Operations fail if the match isn't unique—no accidental mass edits.


Background Task Management

Launch long-running processes and check back later.

# Start a backup (returns immediately)
ssh_task_launch(command="./backup.sh", stdout_log="/var/log/backup.log")

# Check status anytime
ssh_task_status(pid=12345)  # → 'running' or 'exited'

# Kill if needed
ssh_task_kill(pid=12345, force=True)

Comprehensive Sudo Support

Every tool supports use_sudo. Password is handled automatically.

ssh_file_write(path="/etc/app/config.yaml", content="...", use_sudo=True)
ssh_dir_mkdir(path="/opt/myapp", use_sudo=True)
ssh_archive_extract(archive="/backup.tar.gz", dest="/", use_sudo=True)

Dual Timeout System

Never get stuck on a hanging command.

ssh_cmd_run(
    command="./long_script.sh",
    io_timeout=60.0,       # Kill if no output for 60s
    runtime_timeout=3600.0  # Kill if total time exceeds 1 hour
)

Full Unicode Support

Write and read files with emojis, international text, and special characters—on all platforms.

✅ ❌ 🎉 • → ≥ ∞ │ ┌ ─ 你好 مرحبا Привет café naïve

How it works: ssh_file_read and ssh_file_write use SFTP for direct binary transfer, completely bypassing shell encoding issues. This means Unicode works perfectly even on Windows targets where PowerShell's console encoding would normally corrupt special characters.


Windows Server Support

Full support for Windows targets with OpenSSH Server:

  • PowerShell & CMD command execution
  • Windows path handling (backslashes, drive letters, UNC paths)
  • Administrator detection — shows if session has elevated privileges
  • SFTP-based file operations — Unicode-safe, no encoding issues

Note: use_sudo is ignored on Windows (no sudo equivalent). For elevated operations, connect with an Administrator account.


And Much More...

  • Command history with output retention and pattern filtering
  • Recursive directory operations: search, copy, delete with dry-run
  • Archive operations: create and extract tar.gz
  • System info: OS version, memory, disk, CPU, uptime
  • Pattern search: regex and plain text in files

All 43 Tools

Connection & Host Management (10 tools)

Tool Description
ssh_conn_connect Connect using pre-configured host (by key or alias)
ssh_conn_is_connected Check if SSH connection is active
ssh_conn_status Get connection status (user, host, OS, cwd)
ssh_conn_host_info Get detailed system information
ssh_conn_verify_sudo Verify sudo access
ssh_conn_add_host Add new host to configuration
ssh_host_list List all configured hosts
ssh_host_remove Remove host from configuration
ssh_host_disconnect Disconnect current session
list_tools List all available tools

Command Execution (6 tools)

Tool Description
ssh_cmd_run Execute command with I/O and runtime timeouts
ssh_cmd_kill Terminate running command
ssh_cmd_check_status Check command status
ssh_cmd_output Retrieve output from command
ssh_cmd_history Get command history with filtering
ssh_cmd_clear_history Clear command history

Background Tasks (3 tools)

Tool Description
ssh_task_launch Launch command in background
ssh_task_status Check if task is running
ssh_task_kill Send signal to task

File Operations (12 tools)

Tool Description
ssh_file_stat Get file metadata
ssh_file_read Read file contents via SFTP (Unicode-safe)
ssh_file_write Create/overwrite/append file
ssh_file_copy Copy file
ssh_file_move Move or rename file
ssh_file_transfer Upload or download files
ssh_file_find_lines_with_pattern Search for pattern in file
ssh_file_get_context_around_line Get context around match
ssh_file_replace_line Replace single line
ssh_file_replace_line_multi Replace with multiple lines
ssh_file_insert_lines_after_match Insert lines after match
ssh_file_delete_line_by_content Delete line by content

Directory Operations (10 tools)

Tool Description
ssh_dir_mkdir Create directory
ssh_dir_remove Remove directory
ssh_dir_list_files_basic Basic directory listing
ssh_dir_list_advanced Recursive listing with metadata
ssh_dir_search_glob Search files by pattern
ssh_dir_search_files_content Search text in files
ssh_dir_calc_size Calculate directory size
ssh_dir_delete Delete with dry-run support
ssh_dir_batch_delete_files Batch delete by pattern
ssh_dir_copy Copy directory recursively

Archive Operations (2 tools)

Tool Description
ssh_archive_create Create tar.gz archive
ssh_archive_extract Extract archive

Documentation

Detailed guides available in docs/:


Use Cases

  • DevOps Automation — Deploy, configure, and manage servers via AI
  • Log Analysis — Search and analyze logs across multiple servers
  • Configuration Management — Edit configs with precision line operations
  • Backup & Recovery — Create archives, transfer files, restore backups
  • System Monitoring — Check status, verify services, monitor processes
  • Security Auditing — Search for sensitive patterns, verify configurations

License

GPL-3.0 — Free and open source.


<div align="center">

Built by Cygnus Systems

Star this repo if you find it useful!

</div>

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选