Drop to CDN CLI

Upload files and publish pages to CDN from the command line. Built for terminal-native AI agents like Claude Code and Codex, with --json, --dry-run, and a self-describing api-schema.

droptocdn is a command-line client for Drop to CDN. It wraps the same REST API as the dashboard and the MCP server, but speaks the conventions AI coding agents expect from a shell tool: self-describing commands, machine-readable JSON output, deterministic exit codes, and dry-run previews before anything destructive runs.

CLI quick install

Install globally or run with npx.

  • npm install -g droptocdn, or npx droptocdn (a command) without installing.
  • Set DROPTOCDN_API_KEY in your shell — create one in Dashboard → Settings (starts with dtc_).
  • Run droptocdn --help for the command list, or droptocdn api-schema for a machine-readable one.

Commands

Seven commands wrap the REST API.

  • upload (a file path) — upload a local file, returns id, url, expires_at, size, mime_type, original_name.
  • get (a file id) — fetch metadata and the CDN URL for a file.
  • list — list files in your account, paginated with limit and cursor.
  • delete (a file id) — permanently delete a file; supports --dry-run and requires --yes outside an interactive terminal.
  • publish (a file path) — publish a local HTML file as a hosted page, returns id, url, expires_at.
  • whoami — show the account profile for the configured API key.
  • api-schema — print every command's arguments, flags, and exit codes as JSON.

Built for AI agents

Four conventions so an agent can drive the CLI without hardcoded parsing.

  • Self-describing: api-schema returns the full command surface as JSON, discoverable at runtime.
  • Machine-readable output: every command supports --json, and --jq 'EXPRESSION' filters it through the system jq binary.
  • Deterministic exit codes: 0 success, 1 API error, 2 usage error, 3 auth error — an agent can branch on $? without parsing text.
  • Safe-by-default writes: upload, publish, and delete accept --dry-run to preview a request without spending quota; delete also refuses to run without --yes outside an interactive shell.

CLI FAQ

Common questions about the CLI.

Do I need Node.js?

Yes. droptocdn is a Node.js CLI; Node 20 or newer is required, whether installed globally or run via npx.

Where does my API key go?

In the DROPTOCDN_API_KEY environment variable in your shell — never in a command-line argument or committed to a file. Create a key in Dashboard → Settings.

How is this different from the MCP server?

Same REST API underneath. The MCP server is for chat-based hosts like Claude Desktop and Cursor's MCP client; the CLI is for terminal-native agents such as Claude Code and OpenAI Codex, and for humans scripting uploads directly.

Can an agent delete files by accident?

delete requires --yes when there is no interactive terminal to confirm in, and --dry-run previews the request without calling the API at all.