Cldsh Cloudinary Shell

io.github.Sheldon1999由 GitHub 帳號 Sheldon1999 發布v2.0.1更新於 Oct 29, 2026

Unix-style shell, scriptable CLI and MCP server for Cloudinary asset management.

概覽

AI 產生的概覽

結合 MCP 伺服器、Shell 與 CLI,讓助手像操作檔案系統一樣瀏覽、上傳、移動、下載和刪除 Cloudinary 帳戶中的資源。

可以做什麼
  • 列出資料夾與資源、顯示資料夾樹狀結構、讀取資源完整中繼資料
  • 產生交付 URL,可選擇加上轉換參數或簽章
  • 上傳本機檔案或目錄,並把資源下載到本機磁碟
  • 移動、重新命名、建立和刪除資源或資料夾,附預覽與確認權杖
  • 查看帳戶的雲端名稱、資料夾模式、憑證來源與剩餘 API 額度
適用情境
適合讓助手管理既有 Cloudinary 帳戶中的媒體資源,例如檢視目錄、產生 CDN 連結、上傳建置產物或清理舊資源,且不需要託管服務或 OAuth 流程。
執行需求
需要 Node.js 20 或更新版本,透過 npx 以 stdio 在本機執行。需要 Cloudinary 帳戶的雲端名稱、API key 與 API secret,可透過 CLOUDINARY_URL 或各個 CLOUDINARY_* 環境變數、目前目錄的 .env 檔案,或以 login 儲存的設定檔提供。需能連線 Cloudinary Admin API,該介面有每小時的請求上限。
安裝前請注意
伺服器持有可修改與刪除帳戶資源的 Cloudinary API 憑證,設定檔保存在本機憑證檔案中。上傳、移動和刪除會改動帳戶,且支援遞迴與萬用字元刪除。確認權杖可保護變更,但以 --no-confirm 啟動時會略過,僅應用於可信任的自動化。本機檔案存取限於啟動目錄、用戶端分享的根目錄和 --allow-path 目錄,但上傳會把本機檔案傳送到 Cloudinary。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Cldsh Cloudinary Shell,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

Cloudinary Shell (cldsh)

MCP server, interactive shell and scriptable CLI for Cloudinary

[npm version] [License: MIT] [MCP Protocol]

[cldsh demo: tab completion, a colored ls -l listing, a transformed delivery URL, and a recursive delete that previews the plan and asks before anything is removed]

cldsh lets you work with a Cloudinary account like a file system:

  • AI agents (Claude Desktop, Claude Code, Cursor) get Cloudinary tools through the Model Context Protocol (MCP), with previews and confirmation before anything is deleted or replaced.
  • Developers get an interactive shell with folders, tab completion, history and inline image previews.
  • Scripts and CI get single commands with JSON output and meaningful exit codes.

It works with both Cloudinary folder modes: dynamic folders (every account created since June 2024) and the older fixed folders. The mode is detected automatically.

Working on a project that uses Cloudinary? Give INTEGRATION.md to your AI agent or team: integration patterns (Next.js, React, Node.js, Python), transformation recipes and cldsh workflows.


How cldsh compares

