io.github.fkom13/mcp-sftp-orchestrator

平台与服务

by fkom13

用于远程任务编排的 MCP server,支持 SSH/SFTP,并提供持久化队列来管理执行流程。

什么是 io.github.fkom13/mcp-sftp-orchestrator

用于远程任务编排的 MCP server,支持 SSH/SFTP,并提供持久化队列来管理执行流程。

README

🚀 MCP Orchestrator — SSH/SFTP Infrastructure Orchestration Server

Version : 11.3.0
License : MIT
Node : >= 18.0.0

A Model Context Protocol (MCP) server that turns any AI agent (Claude, OpenCode, Cursor...) into a full-fledged system administrator. Persistent queue, SSH connection pool, hybrid sync/async execution.

✨ Key Features

  • 63 MCP tools — SSH, SFTP, file ops, monitoring, snapshots, tunnels
  • Built-in security — Command blocklist, port allowlist, hash protection
  • Multi-servertask_exec {alias:["vps1","vps2"]} or alias:"all"}
  • Persistence — tmux + persistent queue = sessions that survive crashes
  • Snapshots — Deduplicated versioning of your critical files
  • SSH Tunnels — Local, Remote, SOCKS5 with secured port allowlist
  • AI Guide — Built-in manual for the agent (section:index/workflows/audit/security)

🇫🇷 Version française : README.fr.md


📦 Installation

Via npx (recommended)

bash
npx @fkom13/mcp-sftp-orchestrator

Via git

bash
git clone https://github.com/fkom13/mcp-sftp-orchestrator.git
cd mcp-sftp-orchestrator
npm install
cp .env.example .env
# Edit .env with your paths

Requirements: Node.js >= 18.0.0


⚙️ Configuration (.env)

All variables are optional. Defaults are designed for standard usage.

VariableDefaultDescription
MCP_DATA_DIR~/.config/mcp-orchestratorData directory (servers.json, apis.json, queue.json)
MCP_SYNC_TIMEOUT_S120Seconds before background execution
MCP_DEFAULT_CMD_TIMEOUT_S600Default SSH timeout (0 = unlimited)
MCP_INTERACTIVE_CMD_TIMEOUT_S300Interactive command timeout (0 = unlimited)
MCP_MAX_WAIT_TIMEOUT_S600Max timeout for task_wait
MAX_CONNECTIONS_PER_SERVER5Max parallel SSH connections per server
MIN_CONNECTIONS_PER_SERVER1Min pooled connections per server
IDLE_TIMEOUT300000Idle connection close delay (ms)
KEEP_ALIVE_INTERVAL30000SSH keepalive interval (ms)
MAX_QUEUE_SIZE1000Max jobs in queue
SAVE_INTERVAL5000Queue disk save interval (ms)
MCP_ALLOWED_ROOTS(empty)Restrict file access to these roots (comma-separated). Empty = full access
MCP_DEBUGfalseEnable detailed debug logs

🔌 MCP Client Configuration (OpenCode, Claude Desktop, etc.)

json
{
  "mcpServers": {
    "orchestrator": {
      "command": "node",
      "args": ["/path/to/sftp-mcp/server.js"],
      "env": {
        "MCP_DATA_DIR": "/path/to/sftp-mcp/data"
      }
    }
  }
}

🧰 Tool Reference (63 tools)

Help & Diagnostics

ToolDescription
helpComplete guide: tools, env vars, parameter schemas
guideAI manual: workflows, cheatsheet, audit, security
system_diagnosticsFull system diagnostic (queue, pool, servers, APIs)

Server Management

ToolDescription
server_addAdd/update a server alias
server_listList all configured servers
server_removeRemove a server alias
infra_overviewFleet-wide overview (roles, services, warnings)
server_note_set/get/list/removeDocumented server context

Security (Blocklist)

ToolDescription
policy_blocklist_listList blocked commands
policy_blocklist_addAdd a pattern to blocklist
policy_blocklist_removeRemove a pattern from blocklist

Task Execution

ToolDescription
task_execSSH one-shot. Supports alias:["vps1","vps2"] or alias:"all"
task_exec_interactiveSSH with interactive prompt handling
task_exec_sequenceSequential SSH commands
task_transferSFTP transfer. Supports server_to_server
task_transfer_multiBulk transfers with glob patterns

Monitoring

ToolDescription
get_system_resourcesCPU, RAM, Disk metrics
get_services_statussystemd, Docker, PM2 status (graceful fallback)
get_fail2ban_statusFail2Ban status
check_api_healthHTTP health check

Logs

ToolDescription
get_pm2_logsPM2 logs
get_docker_logsDocker logs
tail_fileTail a remote file

File Operations (Local + Remote)

ToolDescription
file_readRead file + SHA-256 hash (edit protection)
file_writeCreate/overwrite with dryRun and backup
file_editSurgical or full edit + hash protection

Comparison & Drift Detection

ToolDescription
diff_filesCompare 2 files (local/remote, cross-server)
diff_foldersCompare 2 directories
compare_all_sourcesDetect drifts across N servers

