Skip to content
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
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/svonme--scp-sync/badge.svg)](/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
  1. {
  2. "$schema": "https://agent-plugins.org/schemas/1.0.0/plugin.schema.json",
  3. "name": "codex-file-sync",
  4. "version": "1.1.0",
  5. "description": "Sync Git-changed repository files to an SSH/SFTP server.",
  6. "license": "MIT",
  7. "keywords": ["git", "scp", "sftp", "file-sync", "deployment"],
  8. "extensions": {
  9. "com.openai": {
  10. "interface": {
  11. "displayName": "File Sync",
  12. "shortDescription": "Sync Git files to SSH",
  13. "longDescription": "Preview and sync changed files from a local Git repository to a configured remote directory over SCP or SFTP.",
  14. "category": "Developer Tools",
  15. "capabilities": ["Read", "Write"]
  16. }
  17. }
  18. }
  19. }
README.md · README · 121 lines
  1. # Codex MCP File Sync
  2. 这是 `dsh-plugin-file-sync` 的 Codex MCP Server 版本。
  3. 要求 Node.js 22.5.0 或更高版本,使用内置的 `node:sqlite` 保存同步缓存。
  4. 它提供两个 MCP 工具:
  5. - `file_sync_preview`:收集 Git 改动文件并显示远程目标,不上传;
  6. - `file_sync`:把 Git 改动文件通过 SCP 或 SFTP 上传到远程服务器。
  7. 默认优先使用 SSH 公钥认证。只有传入 `password`、`.dsh.yml` 中配置密码,或设置 `FILE_SYNC_PASSWORD` 时才使用 `ssh2` 的 SFTP 密码认证。
  8. ## 安装依赖
  9. 在本目录执行:
  10. ```powershell
  11. cd D:\works\codex\mcp\file_sync
  12. npm install
  13. ```
  14. 检查语法:
  15. ```powershell
  16. npm run check
  17. ```
  18. ## Codex MCP 配置
  19. `mcp.json` 已配置为本地 stdio MCP Server。使用插件目录安装时,入口是:
  20. ```text
  21. ${PLUGIN_ROOT}/server/index.js
  22. ```
  23. 如果只是在 Codex 配置中直接注册本地 MCP Server,可以使用等价配置:
  24. ```toml
  25. [mcp_servers.file_sync]
  26. command = "node"
  27. args = ["D:/works/codex/mcp/file_sync/server/index.js"]
  28. cwd = "D:/works/codex/mcp/file_sync"
  29. ```
  30. ## GitHub Marketplace
  31. 仓库根目录包含 `.agents/plugins/marketplace.json`,因此可以直接作为 Git-backed Marketplace 添加:
  32. ```powershell
  33. codex plugin marketplace add https://github.com/svonme/scp_sync.git
  34. ```
  35. 添加后重启 Codex,在 Plugins Directory 中安装 `codex-file-sync`。本仓库根目录同时就是插件根目录,Marketplace 使用 `source: "url"` 指向仓库根目录。
  36. ## 工具参数
  37. 两个工具的主要参数如下;`file_sync_preview` 始终只读,`file_sync` 支持 `dry_run`:
  38. | 参数 | 说明 |
  39. |---|---|
  40. | `server` | `user@host`、SSH config 主机别名或 `host:port` |
  41. | `remote_dir` | 远程绝对 POSIX 基目录 |
  42. | `password` | 可选的密码认证兜底;通常不要传,优先使用公钥 |
  43. | `workdir` | 本地 Git 仓库或其子目录 |
  44. | `dry_run` | 仅 `file_sync` 支持的试运行开关;preview 工具始终不上传 |
  45. `workdir` 未提供时依次使用:
  46. 1. `FILE_SYNC_WORKDIR` 环境变量;
  47. 2. MCP Server 进程当前目录。
  48. 由于 MCP Server 通常从插件目录启动,建议在 Codex 调用时明确传入 `workdir`,或者设置 `FILE_SYNC_WORKDIR`。
  49. ## 项目配置
  50. 保留原插件的 `.dsh.yml` 配置格式。程序会从 `workdir` 向上查找 `.dsh.yml`,读取 `tool-file-sync` 区域:
  51. ```yaml
  52. tool-file-sync:
  53. server: test
  54. remote_dir: /data/docms/code/works
  55. sshOptions:
  56. - -o
  57. - BatchMode=yes
  58. dry_run: false
  59. ```
  60. 密码兜底可以保留:
  61. ```yaml
  62. tool-file-sync:
  63. password: "your-password"
  64. ```
  65. 不过更建议使用环境变量:
  66. ```powershell
  67. $env:FILE_SYNC_PASSWORD = "your-password"
  68. ```
  69. ## 行为说明
  70. - 收集未暂存、已暂存和未跟踪文件,并自动去重;
  71. - 使用文件规范化后的绝对路径生成 SHA-256 key;
  72. - 使用文件内容的 MD5 作为同步缓存值;
  73. - SQLite 数据库位于插件根目录的 `file_sync.sqlite`;
  74. - 首次同步或 MD5 发生变化时上传,上传成功后写入最新 MD5;
  75. - 绝对路径 key 相同且 MD5 未变化时标记为 `unchanged` 并跳过上传;
  76. - `file_sync_preview` 会读取缓存并显示哪些文件会被跳过,但不会修改 SQLite;
  77. - `workdir` 为子目录时自动解析 Git 仓库根目录;
  78. - 已被删除的本地文件会标记为 `missing` 并跳过,不会删除远端文件;
  79. - 远程基目录及其对应子目录必须已存在;
  80. - 公钥认证使用本机 `ssh`/`scp`;
  81. - 密码认证使用 `ssh2` SFTP,不把密码放入进程参数;
  82. - `host:port` 会分别转换为 OpenSSH 的 `-p`/`-P` 参数和 SFTP 端口;
  83. - Git 命令失败、路径越界和非绝对远程目录会直接返回错误。
  84. ## 与原 DSH 插件的差异
  85. 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 in

Free to use. If it’s helped, pass it on.