Back to search
codex-file-sync
SkillWorks with Claude CodeGitHub
Sync Git-changed repository files to an SSH/SFTP server.
Safety scan
A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.
Badge for your README
Markdown
[](/listings/svonme--scp-sync)HTML
<a href="/listings/svonme--scp-sync"><img src="/api/listings/svonme--scp-sync/badge.svg" alt="findsafeskills safety rating" /></a>Install
i
What was scanned
The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.
plugin.json · Manifest · 19 lines
- {
- "$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
- "name": "codex-file-sync",
- "version": "1.1.0",
- "description": "Sync Git-changed repository files to an SSH/SFTP server.",
- "license": "MIT",
- "keywords": ["git", "scp", "sftp", "file-sync", "deployment"],
- "extensions": {
- "com.openai": {
- "interface": {
- "displayName": "File Sync",
- "shortDescription": "Sync Git files to SSH",
- "longDescription": "Preview and sync changed files from a local Git repository to a configured remote directory over SCP or SFTP.",
- "category": "Developer Tools",
- "capabilities": ["Read", "Write"]
- }
- }
- }
- }
README.md · README · 121 lines
- # Codex MCP File Sync
- 这是 `dsh-plugin-file-sync` 的 Codex MCP Server 版本。
- 要求 Node.js 22.5.0 或更高版本,使用内置的 `node:sqlite` 保存同步缓存。
- 它提供两个 MCP 工具:
- - `file_sync_preview`:收集 Git 改动文件并显示远程目标,不上传;
- - `file_sync`:把 Git 改动文件通过 SCP 或 SFTP 上传到远程服务器。
- 默认优先使用 SSH 公钥认证。只有传入 `password`、`.dsh.yml` 中配置密码,或设置 `FILE_SYNC_PASSWORD` 时才使用 `ssh2` 的 SFTP 密码认证。
- ## 安装依赖
- 在本目录执行:
- ```powershell
- cd D:\works\codex\mcp\file_sync
- npm install
- ```
- 检查语法:
- ```powershell
- npm run check
- ```
- ## Codex MCP 配置
- `mcp.json` 已配置为本地 stdio MCP Server。使用插件目录安装时,入口是:
- ```text
- ${PLUGIN_ROOT}/server/index.js
- ```
- 如果只是在 Codex 配置中直接注册本地 MCP Server,可以使用等价配置:
- ```toml
- [mcp_servers.file_sync]
- command = "node"
- args = ["D:/works/codex/mcp/file_sync/server/index.js"]
- cwd = "D:/works/codex/mcp/file_sync"
- ```
- ## GitHub Marketplace
- 仓库根目录包含 `.agents/plugins/marketplace.json`,因此可以直接作为 Git-backed Marketplace 添加:
- ```powershell
- codex plugin marketplace add https://github.com/svonme/scp_sync.git
- ```
- 添加后重启 Codex,在 Plugins Directory 中安装 `codex-file-sync`。本仓库根目录同时就是插件根目录,Marketplace 使用 `source: "url"` 指向仓库根目录。
- ## 工具参数
- 两个工具的主要参数如下;`file_sync_preview` 始终只读,`file_sync` 支持 `dry_run`:
- | 参数 | 说明 |
- |---|---|
- | `server` | `user@host`、SSH config 主机别名或 `host:port` |
- | `remote_dir` | 远程绝对 POSIX 基目录 |
- | `password` | 可选的密码认证兜底;通常不要传,优先使用公钥 |
- | `workdir` | 本地 Git 仓库或其子目录 |
- | `dry_run` | 仅 `file_sync` 支持的试运行开关;preview 工具始终不上传 |
- `workdir` 未提供时依次使用:
- 1. `FILE_SYNC_WORKDIR` 环境变量;
- 2. MCP Server 进程当前目录。
- 由于 MCP Server 通常从插件目录启动,建议在 Codex 调用时明确传入 `workdir`,或者设置 `FILE_SYNC_WORKDIR`。
- ## 项目配置
- 保留原插件的 `.dsh.yml` 配置格式。程序会从 `workdir` 向上查找 `.dsh.yml`,读取 `tool-file-sync` 区域:
- ```yaml
- tool-file-sync:
- server: test
- remote_dir: /data/docms/code/works
- sshOptions:
- - -o
- - BatchMode=yes
- dry_run: false
- ```
- 密码兜底可以保留:
- ```yaml
- tool-file-sync:
- password: "your-password"
- ```
- 不过更建议使用环境变量:
- ```powershell
- $env:FILE_SYNC_PASSWORD = "your-password"
- ```
- ## 行为说明
- - 收集未暂存、已暂存和未跟踪文件,并自动去重;
- - 使用文件规范化后的绝对路径生成 SHA-256 key;
- - 使用文件内容的 MD5 作为同步缓存值;
- - SQLite 数据库位于插件根目录的 `file_sync.sqlite`;
- - 首次同步或 MD5 发生变化时上传,上传成功后写入最新 MD5;
- - 绝对路径 key 相同且 MD5 未变化时标记为 `unchanged` 并跳过上传;
- - `file_sync_preview` 会读取缓存并显示哪些文件会被跳过,但不会修改 SQLite;
- - `workdir` 为子目录时自动解析 Git 仓库根目录;
- - 已被删除的本地文件会标记为 `missing` 并跳过,不会删除远端文件;
- - 远程基目录及其对应子目录必须已存在;
- - 公钥认证使用本机 `ssh`/`scp`;
- - 密码认证使用 `ssh2` SFTP,不把密码放入进程参数;
- - `host:port` 会分别转换为 OpenSSH 的 `-p`/`-P` 参数和 SFTP 端口;
- - Git 命令失败、路径越界和非绝对远程目录会直接返回错误。
- ## 与原 DSH 插件的差异
- DSH 的 `ctx.tools.register`、`workingDirectory` 注入和 `presentCall` 已替换为 MCP 的 `registerTool`、显式 `workdir` 参数和结构化工具结果。核心的 Git 文件收集、`.dsh.yml` 读取、SSH 配置解析、SCP/SFTP 上传逻辑已迁移到 `server/index.js`。
Version history
v1.1.011/22/2026
Ratings and comments
Sign in to rate this skill.
Sign inFree to use. If it’s helped, pass it on.