vm-mcp-go
Provides SSH/SFTP tools to manage remote Linux hosts: execute bash scripts, inspect system information, read/write files, list directories, transfer files, and open local/remote/SOCKS5 port-forwarding tunnels.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
vm-mcp-go
一个零运行时依赖的 MCP stdio 服务器,把远程 Linux 暴露成一组工具。
用纯 Go 实现 SSH / SFTP / 端口转发,不依赖系统的 ssh.exe / sftp.exe / scp.exe,可以交叉编译到 Windows、Linux、macOS,单个二进制即可分发。
定位:本地测试环境
这个 MCP 是给 DSH 在写完 web / 小程序 / app 后端逻辑后,先在本地虚拟机上验证用的——不必立刻部署到云服务器,线上服务完全不受影响。
编码 → 本地 VM 部署验证 → 通过 → 上云这样反复重启、改配置、压测都发生在测试机上,生产环境保持稳定。
⚠️ 仅测试环境:请勿在测试机中填写生产环境的参数、密钥或数据库连接串 ⚠️ 仅测试环境:请勿在测试机中填写生产环境的参数、密钥或数据库连接串 ⚠️ 仅测试环境:请勿在测试机中填写生产环境的参数、密钥或数据库连接串
这条提醒会在 session_add、write_file、sftp_put 三处重复输出——那正是最容易把生产凭据带进测试机的时刻。
Related MCP server: MCP SSH Server
特性
单文件静态二进制(约 5 MB),不需要 Node、Python 或系统 OpenSSH
三种认证:密钥、密码、ssh-agent
密码不落盘:
auth.type=password的会话在首次连接时弹原生密码框,只在进程内存缓存,退出即消失主机密钥 TOFU:首次见到自动记录到
known_hosts,之后严格校验,密钥变更会拒绝连接17 个工具:会话管理、命令执行、文件读写、SFTP、端口转发
快速开始
1. 下载二进制
按平台选择 release/ 里的文件:
平台 | 文件 |
Windows x64 |
|
Linux x64 |
|
Linux arm64 |
|
macOS Intel |
|
macOS Apple Silicon |
|
Unix 上需要 chmod +x。
2. 注册为 MCP 连接器
在 DeepSeek Harness 里添加一个 stdio 类型的自定义 MCP 连接:
command: 二进制的绝对路径args: 留空env: 留空
服务端名建议用 vm,工具会以 mcp__vm__* 出现。
3. 配置会话
首次使用时调 session_add,例如:
{
"name": "vm-ubuntu",
"mode": "ssh",
"host": "192.168.1.10",
"port": 22,
"user": "yourname",
"auth": { "type": "key", "keyPath": "C:\\Users\\you\\.ssh\\vm_ed25519" },
"workdir": "/home/yourname"
}密码方式则写 "auth": { "type": "password" }——不含密码本身,首次连接时弹框输入。
配置文件
位置:~/.dsh/vm-mcp/config.json(Windows 为 C:\Users\<你>\.dsh\vm-mcp\config.json),权限 0600。
{
"version": 3,
"activeSession": "vm-ubuntu",
"sessions": {
"vm-ubuntu": {
"mode": "ssh",
"host": "192.168.1.10",
"port": 22,
"user": "yourname",
"auth": { "type": "key", "keyPath": "C:\\Users\\you\\.ssh\\vm_ed25519" },
"workdir": "/srv/app"
}
}
}主机密钥记录在同目录的 known_hosts,格式与 OpenSSH 兼容。
工具
会话
工具 | 说明 |
| 列出会话,标出活动会话 |
| 添加或更新会话 |
| 切换活动会话 |
| 删除会话 |
执行与文件
工具 | 说明 |
| 执行 bash 脚本,返回退出码 / stdout / stderr |
| 主机名、负载、CPU、内存、磁盘、IP |
| 读远端文本文件(上限 1 MB) |
| 写远端文件(适合小文件) |
| 列目录( |
SFTP
工具 | 说明 |
| 列目录,含大小与时间 |
| 上传文件或目录(目录需 |
| 下载文件或目录(目录需 |
| 创建目录(自动建父目录) |
| 删除文件或目录 |
端口转发
工具 | 说明 |
| 开启隧道: |
| 列出隧道 |
| 关闭隧道 |
encrypted: true(默认)走 SSH 加密通道;encrypted: false 走本机明文 TCP 中继(仅支持 local)。
示例
# 执行
exec { command: "cd /srv/app && docker compose ps" }
# 部署
sftp_put { localPath: "E:\\proj", remotePath: "/srv/app", recursive: true }
exec { command: "cd /srv/app && docker compose up -d" }
# 端口映射到本机
tunnel_open { type: "local", localPort: 8080, targetHost: "127.0.0.1", targetPort: 80 }
# 然后浏览器访问 http://127.0.0.1:8080
# SOCKS5 代理
tunnel_open { type: "dynamic", localPort: 1080 }多会话时可以按调用指定,不用切换活动会话:
exec { session: "vm-staging", command: "docker compose ps" }平台差异
平台 | 密码框实现 |
Windows | PowerShell + WinForms,owner 设为 DeepSeek Harness 主窗口(居中、置顶) |
Linux |
|
macOS |
|
密钥和 ssh-agent 认证在所有平台行为一致。
安全说明
配置文件权限
0600;密码从不写入磁盘主机密钥 TOFU:首次自动信任并记录,之后密钥变更直接拒绝
明文隧道默认只监听
127.0.0.1,要暴露到局域网需显式传bindAddress: "0.0.0.0"扫描/攻击类工具不在本项目中,请只在自有环境使用
从源码构建
需要 Go 1.21+。
# 全部平台
./build.sh 1.3.0 # Linux / macOS
.\build.ps1 -Version 1.3.0 # Windows
# 单个平台
GOOS=linux GOARCH=amd64 CGO_ENABLED=0 \
go build -trimpath -ldflags "-s -w -X main.version=1.3.0" -o vm-mcp-go-linux-amd64 .依赖只有两个纯 Go 包:
golang.org/x/crypto/ssh(含knownhosts、agent)github.com/pkg/sftp
已知限制
wsl模式未实现(仅支持ssh)带口令的私钥暂不支持
每次
exec新建连接,未做连接复用(局域网下约 50ms)隧道随 MCP 进程生命周期,连接器重连即断开
remote反向转发需要服务端 sshd 配置GatewayPorts
项目来源
本项目的全部源码由一个 AI 编码代理生成(DeepSeek Harness,deepseek-flash 模型),在一次连续会话中完成。
人类贡献者(zhiliaoya)负责:
角色 | 具体内容 |
需求与方向 | 零依赖、跨平台、密码不落盘、从 Node 版改用 Go 重写 |
环境与实测 | Hyper-V 虚拟机搭建、Ubuntu 安装、SSH 密钥配置、端到端验证 |
持续反馈 | 发现动态内存 OOM、askpass 需要换行、变量遮蔽等关键问题 |
简言之:思路与验证由人提供,代码实现由代理完成。
The source code in this repository was generated by an AI coding agent (DeepSeek Harness, deepseek-flash). The human contributor provided the requirements, environment setup and hands-on testing feedback.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
This server cannot be deployed
Maintenance
Related MCP Connectors
Remote MCP access to user-authorized Linux, Windows and Intel Mac devices for AI assistants.
SSH client, server management and one remote MCP URL for your machines, with human approvals.
Remote MCP access to a real Windows, macOS, Linux or Android machine. Outbound only.
Connect ChatGPT and Claude to your Mac, Windows or Linux with secure MCP remote access.
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables secure remote Linux/Unix server management over SSH/SFTP, including command execution, system inspection, file editing, and service control.8MIT
- AlicenseAqualityDmaintenanceEnables remote command execution and SFTP file upload or download from any MCP client without a local SSH client, SCP, or PuTTY installed. Supports password or private key authentication with SHA256 host fingerprint verification, timeouts, output limits, and multiple configured server instances.5MIT
- AlicenseNot gradedqualityBmaintenanceEnables managing multiple Linux SSH servers from MCP clients, with structured filesystem operations, shell commands, durable long-running jobs, process listing, and CPU/RAM/disk/GPU status.MIT
- AlicenseAqualityCmaintenanceEnables managing multiple remote Linux hosts over SSH via MCP, with command execution, SFTP file operations, and Windows DPAPI-protected credentials.101MIT