
rekey
io.github.Ezra-Black由 GitHub 帳號 Ezra-Black 發布v0.1.0更新於 Nov 1, 2026
Rotate API keys across AWS, GitLab, Cloudflare, OpenAI & more. Secrets never reach the model.
概覽
本機 CLI 兼 MCP 伺服器,可在多個服務商之間輪替 API 金鑰與權杖,並把新密鑰投遞到預設目的地,密鑰不會進入模型。
- 可以做什麼
- 列出服務商、檢查憑證與金鑰管理權限、列出金鑰(預設啟用的唯讀工具)
- 輪替金鑰,新密鑰只投遞到設定檔中定義的消費者(需 --allow-rotate)
- 停用或刪除舊金鑰,並拒絕操作伺服器自身登入所用的金鑰(需 --allow-retire)
- 密鑰值不會回傳給用戶端,憑證來自環境變數或已儲存的登入
- 適用情境
- 適合讓助理協助處理日常憑證輪替,涵蓋 AWS、GitLab、Cloudflare、Datadog、npm、Docker Hub、OpenAI、Twilio、SendGrid 等服務商,並把新密鑰寫入 .env 檔、GitHub Actions secret、AWS SSM、檔案或系統鑰匙圈。
- 執行需求
- 以本機程序執行(cargo install rekey 或預先編譯的執行檔),支援 macOS、Linux、Windows。服務商憑證來自環境變數(例如 GITLAB_TOKEN、CLOUDFLARE_API_TOKEN、OPENAI_ADMIN_KEY)或系統鑰匙圈中儲存的登入。部分服務商需要外部 CLI:aws、npm,以及用於 GitHub Actions secret 的 gh。輪替類工具需以 --allow-rotate 與 --allow-retire 啟用。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 rekey,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
rekey
Rotate API keys and tokens across providers from one CLI: mint the new key, push it to everything that uses it, verify it, retire the old one. Includes an MCP server.
Only touches accounts you administer — every provider acts with your own credential.
CLI — rotate a GitLab token straight into a .env file:
[rekey rotating a GitLab token from the CLI]
MCP — Claude rotating the same token through rekey mcp; the secret
never reaches the model:
[Claude rotating a GitLab token via the rekey MCP server]
Install
Prebuilt binaries for macOS, Linux and Windows: Releases.
Or with Rust (stable):
OS keychain support (macOS Keychain, Windows Credential Manager, Linux Secret Service) is built in.
Quick start
Practice on a throwaway GitLab token first. Every command below is safe to
copy; replace 28550311 with your own ids from step 3.
1. Make a throwaway token to rotate. In GitLab → Access tokens, create a
token named kr-test (any scope).
2. Log in. Opens GitLab's token page with the name and api scope
pre-filled. Click Create token, paste it back (input is hidden).
3. Find the key id.
4. Rotate it into a .env file. rekey shows the plan and waits for you.
5. Check and clean up.
Then delete kr-test in GitLab.
For real keys: run rekey rotate gitlab with no arguments — it lets
you pick the key and destination and can save that to rekey.toml, so
the next rotation is one command. In scripts/CI:
Commands
Global: --config <path>, --no-input (fail instead of prompting).
--yes skips confirmation. Omitted args are prompted for in a TTY. Flags go in
any order. stdout carries only list output and --print-secret values;
everything else is stderr.
Destinations
rotate refuses to start unless the new secret has at least one destination.
Repeatable flags: --dotenv, --gh-secret, --ssm.
--delete-old-now deletes the old key right after the new one is delivered.
Config
./rekey.toml, then ~/.config/rekey/config.toml. Contains no
secrets. Interactive rotate can write entries for you.
Consumer types: dot_env_file, github_actions_secret, aws_ssm_parameter,
file, keychain. Match on name/principal for providers that issue a new
id per rotation. Relative paths resolve against the config file. Full example:
rekey.toml.example.
Credentials
Lookup order: environment variable → saved login (rekey login) → prompt
(TTY only, offers to save). Never taken as flags. Rotating the token rekey
signs in with (GitLab, Cloudflare) updates the saved login.
REKEY_DISABLE_KEYCHAIN=1 disables keychain reads/writes.
Providers
AWS needs the aws CLI, npm needs npm, --gh-secret needs gh.
Want another provider? Request it.
Rotation semantics
Without --delete-old-now, an old key with no disabled state stays active;
the output gives the retire command. Exit code is non-zero whenever
something needs attention.
MCP
Secret values are never returned to the client. Credentials come from the environment or saved logins. On macOS, allow Keychain access once after installing a new build.
Security
- Secrets go to subprocesses via stdin, never argv.
- Files rekey creates are 0600; existing
.envpermissions are kept; writes are atomic. - Secret values are printed only with
--print-secret. - Report vulnerabilities privately via the repo's Security tab.
Contributing
- New provider or feature: open an issue.
- Code: see CONTRIBUTING.md. A provider is one file
implementing the
Connectortrait.
Links
- crates.io: rekey
- MCP Registry name — mcp-name: io.github.Ezra-Black/rekey
Credits
Built by Ezra Black — ezrablack.dev.
License
來源:README.md,提交 fe1ab58
工具
0版本歷史
1- v0.1.0最新Oct 18, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分