NikolaNddTesla/ssh-mcp-server

NikolaNddTesla/ssh-mcp-server

SSH MCP Server - AI manages remote servers via SSH. Multi-server, SFTP zero-token transfer, SOCKS5 proxy, jump host, 2FA, async transfer with progress.

Category
访问服务器

README

@nl4ever/sshmcp

npm version MCP Registry License: MIT

中文文档

Let AI manage your remote servers. A Model Context Protocol (MCP) server that gives AI assistants full SSH access — execute commands, transfer files, manage multiple servers simultaneously, all through natural conversation.

You:   "Deploy the latest build to production server"
AI:    connects → uploads build → restarts service → verifies status

Features

  • 21 Tools — Connect, execute, upload, download, write files, and more
  • Connection Pool — Operate multiple servers simultaneously, each command tagged with server_id
  • Zero-Token File Transfer — SFTP path-based transfer, file content never enters AI context
  • Directory Upload — Auto tar.gz compress → upload → remote decompress (fast for many small files)
  • Async Transfer + Progress — Background transfer for large files with real-time progress tracking
  • Quick Connect — Temporary connections without saving config, returns host:port as temp ID
  • SOCKS4/5 Proxy — Per-connection proxy support
  • Jump Host — SSH ProxyJump for bastion/gateway access
  • Multi-Auth — Password, private key, ssh-agent, keyboard-interactive (OTP/2FA)

Quick Start

Install globally

npm install -g @nl4ever/sshmcp

Add to Claude Code

claude mcp add sshmcp sshmcp

Add to Claude Desktop

Edit claude_desktop_config.json:

{
  "mcpServers": {
    "sshmcp": {
      "command": "npx",
      "args": ["-y", "@nl4ever/sshmcp"]
    }
  }
}

Add to Cursor

Go to Settings → MCP Servers → Add:

{
  "sshmcp": {
    "command": "npx",
    "args": ["-y", "@nl4ever/sshmcp"]
  }
}

Tools Overview

Connection Management

Tool Description
list_servers List all configured servers and active connections
get_server View server config details
add_server Add/update server config (password, key, agent, OTP)
update_server Modify server config (only pass fields you want to change)
delete_server Remove a server
rename_server Rename a server ID
connect Manually connect (usually not needed, tools auto-connect)
quick_connect Temporary connection, returns host:port as ID
disconnect Disconnect specific server or all connections
test_connection Test connectivity without affecting existing connections

Command Execution

Tool Description
execute Run shell commands on remote server (with configurable timeout)

File Operations

Tool Description
read_file Read remote file content (with optional line range)
write_file Write text content to remote file
upload_file Upload local file to remote (supports async mode)
upload_directory Upload directory with auto compress → transfer → decompress
download_file Download remote file to local (supports async mode)
download_directory Download directory with remote compress → transfer → local decompress
transfer_status Check progress of async transfers (size/speed/ETA)

Proxy Management

Tool Description
list_proxies List all SOCKS proxy presets
add_proxy Add SOCKS4/5 proxy preset
delete_proxy Remove a proxy preset

Connection Pool: Multi-Server Operations

All operation tools take a server_id parameter. The connection pool auto-manages connections — no manual connect/disconnect needed:

AI: execute(server_id="prod", command="nginx -s reload")         ← auto-connects to prod
AI: execute(server_id="dev", command="tail -f /var/log/app.log") ← auto-connects to dev, prod stays
AI: execute(server_id="prod", command="curl localhost")           ← reuses prod connection

For temporary servers, use quick_connect which returns host:port as the ID:

AI: quick_connect(host="1.2.3.4", username="root", password="***")
→ "Connected: root@1.2.3.4:22, use server_id="1.2.3.4:22""

AI: execute(server_id="1.2.3.4:22", command="df -h")
AI: disconnect(server_id="1.2.3.4:22")

Async Transfer (Large Files)

For large files, enable background transfer mode to avoid blocking:

AI: upload_file(server_id="prod", local_path="big.tar.gz", remote_path="/data/", async_transfer=true)
→ "Background upload started: tf_1"

AI: transfer_status("tf_1")
→ "🔄 Uploading: 638.2 MB / 1.2 GB (53.2%) — 12.4 MB/s, ETA 46s"

AI: transfer_status("tf_1")
→ "✅ Upload complete: 1.2 GB, 98s, 12.3 MB/s"

Small files use synchronous mode by default — no config needed.

Connection Examples

Password authentication

AI: add_server(server_id="prod", name="Production", host="10.0.0.1", username="deploy", password="***")
AI: execute(server_id="prod", command="systemctl status nginx")

Private key authentication

AI: add_server(server_id="aws", name="AWS EC2", host="ec2-xx.compute.amazonaws.com", username="ubuntu", private_key="~/.ssh/id_rsa")

Quick connect (no config saved)

AI: quick_connect(host="192.168.1.100", username="root", password="***")
→ server_id="192.168.1.100:22"

AI: execute(server_id="192.168.1.100:22", command="df -h")
AI: disconnect(server_id="192.168.1.100:22")

Via SOCKS5 proxy

AI: add_proxy(proxy_id="tunnel", name="SSH Tunnel", host="127.0.0.1", port=1080, type="5")
AI: add_server(server_id="internal", ..., proxy="tunnel")

Via jump host

AI: add_server(server_id="bastion", name="Bastion", host="bastion.example.com", username="admin", private_key="~/.ssh/id_rsa")
AI: add_server(server_id="internal", name="Internal DB", host="10.0.0.5", username="dbadmin", password="***", jump_host="bastion")

Config Location

Server and proxy configurations are stored in:

~/.ssh-mcp/config.json

Passwords are stored in plaintext. For production use, prefer private key authentication.

Requirements

  • Node.js >= 18
  • An MCP-compatible client (Claude Code, Claude Desktop, Cursor, etc.)
  • Remote server with SSH access

License

MIT

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选