SSH MCP Server

SSH MCP Server

Enables AI tools to manage SSH connections, execute commands, transfer files, and perform remote server diagnostics via MCP protocol.

Category
访问服务器

README

SSH MCP Server

高效的 SSH 远程运维 MCP 服务。让 AI 工具通过 MCP 协议管理 SSH 连接、执行命令、传输文件。

功能

Tool 说明
ssh_connect 建立 SSH 连接(支持跳板机)
ssh_disconnect 断开连接
ssh_exec 执行单条命令
ssh_exec_script 执行多行脚本
sftp_read 读取远程文件
sftp_write 写入远程文件
sftp_list 列出远程目录
ssh_status 查看所有连接状态
ssh_history 查询操作历史日志
ssh_analyze 一键诊断远程服务器
ssh_logs 日志查询与增量监控(file/journalctl/docker)
ssh_host_add 保存服务器配置(支持备注和标签)
ssh_host_remove 删除已保存的服务器
ssh_host_list 列出所有已保存的服务器
ssh_host_update 更新服务器备注/标签(AI 知识积累)

核心特性

  • 连接池管理 — 持久化连接,避免重复建连
  • 跳板机支持 — 通过 jump host 连接内网服务器
  • 多认证方式 — 密码 / 私钥
  • SFTP 文件操作 — 读写文件、浏览目录
  • 空闲超时清理 — 30 分钟无活动自动断开
  • 多行脚本执行 — 通过 bash -s 执行复杂脚本
  • 持久化操作日志 — 所有操作记录到 ~/.ssh-mcp/logs/operations.jsonl,支持 AI 溯源
  • 一键服务器诊断 — 系统信息、资源、网络、Docker、GPU 全面检查

安装

npm install -g @honwee/ssh-mcp-server

或者直接通过 npx 使用(无需全局安装):

npx @honwee/ssh-mcp-server

配置

Claude Desktop

编辑 ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "ssh": {
      "command": "npx",
      "args": ["-y", "@honwee/ssh-mcp-server"]
    }
  }
}

Cursor

在 Cursor Settings → MCP 中添加:

{
  "mcpServers": {
    "ssh": {
      "command": "npx",
      "args": ["-y", "@honwee/ssh-mcp-server"]
    }
  }
}

Gemini CLI / Antigravity

在 settings.json 中添加:

{
  "mcpServers": {
    "ssh": {
      "command": "npx",
      "args": ["-y", "@honwee/ssh-mcp-server"]
    }
  }
}

使用示例

直连服务器

1. ssh_connect(host="192.168.1.100", username="root", password="xxx", alias="web-server")
2. ssh_exec(connectionId="web-server", command="uptime")
3. ssh_exec(connectionId="web-server", command="df -h")
4. sftp_list(connectionId="web-server", remotePath="/var/log")
5. sftp_read(connectionId="web-server", remotePath="/etc/nginx/nginx.conf")
6. ssh_disconnect(connectionId="web-server")

通过跳板机连接

ssh_connect(
  host="10.0.0.50",
  username="deploy",
  privateKey="-----BEGIN OPENSSH PRIVATE KEY-----\n...",
  alias="internal-db",
  jumpHost={
    host="bastion.example.com",
    username="admin",
    password="xxx"
  }
)

执行多行脚本

ssh_exec_script(
  connectionId="web-server",
  script="#!/bin/bash\necho '--- Disk Usage ---'\ndf -h\necho '--- Memory ---'\nfree -h\necho '--- Top Processes ---'\nps aux --sort=-%mem | head -10"
)

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

官方
精选