Persistent Shell Sessions

ToolDescription
shell_createOpen a persistent shell (cd/env preserved)
shell_execExecute in an existing session
shell_list / shell_closeList/close sessions

tmux (Surviving Terminal Sessions)

ToolDescription
tmux_createCreate a persistent tmux session
tmux_execSend a command to a session
tmux_readRead session buffer
tmux_list / tmux_killList/kill sessions

SSH Tunnels

ToolDescription
tunnel_createLocal/remote/SOCKS5 tunnel, persistent via tmux
tunnel_listList active tunnels
tunnel_closeClose a tunnel
tunnel_allowlist_add/removeManage allowed ports

Snapshots (File Versioning)

ToolDescription
snapshot_createCapture file state with deduplication
snapshot_listList snapshots
snapshot_diffCompare 2 snapshots
snapshot_restoreRestore (dryRun by default)
snapshot_deleteDelete + orphan cleanup

Queue & Monitoring

ToolDescription
task_queueView all active/pending tasks
task_statusTask detail by ID
task_historyFilterable history
task_retryRetry a failed task
task_waitWait for a background task
task_logsMCP internal logs
queue_stats / pool_statsQueue and SSH pool stats

API Catalog

ToolDescription
api_add / api_list / api_removeAPI monitoring catalog
api_checkHealth check via SSH + curl

📖 Usage Examples

Multi-server

bash
# One command, multiple servers
task_exec {alias:["vps1","vps2","vps3"], cmd:"uptime"}

# Entire fleet
task_exec {alias:"all", cmd:"df -h /"}

SOCKS5 Proxy Tunnel

bash
tunnel_create {name:"proxy", type:"socks", listen_port:1080, via:"vps_paris"}
# → Browser → SOCKS5 127.0.0.1:1080 → Paris VPS

Local Tunnel (access remote service)

bash
tunnel_create {name:"crm", type:"local", listen_port:8080, target:"127.0.0.1:3100", via:"vps_prod"}
# → http://localhost:8080 → production CRM

Remote Tunnel (expose local service)

bash
tunnel_create {name:"dev", type:"remote", listen_port:9090, target:"127.0.0.1:3000", via:"vps", source:"vps_prod", key_path:"/home/user/.ssh/vps.key"}
# → vps_prod:9090 → your local machine:3000

Persistent tmux Session

bash
tmux_create {alias:"vps", name:"build", start_cmd:"npm run build"}
tmux_read {alias:"vps", session:"build"}
tmux_kill {alias:"vps", session:"build"}

Security Blocklist

bash
# List blocked commands
policy_blocklist_list
# → ["rm -rf /", "mkfs*", ...]

# Conscious bypass
task_exec {alias:"vps", cmd:"rm -rf /tmp/cache", skip_policy:true}

Secure File Editing

bash
# Read + hash
file_read {source:{type:"remote", alias:"vps", path:"/etc/nginx/nginx.conf"}}
# → content + hash

# Edit with protection
file_edit {source:{type:"remote", alias:"vps", path:"/etc/nginx/nginx.conf"},
           oldString:"worker_connections 768;",
           newString:"worker_connections 1024;",
           expectedHash:"abc123...",
           backup:true}

# Preview without writing
file_edit {source:{type:"remote", alias:"vps", path:"/etc/nginx/nginx.conf"},
           oldString:"worker_connections 768;",
           newString:"worker_connections 1024;",
           dryRun:true}

Snapshot Before Risky Changes

bash
# Before
snapshot_create {source:{type:"remote", alias:"vps"}, paths:["/etc/nginx/"], tag:"before-fix"}

# After if something broke
snapshot_restore {snapshotId:"...", target:{type:"remote", alias:"vps"}, dryRun:false, force:true}

Multi-server Drift Detection

bash
compare_all_sources {sources:[
  {type:"remote", alias:"vps1", path:"/etc/nginx/nginx.conf", label:"prod"},
  {type:"remote", alias:"vps2", path:"/etc/nginx/nginx.conf", label:"staging"}
]}

📚 AI Built-in Manual (guide)

The orchestrator includes an interactive manual for your AI agent:

bash
guide section:index       # Table of contents
guide section:workflows   # Copy-paste recipes
guide section:cheatsheet  # Tool → usage table
guide section:audit       # Full fleet audit in 8 steps
guide section:security    # Blocklist + tunnels
guide section:pitfalls    # Common mistakes

🏗️ Architecture

code
MCP Client (stdio)
    │