Cloudinary also publishes an official CLI (cloudinary-cli, Python) and official MCP packages (@cloudinary/*). cldsh is a separate, independent project built for a different workflow: one Node binary that is a shell, a scriptable CLI and an MCP server together, authenticated with your existing API key — no Python runtime, no OAuth browser flow, no hosted service required.

cldshcloudinary-cli (official)@cloudinary/* MCP (official)community MCP servers
RuntimeNode, npxPython, pipx/DockerNode, npx per packageNode, npx
AuthAPI key / .envOAuth loginOAuth (hosted) or API keyAPI key
Interactive shell (cd, ls, tab completion)✅❌ one-shot flags❌ not a CLI❌ not a CLI
MCP server✅ same binary❌✅ (5 separate packages)✅
Confirm before delete/move/overwrite✅ two-step token, --dry-run❌—❌
Fixed/dynamic folder mode✅ auto-detectednot documentednot documentednot documented

Pick cldsh for one local tool, API-key auth and a safety net on AI-driven changes. Pick the official packages for Cloudinary-maintained, domain-split MCP servers with OAuth and enterprise support.


Quick start

Requires Node.js 20 or newer and a Cloudinary account (cloud name, API key and API secret, or a CLOUDINARY_URL).

bash
# AI agents: add the MCP server to Claude Codeclaude mcp add cloudinary npx -y cloudinary-shell --mcp
# Developers: open the interactive shellnpx cloudinary-shell
# Scripts: run one commandnpx cloudinary-shell ls products --json

Install globally to get the shorter cldsh command: npm install -g cloudinary-shell.


MCP server (for AI agents)

cldsh --mcp runs an MCP server over stdio (JSON-RPC 2.0). It supports protocol versions 2025-06-18, 2025-03-26 and 2024-11-05.

Client setup

Claude Desktop (claude_desktop_config.json):

json
{  "mcpServers": {    "cloudinary": {      "command": "npx",      "args": ["-y", "cloudinary-shell", "--mcp"]    }  }}

Claude Code: claude mcp add cloudinary npx -y cloudinary-shell --mcp

Cursor: Settings → MCP → Add new MCP server, type command, command npx -y cloudinary-shell --mcp.

Check the setup with cldsh mcp: it runs the handshake, lists the tools and makes a live call on your account.

Tools

ToolWhat it doesMain arguments
cloudinary_listList folders and assets (wildcards allowed)path, resource_type, delivery_type, max
cloudinary_treeFolder treefolder, depth, resource_type, max_files
cloudinary_infoFull metadata of one assetpublic_id, resource_type, delivery_type
cloudinary_get_urlDelivery URL, optionally transformed or signedpublic_id, transformation, signed, resource_type
cloudinary_uploadUpload a local file or directorylocal_path, name, folder, recursive, overwrite, resource_type, dry_run
cloudinary_downloadDownload assets to the local diskpublic_id, destination, overwrite, dry_run
cloudinary_moveMove or rename an asset or foldersource, target, overwrite, change_public_id, dry_run
cloudinary_deleteDelete assets, or folders with recursivetarget, recursive, resource_type, dry_run
cloudinary_mkdirCreate a folderfolder
cloudinary_rename_folderRename or move a folder (dynamic folder mode)from, to
cloudinary_accountCloud name, folder mode, credential source, remaining API budget—

Every tool carries MCP annotations (read-only, destructive, idempotent), so clients can decide when to ask you.

Safety

  • Two-step changes. cloudinary_delete, cloudinary_move, cloudinary_rename_folder, and uploads that would replace existing assets first return a preview with a confirm_token. Nothing changes until the agent calls again with the same arguments and that token. Tokens are single-use, expire after 5 minutes and stop working if the account changes. dry_run: true only previews.
  • Local files. Uploads and downloads can only reach the folder the server was started in, the folders your MCP client shares as roots, and folders added with --allow-path. The cldsh credentials folder, ~/.ssh and hidden files (unless named explicitly) are always refused. Downloads never overwrite a local file unless overwrite: true.
  • Server options:
    • --read-only: only the read-only tools (list, tree, info, get_url, account).
    • --allow-path <dir>: allow another local folder (repeatable).
    • --no-confirm: run changes in one call, as in cldsh 1.x. Use only for trusted automation.
json
"args": ["-y", "cloudinary-shell", "--mcp", "--read-only"]

Command line (for scripts and CI)

Run any command directly: cldsh <command> [arguments] [options].

  • Results go to stdout; progress, warnings and errors go to stderr.
  • --json prints machine-readable JSON on stdout (errors are printed as JSON on stderr).
  • Exit codes: 0 success, 1 error, 2 wrong usage, 3 partly failed (for example 2 of 50 uploads failed), 4 needs confirmation (add --yes) or was cancelled.
  • --profile <name> uses a saved profile for one command.
bash
# Upload a build folder with subfolderscldsh upload ./dist/assets -r --to site/assets
# CDN URLs of every asset in a foldercldsh ls portfolio --json | jq -r '.files[].secure_url'
# Assets larger than 100 KBcldsh ls portfolio --json | jq -r '.files[] | select(.bytes > 100000) | .public_id'
# Preview a delete, then run it without the questioncldsh rm 'old-*' --dry-runcldsh rm -r archive/2023 --yes

Quote wildcards. Your shell expands an unquoted cld* into local file names before cldsh sees it. Write cldsh rm 'cld*'. If every name given to rm exists in the local directory, cldsh refuses and reminds you.


Interactive shell

Run cldsh with no arguments.

Connected to Cloudinary account: my-cloud (global credentials profile (default))[my-cloud]$~ cd products[my-cloud]$~/products ls -l
      SIZE(KB)  DIMENSIONS(px)  NAME      FORMAT  TYPE      ────────  ──────────────  ────────  ──────  ─────           245  1200x630        hero      png     image            15  512x512         logo      svg     image          1830  1920x1080       promo     mp4     video
  • The prompt shows the account (and profile) and the current folder.
  • Tab completes commands, options, folder paths (cd apps/<Tab>) and asset names.
  • History is kept across sessions in ~/.cldsh_history (private file; lines with credentials are never saved).
  • Paths are relative to the current folder; / or ~ is the root, .. goes up, cd - goes back.
  • help lists all commands; help <command> lists all options of one command.

Commands

CommandWhat it does
login [profile] [URL] [--stdin]Connect an account and save it as a profile (checked with Cloudinary first)
config [ls | use <profile> | rm <profile>]Show the active account and which sources it overrides; list, switch or remove profiles
ls [path|pattern] [-l]List folders and assets
cd, pwdChange and show the current Cloudinary folder (shell only)
lcd, lpwdChange and show the local directory
mkdir <folder>...Create folders (parents included)
upload <path> [name] [--to folder] [-r]Upload a file or a directory
download <name|pattern>... [destination] [-f]Download assets
mv <source> <target> [-o] [--public-id]Move or rename an asset or folder
info <name>Asset metadata (-v for the full API response)
url <name|pattern>... [--t=...] [--signed]Delivery URLs
view <name> (alias preview)Show an image or video thumbnail in the terminal
open <name>Open an asset in the browser
rm [-r] <name|folder|pattern>... [-y]Delete assets, or folders with -r
tree [folder] [-d N]Folder tree
quotaRemaining Admin API requests this hour and the folder mode
mcpCheck the MCP server

Options shared by many commands:

OptionMeaning
--rt=image|video|raw|allResource type. Listings show all types by default.
--type=upload|private|authenticatedDelivery type
--dry-runShow what would happen without changing anything
-y, --yesDon't ask for confirmation
--jsonJSON output

Assets can be named by their name in the current folder, by path (products/hero), by public ID, or as asset_id:<id>. If a name matches several assets (for example an image and a video called intro), cldsh lists them; add --rt or use the public ID.

Uploading

[my-cloud]$~/products upload ~/Pictures/hero.pngUploaded (created): https://res.cloudinary.com/my-cloud/image/upload/v1730000000/products/hero.png
[my-cloud]$~ upload ./media -r --to campaigns/fall[1/3] created https://res.cloudinary.com/my-cloud/image/upload/.../campaigns/fall/banner.png[2/3] created https://res.cloudinary.com/my-cloud/video/upload/.../campaigns/fall/teaser.mp4[3/3] created https://res.cloudinary.com/my-cloud/raw/upload/.../campaigns/fall/notes.txt
  • The resource type comes from the file extension: images (including PDF and SVG) → image, video and audio → video, everything else → raw. --rt overrides it.
  • Images and videos get a public ID without extension; raw files keep it (notes.txt).
  • -r includes subdirectories as subfolders. Dotfiles are skipped.
  • Existing assets are overwritten and reported as overwritten; --no-overwrite keeps them (skipped).
  • When two files would get the same public ID (photo.jpg, photo.png), both get their extension as suffix (photo_jpg, photo_png).
  • Files over 20 MB are uploaded in chunks with progress; temporary failures are retried.
  • --dry-run shows the planned public IDs and works without credentials.

Deleting

[my-cloud]$~/products rm herodeleted  products/heroDeleted 1 · not found 0 · failed 0
[my-cloud]$~ rm -r campaigns/fallDelete 3 assets (1 image, 1 video, 1 raw, 2.1 MB) and 1 folder in cloud my-cloud:  ...Proceed? [y/N]
  • rm -r deletes everything in the folder and its subfolders (all resource and delivery types), then the folder.
  • Recursive deletes, wildcard deletes and deletes of more than 20 assets show the plan and ask first. Emptying the whole account asks you to type the cloud name. -y skips the question; scripts need --yes.
  • Every asset is reported as deleted, not found or failed, and the exit code is 3 if anything was not found or failed.
  • --skip-backup deletes folders that still hold backups of deleted assets.

Moving and renaming

[my-cloud]$~/products mv hero archive/Moved: /products/hero -> /archive/hero (URL unchanged)
  • Dynamic folder mode: moving and renaming keep the delivery URL (the folder and display name change). --public-id also renames the public ID, which changes the URL. Folders can be moved and renamed: mv products catalog/products.
  • Fixed folder mode: the folder is part of the public ID, so moving or renaming changes the URL. Cloudinary can't move folders in this mode.
  • An existing target stops the move; -o goes ahead. In dynamic mode, -o only replaces an asset with the same public ID; an asset that merely has the same name is kept.
  • --dry-run shows whether the URL will change.

URLs, previews and downloads

bash
url hero                          # delivery URLurl hero --t="f_auto,q_auto,w_800" # with a transformationurl 'banner-*'                    # several assetsurl private-doc --signed          # signed URL for authenticated assetsview hero --t="e_grayscale"       # inline preview (iTerm2, WezTerm, Ghostty, VS Code, Warp)download 'shots/*' ./shots/       # several files into a folder
  • Unsigned URLs without --t are exactly the asset's secure_url.
  • view prints the preview URL when the terminal can't show images.
  • download skips local files that already exist unless -f; private and authenticated assets download through signed URLs.

Accounts and credentials

bash
# Interactive (the secret is not shown while you type)cldsh login
# From a script, without putting the secret in your shell historyprintf %s "$CLOUDINARY_URL" | cldsh login prod --stdin
cldsh config ls          # saved profilescldsh config use prod    # switch (also inside the shell)cldsh config             # active account, where it comes from, what it overrides

Profiles are stored in ~/.config/cldsh/credentials.json (%APPDATA%\cldsh on Windows) with owner-only permissions. Writes are atomic, and a damaged file is never overwritten (login --reset moves it aside).

When several sources are present, the strongest wins:

  1. --profile <name>, config use / login in the current shell, or CLOUDINARY_PROFILE
  2. CLOUDINARY_URL (or CLOUDINARY_CLOUD_NAME, CLOUDINARY_API_KEY, CLOUDINARY_API_SECRET) in the environment
  3. A .env file in the current directory
  4. The saved default profile

cldsh warns at startup, and config shows, when a source is overridden. CLOUDINARY_URL options such as ?upload_prefix=https://api-eu.cloudinary.com (EU/AP data centers) and private CDN settings are supported.


Folder modes and API limits

  • cldsh detects the folder mode of your account. Override it with --folder-mode=fixed|dynamic or CLDSH_FOLDER_MODE.
  • Listing folders and assets uses Cloudinary's Admin API, which is rate-limited per hour (500 requests on the Free plan). cldsh caches listings for a few seconds, warns when less than 10% of the hourly budget is left, and quota shows the remaining requests. Uploads and delivery URLs don't count.
  • In fixed folder mode, listing a folder also pages through its subfolders' assets, so very large folders cost more requests.

Troubleshooting

ProblemWhat to do
Not connected to a Cloudinary accountRun cldsh login, or set CLOUDINARY_URL. cldsh config shows what is active.
The wrong account is usedcldsh config lists the source in use and the ones it overrides.
Refusing to run "rm" on ... names that all exist in the local directoryYour shell expanded a wildcard; quote it: cldsh rm 'cld*'.
needs an interactive terminal / exit code 4The command wants a confirmation; add --yes in scripts.
matches 2 assetsAdd --rt=image (or video/raw) or use the public ID.
Rate limit reachedcldsh quota shows when the hourly budget resets.

License

MIT. See CHANGELOG.md for changes between versions.

來源:README.md,提交 2fe2579

工具

0
SourceWeft 曾在隔離沙箱中以無憑證方式啟動該軟體包一次,以列出其工具,但未能完成:伺服器未在限時內回應。

版本歷史

1
  1. v2.0.1最新Oct 29, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分