Relay MCP - Operações Remotas via SSH
tengfei1994/Relay-MCP
Plataforma MCP para operações remotas em produção via SSH
Ver no GitHubServidor MCP que permite agentes Claude gerenciar servidores de produção via SSH através de uma plataforma auto-hospedada. Inclui interface Web para gerenciar servidores, projetos e usuários, além de ferramentas MCP como exec_remote, deploy, fetch_logs e manipulação de arquivos remotos.
Instalação
npx convez-ai tengfei1994/Relay-MCP1 comando no terminal: detecta o formato do repositório (marketplace ou plugin avulso) e instala via Claude Code. Requer Node 18+ e o Claude Code instalado.
Métricas
Casos de uso
- Automação de deployments e gerenciamento de infraestrutura com Claude
- Execução remota de scripts e comandos em múltiplos servidores
- Leitura de logs, restart de serviços e operações DevOps via agente IA
Veredito

Solução robusta e bem arquitetada para integrar operações SSH em agentes Claude. Requer auto-hospedagem em Ubuntu e conhecimento técnico sólido, mas oferece controle total sobre operações de produção de forma segura via JWT.
README
A tradução para o português deste README ainda está na fila.
Remote Ops Platform
A self-hosted remote operations platform that lets AI agents (Claude) manage production servers via SSH through an MCP (Model Context Protocol) server.
中文说明见下方 / Chinese documentation below ↓
Architecture
Claude (AI Agent)
│ MCP over HTTP
▼
RelayMCP Server (Ubuntu VM)
├── Web UI :3000 — project & server management
└── MCP Server :3001 — tools for Claude
│ SSH
▼
Production Servers (any SSH-accessible host)
Features
- MCP Tools:
exec_remote,deploy,fetch_logs,restart_service,read/write_remote_file,list_remote_files,read/write_local_file,list_projects - Server Management: add servers, auto-generate SSH key pairs, push public keys, test connectivity, edit settings
- Project Management: workspace directories per user, link/unlink servers per project per environment
- User Management: admin-only user creation, password reset, admin role toggle
- JWT Auth: token-based authentication for both Web UI and MCP
Tech Stack
| Layer | Technology |
|---|---|
| Backend | Node.js · Fastify · SQLite (Drizzle ORM) |
| MCP Server | @modelcontextprotocol/sdk · Express · HTTP/SSE |
| Frontend | React · Vite · Tailwind CSS |
| Process Manager | PM2 |
| SSH | node-ssh · openssh-client |
Deployment
Requirements
- Ubuntu 22.04+ server (RelayMCP)
- Node.js 20 LTS
- PM2 (
npm install -g pm2)
Steps
# 1. Clone the repo on RelayMCP
git clone https://github.com/tengfei1994/Relay-MCP.git ~/Relay-MCP
cd ~/Relay-MCP
# 2. Install dependencies
npm install
cd frontend && npm install && npm run build && cd ..
# 3. Configure environment
cp .env.example .env
# Edit .env: set JWT_SECRET, WORKSPACE_ROOT, SSH_KEYS_DIR
# 4. Build backend
npx tsc
# 5. Start with PM2
pm2 start ecosystem.config.cjs
pm2 save && pm2 startup
Environment Variables (.env)
| Variable | Default | Description |
|---|---|---|
PORT | 3000 | Web server port |
MCP_PORT | 3001 | MCP server port |
JWT_SECRET | (required) | Secret for signing JWT tokens |
WORKSPACE_ROOT | /workspace | Root directory for project workspaces |
SSH_KEYS_DIR | /workspace/.ssh-keys | Directory for generated SSH key pairs |
DB_PATH | ./data/app.db | SQLite database file path |
Connecting Claude
Claude Desktop (Cowork)
Requires Node.js on the client machine. Add to claude_desktop_config.json:
{
"mcpServers": {
"remote-ops": {
"command": "npx",
"args": [
"-y",
"mcp-remote",
"http://YOUR_SERVER:3001/mcp?token=YOUR_JWT_TOKEN",
"--allow-http"
]
}
}
}
Claude Code CLI
Add to ~/.claude/settings.json:
{
"mcpServers": {
"remote-ops": {
"url": "http://YOUR_SERVER:3001/mcp?token=YOUR_JWT_TOKEN"
}
}
}
Get your JWT token:
curl -s -X POST http://YOUR_SERVER:3000/api/auth/login \
-H "Content-Type: application/json" \
-d '{"username":"your-user","password":"your-password"}' | python3 -m json.tool
Windows SSH Notes
For Windows servers (Administrator account), the authorized keys file location is:
C:\ProgramData\ssh\administrators_authorized_keys
Required permissions (others will cause key auth to fail):
icacls "C:\ProgramData\ssh\administrators_authorized_keys" /inheritance:r
icacls "C:\ProgramData\ssh\administrators_authorized_keys" /grant "NT AUTHORITY\SYSTEM:(F)"
icacls "C:\ProgramData\ssh\administrators_authorized_keys" /grant "BUILTIN\Administrators:(F)"
Restart-Service sshd
远端运维平台
一个自托管的远端运维平台,通过 MCP (Model Context Protocol) 让 AI 智能体(Claude)经由 SSH 管理生产服务器。
架构说明
Claude(AI 智能体)
│ MCP over HTTP
▼
RelayMCP 服务器(Ubuntu VM)
├── Web UI :3000 — 项目与服务器管理界面
└── MCP Server :3001 — 提供给 Claude 的工具
│ SSH
▼
生产服务器(任意可 SSH 访问的主机)
功能特性
- MCP 工具:
exec_remote(执行命令)、deploy(部署)、fetch_logs(获取日志)、restart_service(重启服务)、远程/本地文件读写、项目列表查询 - 服务器管理:添加服务器、自动生成 SSH 密钥对、一键推送公钥、连通性测试、编辑服务器信息
- 项目管理:按用户隔离的工作区目录、支持多环境的项目-服务器关联管理
- 用户管理:仅管理员可创建用户、重置密码、管理员权限授予/撤销
- JWT 认证:Web UI 和 MCP 均使用 Token 认证
技术栈
| 层级 | 技术 |
|---|---|
| 后端 | Node.js · Fastify · SQLite(Drizzle ORM) |
| MCP 服务 | @modelcontextprotocol/sdk · Express · HTTP/SSE |
| 前端 | React · Vite · Tailwind CSS |
| 进程管理 | PM2 |
| SSH | node-ssh · openssh-client |
部署步骤
环境要求
- Ubuntu 22.04+ 服务器(作为 RelayMCP 中继节点)
- Node.js 20 LTS
- PM2(
npm install -g pm2)
部署
# 1. 克隆仓库到 RelayMCP 服务器
git clone https://github.com/tengfei1994/Relay-MCP.git ~/Relay-MCP
cd ~/Relay-MCP
# 2. 安装依赖
npm install
cd frontend && npm install && npm run build && cd ..
# 3. 配置环境变量
cp .env.example .env
# 编辑 .env,设置 JWT_SECRET、WORKSPACE_ROOT、SSH_KEYS_DIR
# 4. 编译后端
npx tsc
# 5. 用 PM2 启动
pm2 start ecosystem.config.cjs
pm2 save && pm2 startup
环境变量说明(.env)
| 变量名 | 默认值 | 说明 |
|---|---|---|
PORT | 3000 | Web 服务端口 |
MCP_PORT | 3001 | MCP 服务端口 |
JWT_SECRET | 必填 | JWT 签名密钥 |
WORKSPACE_ROOT | /workspace | 项目工作区根目录 |
SSH_KEYS_DIR | /workspace/.ssh-keys | SSH 密钥对存储目录 |
DB_PATH | ./data/app.db | SQLite 数据库路径 |
连接 Claude
Claude Desktop(Cowork)
客户端需安装 Node.js,将以下内容加入 claude_desktop_config.json:
{
"mcpServers": {
"remote-ops": {
"command": "npx",
"args": [
"-y",
"mcp-remote",
"http://你的服务器:3001/mcp?token=你的JWT令牌",
"--allow-http"
]
}
}
}
Claude Code CLI
加入 ~/.claude/settings.json:
{
"mcpServers": {
"remote-ops": {
"url": "http://你的服务器:3001/mcp?token=你的JWT令牌"
}
}
}
获取 JWT 令牌:
curl -s -X POST http://你的服务器:3000/api/auth/login \
-H "Content-Type: application/json" \
-d '{"username":"用户名","password":"密码"}' | python3 -m json.tool
Windows 服务器 SSH 说明
Windows(Administrator 账号)的授权密钥文件路径为:
C:\ProgramData\ssh\administrators_authorized_keys
必须设置正确的文件权限(其他权限会导致密钥认证失败):
icacls "C:\ProgramData\ssh\administrators_authorized_keys" /inheritance:r
icacls "C:\ProgramData\ssh\administrators_authorized_keys" /grant "NT AUTHORITY\SYSTEM:(F)"
icacls "C:\ProgramData\ssh\administrators_authorized_keys" /grant "BUILTIN\Administrators:(F)"
Restart-Service sshd
许可证 / License
MIT