Remote Demo MCP
Remote Demo MCP
本地 MCP 服务器,使用 rsync 将预构建的静态目录部署到远程主机。
功能说明
使用 MCP 配置中固定的
deployUser从
localDir的基本名称派生project将
localDir内容上传至:/var/www/html/demo-remote/{user}/{project}/
使用本地
rsync命令通过将 rsync 会话附加到
/dev/tty来支持 OTP/交互式 SSH 流程失败时,询问是否重试,直到用户取消
安装
npm install
npm run build配置
默认配置文件路径:
~/.config/remote-demo-mcp/config.json
通过以下方式覆盖路径:
REMOTE_DEMO_MCP_CONFIG=/abs/path/config.json
示例:
{
"deployUser": "demo_user-01",
"publicBaseUrl": "https://example.com",
"sessionLog": {
"enabled": false,
"path": "/tmp/remote-demo-mcp-session.log",
"logInputValue": false
},
"ssh": {
"host": "xxx.xxx.xxx.xxx",
"port": 2222,
"username": "alice123#ec2-user#52.76.147.44",
"interactiveAuth": true,
"password": "",
"hostKeyPolicy": "accept-new",
"autoFillPassword": true
},
"rsyncOptions": ["-az", "--delete"]
}服务器通过添加以下参数自动启用断点续传:
--partial--checksum--progress(除非rsyncOptions已包含--progress或--info=...)
兼容性说明:
交互式会话模式使用
node-pty。如果您在 macOS/Linux 上看到posix_spawnp failed,通常是因为node-pty辅助程序(.../node-pty/prebuilds/*/spawn-helper)没有可执行权限。本服务器现在会在会话启动时检查并自动修复辅助程序的执行权限。
远程目标基础路径是硬编码的,无法覆盖:
/var/www/html/demo-remote
工具
deploy_static
关键词:
EN:
deploy to remote,deploy demo,publish demo,upload static site中文:
部署到远程,部署demo,部署 demo,发布demo,上传静态网页
user 规则:
deployUser是远程路径的应用用户 ID,而非 SSHusername允许字符:
A-Z a-z 0-9 _ -不允许:
.,.., 空格,/,\以及其他特殊字符
输入:
{
"localDir": "/abs/path/to/dist",
"clientCwd": "/abs/path/on-mcp-client",
"dryRun": false
}localDir 路径解析:
绝对路径:直接使用
相对路径:如果提供了
clientCwd,则相对于clientCwd解析相对路径回退:如果设置了
CODEX_START_DIR则使用该路径,否则使用process.cwd()(服务器启动目录)
项目名称解析:
如果提供了
clientCwd,项目名称使用clientCwd的最后一段路径否则,项目名称使用已解析
localDir的最后一段路径
行为说明:
如果
ssh.interactiveAuth=true且dryRun=false,deploy_static将按设计快速失败。对于 OTP/密码交互式部署,请使用:
start_deploy_sessionpoll_deploy_session当
nextAction=submit_input时调用submit_deploy_input
主机密钥确认 (
yes/no) 和密码提示在会话模式下会自动处理。OTP 仍需手动操作:当
nextAction=submit_input时调用submit_deploy_input。
输出 (structuredContent):
{
"ok": true,
"attempts": 1,
"user": "alice",
"project": "my-site",
"remotePath": "/var/www/html/demo-remote/alice/my-site/",
"publicUrl": "https://example.com/alice/my-site/index.html",
"message": "Deploy succeeded after 1 attempt(s)."
}verify_deploy
输入:
{
"url": "https://example.com/alice/my-site/index.html",
"timeoutMs": 8000
}交互式 OTP 会话工具
当在非 TTY 主机中部署期间必须输入 OTP/密码时,请使用这些工具:
start_deploy_sessionpoll_deploy_session(读取输出和进度;如果state=waiting_input,则提交代码)submit_deploy_input(发送 OTP/密码)重复第 2 步,直到
state为succeeded或failed可选的
cancel_deploy_session
poll_deploy_session 通过 cursor 支持增量输出,并返回 nextCursor。
会话工具返回 nextAction 以使编排具有确定性:
submit_input: 调用submit_deploy_inputpoll: 调用poll_deploy_sessiondone: 工作流结束 (succeeded/failed/cancelled)
会话日志:
在 MCP 配置文件中的
sessionLog下配置。sessionLog.enabled默认为false。sessionLog.path默认为/tmp/remote-demo-mcp-session.log。sessionLog.logInputValue默认为false(仅记录输入长度)。交互式会话工具在 PTY 中运行 rsync,因此可以通过
poll_deploy_session检测到密码/OTP 提示。
SSH 主机密钥策略:
accept-new(默认):首次使用的主机密钥自动接受;已更改的密钥被拒绝。strict: 从不自动接受未知主机密钥。insecure: 禁用主机密钥验证(高风险;仅供临时/调试使用)。
Codex CLI 交互流程:
调用
start_deploy_session循环调用
poll_deploy_session如果
needsInput=true或nextAction=submit_input,使用 OTP/密码调用submit_deploy_input。向用户显示的提示为 "Please Enter MFA Code." 或 "Please Enter Password."继续轮询直到
nextAction=done
代理协议契约(适用于 Codex 等 MCP 客户端):
调用一次
start_deploy_session。从响应中读取
nextAction。如果
nextAction=submit_input,调用submit_deploy_input。如果
nextAction=poll,调用poll_deploy_session。重复步骤 2-4 直到
nextAction=done。切勿在 OTP 流程中调用
deploy_static;仅使用会话工具。轮询时,持续将传输进度从
output中继给最终用户。
输出 (structuredContent):
{
"ok": true,
"url": "https://example.com/alice/my-site/index.html",
"status": 200,
"statusText": "OK",
"responseTimeMs": 123,
"message": "URL is reachable: HTTP 200 in 123ms"
}运行
npm run dev
# or
npm run build && npm start初始化配置文件:
remote-demo-mcp init它会创建:
~/.config/remote-demo-mcp/config.json交互模式显示每个当前字段值以供编辑。
不输入内容直接按回车键可保持当前值不变。
如果配置已存在,
init会询问是否修改,并在覆盖前要求最终确认。
codex 使用
安裝 npm 包
npm install -g @jake.e-com365/remote-demo-mcpcodex 添加 mcp
codex mcp add remote-demo-mcp remote-demo-mcp remote-demo-mcp 的配置
remote-demo-mcp init
vi ~/.config/remote-demo-mcp/config.json{
"deployUser": "jake",
"publicBaseUrl": "https://demo-remote.e-com365.com/",
"ssh": {
"host": "xxx.xxx.xxx.xxx",
"username": "alice123#ec2-user#18.140.183.126",
"interactiveAuth": true,
"port": 2222,
"password": "xxx",
"hostKeyPolicy": "accept-new",
"autoFillPassword": true
},
"rsyncOptions": ["-az", "--delete"]
}This server cannot be installed
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/jake-bcn/remote-demo-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server