server.js ─── 63 MCP tools registered
    │
    ├── queue.js ─────── Persistent job queue (JSON + backup)
    ├── ssh.js ───────── SSH execution (pool + dedicated connections)
    ├── sftp.js ──────── SFTP transfers (upload/download/multi)
    ├── sshPool.js ───── Persistent SSH connection pool
    ├── servers.js ───── CRUD server aliases
    ├── apis.js ──────── CRUD API catalog
    ├── history.js ───── Task history
    ├── config.js ────── Centralized configuration
    ├── utils.js ─────── Utilities (escapeShellArg)
    ├── fileOps.js ───── File operations (read/write/edit)
    ├── diffEngine.js ── Diff engine (files/dirs/sources)
    ├── compareEngine.js ─ Multi-source comparison
    ├── diffFormatter.js ─ Diff formatting
    ├── sourceAdapter.js ─ Local/remote abstraction
    ├── shellSessions.js ─ Persistent shell sessions
    ├── snapshotManager.js ─ Versioned snapshots
    ├── notes.js ──────── Documented server context
    ├── policies.js ──── Command blocklist
    ├── tunnels.js ────── SSH tunnels (local/remote/SOCKS)
    ├── guide.js ──────── AI built-in manual
    └── diagnose.js ───── Diagnostics

Job Lifecycle

code
pending → running → completed / failed
                      ↓ (on restart)
                    crashed → retry → pending

🔒 Security

  • Command Blocklist : rm -rf /, mkfs*, fork bombs, and other destructive commands are blocked by default
  • Conscious bypass : skip_policy: true to force execution
  • Tunnel port allowlist : only explicitly allowed ports can be used
  • File access restriction : MCP_ALLOWED_ROOTS env var to limit file operations to specific directories
  • escapeShellArg() : all URLs and paths are escaped before being passed to curl/shell
  • Plaintext secret detection : warning on startup if passwords/API keys are in plaintext
  • Pre-modification snapshots : backup:true on file_edit/file_write for instant rollback
  • Recommendation : use SSH keys (not passwords), store secrets in Vaultwarden

🧪 Tests

bash
node diagnose.js        # Full diagnostic
node test_mcp.js        # MCP smoke test
node test_features.js   # Unit tests (queue, pool, glob, prompts, crash)

🛣️ Roadmap

VersionChanges
10.0.0New tools: file_read/write/edit, diff, snapshots, shell, notes
10.4.0server_to_server, help with schemas, audit guide
11.0.0Command Blocklist, Multi-host (alias:"all"), tmux
11.2.0SSH Tunnels (local/remote/SOCKS5), allowlist, ssh2 stderr fix
11.3.0AllowedRoots (MCP_ALLOWED_ROOTS) for file restriction
12.0.0 (planned)Auto key setup for tunnels, webhooks, static dashboard

📄 License

MIT — Copyright (c) 2025-2026 Franck (fkom13)

常见问题

io.github.fkom13/mcp-sftp-orchestrator 是什么?

用于远程任务编排的 MCP server,支持 SSH/SFTP,并提供持久化队列来管理执行流程。

相关 Skills

Slack动图

by anthropics

Universal
热门

面向Slack的动图制作Skill,内置emoji/消息GIF的尺寸、帧率和色彩约束、校验与优化流程,适合把创意或上传图片快速做成可直接发送的Slack动画。

帮你快速做出适配 Slack 的动图,内置约束规则和校验工具,少踩上传与播放坑,做表情包和演示都更省心。

平台与服务
未扫描166.1k

MCP构建

by anthropics

Universal
热门

聚焦高质量 MCP Server 开发,覆盖协议研究、工具设计、错误处理与传输选型,适合用 FastMCP 或 MCP SDK 对接外部 API、封装服务能力。

想让 LLM 稳定调用外部 API,就用 MCP构建:从 Python 到 Node 都有成熟指引,帮你更快做出高质量 MCP 服务器。

平台与服务
未扫描166.1k

接口测试套件

by alirezarezvani

Universal
热门

扫描 Next.js、Express、FastAPI、Django REST 的 API 路由,自动生成覆盖鉴权、参数校验、错误码、分页、上传与限流场景的 Vitest 或 Pytest 测试套件。

帮你把API与集成测试自动化跑顺,减少回归漏测;能力全面,尤其适合复杂接口场景的QA团队。

平台与服务
未扫描23.8k

相关 MCP Server

Slack 消息

编辑精选

by Anthropic

热门

Slack 是让 AI 助手直接读写你的 Slack 频道和消息的 MCP 服务器。

这个服务器解决了团队协作中需要 AI 实时获取 Slack 信息的痛点,特别适合开发团队让 Claude 帮忙汇总频道讨论或发送通知。不过,它目前只是参考实现,文档有限,不建议在生产环境直接使用——更适合开发者学习 MCP 如何集成第三方服务。

平台与服务
89.2k

by netdata

热门

io.github.netdata/mcp-server 是让 AI 助手实时监控服务器指标和日志的 MCP 服务器。

这个工具解决了运维人员需要手动检查系统状态的痛点,最适合 DevOps 团队让 Claude 自动分析性能数据。不过,它依赖 NetData 的现有部署,如果你没用过这个监控平台,得先花时间配置。

平台与服务
80.0k

by d4vinci

热门

Scrapling MCP Server 是专为现代网页设计的智能爬虫工具,支持绕过 Cloudflare 等反爬机制。

这个工具解决了爬取动态网页和反爬网站时的头疼问题,特别适合需要批量采集电商价格或新闻数据的开发者。不过,它依赖外部浏览器引擎,资源消耗较大,不适合轻量级任务。

平台与服务
72.4k

评论